Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error : argument of type "int" is incompatible with parameter of type "const void *"

Tags:

cuda

in this part of my code when compile program. this error show: "argument of type "int" is incompatible with parameter of type "const void *". i declare variable as follow:

int *dev_matrix, *dev_array, *dev_array_length;
int array_length=1;
cudaMalloc((void**)&dev_array_length, 1*sizeof(int));
cudaMemcpy(dev_array_length, array_length, 1*sizeof(int), cudaMemcpyHostToDevice);
like image 972
milad_b Avatar asked Apr 10 '13 06:04

milad_b


1 Answers

The second argument to cudaMemcpy() is wrong. It is meant to be a pointer (const void*) and you're supplying an int.

Did you mean to write:

cudaMemcpy(dev_array_length, &array_length, 1*sizeof(int), cudaMemcpyHostToDevice);
                             ^
like image 149
NPE Avatar answered Sep 18 '22 03:09

NPE