[Avoid pits] paddlepaddle-gpu installation error: The GPU architecture in your current machine is Pascal, which is not

Version and error information

The complete system, graphics card and other environments are as follows:

  • System: win10
  • Graphics card: GeForce GTX 1060 6GB
  • python 3.7.16
  • tail:tail 11.2.0
  • hidden:hidden 8.2.1
  • paddlepaddle: pip installation version: gpu==2.5.1.post112

The installation instructions are:

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

After the installation is successful, the test results are as follows:

(base) D:\Downloads>python -c "import paddle; paddle.utils.run_check()"
Running verify PaddlePaddle program ...
I0831 10:35:55.205960  7352 interpretercore.cc:237] New Executor is Running.
W0831 10:35:55.205960  7352 gpu_resources.cc:96] The GPU architecture in your current machine is Pascal, which is not compatible with Paddle installation with arch: 70 75 80 86 , it is recommended to install the corresponding wheel package according to the installation information on the official Paddle website.
W0831 10:35:55.206962  7352 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 12.2, Runtime API Version: 11.2
W0831 10:35:55.221961  7352 gpu_resources.cc:149] device: 0, cuDNN Version: 8.2.
I0831 10:35:56.037954  7352 interpreter_util.cc:518] Standalone Executor is Used.
PaddlePaddle works well on 1 GPU.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.

Heed this warning message:

The GPU architecture in your current machine is Pascal, which is not compatible with Paddle installation with arch: 70 75 80 86

I thought it was just a warning message and ignored it. But when I wrote the code specifically, I found a very serious problem! ! !

(w) D:\Downloads>python
Python 3.7.16 (default, Jan 17 2023, 16:06:28) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
>>> paddle.ones([3,3])
W0831 10:13:48.890246 16284 gpu_resources.cc:96] The GPU architecture in your current machine is Pascal, which is not compatible with Paddle installation with arch: 70 75 80 86 , it is recommended to install the corresponding wheel package according to the installation information on the official Paddle website.
W0831 10:13:48.891247 16284 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 12.2, Runtime API Version: 11.2
W0831 10:13:48.901255 16284 gpu_resources.cc:149] device: 0, cuDNN Version: 8.2.
Tensor(shape=[3, 3], dtype=float32, place=Place(gpu:0), stop_gradient=True,
       [[0., 0., 0.],
        [0., 0., 0.],
        [0., 0., 0.]])
>>> paddle.ones([3,3]) *3
Tensor(shape=[3, 3], dtype=float32, place=Place(gpu:0), stop_gradient=True,
       [[0., 0., 0.],
        [0., 0., 0.],
        [0., 0., 0.]])

paddle.ones([3,3])The returned result is 0! ! ! ! I was immediately shocked, and the same was true for other codes tested later, which shows that the installation indeed failed!
Later, I installed the CPU version of paddle and found that it was normal, indicating that the GPU version was indeed not installed successfully! Here I compared torch and tensorflow. The GPUs of these two frameworks can be used! ! So the paddle is really hammered...

2.4.1.post112 version installation (×)

Keep trying, I tried to install paddle with a lower version, the first one I tried was 2.4.1.post112.
I downloaded the 2.4.1.post112 version of the whl file from ( https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html ), and then installed:

D:\Downloads>pip install paddlepaddle_gpu-2.4.1.post112-cp37-cp37m-win_amd64.whl -i https://pypi.tuna.tsinghua.edu.cn/simple/

After the installation is complete, the test results are as follows:

(w) D:\Downloads>python -c "import paddle; paddle.utils.run_check()"
Running verify PaddlePaddle program ...
W0831 10:04:52.412166 12988 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 12.2, Runtime API Version: 11.2
W0831 10:04:52.426165 12988 gpu_resources.cc:91] device: 0, cuDNN Version: 8.2.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "D:\anaconda3\envs\w\lib\site-packages\paddle\utils\install_check.py", line 270, in run_check
    _run_dygraph_single(use_cuda, use_xpu, use_npu)
  File "D:\anaconda3\envs\w\lib\site-packages\paddle\utils\install_check.py", line 136, in _run_dygraph_single
    linear_out = linear(input_tensor)
  File "D:\anaconda3\envs\w\lib\site-packages\paddle\fluid\dygraph\layers.py", line 948, in __call__
    return self.forward(*inputs, **kwargs)
  File "D:\anaconda3\envs\w\lib\site-packages\paddle\nn\layer\common.py", line 176, in forward
    x=input, weight=self.weight, bias=self.bias, name=self.name
  File "D:\anaconda3\envs\w\lib\site-packages\paddle\nn\functional\common.py", line 1882, in linear
    return _C_ops.linear(x, weight, bias)
OSError: Invalid enum backend type `63`.
  [..\paddle/phi/common/backend.h:140]

New error reported: OSError: Invalid enum backend type 63.

develop version installation (×)

I found the same error in the github issue ( https://github.com/PaddlePaddle/Paddle/issues/49964
image.png
), and found a solution given by an expert: the installation instructions are as follows:

python -m pip install paddlepaddle-gpu==0.0.0.post112 -f https://www.paddlepaddle.org.cn/whl/windows/gpu/develop.html

After the installation is successful, the test results are as follows, and an error is still reported (this is the initial error):

(w) D:\Downloads>python -c "import paddle; paddle.utils.run_check()"
Running verify PaddlePaddle program ...
I0831 10:13:26.942690 11972 program_interpreter.cc:175] New Executor is Running.
W0831 10:13:26.943701 11972 gpu_resources.cc:96] The GPU architecture in your current machine is Pascal, which is not compatible with Paddle installation with arch: 70 75 80 86 , it is recommended to install the corresponding wheel package according to the installation information on the official Paddle website.
W0831 10:13:26.943701 11972 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 12.2, Runtime API Version: 11.2
W0831 10:13:26.956668 11972 gpu_resources.cc:149] device: 0, cuDNN Version: 8.2.
I0831 10:13:27.715677 11972 interpreter_util.cc:602] Standalone Executor is Used.
PaddlePaddle works well on 1 GPU.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.

ERROR:The GPU architecture in your current machine is Pascal, which is not compatible with Paddle installation with arch: 70 75 80 86

It can be found that the results of the GPU version of paddle and ones function are all 0. It is obvious that the installation failed!

(w) D:\Downloads>python
Python 3.7.16 (default, Jan 17 2023, 16:06:28) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import paddle
>>> paddle.ones([3,3])
W0831 10:13:48.890246 16284 gpu_resources.cc:96] The GPU architecture in your current machine is Pascal, which is not compatible with Paddle installation with arch: 70 75 80 86 , it is recommended to install the corresponding wheel package according to the installation information on the official Paddle website.
W0831 10:13:48.891247 16284 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 12.2, Runtime API Version: 11.2
W0831 10:13:48.901255 16284 gpu_resources.cc:149] device: 0, cuDNN Version: 8.2.
Tensor(shape=[3, 3], dtype=float32, place=Place(gpu:0), stop_gradient=True,
       [[0., 0., 0.],
        [0., 0., 0.],
        [0., 0., 0.]])
>>> paddle.ones([3,3]) *3
Tensor(shape=[3, 3], dtype=float32, place=Place(gpu:0), stop_gradient=True,
       [[0., 0., 0.],
        [0., 0., 0.],
        [0., 0., 0.]])

2.3.2.post112 version installation

Continue to try the previous version, download the 2.3.2.post112 version of the whl file from the ( https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html
) web page, and then install it: Installation instructions as follows:

pip install paddlepaddle_gpu-2.3.2.post112-cp37-cp37m-win_amd64.whl

The versions of all packages in the environment are as follows:

(w) D:\Downloads>conda list
# packages in environment at D:\anaconda3\envs\w:
#
# Name                    Version                   Build  Channel
anyio                     3.7.1                    pypi_0    pypi
astor                     0.8.1                    pypi_0    pypi
ca-certificates           2023.05.30           haa95532_0    defaults
certifi                   2022.12.7        py37haa95532_0    defaults
charset-normalizer        3.2.0                    pypi_0    pypi
decorator                 5.1.1                    pypi_0    pypi
exceptiongroup            1.1.3                    pypi_0    pypi
h11                       0.14.0                   pypi_0    pypi
httpcore                  0.17.3                   pypi_0    pypi
httpx                     0.24.1                   pypi_0    pypi
idna                      3.4                      pypi_0    pypi
numpy                     1.21.6                   pypi_0    pypi
openssl                   1.1.1v               h2bbff1b_0    defaults
opt-einsum                3.3.0                    pypi_0    pypi
paddle-bfloat             0.1.7                    pypi_0    pypi
paddlepaddle-gpu          2.3.2.post112            pypi_0    pypi 
pillow                    9.5.0                    pypi_0    pypi
pip                       22.3.1           py37haa95532_0    defaults
protobuf                  3.20.0                   pypi_0    pypi
python                    3.7.16               h6244533_0    defaults
python-version            0.0.2                    pypi_0    pypi
requests                  2.31.0                   pypi_0    pypi
setuptools                65.6.3           py37haa95532_0    defaults
six                       1.16.0                   pypi_0    pypi
sniffio                   1.3.0                    pypi_0    pypi
sqlite                    3.41.2               h2bbff1b_0    defaults
typing-extensions         4.7.1                    pypi_0    pypi
urllib3                   2.0.4                    pypi_0    pypi
vc                        14.2                 h21ff451_1    defaults
vs2015_runtime            14.27.29016          h5e58377_2    defaults
wheel                     0.38.4           py37haa95532_0    defaults
wincertstore              0.2              py37haa95532_2    defaults

The test results are as follows:

(w) D:\Downloads>python -c "import paddle; paddle.utils.run_check()"
Running verify PaddlePaddle program ...
W0831 10:32:31.453032 12400 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 12.2, Runtime API Version: 11.2
W0831 10:32:31.468046 12400 gpu_resources.cc:91] device: 0, cuDNN Version: 8.2.
PaddlePaddle works well on 1 GPU.
PaddlePaddle works well on 1 GPUs.
PaddlePaddle is installed successfully! Let's start deep learning with PaddlePaddle now.

(w) D:\Downloads>python -c "import paddle; conv = paddle.nn.Conv1D(3, 1, 1); ts = paddle.to_tensor([[[1.1], [4.5], [1.4]]], dtype='float32'); print(conv(ts))
W0831 10:32:42.271850 13316 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 12.2, Runtime API Version: 11.2
W0831 10:32:42.285848 13316 gpu_resources.cc:91] device: 0, cuDNN Version: 8.2.
Tensor(shape=[1, 1, 1], dtype=float32, place=Place(gpu:0), stop_gradient=False,
       [[[1.36227489]]])

success! Still worried, I wrote another script to test it:

import paddle
from paddle.vision.transforms import Normalize

transform = Normalize(mean=[127.5], std=[127.5], data_format='CHW')
# 下载数据集并初始化 DataSet
train_dataset = paddle.vision.datasets.MNIST(mode='train', transform=transform)
test_dataset = paddle.vision.datasets.MNIST(mode='test', transform=transform)

# 模型组网并初始化网络
lenet = paddle.vision.models.LeNet(num_classes=10)
model = paddle.Model(lenet)

# 模型训练的配置准备,准备损失函数,优化器和评价指标
model.prepare(paddle.optimizer.Adam(parameters=model.parameters()),
              paddle.nn.CrossEntropyLoss(),
              paddle.metric.Accuracy())

# 模型训练
model.fit(train_dataset, epochs=5, batch_size=512, verbose=1)
# 模型评估
model.evaluate(test_dataset, batch_size=128, verbose=1)

The operation was successful, don’t worry! ! !

D:\anaconda3\envs\w\python.exe E:\Code\paddle_test\p.py 
W0831 10:51:13.105628 15956 gpu_resources.cc:61] Please NOTE: device: 0, GPU Compute Capability: 6.1, Driver API Version: 12.2, Runtime API Version: 11.2
W0831 10:51:13.128626 15956 gpu_resources.cc:91] device: 0, cuDNN Version: 8.2.
The loss value printed in the log is the current step, and the metric is the average value of previous steps.
Epoch 1/5
D:\anaconda3\envs\w\lib\site-packages\paddle\fluid\dygraph\amp\auto_cast.py:303: UserWarning: For float16, amp only support NVIDIA GPU with Compute Capability 7.0 or higher, current GPU is: NVIDIA GeForce GTX 1060 6GB, with Compute Capability: 6.1.
  % (paddle.device.cuda.get_device_name(), prop[0], prop[1]))
step 118/118 [==============================] - loss: 0.1857 - acc: 0.8243 - 90ms/step          
Epoch 2/5
step 118/118 [==============================] - loss: 0.1530 - acc: 0.9593 - 76ms/step          
Epoch 3/5
step 118/118 [==============================] - loss: 0.1555 - acc: 0.9718 - 74ms/step          
Epoch 4/5
step 118/118 [==============================] - loss: 0.0283 - acc: 0.9774 - 73ms/step          
Epoch 5/5
step 118/118 [==============================] - loss: 0.0505 - acc: 0.9806 - 73ms/step          
Eval begin...
step 79/79 [==============================] - loss: 0.0014 - acc: 0.9770 - 24ms/step          
Eval samples: 10000

Process finished with exit code 0

Summary of paddlepaddle-gpu installation method

paddlepaddle-gpu installation steps

  1. Install Anaconda. I won’t go into details here. Any version will do.
  2. Install CUDA and CUDNN. ( Emphasis : You must refer to the cuda and cudnn versions provided by paddle’s official website to install them!!! )

The paddlepaddle official website ( https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/install/pip/windows-pip.html ) describes the requirements for cuda and cudnn versions as follows:

  • If your computer does not have an NVIDIA® GPU, please install the CPU version of PaddlePaddle
  • If your computer has an NVIDIA® GPU, please ensure the following conditions are met and PaddlePaddle for GPU is installed
    • CUDA toolkit 10.2 cooperates with cuDNN v7.6.5. If you need to use PaddleTensorRT inference, you need to cooperate with TensorRT7.0.0.11
    • CUDA toolkit 11.2 works with cuDNN v8.2.1, if you need to use PaddleTensorRT reasoning, you need to work with TensorRT8.2.4.2
    • CUDA toolkit 11.6 works with cuDNN v8.4.0, if you want to use PaddleTensorRT reasoning, you need to work with TensorRT8.4.0.6
    • CUDA toolkit 11.7 works with cuDNN v8.4.1, if you want to use PaddleTensorRT reasoning, you need to work with TensorRT8.4.2.4
    • CUDA Toolkit 11.8 works with cuDNN v8.6.0, if you want to use PaddleTensorRT reasoning, you need to work with TensorRT8.5.1.7
    • CUDA Toolkit 12.0 works with cuDNN v8.9.1, if you want to use PaddleTensorRT reasoning, you need to work with TensorRT8.6.1.6
    • Hardware devices with GPU computing capabilities exceeding 3.5
    • Note: The currently officially released windows installation package only contains CUDA 10.2/11.2/11.6/11.7/11.8/12.0. If you need to use other CUDA versions, please compile it yourself from the source code. You can refer to NVIDIA official documentation to learn about the installation process and configuration methods of CUDA, CUDNN and TensorRT. Please see CUDA , cuDNN and TensorRT.

PS: According to the official website requirements, the versions I installed are: CUDA11.2 , cuDNN8.2.1 . In addition, for the installation tutorial of CUDA and CUDNN, you can read the blog written by this boss: https://blog.csdn.net/Vertira/article/details/125060383 , which is very detailed.

  1. Install paddle. Try to choose an older version here. For example, I finally chose version 2.3.2.post112 before the installation was successful. Refer to the official website for the installation method. It is not recommended to install the latest version of paddle. It is recommended to refer to the webpage ( https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html ) to download the whl file and install it offline, so that there are more versions to choose from.

write at the end

  1. The CUDA and CUDNN versions must correspond. Paddle has strict restrictions on driver versions! ! ! (Unable to complain)
  2. You should try the paddle-gpu version more often, and an older version is recommended (the CPU version of paddle will not be affected)
  3. I'm not sure if my version is suitable for you, but I can only try more versions. I feel that these two errors are problems with the paddle version. Please try more. Eh…

That’s it, I hope this article was helpful to you, thanks for reading.

Guess you like

Origin blog.csdn.net/qq_37085158/article/details/132598829