diff options
author | mastbaum <mastbaum@hep.upenn.edu> | 2015-07-30 09:31:54 -0400 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2021-05-09 08:42:39 -0700 |
commit | c784d169ae8f170e10ec2d5a61387e2b01643468 (patch) | |
tree | efd9d57f6cf8e297ba9c8ffbff309a53b8e4213a | |
parent | dabe7884f5c65ec2a87298c804d6f6442a19c526 (diff) | |
download | chroma-c784d169ae8f170e10ec2d5a61387e2b01643468.tar.gz chroma-c784d169ae8f170e10ec2d5a61387e2b01643468.tar.bz2 chroma-c784d169ae8f170e10ec2d5a61387e2b01643468.zip |
wrap cuda.memcpy_htod args in np.asarray
Fixes "TypeError: 'numpy.int64' does not have the buffer interface" error.
-rw-r--r-- | chroma/gpu/tools.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/chroma/gpu/tools.py b/chroma/gpu/tools.py index 8bf5d81..ac58f45 100644 --- a/chroma/gpu/tools.py +++ b/chroma/gpu/tools.py @@ -157,10 +157,10 @@ def make_gpu_struct(size, members): 'arrange struct member variables in order of ' 'decreasing size.') - cuda.memcpy_htod(int(struct)+i, np.intp(int(member))) + cuda.memcpy_htod(int(struct)+i, np.asarray(np.intp(int(member)))) i += 8 elif np.isscalar(member) or (hasattr(member, 'dtype') and member.dtype in vec_dtypes and member.shape == ()): - cuda.memcpy_htod(int(struct)+i, member) + cuda.memcpy_htod(int(struct)+i, np.asarray(member)) i += member.nbytes else: raise TypeError('expected a GPU device pointer or scalar type.') |