When i use the nvcc compiler,i can't use the cuda

i want to try the cuda,while in hello.cu i have program like below,while i canโ€™t have the right answer


after the compile and i got this

add:

cudaDeviceSynchronize();

before the cudaDeviceReset(); line.

then try:

compute-sanitizer ./hello

Hi,Robert,thank you for you answer,now i use the compute-snitizer,and i got the question below


so whether is the question of the nvcc,when i use the nvidia-smi,i got this

and i use the

,how can i fix it?

install the latest driver for your GPU

or switch to a CUDA version that is 12.0 or older.

1 Like

thank,i use the Nvtoolkit12.0 and the problem was solved