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.
Your machine should be a GPU enabled device - NVIDIA GPU card with CUDA® architectures 3.5, 5.0, 6.0, 7.0, 7.5, 8.0 and higher than 8.0
- Open Run window from the start menu
- Type
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)
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
Pip package
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
Post a Comment