Call to cudaMemcpyToSymbol() failed

I am trying to run a program wirttten in CUDA C++, but get the following error in one of the subroutines and the program stops: error: cuda function call failed:
  cudaMemcpyToSymbol(matYoungModulus, &matYoungModulus_d, sizeof(void*));
message: invalid device symbol

My card is a GeForce GTX 760 and I am using CUDA 11.4.4, driver version 470.82.01, Ubuntu 18.04.6, kernel 5.4.0.

The piece of code in where this error arises is this:

cudaVerify(cudaMalloc((void **)&matYoungModulus_d, numberOfElements*sizeof(double)));
cudaVerify(cudaMemcpy(matYoungModulus_d, young_modulus, numberOfElements*sizeof(double), cudaMemcpyHostToDevice));
cudaVerify(cudaMemcpyToSymbol(matYoungModulus, &matYoungModulus_d, sizeof(void*)));

The same exact program runs normally in another desktop with a GeForce GTX 1080 card, using CUDA 11.0.1, driver version 450.102.04, Ubuntu 16.04.7, kernel 4.15.0.

Does anybody have any clue of what could be the problem?

GTX 760 is a cc3.0 device.

cc 3.0 devices are not supported by CUDA 11.x

to explain the error, my guess is this:

your compiled executable (whether via CUDA 11.4.4 or CUDA 11.0.1) could not possibly contain cc3.0 device code, therefore the module fails to load. When the module fails to load, not only are there no binaries for execution on the device (which would be the typical error if you tried to launch a kernel in this configuration) but since the module fails to load, device symbols are also invalid.

Thank you for this advice. So a possible solution would be to downgrade CUDA to an earlier version (10.x) ? I will try this and see what happens.

and make sure when you build your code you target a cc3.0 device in compilation

Thanks @Robert_Crovella , that solution worked. I have now a different problem, but I will put it in a different post.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.