summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-10-23 10:19:32 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-11-01 12:09:35 +0100
commit9c4222b4cab810815a0adee0302501471da177aa (patch)
tree6a8876055f5edbe37d220653f7fca85b9a1df8d1 /include
parentf84f0c623cd2652fcf80ec47cb287cc29fd430c5 (diff)
downloadastra-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 'include')
-rw-r--r--include/astra/Float32Data3DGPU.h3
-rw-r--r--include/astra/cuda/3d/astra3d.h7
-rw-r--r--include/astra/cuda/3d/mem3d.h14
-rw-r--r--include/astra/cuda/3d/util3d.h1
4 files changed, 22 insertions, 3 deletions
diff --git a/include/astra/Float32Data3DGPU.h b/include/astra/Float32Data3DGPU.h
index cac38f6..b2cdcda 100644
--- a/include/astra/Float32Data3DGPU.h
+++ b/include/astra/Float32Data3DGPU.h
@@ -38,9 +38,6 @@ along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>.
namespace astra {
-astraCUDA3d::MemHandle3D wrapHandle(float *D_ptr, unsigned int x, unsigned int y, unsigned int z, unsigned int pitch);
-
-
/**
* This class represents a 3-dimensional block of 32-bit floating point data.
* The data block is stored on a GPU, and owned by external code.
diff --git a/include/astra/cuda/3d/astra3d.h b/include/astra/cuda/3d/astra3d.h
index 0ea752d..28a8f01 100644
--- a/include/astra/cuda/3d/astra3d.h
+++ b/include/astra/cuda/3d/astra3d.h
@@ -42,6 +42,7 @@ class CParallelVecProjectionGeometry3D;
class CConeProjectionGeometry3D;
class CConeVecProjectionGeometry3D;
class CVolumeGeometry3D;
+class CFloat32ProjectionData3DGPU;
class AstraSIRT3d_internal;
using astraCUDA3d::Cuda3DProjectionKernel;
@@ -308,6 +309,12 @@ _AstraExport bool astraCudaBP_SIRTWeighted(float* pfVolume, const float* pfProje
const CProjectionGeometry3D* pProjGeom,
int iGPUIndex, int iVoxelSuperSampling);
+_AstraExport void uploadMultipleProjections(CFloat32ProjectionData3DGPU *proj,
+ const float *data,
+ unsigned int y_min,
+ unsigned int y_max);
+
+
}
diff --git a/include/astra/cuda/3d/mem3d.h b/include/astra/cuda/3d/mem3d.h
index 78e1294..8c3956e 100644
--- a/include/astra/cuda/3d/mem3d.h
+++ b/include/astra/cuda/3d/mem3d.h
@@ -37,6 +37,17 @@ class CVolumeGeometry3D;
class CProjectionGeometry3D;
}
+
+// MemHandle3D defines a very basic opaque interface to GPU memory pointers.
+// Its intended use is allowing ASTRA code to pass around GPU pointers without
+// requiring CUDA headers.
+//
+// It generally wraps CUDA linear global memory.
+//
+// As a very basic extension, it also allows wrapping a CUDA 3D array.
+// This extension (only) allows creating a CUDA 3D array, copying projection
+// data into it, performing a BP from the array, and freeing the array.
+
namespace astraCUDA3d {
// TODO: Make it possible to delete these handles when they're no longer
@@ -80,6 +91,7 @@ enum Mem3DZeroMode {
int maxBlockDimension();
_AstraExport MemHandle3D wrapHandle(float *D_ptr, unsigned int x, unsigned int y, unsigned int z, unsigned int pitch);
+MemHandle3D createProjectionArrayHandle(const float *ptr, unsigned int x, unsigned int y, unsigned int z);
MemHandle3D allocateGPUMemory(unsigned int x, unsigned int y, unsigned int z, Mem3DZeroMode zero);
@@ -93,6 +105,8 @@ bool zeroGPUMemory(MemHandle3D handle, unsigned int x, unsigned int y, unsigned
bool setGPUIndex(int index);
+bool copyIntoArray(MemHandle3D handle, MemHandle3D subdata, const SSubDimensions3D &pos);
+
bool FP(const astra::CProjectionGeometry3D* pProjGeom, MemHandle3D projData, const astra::CVolumeGeometry3D* pVolGeom, MemHandle3D volData, int iDetectorSuperSampling, astra::Cuda3DProjectionKernel projKernel);
diff --git a/include/astra/cuda/3d/util3d.h b/include/astra/cuda/3d/util3d.h
index 17eb31e..0146d2d 100644
--- a/include/astra/cuda/3d/util3d.h
+++ b/include/astra/cuda/3d/util3d.h
@@ -51,6 +51,7 @@ bool duplicateProjectionData(cudaPitchedPtr& D_dest, const cudaPitchedPtr& D_src
bool transferProjectionsToArray(cudaPitchedPtr D_projData, cudaArray* array, const SDimensions3D& dims);
+bool transferHostProjectionsToArray(const float *projData, cudaArray* array, const SDimensions3D& dims);
bool transferVolumeToArray(cudaPitchedPtr D_volumeData, cudaArray* array, const SDimensions3D& dims);
bool zeroProjectionArray(cudaArray* array, const SDimensions3D& dims);
bool zeroVolumeArray(cudaArray* array, const SDimensions3D& dims);