【记录】报错CUDA error: no kernel image is available for execution on the device

在安装pytorch的时候,如果服务器上有GPU,不能直接使用pip install pytorch==x.xconda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 -c pytorch,在这种情况下默认安装的是CPU版本的pytorch,因此如果使用GPU运行会出现CUDA版本不匹配的问题,即CUDA error: no kernel image is available for execution on the device。

按照官网的安装命令,如果需要安装GPU版本的pytorch,可以使用conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=11.0 -c pytorch指定cudatoolkit的版本安装。

另,官网中给出了不同版本的pytorch对应的torchvision、torch audio和CUDA版本,十分实用。

猜你喜欢

转载自blog.csdn.net/yaoyao_chen/article/details/131274751
今日推荐