CUDA returns 0 for all values for simple vector addition

I have an RTX 3070 and installed cuda 12.2 Ubuntu 22.04. I got the code from git@github.com:olcf-tutorials/vector_addition_cuda.git
The repository supposedly works. But I get zeros for the added vector C.
Can anyone please help.
Thanks in advance.
I am adding my code as well in case if you want to look
vector_addition.cu (3.1 KB)
CMakeLists.txt (288 Bytes)

Your code is not doing proper CUDA error checking. Coupled with that, you are compiling for an incorrect architecture; does not match your GPU. As a result, you are getting a launch error but you don’t know it.

Thanks for the reply, I installed the correct cuda version, i.e., nvcc --version and nvidia-smi shows the same cuda version.

None of that has anything to do with what I suggested.


This is the changed CMakelists.txt, I am using now. And this is giving the correct answer.