我已经按照[https://www.tensorflow.org/install/gpu]安装了CUDA,cuDNN和Titan XP GPU,并通过nvidia-smi
进行了测试。
Fri Oct 23 00:10:12 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.80.02 Driver Version: 450.80.02 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 TITAN Xp Off | 00000000:01:00.0 On | N/A |
| 23% 38C P8 17W / 250W | 532MiB / 12192MiB | 6% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
使用“ python3.6 -m venv --system-site-packages ./TF_1_xx
”创建了两个虚拟环境(xx分别代表14和20,并使用“ pip install tensorflow-gpu==1.14.*
”或“ pip install --upgrade tensorflow-gpu==2.2.* --use-feature=2020-resolver
”安装TensorFlow-GPU
但是当我尝试通过导入TensorFlow并使用“ print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
”检查GPU时,结果显示为0 GPU可用“ Num GPUs Available: 0
”。
我正在共享终端输出,同时使用上述命令使用TensorFlow检查GPU。
>>> print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
2020-10-23 00:28:49.958436: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-10-23 00:28:49.985545: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-10-23 00:28:49.985961: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: TITAN Xp computeCapability: 6.1
coreClock: 1.582GHz coreCount: 30 deviceMemorySize: 11.91GiB deviceMemoryBandwidth: 510.07GiB/s
2020-10-23 00:28:49.986354: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
2020-10-23 00:28:49.987652: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10
2020-10-23 00:28:49.988765: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10
2020-10-23 00:28:49.988946: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10
2020-10-23 00:28:49.990272: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10
2020-10-23 00:28:49.991011: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10
2020-10-23 00:28:49.991143: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda/lib64::/usr/local/cuda/extras/CUPTI/lib64
2020-10-23 00:28:49.991154: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1598] 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.
Skipping registering GPU devices...
我检查了文件夹,/usr/local/cuda/lib64
和usr/local/cuda/extras/CUPTI/lib64
都可用,并且在〜/ .bashrc中使用了导出行。打开终端时没有错误。