diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2018-10-23 10:19:32 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2018-11-01 12:09:35 +0100 |
commit | 9c4222b4cab810815a0adee0302501471da177aa (patch) | |
tree | 6a8876055f5edbe37d220653f7fca85b9a1df8d1 /cuda/3d/util3d.cu | |
parent | f84f0c623cd2652fcf80ec47cb287cc29fd430c5 (diff) | |
download | astra-9c4222b4cab810815a0adee0302501471da177aa.tar.gz astra-9c4222b4cab810815a0adee0302501471da177aa.tar.bz2 astra-9c4222b4cab810815a0adee0302501471da177aa.tar.xz astra-9c4222b4cab810815a0adee0302501471da177aa.zip |
Add minimal GPU Array interface
This extension (only) allows creating a CUDA 3D array, copying projection
data into it, performing a BP from the array, and freeing the array.
Diffstat (limited to 'cuda/3d/util3d.cu')
-rw-r--r-- | cuda/3d/util3d.cu | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/cuda/3d/util3d.cu b/cuda/3d/util3d.cu index 90aa5ea..41eb9d2 100644 --- a/cuda/3d/util3d.cu +++ b/cuda/3d/util3d.cu @@ -386,6 +386,41 @@ bool transferProjectionsToArray(cudaPitchedPtr D_projData, cudaArray* array, con return true; } +bool transferHostProjectionsToArray(const float *projData, cudaArray* array, const SDimensions3D& dims) +{ + cudaExtent extentA; + extentA.width = dims.iProjU; + extentA.height = dims.iProjAngles; + extentA.depth = dims.iProjV; + + cudaPitchedPtr ptr; + ptr.ptr = (void*)projData; // const cast away + ptr.pitch = dims.iProjU*sizeof(float); + ptr.xsize = dims.iProjU*sizeof(float); + ptr.ysize = dims.iProjAngles; + + cudaMemcpy3DParms p; + cudaPos zp = {0, 0, 0}; + p.srcArray = 0; + p.srcPos = zp; + p.srcPtr = ptr; + p.dstArray = array; + p.dstPtr.ptr = 0; + p.dstPtr.pitch = 0; + p.dstPtr.xsize = 0; + p.dstPtr.ysize = 0; + p.dstPos = zp; + p.extent = extentA; + p.kind = cudaMemcpyHostToDevice; + + cudaError err = cudaMemcpy3D(&p); + ASTRA_CUDA_ASSERT(err); + + // TODO: check errors + + return true; +} + float dotProduct3D(cudaPitchedPtr data, unsigned int x, unsigned int y, |