Hi!
I’m having problems compiling and linking a c++ program to a CUDA file that uses dynamic parallelism. The program itself is quite extensive so for testing sake I simplified it to a very basic main.cpp file and wrapper.cu file which replicates the error. I’m also using a Jetson Nano (aarch64 /arm64, compute capability - 5.3) to compile these files which I’m thinking may be causing the problem (?).
Here are my programs:
main.cpp:
extern void wrapperfunction();
int main(){
wrapperfunction();
}
wrapper.cu:
#include <cuda.h>
#include <cuda_runtime.h>
using namespace std;
__global__ void update_upper_image(){
int x = 1;
}
__global__ void event_kernel(){
update_upper_image<<<512,1>>>();
}
void wrapperfunction(){
event_kernel<<<4,1>>>();
}
The commands I’m using to compile are:
nvcc -arch=sm_53 -rdc=true -c wrapper.cu
nvcc -arch=sm_53 -dlink -o file_link.o wrapper.o -lcudart -lcudadevrt
g++ wrapper.o file_link.o main.cpp -L/usr/local/cuda/lib64 -lcudart -lcudadevrt
The first two commands work fine, but at the g++ compilation stage I get the following error:
file_link.o: In function
__cudaRegisterLinkedBinary_38_cuda_device_runtime_compute_75_cpp1_ii_8b1a5d37': link.stub:(.text+0xcc): undefined reference to
__fatbinwrap_38_cuda_device_runtime_compute_75_cpp1_ii_8b1a5d37’
link.stub:(.text+0xd0): undefined reference to `__fatbinwrap_38_cuda_device_runtime_compute_75_cpp1_ii_8b1a5d37’
collect2: error: ld returned 1 exit status
rufus@rufus-desktop:~/Documents/CUDA_CODE/cm
I’ve been working on this problem for a few days now without any luck, so any help would be greatly appreciated!
Thanks,
Sophie