Hi guys, when I finished install the Matlab and CUDA in my Ubuntu, I try to make the examples from cu file to mexa64 file. However, when I use the unix(‘make’). it returns the following error information.
unix(‘make’);
/home/lys/MATLAB/R2011a/bin/mex CFLAGS=‘-fPIC -D_GNU_SOURCE -pthread -fexceptions’ COPTIMFLAGS=‘-O3 -funroll-loops -msse2’ fft2_cuda.c
-I/home/lys/cuda/include -L/home/lys/cuda/lib -lcufft -Wl,-rpath,/home/lys/cuda/lib
/usr/bin/ld: skipping incompatible /home/lys/cuda/lib/libcufft.so when searching for -lcufft
/usr/bin/ld: cannot find -lcufft
collect2: ld returned 1 exit status
mex: link of ' "fft2_cuda.mexa64"' failed.
make: *** [fft2_cuda.mexa64] Error 1
Do you know how to solve the problem and would you please help me out ? Thank yo so much
Thanks so much. This problem is solved. However, even though I have already install the Nvidia_GPU_Computing_SDK and also make it successfully. When I try to make the Matlab examples, it still report the following errors:
unix(‘make’)
/home/lys/MATLAB/R2011a/bin/mex CFLAGS=‘-fPIC -D_GNU_SOURCE -pthread -fexceptions’ COPTIMFLAGS=‘-O3 -funroll-loops -msse2’ fft2_cuda.c
-I/home/lys/cuda/include -L/home/lys/cuda/lib64 -lcufft -Wl,-rpath,/home/lys/cuda/lib64
fft2_cuda.o: In function mexFunction': fft2_cuda.c:(.text+0xddf): undefined reference to cudaMalloc’
fft2_cuda.c:(.text+0xdf4): undefined reference to cudaMemcpy' fft2_cuda.c:(.text+0xe3c): undefined reference to cudaMemcpy’
fft2_cuda.c:(.text+0xe91): undefined reference to `cudaFree’
collect2: ld returned 1 exit status
mex: link of ' "fft2_cuda.mexa64"' failed.
make: *** [fft2_cuda.mexa64] Error 1
It seems that I did not install the Matlab CUDA interface successfully. Can you help me to solve the problem ?
Thanks
I think you didn’t add $(CUDA_INSTALL_DIR)/bin to PATH
$ export PATH=$PATH:/usr/local/cuda/bin # This should fix your issue.
Also, You can use Jacket SDK for compiling custom CUDA code for Matlab. Visit this for more on Jacket SDK and how to use it with Matlab. Jacket ships some pretty good SDK samples and is very easy to setup and get started with.