0

i am using pycuda and i write this program

etat=np.zeros(XBLOCK * YBLOCK * XGRID * YGRID,dtype=np.uint)
compteur_init=np.uint(0)
clef_utilisateur=np.uint(SEED)
config=clef_utilisateur

compteur_init_gpu = cuda.mem_alloc(compteur_init.nbytes)
etat_init_gpu=cuda.mem_alloc(etat.nbytes)
cuda.memcpy_htod(compteur_init_gpu, compteur_init)
cuda.memcpy_htod(etat_gpu, etat)

when i compile i get this error message

'numpy.uint64' does not have the buffer interface

what does it means exactly ??

3
  • Looks like there'a a typo in sample code, I'm sure you meant cuda.memcpy_htod(etat_init_gpu, etat), note "init" bit. Commented May 29, 2015 at 11:21
  • Yes, sorry i've edited the code Commented May 29, 2015 at 11:33
  • the code seem to work when i put in comment those lines compteur_init_gpu = cuda.mem_alloc(compteur_init.nbytes) cuda.memcpy_htod(compteur_init_gpu, compteur_init) so i guess that the mistake come from the variable compteur_init Commented May 29, 2015 at 11:36

1 Answer 1

1

finally , i've solved the problem with the module gpuarray

import pycuda.gpuarray as gpuarray
etat=np.zeros(XBLOCK * YBLOCK * XGRID * YGRID,dtype=np.uint)
etat_gpu= gpuarray.to_gpu(etat)

kern(etat_gpu,np.uint(10),block=(XBLOCK,YBLOCK,1),grid=(XGRID,YGRID,1))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.