【激动人心】ubuntu+tensorflow-gpu15.0+cudatoolkit10.0安装

显卡:A100-PCIE-40GB

【激动人心】ubuntu+tensorflow-gpu15.0+cudatoolkit10.0安装_第1张图片

已经安装tensorflow2.4版本,重新创建一个虚拟环境,tf15,想要安装tensorflow1.15.0版本

步骤:

1.创建虚拟环境:conda create -n tf15

2. 安装tensorflow-gpu

pip install tensorflow-gpu==1.15.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

3.安装cudatoolkit

conda install cudatoolkit=10.0

4.安装cudnn

conda install cudnn

出现问题:

2022-06-21 02:38:22.594013: 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; LD_LIBRARY_PATH: /home/zhangxin/anaconda3/envs/tf15/lib:/home/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
2022-06-21 02:38:22.594079: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcublas.so.10.0'; dlerror: libcublas.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/zhangxin/anaconda3/envs/tf15/lib:/home/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
2022-06-21 02:38:22.594170: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcufft.so.10.0'; dlerror: libcufft.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/zhangxin/anaconda3/envs/tf15/lib:/home/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
2022-06-21 02:38:22.594220: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcurand.so.10.0'; dlerror: libcurand.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/zhangxin/anaconda3/envs/tf15/lib:/home/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
2022-06-21 02:38:22.594272: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcusolver.so.10.0'; dlerror: libcusolver.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/zhangxin/anaconda3/envs/tf15/lib:/home/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
2022-06-21 02:38:22.594333: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcusparse.so.10.0'; dlerror: libcusparse.so.10.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/zhangxin/anaconda3/envs/tf15/lib:/home/usr/lib/x86_64-linux-gnu:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
2022-06-21 02:38:22.597918: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2022-06-21 02:38:22.597947: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1641] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.

解决方法:

vim ~/.bashrc添加LD_LIBRARY_PATH路径,之前我路径写错了

【激动人心】ubuntu+tensorflow-gpu15.0+cudatoolkit10.0安装_第2张图片

 最后source ~/.bashrc

5. 测试:

import tensorflow as tf
tf.test.is_gpu_available()

结果:

>>> import tensorflow as tf
>>> tf.test.is_gpu_available()
2022-06-21 02:48:42.409195: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
2022-06-21 02:48:42.444005: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2100000000 Hz
2022-06-21 02:48:42.459630: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x4e68db0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2022-06-21 02:48:42.459703: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2022-06-21 02:48:42.463157: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2022-06-21 02:48:43.353648: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x4ed62e0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2022-06-21 02:48:43.353762: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): A100-PCIE-40GB, Compute Capability 8.0
2022-06-21 02:48:43.353805: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (1): A100-PCIE-40GB, Compute Capability 8.0
2022-06-21 02:48:43.353843: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (2): A100-PCIE-40GB, Compute Capability 8.0
2022-06-21 02:48:43.353908: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (3): A100-PCIE-40GB, Compute Capability 8.0
2022-06-21 02:48:43.353949: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (4): A100-PCIE-40GB, Compute Capability 8.0
2022-06-21 02:48:43.353988: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (5): A100-PCIE-40GB, Compute Capability 8.0
2022-06-21 02:48:43.366944: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: 
name: A100-PCIE-40GB major: 8 minor: 0 memoryClockRate(GHz): 1.41
pciBusID: 0000:1a:00.0
2022-06-21 02:48:43.370653: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 1 with properties: 
name: A100-PCIE-40GB major: 8 minor: 0 memoryClockRate(GHz): 1.41
pciBusID: 0000:1d:00.0
2022-06-21 02:48:43.373600: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 2 with properties: 
name: A100-PCIE-40GB major: 8 minor: 0 memoryClockRate(GHz): 1.41
pciBusID: 0000:20:00.0
2022-06-21 02:48:43.376523: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 3 with properties: 
name: A100-PCIE-40GB major: 8 minor: 0 memoryClockRate(GHz): 1.41
pciBusID: 0000:21:00.0
2022-06-21 02:48:43.379443: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 4 with properties: 
name: A100-PCIE-40GB major: 8 minor: 0 memoryClockRate(GHz): 1.41
pciBusID: 0000:23:00.0
2022-06-21 02:48:43.381460: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 5 with properties: 
name: A100-PCIE-40GB major: 8 minor: 0 memoryClockRate(GHz): 1.41
pciBusID: 0000:24:00.0
2022-06-21 02:48:43.381843: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2022-06-21 02:48:43.384064: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2022-06-21 02:48:43.386167: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0
2022-06-21 02:48:43.386616: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0
2022-06-21 02:48:43.389314: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0
2022-06-21 02:48:43.390855: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0
2022-06-21 02:48:43.395460: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2022-06-21 02:48:43.410386: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0, 1, 2, 3, 4, 5
2022-06-21 02:48:43.410447: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2022-06-21 02:48:43.418114: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2022-06-21 02:48:43.418142: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0 1 2 3 4 5 
2022-06-21 02:48:43.418153: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N Y Y Y Y Y 
2022-06-21 02:48:43.418161: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 1:   Y N Y Y Y Y 
2022-06-21 02:48:43.418169: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 2:   Y Y N Y Y Y 
2022-06-21 02:48:43.418177: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 3:   Y Y Y N Y Y 
2022-06-21 02:48:43.418185: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 4:   Y Y Y Y N Y 
2022-06-21 02:48:43.418193: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 5:   Y Y Y Y Y N 
2022-06-21 02:48:43.426829: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/device:GPU:0 with 37574 MB memory) -> physical GPU (device: 0, name: A100-PCIE-40GB, pci bus id: 0000:1a:00.0, compute capability: 8.0)
2022-06-21 02:48:43.428976: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/device:GPU:1 with 37574 MB memory) -> physical GPU (device: 1, name: A100-PCIE-40GB, pci bus id: 0000:1d:00.0, compute capability: 8.0)
2022-06-21 02:48:43.430612: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/device:GPU:2 with 37574 MB memory) -> physical GPU (device: 2, name: A100-PCIE-40GB, pci bus id: 0000:20:00.0, compute capability: 8.0)
2022-06-21 02:48:43.432523: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/device:GPU:3 with 37574 MB memory) -> physical GPU (device: 3, name: A100-PCIE-40GB, pci bus id: 0000:21:00.0, compute capability: 8.0)
2022-06-21 02:48:43.434064: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/device:GPU:4 with 37574 MB memory) -> physical GPU (device: 4, name: A100-PCIE-40GB, pci bus id: 0000:23:00.0, compute capability: 8.0)
2022-06-21 02:48:43.435756: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/device:GPU:5 with 37574 MB memory) -> physical GPU (device: 5, name: A100-PCIE-40GB, pci bus id: 0000:24:00.0, compute capability: 8.0)
True

安装成功!!!

你可能感兴趣的:(ubuntu,tensorflow,tensorflow,ubuntu,人工智能)