summaryrefslogtreecommitdiffstats
path: root/cuda/3d/mem3d.cu
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2017-01-26 14:57:57 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2017-02-08 14:39:01 +0100
commitd85a660f064e8130b27e11c7fd762221c754c315 (patch)
tree72382e8414c8dc51a7a7ef45845b4c61b25dfed9 /cuda/3d/mem3d.cu
parentebd5fe932fd2d6c4a516bc1cdc69e37aa4f5cf55 (diff)
downloadastra-d85a660f064e8130b27e11c7fd762221c754c315.tar.gz
astra-d85a660f064e8130b27e11c7fd762221c754c315.tar.bz2
astra-d85a660f064e8130b27e11c7fd762221c754c315.tar.xz
astra-d85a660f064e8130b27e11c7fd762221c754c315.zip
Start work on CFloat32Data3DGPU to allow persistent/external GPU memory
Diffstat (limited to 'cuda/3d/mem3d.cu')
-rw-r--r--cuda/3d/mem3d.cu24
1 files changed, 24 insertions, 0 deletions
diff --git a/cuda/3d/mem3d.cu b/cuda/3d/mem3d.cu
index 2b26fe1..97be8a4 100644
--- a/cuda/3d/mem3d.cu
+++ b/cuda/3d/mem3d.cu
@@ -118,6 +118,13 @@ MemHandle3D allocateGPUMemory(unsigned int x, unsigned int y, unsigned int z, Me
return ret;
}
+bool zeroGPUMemory(MemHandle3D handle, unsigned int x, unsigned int y, unsigned int z)
+{
+ SMemHandle3D_internal& hnd = *handle.d.get();
+ cudaError_t err = cudaMemset3D(hnd.ptr, 0, make_cudaExtent(sizeof(float)*x, y, z));
+ return err == cudaSuccess;
+}
+
bool freeGPUMemory(MemHandle3D handle)
{
size_t free = availableGPUMemory();
@@ -307,6 +314,23 @@ bool FDK(const astra::CProjectionGeometry3D* pProjGeom, MemHandle3D projData, co
}
+MemHandle3D wrapHandle(float *D_ptr, unsigned int x, unsigned int y, unsigned int z, unsigned int pitch)
+{
+ cudaPitchedPtr ptr;
+ ptr.ptr = D_ptr;
+ ptr.xsize = sizeof(float) * x;
+ ptr.pitch = sizeof(float) * pitch;
+ ptr.ysize = y;
+
+ SMemHandle3D_internal h;
+ h.ptr = ptr;
+
+ MemHandle3D hnd;
+ hnd.d = boost::shared_ptr<SMemHandle3D_internal>(new SMemHandle3D_internal);
+ *hnd.d = h;
+
+ return hnd;
+}