dlerror: libcuXXX.so.10.0: cannot open shared object file解决方法

因为机器上装的cuda tookit 是10.2版本 在测试tensorflow-gpu1.14.0的时候提示找不到库文件
得益于https://blog.csdn.net/u014421914/article/details/103410545的提示,在tf路径下创建这些缺失文件的软连接如下

$PYTHON_PATH/site-packages/tensorflow$ ln -s '/usr/local/cuda/lib64/libcudart.so' ./libcudart.so.10.0
$PYTHON_PATH/site-packages/tensorflow$ ln -s '/usr/lib/x86_64-linux-gnu/libcublas.so' ./libcublas.so.10.0
$PYTHON_PATH/site-packages/tensorflow$ ln -s '/usr/local/cuda/targets/x86_64-linux/lib/libcufft.so' ./libcufft.so.10.0
$PYTHON_PATH/site-packages/tensorflow$ ln -s '/usr/local/cuda/targets/x86_64-linux/lib/libcurand.so' ./libcurand.so 
$PYTHON_PATH/site-packages/tensorflow$ ln -s '/usr/local/cuda/targets/x86_64-linux/lib/libcurand.so' ./libcurand.so.10.0 
$PYTHON_PATH/site-packages/tensorflow$ ln -s '/usr/local/cuda/targets/x86_64-linux/lib/libcusolver.so' ./libcusolver.so.10.0
$PYTHON_PATH/site-packages/tensorflow$ ln -s '/usr/local/cuda/targets/x86_64-linux/lib/libcusparse.so' ./libcusparse.so.10.0

初测可以解决

import tensorflow as tf
print(tf.test.is_gpu_available())
print(tf.test.is_built_with_cuda())


2020-02-24 00:04:28.126910: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0
2020-02-24 00:04:28.128464: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcublas.so.10.0
2020-02-24 00:04:28.129871: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcufft.so.10.0
2020-02-24 00:04:28.130144: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcurand.so.10.0
2020-02-24 00:04:28.131733: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusolver.so.10.0
2020-02-24 00:04:28.132707: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusparse.so.10.0
2020-02-24 00:04:28.141224: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7

2020-02-24 00:04:29.846404: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:0 with 2784 MB memory) -> physical GPU (device: 0, name: GeForce GTX 960, pci bus id: 0000:01:00.0, compute capability: 5.2)
True
True

你可能感兴趣的:(tensorflow)