在linux系统ubuntu系统里安装的GPU的pytorch测试GPU时提示如下错误信息

/home/haiyc/miniconda3/lib/python3.13/site-packages/torch/cuda/__init__.py:174: UserWarning: CUDA initialization: CUDA driver initialization failed, you might not have a CUDA gpu. (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:109.)
  return torch._C._cuda_getDeviceCount() > 0
PyTorch CUDA状态: False
 

解决方法:

CUDA_DEVICE_ORDER="PCI_BUS_ID"

PYTORCH_NVML_BASED_CUDA_CHECK=1

CUDA_VISIBLE_DEVICES=0,1,2,3

python -c "import torch;print(torch.cuda.is_available());"

Logo

分享最新的 NVIDIA AI Software 资源以及活动/会议信息,精选收录AI相关技术内容,欢迎大家加入社区并参与讨论。

更多推荐