Why Memset2D failed ..

int *d_v;
  size_t pitch;
  int m = 1024;	
  cutilSafeCall(cudaMallocPitch ((void**)&d_v,&pitch,n*n*sizeof(int),m));
  cutilSafeCall(cudaMemset2D((void**)&d_v,pitch,0,n*n*sizeof(int),m));

cudaMallocPitch return OK but cudaMemset2D failed with invailid argument … seems cudaMemcpy2D failed either.

help please.any clue.

The first argument to cudaMemset2D() is incorrect. It expects to be passed a device pointer, so you need to pass d_v, not &d_v.

I see.just remove (void**)& and it is OK now.thank you!