目录
2. 使用cuda()和torch.cuda.set_device()
1. 使用CUDA_VISIBLE_DEVICES
使用CUDA_VISIBLE_DEVICES设置显卡https://blog.csdn.net/qq_43307074/article/details/127659967
2. 使用cuda()和torch.cuda.set_device()
torch.cuda常用指令https://blog.csdn.net/qq_43307074/article/details/127628498?spm=1001.2014.3001.5501方法1和方法2可以同时使用,比如在运行代码时使用:
CUDA_VISIBLE_DEVICES=2,3 python test.py