From 9c4222b4cab810815a0adee0302501471da177aa Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 23 Oct 2018 10:19:32 +0200 Subject: 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. --- cuda/3d/util3d.cu | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'cuda/3d/util3d.cu') 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, -- cgit v1.2.3