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 ??

SOCKet
  • 191
  • 1
  • 2
  • 15
  • Looks like there'a a typo in sample code, I'm sure you meant `cuda.memcpy_htod(etat_init_gpu, etat)`, note "_init_" bit. – Dima Tisnek May 29 '15 at 11:21
  • Yes, sorry i've edited the code – SOCKet May 29 '15 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 – SOCKet May 29 '15 at 11:36

1 Answers1

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))
SOCKet
  • 191
  • 1
  • 2
  • 15