I’m trying to compile a CUDA program that uses the cudaBLAS and the cBLAS libraries. No problem with the first one, but with second I always get an “undefined reference” error. I compile the program with this command:
nvcc axpy.cu -o axpy -lcublas -lcblas
CBLAS library is correctly installed, cause I can compile with gcc (commenting the CUDA parts) without errors. The problem comes because NVCC calls the C++ compiler, and it’s g++ who returns the error. Here is the output to the above command with the --verbose option:
[...]
[...]
#$ gcc -c -x c++ "-I/usr/local/cuda/bin/../include" "-I/usr/local/cuda/bin/../include/cudart" -I. -fpreprocessed -m32 -malign-double -o "/tmp/tmpxft_000015d0_00000000-12_axpy.o" "/tmp/tmpxft_000015d0_00000000-11_axpy.ii"
#$ g++ -m32 -malign-double -o "axpy" -Wl,--start-group "/tmp/tmpxft_000015d0_00000000-12_axpy.o" -lcublas -lcblas "-L/usr/local/cuda/bin/../lib" -lcudart -Wl,--end-group
/tmp/tmpxft_000015d0_00000000-12_axpy.o: In function `main':
tmpxft_000015d0_00000000-1_axpy.cudafe1.cpp:(.text+0x4e8): undefined reference to `cblas_daxpy(int, double, double const*, int, double*, int)'
collect2: ld devolvió el estado de salida 1
# --error 0x1 --
I tried to compile with the option " --host-compilation C " but it doesn’t change anything. Any ideas?
At the beginning I was getting a different “undefined reference” message, cause I was not linking with the atlas library, but changing compiling line for