简体   繁体   中英

Tensorflow 1.15 cannot detect gpu with Cuda10.1

I have installed both tensorflow 2.2.0 and tensorflow 1.15.0 (by pip install tensorflow-gpu==1.15.0 ). The tensorflow 2 is installed in the base environment of Anaconda 3 , while the tensorflow 1 is installed in a separate environment.

The tensorflow 2.2.0 can recognize gpu based on a simple test:

if tf.test.gpu_device_name():
    print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))

//output: Default GPU Device: /device:GPU:0

But the tensorflow 1.15.0 can not detect gpu.

For your information, my system environment is python + cuda 10.1 + vs 2015.

The tensosflow versions 1.15.0 to 1.15.3 (the latest version) are all compiled against Cuda 10.0. Downgrading the cuda 10.1 to cuda 10.0 solved the problem.

Also be aware of the python version. It is recommended to install the tensorflow .whl file (as listed at https://nero-mirror.stanford.edu/pypi/simple/tensorflow-gpu/ ) for the specific python version. As for installation, see How do I install a Python package with a.whl file?

Tensorflow 1.15 expects cuda 10.0, but I managed to make it work with cuda 10.1 by installing the following packages with Anaconda: cudatoolkit (10.0) and cudnn (7.6.5). So, after running

conda install cudatoolkit=10.0
conda install cudnn=7.6.5

tensorflow 1.15 was able to find and use GPU (which is using cuda 10.1).

PS: I understand your environment is Windows based, but this question pops on Google for the same problem happening on Linux (where I tested this solution). Might be useful also on Windows.

Have you tried installing Anaconda? it downloads all the requirements and make it easy for you with just a few clicks.

It might have to do with the version compatibility of TF, Cuda and CuDNN. This post has it discussed thoroughly.

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