Hello!
I’ve recently switched devices (I was using a Jetson Nano and now I’m using a Laptop with Nvidia GeForce RTX 2060), and I’m having problems compiling/linking my C++ and CUDA code. To clarify, this code wasn’t run on the Jetson Nano, but I am slightly more used to writing and compiling CUDA for the Nano.
Right now I only have one CUDA .cu file, which has a
#include <cuda_runtime.h>
header.
I’m compiling my C++ and CUDA files in a makefile with the following structure:
all: test
test: cudacode.o
g++ -std=c++11 -o test main.cpp -L/usr/local/cuda -lucdadevrt -lcudart cudacode.o
cudacode.o :
nvcc -c -arch=sm_75 cuda_file.cu -o cudacode.o
When I make this, I get the following error triggered in my .cu file:
fatal error: cuda_runtime.h: No such file or directory
I feel like I’ve gone through every possible stack overflow and nvidia discussion post on this issue, and tried a few different variations of this makefile, but haven’t had any luck.
For additional context:
-
My compute capability is 7.5.
-
running “sudo find / -name cuda_runtime.h” returns /usr/local/cuda-11.5/targets/x86_64-linux/include/cuda_runtime.h
-
running “sudo find / -name cuda” returns multiple things but the two important ones are /usr/local/cuda-11.5/targets/x86_64-linux/include/cuda and /usr/local/cuda
(in addition to noting that I am using cuda-11.5, I also changed the link -L/usr/local/cuda in the makefile to -L/usr/local/cuda-11.5 with no luck).
Any help or guidance would be very much appreciated!
Edit
If I compile with the single line
nvcc -arch=sm_75 cuda_file.cu main.cpp
It seems to find the #include<cuda_runtime.h> file okay, but it throws errors, not recognising cuda syntax like “<<<” or “blockIdx”