实验室服务器崩了好几次之后,CUDA突然用不了
import torch
torch.cuda.is_available()
通过上面的命令,一直都是False
,并伴随下面的报错信息
UserWarning: CUDA initialization: CUDA unknown error - this may be due to an incorrectly set up
environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the
available devices to be zero. (Triggered internally at …/c10/cuda/CUDAFunctions.cpp:109.)
return torch._C._cuda_getDeviceCount() > 0
重装pytorch和CUDA也无济于事,后面查到是因为ubuntu在suspend出现的问题,重启服务器物理机就可以了。
重启,问题解决。