summaryrefslogtreecommitdiffstats
path: root/python/astra/pythonutils.py
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2017-02-09 18:01:03 +0100
committerGitHub <noreply@github.com>2017-02-09 18:01:03 +0100
commit981d6adc0e3c98a67403b92b1ec4cdb881c62fda (patch)
treecccde0fd4a3a2d92919338df4e162c9abfd079e1 /python/astra/pythonutils.py
parent03c3e5b5043cc8cba9aceeb8641d497edd1be7cf (diff)
parent4c665b0d5af3841f20501a5dc01a23e671367856 (diff)
downloadastra-981d6adc0e3c98a67403b92b1ec4cdb881c62fda.tar.gz
astra-981d6adc0e3c98a67403b92b1ec4cdb881c62fda.tar.bz2
astra-981d6adc0e3c98a67403b92b1ec4cdb881c62fda.tar.xz
astra-981d6adc0e3c98a67403b92b1ec4cdb881c62fda.zip
Merge pull request #93 from wjp/GPULink
GPULink support
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