gpt4 book ai didi

tensorflow - Keras,Tensorflow 无法打开 CUDA 库 libcudnn.so。 LD_LIBRARY_PATH :?

转载 作者:行者123 更新时间:2023-12-03 23:52:59 24 4
gpt4 key购买 nike

我已经安装了CUDA 8.0并将目录中的cuDNN文件复制为Install CUDA (GPUs on Linux)说。

我运行 mnist_cnn.py 并得到以下信息:

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

最后
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'

那么如何加载 cuDNN DSO 呢?

最佳答案

正如评论中提到的,如果你还没有,你需要运行以下命令来设置你的环境变量:

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

您还可以将这些命令添加到 ~/.bashrc 的末尾,以便在您下次登录时执行它们。

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

关于tensorflow - Keras,Tensorflow 无法打开 CUDA 库 libcudnn.so。 LD_LIBRARY_PATH :?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40258631/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com