Search code examples
pythonpytorchcudapython-poetry

CUDA 11.6 not compatible with PyTorch 1.12.1


The PyTorch website says that PyTorch 1.12.1 is compatible with CUDA 11.6, but I get the following error:

NVIDIA GeForce RTX 3060 Laptop GPU with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.

I am using a laptop RTX 3060 and Poetry as my package manager in Python.

enter image description here

>>> nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_Mar__8_18:18:20_PST_2022
Cuda compilation tools, release 11.6, V11.6.124
Build cuda_11.6.r11.6/compiler.31057947_0
>>> poetry show
certifi               2022.9.24 Python package for providing Mozilla's CA Bundle.
charset-normalizer    2.1.1     The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet.
idna                  3.4       Internationalized Domain Names in Applications (IDNA)
numpy                 1.23.4    NumPy is the fundamental package for array computing with Python.
opencv-contrib-python 4.6.0.66  Wrapper package for OpenCV python bindings.
opencv-python         4.6.0.66  Wrapper package for OpenCV python bindings.
pillow                9.2.0     Python Imaging Library (Fork)
requests              2.28.1    Python HTTP for Humans.
torch                 1.12.1    Tensors and Dynamic neural networks in Python with strong GPU acceleration
torchvision           0.13.1    image and video datasets and models for torch deep learning
typing-extensions     4.4.0     Backported and Experimental Type Hints for Python 3.7+
urllib3               1.26.12   HTTP library with thread-safe connection pooling, file post, and more.

What am I missing here? Is this a PyTorch <> CUDA issue or a CUDA <> GPU issue?


Solution

  • NVIDIA GeForce RTX 3060 Laptop GPU with CUDA capability sm_86 is not compatible with the current PyTorch installation. The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.

    The build of PyTorch which you have installed doesn't have binary support for your GPU. This is because whoever built the PyTorch you are using chose to build it like that. This isn't a question of CUDA versions or PyTorch versions. It just that many frameworks are built with a limited range of binary architectures in order to keep the size of the packages they distribute small.

    NVIDIA provide a method to support forward compatible architectures running older code through JIT recompilation at runtime. Unfortunately the standard PyTorch build system doesn't use it in order to save space in their build distributions, so that cannot help you in this situation.

    Your only solution is to either source another build with the appropriate binary support for your GPU included.