I’ve been working a project with CUDA (first timer).
I have all libraries linked and setup so it compiles correctly but I am having an issue with some of my code when it comes time to perform calculations on some of the variables. I have looked all over the internet trying to find any help but it does not appear to have any useful results, so far.
I’ll post the snippets of code that is giving me issues since it spans over the program.
double dXmax; double dXn; double *dev_dXmax; double *dev_dXn; //other declarations dXn = 0.25; //delta X (change in X) cudaMalloc((void**)&dev_dXn, sizeof(double)); cudaMemcpy(dev_dXn, &dXn, sizeof(double), cudaMemcpyHostToDevice); dXmax = 2; cudaMalloc((void**)&dev_dXmax, sizeof(double)); cudaMemcpy(dev_dXmax, &dXmax, sizeof(double), cudaMemcpyHostToDevice); dev_dXn = dev_dXmax * 2.000 * (mtrand1.randExc() - 0.5);
The error: “expression must have arithmetic or enum type” is being thrown on double *dev_dXmax, on line:
dev_dXn = dev_dXmax * 2.000 * (mtrand1.randExc() - 0.5);
I’m assuming this is due to the pointers and references but I am having issues finding which is causing the problem.
Does anyone have any suggestions or help to guide me along here?