I've been trying to link to the functions in the cutil.h ofthe GPU Computing SDK released by NVIDIA.
At the moment, I am simply trying to compile this simple piece of code:
#include <iostream>
#include <cuda.h>
#include <cutil.h>
using namespace std;
int main(){
unsigned int time_total;
cutCreateTimer(&time_total);
return 0;
}
using the following command:
nvcc -I/home/sj755/NVIDIA_GPU_Computing_SDK/C/common/inc/ -L/home/sj755/NVIDIA_GPU_Computing_SDK/C/lib/libcutil_x86_64.a cutiltest.cu
Only to get the following error:
/tmp/tmpxft_000077cc_00000000-13_cutiltest.o: In function `main':
tmpxft_000077cc_00000000-1_cutiltest.cudafe1.cpp:(.text+0x10): undefined reference to
`cutCreateTimer'
collect2: ld returned 1 exit status
ld also can't find -lcutil if I were to add the flag. There is a static library that I'm supposed to link to, but for some reason this never works out. Here's what I tried:
I've changed my .bashrc file so that LD_LIBRARY_PATH includes the path to the static library
##########< CULA >export CULA_ROOT=/usr/local/cula
export CULA_INC_PATH=$CULA_ROOT/include
export CULA_BIN_PATH_32=$CULA_ROOT/bin
export CULA_BIN_PATH_64=$CULA_ROOT/bin64
export CULA_LIB_PATH_32=$CULA_ROOT/lib
export CULA_LIB_PATH_64=$CULA_ROOT/lib64
##########< CUDA >export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=:/usr/local/cuda/lib64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CULA_LIB_PATH_64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/libnvvp/
export CUDA_SDK_ROOT_DIR=/home/sj755/NVIDIA_GPU_Computing_SDK/C
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUDA_SDK_ROOT_DIR/lib
I've also tried renaming
libcutil_x86_64.atolibcutil.a, still nothing.Tried extracting the archive, creating a shared object file, and linking to it:
ar -x libcutil_x86_64.a
gcc -I /usr/include/GL/ -L /usr/include/GL/ -lglut -lGL -lGLU -lX11 -lXmu -lXi -lm -lpthread -shared *.cpp.o -o libcutil.so
nvcc -lcutil -I /home/sj755/NVIDIA_GPU_Computing_SDK/C/common/inc/ -L /home/sj755/NVIDIA_GPU_Computing_SDK/C/lib/libcutil.so cutiltest.cu
Only to get the following /usr/bin/ld: cannot find -lcutil
What step am I forgetting here?