starrr starrr - 4 months ago 18
Linux Question

Adding path to CUDA libraries without sudo access

I used a library (the library is called cublas) in my CUDA code which I 'm writing in linux, I can compile my code successfully using nvcc but when I run the code I get this error:


error while loading shared libraries: libcublas.so.7.5: cannot open shared object file: No such file or directory


I found This link as a solution which suggests to run some commands in order to solve the issue. one solution based on this link is running the following command:


export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib


The system which gpu locates in it and I am using to run my code on it is shared between me and other people, I am not a sudo user in that system. I am wondering if running this command is safe and does not affect other settings of the system

Can anyone please help me to know that>

Thank you so much

Answer

I am wondering if running this command is safe and does not affect other settings of the system

Yes, you'll be fine.

This command:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib

only affects the process you execute it in.

It will not affect any other user's process, or any other process of yours.

Furthermore, if you log out and log in again, you will have to execute that command again. It is not "sticky"