I’ve added cuda code to a .c file, and renamed it .cu.
The code originally compiled just fine with gcc, but with nvcc I get errors like this with malloc related code:
cm_dpsearch.cu(140): error: a value of type “void *” cannot be assigned to an entity of type “float *”
cm_dpsearch.cu(152): error: a value of type “void *” cannot be assigned to an entity of type “int *”
cm_dpsearch.cu(155): error: a value of type “void *” cannot be assigned to an entity of type “float *”
cm_dpsearch.cu(163): error: a value of type “void *” cannot be assigned to an entity of type “double **”
cm_dpsearch.cu(165): error: a value of type “void *” cannot be assigned to an entity of type “double *”
A little research suggested that perhaps it was trying to interpret the host code as C++, or compile it with g++, or something. So I tried the --host-compilation=C option, but it had no effect whatsoever. Is there some way to ensure that the host code is being compiled as plain old C, so I don’t have to go around adding typecasts in a billion places?
thanks!
Adam