Keras, Tensorflow Could not open the CUDA library libcudnn.so. LD_LIBRARY_PATH :?

I already installed CUDA 8.0 and copied the cuDNN file to the Install CUDA directory (GPUs on Linux) .

I ran mnist_cnn.py and got the following information:

Using TensorFlow backend.
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:105] Couldn't open CUDA library libcudnn.so. LD_LIBRARY_PATH: 
I tensorflow/stream_executor/cuda/cuda_dnn.cc:3448] Unable to load cuDNN DSO
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally
X_train shape: (60000, 28, 28, 1)
60000 train samples

and finally

Traceback (most recent call last):
  File "mnist_cnn.py", line 65, in <module>
    model.add(Dropout(0.25))
  File "/home/nsknsl/.local/lib/python3.5/site-packages/keras/models.py", line 308, in add
    output_tensor = layer(self.outputs[0])
  File "/home/nsknsl/.local/lib/python3.5/site-packages/keras/engine/topology.py", line 514, in __call__
    self.add_inbound_node(inbound_layers, node_indices, tensor_indices)
  File "/home/nsknsl/.local/lib/python3.5/site-packages/keras/engine/topology.py", line 572, in add_inbound_node
    Node.create_node(self, inbound_layers, node_indices, tensor_indices)
  File "/home/nsknsl/.local/lib/python3.5/site-packages/keras/engine/topology.py", line 149, in create_node
    output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0]))
  File "/home/nsknsl/.local/lib/python3.5/site-packages/keras/layers/core.py", line 90, in call
    x = K.in_train_phase(K.dropout(x, self.p, noise_shape), x)
  File "/home/nsknsl/.local/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 1304, in in_train_phase
    x = tf.python.control_flow_ops.cond(tf.cast(_LEARNING_PHASE, 'bool'),
AttributeError: module 'tensorflow.python' has no attribute 'control_flow_ops'
Exception ignored in: <bound method BaseSession.__del__ of <tensorflow.python.client.session.Session object at 0x7ff2a70e4ba8>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 532, in __del__
AttributeError: 'NoneType' object has no attribute 'TF_DeleteStatus'

so how can i load cuDNN DSO?

+4
source share
2 answers

As mentioned in the comments, if you have not already done so, you need to run the following commands to set the environment variables:

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda

You can also add these commands at the end of your ~ / .bashrc so that they execute the next time you log in.

: https://www.tensorflow.org/versions/master/install/install_linux#nvidia_requirements_to_run_tensorflow_with_gpu_support

+4
  • , , cudnn. Cuda.

  • "libcudnn.so". : sudo find /usr/ -name 'libcudnn.so'

/usr/local/cuda-8.0/targets/x86_64-linux/lib.

  1. , , , ​​ libcufft.so sudo find /usr/ -name 'libcufft.so' /usr/lib.

  2. : sudo cp /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcud* /usr/lib

  3. Tensorflow . :)
0

Source: https://habr.com/ru/post/1658908/


All Articles