Three major frameworks (Paddle\Pytorch\Tensorflow-GPU) configuration

One, cuda, cudnn installation

1. View the highest version supported by this machine

Open the NVIDIA Control Panel - click System Information - Components to see the highest version currently supported.
insert image description here

2. Installation

CUDA download
cudnn download

If you don't want to download, you can see the link I have downloaded
: https://pan.baidu.com/s/1rHr7Af_0Hu98Q75KDlwGjA?pwd=4869
Extraction code: 4869

Here we take cuda11.6 as an example:

aaa
The cuda installation can be directly defaulted, there is no need to set different paths, and setting the same path will not affect each other.
Multiple cuda versions can be installed on one computer, and different versions will not be overwritten.
To switch between different versions of cuda, just put the path of the environment variable in front.

cudnn is not an installer, but a C++ runtime library, including header files, lib files, and dll files. After the download is complete, you need to copy the corresponding files to the cuda directory.
Unzip the cudnn compressed file, you will get the following files:
aaa

It is to select the files in the cudaa folder and copy them to the corresponding cuda folder (the Lib file needs to be copied to x64)! ! !
insert image description here
aaa

Open the system environment variables, you can see that there are two more CUDA_PATH and CUDA_PATH_V11_6 in the system variables, these two variables are automatically added after installing cuda.
insert aaaa image description here
Then create the following environment variables:
aac
Generally, the newly added ones are at the bottom, so you need to click "Move Up" repeatedly to move these four lines to the top.

3. Test

You're done! Test it;
open cmd and type nvcc -V;
if the installation is successful and the environment variables are configured, the cuda version information will be output.
( If you want to change the color and background of cmd, you can refer to it )
aca

二、Paddle—GPU

It is recommended to create , as follows:
insert image description here

Paddle installation
aacc

python -m pip install paddlepaddle-gpu==2.3.2.post116 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html

Generally also need paddlex:

pip install paddlex -i https://mirror.baidu.com/pypi/simple 

test:

import paddle
print(paddle.utils.run_check())

3. Pytorch—GPU

Pytorch installation
accc

conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia

test:

import torch
print(torch.cuda.is_available())

四、TensorFlow—GPU

Domestic use of the pip command to download and install often encounters situations where the download speed is very slow, or even the connection is disconnected, and the response times out, which leads to the installation failure. At this time, we can choose the domestic image configuration pip source, just add "-i source address" after the "pip install" command.
Now we use the domestic Tsinghua source to install the latest version of TensorFlow.

pip install -U tensorflow-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple

test:

import tensorflow as tf
# print(tf.test.is_gpu_available())
print('Num GPUs Available:',len(tf.config.list_physical_devices('GPU')))
print(tf.config.list_physical_devices('GPU'))

output:
acccc

Daily "Big Pie":
The meaning of life is always to expand rather than stick to it Never mind who I am today I want to be a better self

Guess you like

Origin blog.csdn.net/weixin_52051554/article/details/127704662