How to use the GPU in your machine for Building Machine Learning Applications - Windows

You can use Tensor Flow Python machine learning framework to develop your machine learning models.


In order to verify your system has a CUDA  capable GPU - check the Display adapters section in Device Manager
  • Open Run window from the start  menu
  • Type 

control /name Microsoft.DeviceManager





you can find the specification for the above GPU here
Install CUDA® Toolkit

TensorFlow supports CUDA® 11.2 (TensorFlow >= 2.5.0)

Download & Install CUDA Toolkit 11.4.1

Operating System - windows

Architecture - x86_4

Version -10

Installer Type - exe(network)

https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exe_network

The CUDA Toolkit 

  • installs the CUDA driver and tools needed to create
  • build and run a CUDA application as well as libraries, header files, CUDA samples source code, and other resources.

Rebuild &Run the CUDA sample code below - For the systems installed Visual Studio 2019

C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.4\1_Utilities\deviceQuery\deviceQuery_vs2019.sln

Add the following line to the deviceQuery.cpp to keep the console

std::cin.get();

Resolve the following Build Error



Just copy all files from this path (depends on the path you installed CUDA in)

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\visual_studio_integration\MSBuildExtensions

to this path:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\BuildCustomizations


Install CUDNN 

To download CUDNN 

NVIDIA Developer Program Membership Required

https://developer.nvidia.com/rdp/cudnn-download


Create a new folder called tools in C: drive

copy cuda folder to it


Set the following paths from the environment variables

Control Panel - > System and Security 





C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\bin

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\extras\CUPTI\lib64

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.4\include

C:\tools\cuda\bin

cudnn64_8.dll is needed for tensorflow to identify the gpus in the system

Install Pycharm

create an virtual environment

select a python interpreter


Tensor Flow  pip package includes GPU support for CUDA enabled cards.

pip install tensorflow

import tensorflow as tf
print(tf.__version__)
print(tf.config.list_physical_devices('GPU'))
print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
print(tf.config.list_physical_devices('CPU'))
print("Num CPUs Available: ", len(tf.config.list_physical_devices('CPU')))

output




For Personalized Virtual Machine Learning Sessions Booking

Contact

Sarala Kumarage (MSc - IT ,Bsc -IT)

Machine Learning Engineer

https://www.linkedin.com/in/sarala-kumarage/











Comments

Popular posts from this blog