Я пытаюсь скопировать данные RGB (при условии, что каждый является целым числом) изображения с хоста на устройство. Вот часть моего кода
int *img_redd,*img_greend,*img_blued;//d denotes device
int **img_redh,**img_greenh,**img_blueh;// h denotes host
//Initialize+ copy values into the arrays pointed by img_redh,img_greenh etc
// then Copy the values of RGB into host array <here>
//Allocating memory on device below
cudaMallocPitch((void**)&img_redd,&pitch1,img_width*sizeof(int),img_height);
cudaMallocPitch((void**)&img_greend,&pitch2,img_width*sizeof(int),img_height);
cudaMallocPitch((void**)&img_blued,&pitch3,img_width*sizeof(int),img_height);
// copy it to CUDA device
cudaMemcpy2D(img_redd,pitch1,img_redh[0],img_width*sizeof(int),img_width*sizeof(int),img_height,cudaMemcpyHostToDevice);
//I even tried with just img_redh above
//Similarly for green and blue
CudaMallocpitch работает нормальноно он вылетает в строке cudamemcpy2d и открывает файл host_runtime.h и указывает на
static void __cudaUnregisterBinaryUtil(void)
{
__cudaUnregisterFatBinary(__cudaFatCubinHandle);
}
Я чувствую, что логика распределения памяти в порядке. Любые комментарии, что может вызвать сбой?