1

My startup script for GCP GPU instance installs cuda + cudnn + tensorflow-gpu and is coded as below :

## 1. Steps to install CUDA ##
## 2. steps to setup cudnn ##

## 3. set PATH & LD_LIBRARY_PATH variables
echo 'export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}' >> ~/.bashrc 
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc 

## 4. install tensorflow-gpu using pip
## 5. call python script which will 'import tensorflow'

I see that that step-3 is not done by the script properly & the .bashrc file doesnot contain the two entries. Also, for similar reason, I get below error at statement to import tensorflow :

INFO startup-script:     import tensorflow as tf
INFO startup-script:   File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 24, in <module>
.
.
INFO startup-script: ImportError: libcudnn.so.7: cannot open shared object file: No such file or directory
INFO startup-script: Failed to load the native TensorFlow runtime.

If I manually export the two variables in the console window, and run the python script(step-5); it works.

What is the way to have those variables automatically set by the startup script?

OR what is the other/better way to use tensorflow-gpu via a startup script on gcp ?

Akash Goyal
  • 1,273
  • 10
  • 15

0 Answers0