You are not logged in.

#1 2021-04-06 17:23:40

odiam
Member
Registered: 2021-04-06
Posts: 4

[SOLVED] cuda_runtime.h not found after update

After a recent update (cuda 11.2.2-2) I'm not able to compile .cu files with nvcc.

This is the command I issued:

nvcc  -gencode arch=compute_35,code=sm_35 filename.cu -o main

But I get the following error:

cc1plus: fatal error: cuda_runtime.h: No such file or directory.
Compilation terminated.

It's a common issue but I have not been able to fix it.
Despite having updated the cuda and cuda-toolkit packages multiple times, this is the first time I get this error.

Until now I tried removing and reinstalling cuda, rebooting, applying the "-I/opt/cuda/include" and "-I/opt/cuda/targets/x86_64-linux/include" flags, symlinking /opt/cuda to /usr/local/cuda and exporting the env vars listed here, but I still get the same error. I also tried downgrading to the previous version, did not work.

Did anyone faced the same problem?

Note, running "make" in /opt/cuda/samples just works.
Looking at the Makefile commands, they include header files in /opt/cuda/samples/common/inc. I tried to include them as well in my commands but it doesn't work.

Last edited by odiam (2021-04-06 20:07:50)

Offline

#2 2021-04-06 20:07:25

odiam
Member
Registered: 2021-04-06
Posts: 4

Re: [SOLVED] cuda_runtime.h not found after update

Ok this is funny.

"nvcc" is a symlink to /opt/cuda/bin/nvcc.

If I invoke "nvcc" on the command line it gives me the error.
BUT if I invoke the command with the full path like this

/opt/cuda/bin/nvcc  -gencode arch=compute_35,code=sm_35 filename.cu -o main

It works. That's why the Makefiles were working.

I solved my issue, now I'm trying to figure out what the hell is wrong.

Of course, the symlink is correct. I also tried to remove and recreate it but nothing changed.

Is this actually weird or there's something I'm missing?

Last edited by odiam (2021-04-06 20:09:34)

Offline

Board footer

Powered by FluxBB