TensorFlow 1.14.0不使用GPU

环境: python3.7 cuda10.0 cudnn7.4 tensorflow1.14.0 tensorflow_gpu1.14.0

安装完cuda10.0以及cudnn7.4后, tf.test.is_gpu_available() 显示为 False, 报错如下

2022-04-26 09:39:40.811466: 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-04-26 09:39:40.863541: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2100000000 Hz
2022-04-26 09:39:40.871489: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x561db8f7a6e0 executing computations on platform Host. Devices:
2022-04-26 09:39:40.871557: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
False

后尝试如下方案后, 可使用GPU:

conda install -c anaconda tensorflow-gpu=1.14.0

上述命令会直接安装cuda10.1以及cudnn7.6, 安装完成后, GPU可用

>>> tf.test.is_gpu_available()
2022-04-26 09:54:10.957297: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 AVX512F FMA
2022-04-26 09:54:11.051659: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2100000000 Hz
2022-04-26 09:54:11.056615: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55ab6b05a690 executing computations on platform Host. Devices:
2022-04-26 09:54:11.056655: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): <undefined>, <undefined>
2022-04-26 09:54:11.058909: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1
2022-04-26 09:54:13.678290: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties: 
name: Tesla T4 major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:3d:00.0
2022-04-26 09:54:13.680224: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 1 with properties: 
name: Tesla T4 major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:3e:00.0
2022-04-26 09:54:13.682104: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 2 with properties: 
name: Tesla T4 major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:41:00.0
2022-04-26 09:54:13.683999: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 3 with properties: 
name: Tesla T4 major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:42:00.0
2022-04-26 09:54:13.685859: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 4 with properties: 
name: Tesla T4 major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:44:00.0
2022-04-26 09:54:13.687674: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 5 with properties: 
name: Tesla T4 major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:45:00.0
2022-04-26 09:54:13.689621: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 6 with properties: 
name: Tesla T4 major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:46:00.0
2022-04-26 09:54:13.691577: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 7 with properties: 
name: Tesla T4 major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:47:00.0
2022-04-26 09:54:13.747324: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.1
2022-04-26 09:54:14.070356: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcublas.so.10
2022-04-26 09:54:14.074283: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcufft.so.10
2022-04-26 09:54:14.202802: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcurand.so.10
2022-04-26 09:54:14.205169: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusolver.so.10
2022-04-26 09:54:14.206367: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusparse.so.10
2022-04-26 09:54:14.212801: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7
2022-04-26 09:54:14.275035: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0, 1, 2, 3, 4, 5, 6, 7
2022-04-26 09:54:14.275767: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.1
2022-04-26 09:54:14.316269: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix:
2022-04-26 09:54:14.316308: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187]      0 1 2 3 4 5 6 7 
2022-04-26 09:54:14.316325: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0:   N Y Y Y Y Y Y Y 
2022-04-26 09:54:14.316340: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 1:   Y N Y Y Y Y Y Y 
2022-04-26 09:54:14.316355: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 2:   Y Y N Y Y Y Y Y 
2022-04-26 09:54:14.316370: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 3:   Y Y Y N Y Y Y Y 
2022-04-26 09:54:14.316385: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 4:   Y Y Y Y N Y Y Y 
2022-04-26 09:54:14.316399: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 5:   Y Y Y Y Y N Y Y 
2022-04-26 09:54:14.316415: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 6:   Y Y Y Y Y Y N Y 
2022-04-26 09:54:14.316429: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 7:   Y Y Y Y Y Y Y N 
2022-04-26 09:54:14.334559: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:0 with 3848 MB memory) -> physical GPU (device: 0, name: Tesla T4, pci bus id: 0000:3d:00.0, compute capability: 7.5)
2022-04-26 09:54:14.338640: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:1 with 14069 MB memory) -> physical GPU (device: 1, name: Tesla T4, pci bus id: 0000:3e:00.0, compute capability: 7.5)
2022-04-26 09:54:14.342517: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:2 with 14069 MB memory) -> physical GPU (device: 2, name: Tesla T4, pci bus id: 0000:41:00.0, compute capability: 7.5)
2022-04-26 09:54:14.346316: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:3 with 14069 MB memory) -> physical GPU (device: 3, name: Tesla T4, pci bus id: 0000:42:00.0, compute capability: 7.5)
2022-04-26 09:54:14.349978: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:4 with 2153 MB memory) -> physical GPU (device: 4, name: Tesla T4, pci bus id: 0000:44:00.0, compute capability: 7.5)
2022-04-26 09:54:14.353668: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:5 with 2649 MB memory) -> physical GPU (device: 5, name: Tesla T4, pci bus id: 0000:45:00.0, compute capability: 7.5)
2022-04-26 09:54:14.357379: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:6 with 2693 MB memory) -> physical GPU (device: 6, name: Tesla T4, pci bus id: 0000:46:00.0, compute capability: 7.5)
2022-04-26 09:54:14.361062: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/device:GPU:7 with 2741 MB memory) -> physical GPU (device: 7, name: Tesla T4, pci bus id: 0000:47:00.0, compute capability: 7.5)
2022-04-26 09:54:14.364296: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55ab707532b0 executing computations on platform CUDA. Devices:
2022-04-26 09:54:14.364315: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (0): Tesla T4, Compute Capability 7.5
2022-04-26 09:54:14.364321: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (1): Tesla T4, Compute Capability 7.5
2022-04-26 09:54:14.364327: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (2): Tesla T4, Compute Capability 7.5
2022-04-26 09:54:14.364337: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (3): Tesla T4, Compute Capability 7.5
2022-04-26 09:54:14.364345: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (4): Tesla T4, Compute Capability 7.5
2022-04-26 09:54:14.364350: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (5): Tesla T4, Compute Capability 7.5
2022-04-26 09:54:14.364357: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (6): Tesla T4, Compute Capability 7.5
2022-04-26 09:54:14.364363: I tensorflow/compiler/xla/service/service.cc:175]   StreamExecutor device (7): Tesla T4, Compute Capability 7.5
True

猜你喜欢

转载自blog.csdn.net/qq_29304033/article/details/124422143