Error running Cuda Code on Jetson TX1

I made a Simple Matlab program and used GPU coder to transfer it into Cuda Code and the ran the code on the Jetson and got this error

/usr/lib/gcc/aarch64-linux-gnu/5/…/…/…/aarch64-linux-gnu/crt1.o: In function _start': (.text+0x30): undefined reference to main’
/tmp/tmpxft_000018c0_00000000-10_Cabbage.o: In function cublasEnsureDestruction()': tmpxft_000018c0_00000000-5_Cabbage.cudafe1.cpp:(.text+0x4c): undefined reference to cublasDestroy_v2’
/tmp/tmpxft_000018c0_00000000-10_Cabbage.o: In function cublasEnsureInitialization()': tmpxft_000018c0_00000000-5_Cabbage.cudafe1.cpp:(.text+0x8c): undefined reference to cublasCreate_v2’
tmpxft_000018c0_00000000-5_Cabbage.cudafe1.cpp:(.text+0xa0): undefined reference to cublasSetPointerMode_v2' /tmp/tmpxft_000018c0_00000000-10_Cabbage.o: In function Cabbage(creal_T*)‘:
tmpxft_000018c0_00000000-5_Cabbage.cudafe1.cpp:(.text+0x124): undefined reference to b_rand(double*)' tmpxft_000018c0_00000000-5_Cabbage.cudafe1.cpp:(.text+0x134): undefined reference to Test_f(double const*, creal_T*, creal_T*)’
tmpxft_000018c0_00000000-5_Cabbage.cudafe1.cpp:(.text+0x270): undefined reference to `cublasZgemm_v2’
collect2: error: ld returned 1 exit status


It looks like there is something incorrect in your CUDA toolkit.
Have you install CUDA from JetPack?

After installation, could you try to run a CUDA sample to check cublas functionality?

/usr/local/cuda-9.0/bin/ .
cd NVIDIA_CUDA-9.0_Samples/0_Simple/matrixMulCUBLAS/


Thank you for the reply.
All the samples work fine.
The header file for those functions is in the same folder, could there be something wrong with the path? Or do i have to link them in my make file?

Thanks again.


It looks like your program cannot find the cublas library.

If you can modify the Makefile, please add the library path with -L.
If not, could you try to add the library path into LIBRARY_PATH?

# library path should be ‘/usr/local/cuda-9.0/lib64’