Estaba tratando de usar mi código actual con una GPU A100 pero aparece este error:
---> backend='nccl' /home/miranda9/miniconda3/envs/metalearningpy1.7.1c10.2/lib/python3.8/site-packages/torch/cuda/__init__.py:104: UserWarning: A100-SXM4-40GB with CUDA capability sm_80 is not compatible with the current PyTorch installation. The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_61 sm_70 sm_75 compute_37. If you want to use the A100-SXM4-40GB GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/lo cual es bastante confuso porque apunta a la instalación habitual de pytorch pero no me dice qué combinación de versión de pytorch + versión de cuda usar para mi hardware específico (A100). ¿Cuál es la forma correcta de instalar pytorch para un A100?
Estas son algunas versiones que he probado:
# conda install -y pytorch==1.8.0 torchvision cudatoolkit=10.2 -c pytorch # conda install -y pytorch torchvision cudatoolkit=10.2 -c pytorch #conda install -y pytorch==1.7.1 torchvision torchaudio cudatoolkit=10.2 -c pytorch -c conda-forge # conda install -y pytorch==1.6.0 torchvision cudatoolkit=10.2 -c pytorch #conda install -y pytorch==1.7.1 torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge # conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch # conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge # conda install -y pytorch torchvision cudatoolkit=9.2 -c pytorch # For Nano, CC # conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forgetenga en cuenta que esto puede ser sutil porque he tenido este error con esta versión de máquina + pytorch en el pasado:
¿Cómo resolver el famoso error "cuda no controlado, error NCCL versión 2.7.8"?
Tengo un A100 y he tenido éxito con
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c nvidiaQue ahora también se recomienda en el sitio de pytorch
Yo tuve el mismo problema. Debe instalar CUDA 11.0 en lugar de 10.2 y reinstalar PyTorch para esta versión de CUDA.
Para mí esto es lo que funcionó:
conda update conda pip install --upgrade pip pip3 install --upgrade pip conda create -n meta_learning_a100 python=3.9 conda activate meta_learning_a100 pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.htmlluego lo probé, pedí el dispositivo e hice una matriz de multiplicación, no hubo errores, funcionó:
(meta_learning_a100) [miranda9@hal-dgx diversity-for-predictive-success-of-meta-learning]$ python -c "import uutils; uutils.torch_uu.gpu_test()" device name: A100-SXM4-40GB Success, no Cuda errors means it worked see: out=tensor([[ 0.5877], [-3.0269]], device='cuda:0')codigo pytorch gpu:
def gpu_test(): """ python -c "import uutils; uutils.torch_uu.gpu_test()" """ from torch import Tensor print(f'device name: {device_name()}') x: Tensor = torch.randn(2, 4).cuda() y: Tensor = torch.randn(4, 1).cuda() out: Tensor = (x @ y) assert out.size() == torch.Size([2, 1]) print(f'Success, no Cuda errors means it worked see:\n{out=}')A partir del 17 de julio de 2022 pip3 install torch==1.12.0+cu116 torchvision==0.13.0+cu116 torchaudio==0.12.0+cu116 cuda-python==11.6.1 -f https://download.pytorch.org /whl/torch_stable.html funciona. También creó un Dockerfile para ello https://github.com/omerfsen/gpu-stress-test/blob/main/Dockerfile