简体   繁体   中英

tensorflow 2.2 gpu support Windows

I have the following output for

import tensorflow as tf
print(tf.__version__)
print(tf.test.is_gpu_available())
print(tf.config.list_physical_devices('GPU'))
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
2.2.0
False
[]
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 9877499202779451731
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 5902815618689871957
physical_device_desc: "device: XLA_CPU device"
, name: "/device:XLA_GPU:0"
device_type: "XLA_GPU"
memory_limit: 17179869184
locality {
}
incarnation: 9480702146652446076
physical_device_desc: "device: XLA_GPU device"
]

What should l do in order to have GPU working on Windows?

I have in the path the following in the PATH

C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\bin C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\libnvvp C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\extras\\CUPTI\\lib64 C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.1\\include C:\\cuda\\bin

I believe you need cuda v10.1 not 11.1. What I found easiest to do is uninstall tensorflow if you installed it with pip. If you are using Anaconda then us conda to install tensorflow. It will install version 2.1.1, the cuda toolkit version 10.1.243 and cudnn version 7.6.5. Note conda can only install tensorflow up to version 2.1.1. If you want tensorflow 2.2 install it with pip using pip install tensorflow ==2.2.0. after you have installed 2.1. The cuda toolkit and cudnn work with version 2.2. Otherwise you have to go through the process you used to install cuda 11.1 but this time use the 10.1 download files. One other thing. Use python3.7 not 3.8. Apparently when you install tensorflow with conda it will not work with 3.8.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM