Some problems in pipenv and torch and cuda

As Chinese input app doesn’t installed in my computer, so I write this passage in English.
Some logs encountered related to the incompatibility between torch and CUDA :

Log1:

/home/supercomputer/Downloads/Dr.VOT/.venv/lib/python3.7/site-packages/torch/cuda/__init__.py:125: UserWarning: 
NVIDIA GeForce RTX 3090 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 sm_75.
If you want to use the NVIDIA GeForce RTX 3090 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

Log2:

RuntimeError: CUDA error: no kernel image is available for execution on the device

Environment settings:

  1. The model environment is pipenv
  2. python: 3.7
  3. cuda 11.6
  4. ubuntu 20.4
  5. GPU: RTX 3090

Reason:
the cuda version is lower than torch version. So we need to upgrade cuda version.
I tried many times to upgrade torch version. from 1.2.0 to 1.8.0. Unfortunately, I cannot works.

Solutions:

I found that the pipenv uses the cuda in python.
so I install python in ubuntu and the cudatookit in python.

1: install python in ubuntu

sudo apt install python3.7

2: pip install torch

 pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html

then it works

inspiration:

nvidia-smi : cuda version: 11.6
在这里插入图片描述print(torch.version.cuda) : cuda version: 10.2
在这里插入图片描述so, install cudatoolkit: print(torch.version.cuda) : cuda version: 11.1
在这里插入图片描述Then it works.
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值