1.创建一个新的模块(名为 pel)
conda create -n pel python=3.8 -y
conda activate pel
2.下载cuda11.8 另外搭配torch2.0.0版本
pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 torchaudio==2.0.1+cu118 -f https://download.pytorch.org/whl/torch_stable.html
3.测试(适配?)没有报错就行
import torch
print("PyTorch version:", torch.__version__)
print("CUDA available:", torch.cuda.is_available())
print("CUDA version:", torch.version.cuda)
print("cuDNN version:", torch.backends.cudnn.version())
import torch
# 检查 CUDA 是否可用
print("CUDA Available:", torch.cuda.is_available())
# 检查当前 GPU 的设备 ID
print("Current GPU:", torch.cuda.current_device())
# 打印 GPU 名称
print("GPU Name:", torch.cuda.get_device_name(torch.cuda.current_device()))