>>> import torch
>>> print(torch.cuda.device_count())
2>>> print(torch.cuda.is_available())
/data/conda_env/ft/lib/python3.8/site-packages/torch/cuda/__init__.py:138: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 11040). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at ../c10/cuda/CUDAFunctions.cpp:108.)
return torch._C._cuda_getDeviceCount() > 0
False
上面的信息说明:
GPU 有两块:2;
但是:NVIDIA driver is too old,需要升级驱动。