Я программирую с помощью cuda на C. Я получил ошибку сегментации со следующими строками кода:
int width = 0;
int height = 0;
// load input image
unsigned char * image_input = loadFile(&width, &height, "test.bmp");
// allocate memory for output
unsigned char * image_output = (unsigned char *) malloc(width*height*sizeof(unsigned char));
// set the size of the input and out array 2D
int size = width*height*sizeof(int);
// Allocate space on the GPU for input and output
char* GPU_input = 0;
char* GPU_output = 0;
cudaMalloc(&GPU_input, size);
cudaMalloc(&GPU_output, size);
// Copy the input data to the GPU (host to device)
cudaMemcpy(GPU_input, image_input, size, cudaMemcpyHostToDevice); //segmentation fault here
Есть идеи?
Заранее спасибо.