summaryrefslogtreecommitdiffstats
path: root/python/astra/pythonutils.py
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 /python/astra/pythonutils.py
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 'python/astra/pythonutils.py')
-rw-r--r--python/astra/pythonutils.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/python/astra/pythonutils.py b/python/astra/pythonutils.py
index 3bd3321..27fa8fd 100644
--- a/python/astra/pythonutils.py
+++ b/python/astra/pythonutils.py
@@ -61,3 +61,21 @@ def geom_size(geom, dim=None):
s = s[dim]
return s
+
+class GPULink(object):
+ """Utility class for astra.data3d.link with a CUDA pointer
+
+ The CUDA pointer ptr must point to an array of floats.
+
+ x is the fastest-changing coordinate, z the slowest-changing.
+
+ pitch is the width in bytes of the memory block. For a contiguous
+ memory block, pitch is equal to sizeof(float) * x. For a memory block
+ allocated by cudaMalloc3D, pitch is the pitch as returned by cudaMalloc3D.
+ """
+ def __init__(self, ptr, x, y, z, pitch):
+ self.ptr = ptr
+ self.x = x
+ self.y = y
+ self.z = z
+ self.pitch = pitch