Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSError: libcublas.so.3: cannot open shared object file: No such file or directory

Tags:

cuda

ubuntu

I tried to import cudamat. Then I ran into the error:

OSError: libcublas.so.3: cannot open shared object file: No such file or directory

I tried to locate libcublas

/usr/local/MATLAB/MATLAB_Production_Server/R2013a/bin/glnxa64/libcublas.so.5.0
/usr/local/MATLAB/MATLAB_Production_Server/R2013a/bin/glnxa64/libcublas.so.5.0.40
/usr/local/cuda-5.5/lib/libcublas.so
/usr/local/cuda-5.5/lib/libcublas.so.5.5
/usr/local/cuda-5.5/lib/libcublas.so.5.5.22
/usr/local/cuda-5.5/lib/libcublas_device.a
/usr/local/cuda-5.5/lib64/libcublas.so
/usr/local/cuda-5.5/lib64/libcublas.so.5.5
/usr/local/cuda-5.5/lib64/libcublas.so.5.5.22
/usr/local/cuda-5.5/lib64/libcublas_device.a
/usr/local/cuda-5.5/targets/x86_64-linux/lib/libcublas.so
/usr/local/cuda-5.5/targets/x86_64-linux/lib/libcublas.so.5.5
/usr/local/cuda-5.5/targets/x86_64-linux/lib/libcublas.so.5.5.22
/usr/local/cuda-5.5/targets/x86_64-linux/lib/libcublas_device.a

What can I do? I'm sorry I'm not familiar with ubuntu. Thank you !

QUESTION CLOSED

I solved this myself.

first set PATH and LD_LIBRARY_PATH

$ export PATH=/usr/local/cuda-5.5/bin:$PATH
$ export LD_LIBRARY_PATH=/usr/local/cuda-5.5/lib64:$LD_LIBRARY_PATH

Then build a symbolic link

sudo ln -s /usr/local/cuda-5.5/lib64/libcublas.so /usr/local/cuda-5.5/lib64/libcublas.so.3
like image 247
user2684645 Avatar asked Dec 06 '22 04:12

user2684645


2 Answers

I solved this myself.

first set PATH and LD_LIBRARY_PATH

$ export PATH=/usr/local/cuda-5.5/bin:$PATH
$ export LD_LIBRARY_PATH=/usr/local/cuda-5.5/lib64:$LD_LIBRARY_PATH

Then build a symbolic link

sudo ln -s /usr/local/cuda-5.5/lib64/libcublas.so /usr/local/cuda-5.5/lib64/libcublas.so.3
like image 77
user2684645 Avatar answered Dec 08 '22 18:12

user2684645


In a slightly different situation, the same warning may be raised by literally missing lib file, i.e. the .lib files are not at $CUDA/lib64/. For instance the following code did not show libcublas.so in this directory.

sudo find / -iname libcublas*
/usr/local/cuda-7.5/doc/man/man7/libcublas.so.7
/usr/local/cuda-7.5/doc/man/man7/libcublas.7
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas.so.7.5
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas_static.a
/usr/local/cuda-7.5/targets/x86_64-linux/lib/stubs/libcublas.so
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas_device.a
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas.so.7.5.18
/usr/local/cuda-7.5/targets/x86_64-linux/lib/libcublas.so

The workaround for this case is different but straightforward: just create symlinks in $CUDA/lib64/ for all the lib files in $CUDA/targets/x86_64-linux/lib. An example one-liner is like this:

sudo ln -s /usr/local/cuda/targets/x86_64-linux/lib/* $LD_LIBRARY_PATH
like image 24
zaxliu Avatar answered Dec 08 '22 19:12

zaxliu