0

I'm trying to work with tensorflow on Ubuntu 18.04 using Deep Learning AMI from Amazon which has all CUDA verions installed. However, it's not so easy to make tensorflow 1.X work with GPU because some $PATH problems. When no action is taken, this run time error happens while using TF 1.X:

2020-03-25 16:31:58.162200: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudart.so.10.0'; dlerror: libcudart.so.10.0: cannot open shared object file: No such file or directory

But it works correctly for TF 2.X

So after reading some posts like this or this, i decided to add this commands to 1) ~/.bashrc and later to 2) ~/.profile:

export LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda-10.0/extras/CUPTI/lib64:$LD_LIBRARY_PATH"
export PATH="/usr/local/cuda-10.0/bin:$PATH"

but with no effect (I did restart machine or use source ~/.bashrc command).

However, if I add these variables to /etc/environment then tensorflow finds these variables and works perfectly! Problem is, that it completely breaks machine as, i assume, it overrides all other $PATH and LD_LIBRARY_PATH variables. My theory is, that because /etc/environment has the highest priority the variable LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda-10.0/extras/CUPTI/lib64 is exactly what TF 1.X requires.

Question:

How do I add this variable correctly, so TF 1.X finds it's CUDA-10.0 files and TF 2.X finds its higher CUDA versions?

  • /etc/environment is not a script file, and thus unable to expand variables. So it ought to work if you state all the directories explicitly and drop the variables. (And you can drop the "export" command, too. It serves no purpose in /etc/environment.) – Gunnar Hjalmarsson Apr 2 at 10:53
0

Answer to my own question lies here: setting LD_LIBRARY_PATH for CUDA and its this post but do not forget to do sudo ldconfig

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.