LSC PSD
Published in

LSC PSD

Articles for people who have trouble not recognizing GPU during machine learning

[python] [tensorflow-gpu] [windows10]

I’m a machine learning and python amateur, but I tried hard to recognize the GPU.

Check if the GPU is recognized.

Start python at the command prompt and enter the code written below.

tensorflow.python.client import device_lib
device_lib.list_local_devices()

If the following output is displayed, the GPU is not recognized

[name:“ / device:CPU:0”
device_type:“ CPU”
memory_limit:268435456
locality {
}
incarnation:13982673025618917、name:“ / device:GPU:0”

Check the version

Check the version of tensorflow-gpu, CUDA, cuDNN, and pyhton (Anaconda).
If this is not the right combination, the GPU will not work.

・Check tensorflow-gpu version
Enter “pip list” at the command prompt.

・Check CUDA version
Enter “nvcc -V” at the command prompt.

・Check cuDNN version
Open the cudnn.h file in E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include as a text file.

#define CUDNN_MAJOR 7
#define CUDNN_MINOR 6
#define CUDNN_PATCHLEVEL 2(In this case, the version is 7.6)

・Check the version of python (Anaconda)
After starting python at the command prompt,enter the following code.

import sys
print(sys.version)

So I found out that
tensorflow-gpu 1.14.0
CUDA 10.0
cuDNN 7.6
python (Anaconda) 3,6,6

Check the compatibility table and adjust the version

The correspondence table recommend that
tensorflow-gpu 1.13.0
CUDA 10.0
cuDNN 7.4
python(Anaconda) 3,3~3,6
So I will adjust each version.

・ Specify the version and install tensorflow-gpu
You can downgrade, but uninstall this time, specify the version, and reinstall.
※If tensorflow and tensorflow-gpu exist at the same time, GPU may not be recognized well.Please uninstall and remove tenosrflow.

Enter “ pip uninstall tensorflow-gpu” on the command prompt.

Next,after uninstallation is complete,enter “ pip install tensorflow-gpu 1.13.0” on the command prompt.

・ Install CUDA
Since the CUDA version matches this time, the explanation is omitted. If the version does not match, please download v10.0 from the CUDA site.

・Install cuDNN
Download v7.4 from cuDNN site.
※Account registration required for download

After unzipping the downloaded file, open the cuda file.
Copy the files in the bin folder.

Paste to E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin

Next,copy the files in the include folder.

paste to E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include

Finally,copy the files in the x64 folder of the lib folder.

Paste to E:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\lib

Check again if GPU is recognized

Start python at the command prompt and enter the code written below.

from tensorflow.python.client import device_lib
device_lib.list_local_devices()

If the output is as shown below, recognition is successful.

[name:“ / device:CPU:0”
device_type:“ CPU”
memory_limit:268435456
locality {
}
incarnation:13982673025618917、name:“ / device:GPU:0”
device_type:“ GPU”
memory_limit:9218918974
locality {
bus_id:1
link{
}
}
incarnation:4523574223257016774
physical_device_desc: “device:0、name:GeForce GTX 1080 Ti、pcibus ID:0000:01:00.0、calculation function:6.1”]

--

--

--

The member of LSC Corp.

Recommended from Medium

Kidney Disease Prediction Using Machine Learning

AutoRecs — Part 10

XGBoost: Extreme Gradient Boosting — All you need to know

Simplified MLOps for Kubeflow with Kfops

Text & Face Recognition using Java & Machine Learning

Democratizing strategies for State-of-the-Art (SoTA) in AI

[EasyPeasyPyTorch] 01. Word Embedding

David Silver RL Course: Lecture 1 Notes

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Yutaka_kun

Yutaka_kun

Microbiology technician,Machine learning engineer(beginner)

More from Medium

Searching for lottery tickets inside large neural networks

GANs in Medical Image Analysis: Part 2

Review: Spectral normalization for GANs

On generalization capability of randomly initialized vs pre-trained weights