Trouble Running GPU training with Tensorflow 2.0.0-alpha0 on python 3.7 in a WIndows 10 x64 system

I am trying to get GPU support for TensorFlow 2.0 & Python 3.7.x on a Windows 10 x64 system. My GPU is Gforce GTX 1050 Ti (DELL laptop).

The networks/models I train run slow on the CPU and I don’t seem to have any GPU acceleration effect.

From a clean install I used:

pip install --user tensorflow==2.0.0-alpha0
pip install --user tensorflow-gpu==2.0.0-alpha0
pip install --user tensorflow-datasets
pip install --user tensorboard

I also downloaded:

cuda_10.1.105_418.96_win10.exe

and installed it.

I also downloaded:

cudnn-10.1-windows10-x64-v7.5.0.56.zip

and copied the subdirectory: CUDA*.* (bin/lib/include)
to: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1*.* (bin/lib/include)

I run toy mnist and other models and don’t seem to get GPU acceleration I expect (Task Manager CPU performance is pegged at 100%).

my PATH environment variable is:

PATH=;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp;C:\Program Files\Python37\Scripts;C:\Program Files\Python37;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\MATLAB\R2019a\bin;C:\Program Files\MATLAB\R2018b\bin;C:\Program Files\MATLAB\R2018a\bin;C:\Program Files\MATLAB\R2014a\bin;C:\Program Files\dotnet;C:\Program Files\MATLAB\MATLAB Runtime\v901\runtime\win64;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\NVIDIA Corporation\Nsight Compute 2019.1;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Users\steph\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.5\bin;;C:\Users\steph\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon\

What am I missing?
Is there a way to find out if the GPU is available to Python tensorflow code?
Is there an environment variable that needs to be adjusted?
Is there a configuration file that needs adjusting?

import tensorflow as tf

print(tf.version)
2.0.0-alpha0

print(tf.test.is_gpu_available())
False

How do I get True?

One challenge is:

pip install --user tensorflow==2.0.0-alpha0

This installs TensorFlow with NO GPU

pip install --user tensorflow-gpu==2.0.0-alpha0

This should install TensorFlow WITH GPU capability.

Do one or the other, not both.

When I pip tensorflow==2.0.0-alpha0
and I run:

import tensorflow as tf
print(tf.version)
print(tf.test.is_gpu_available())

I get

2.0.0-alpha0
False


I did a compete clean reinstall of:

Python 3.7.3
PyCharm
Anaconda 3.7.x

and then did:

pip install --user tensorflow-gpu==2.0.0-alpha0
(no pip tensorflow==2.0.0-alpha0)

pip install --user tensorflow-datasets

When I run: python

import tensorflow as tf

I get:


C:\Users\steph\PycharmProjects\Image1\TF2>python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

import tensorflow as tf
Traceback (most recent call last):
File “C:\Users\steph\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File “C:\Users\steph\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File “C:\Users\steph\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 24, in swig_import_helper
_mod = imp.load_module(‘_pywrap_tensorflow_internal’, fp, pathname, description)
File “C:\Users\steph\AppData\Local\Programs\Python\Python37\lib\imp.py”, line 242, in load_module
return load_dynamic(name, filename, file)
File “C:\Users\steph\AppData\Local\Programs\Python\Python37\lib\imp.py”, line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\steph\AppData\Roaming\Python\Python37\site-packages\tensorflow_init_.py”, line 27, in
from tensorflow.api.v2 import audio
File "C:\Users\steph\AppData\Roaming\Python\Python37\site-packages\tensorflow_api\v2\audio_init
.py", line 8, in
from tensorflow.python.ops.gen_audio_ops import decode_wav
File “C:\Users\steph\AppData\Roaming\Python\Python37\site-packages\tensorflow\python_init_.py”, line 49, in
from tensorflow.python import pywrap_tensorflow
File “C:\Users\steph\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File “C:\Users\steph\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File “C:\Users\steph\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File “C:\Users\steph\AppData\Roaming\Python\Python37\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 24, in swig_import_helper
_mod = imp.load_module(‘_pywrap_tensorflow_internal’, fp, pathname, description)
File “C:\Users\steph\AppData\Local\Programs\Python\Python37\lib\imp.py”, line 242, in load_module
return load_dynamic(name, filename, file)
File “C:\Users\steph\AppData\Local\Programs\Python\Python37\lib\imp.py”, line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

Failed to load the native TensorFlow runtime.

See Создание и установка сообщений об ошибках  |  TensorFlow

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.


How do I get GPU to work?

My path is:

C:\Users\steph\PycharmProjects\Image2>path
PATH=C:\tools\cuda\lib\x64;C:\tools\cuda\bin;C:\Users\steph\AppData\Roaming\Python\Python37\Scripts;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\CUPTI\lib64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp;C:\Program Files\Python37\Scripts;C:\Program Files\Python37;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\MATLAB\R2019a\bin;C:\Program Files\MATLAB\R2018b\bin;C:\Program Files\MATLAB\R2018a\bin;C:\Program Files\MATLAB\R2014a\bin;C:\Program Files\dotnet;C:\Program Files\MATLAB\MATLAB Runtime\v901\runtime\win64;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\NVIDIA Corporation\Nsight Compute 2019.1;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Users\steph\AppData\Local\Programs\Python\Python37\Scripts;C:\Users\steph\AppData\Local\Programs\Python\Python37;C:\Users\steph\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.1\bin;;C:\Users\steph\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon\


Where c:\tools\cuda\bin\cudnn64_7.dll