出现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该错误原因是linux系统从suspend状态开启后,联系不上gpu。
解决方案:
sudo apt-get install nvidia-modprobe
# 安装后,以后每次出现找不到gpu的错误,运行下面两条命令
sudo rmmod nvidia_uvm
sudo modprobe nvidia_uvm
如果运行后还是不行,只能重启了