desihub / gpu_specter

Scratch work for porting spectroperfectionism extractions to GPUs
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

Projection Matrix GPU Functions #2

Closed ziyaointl closed 4 years ago

ziyaointl commented 4 years ago

This PR adds three files: projection_matrix_gpu.py: gpu versions of functions originally in ProjectionMatrix.ipynb projection_matrix_reference.py: functions directly copied from ProjectionMatrix.ipynb projection_matrix_test.py: tests for the above functions

Functions included in this PR: hermevander, legvander, evalcoeffs, calc_pgh Functions not yet included: multispot, projection_matrix

ziyaointl commented 4 years ago

As of now projection_matrix_gpu.py contains the gpu-only version. Eventually though, I plan to make it contain a version that can be easily toggled between gpu and cpu, with corresponding tests added in projection_matrix_test.py that tests both versions by comparing them to the reference contained in projection_matrix_reference.py. Of course, if there's a better way to organize this, we should go with that instead.

ziyaointl commented 4 years ago

Hi Laurie,

blockIdx returns the index of the current block within the grid, while grid returns the index of the current thread within the grid. Here, i = blockIdx.x represents which 1-dimensional vector x we are generating the matrix for, while _, j = cuda.grid(2) is used to represent which elements within that x the current thread is responsible for.