指定GPU运行

第一种:

CUDA_VISIBLE_DEVICES=1 python your_file.py

CUDA_VISIBLE_DEVICES=0,1 python your_file.py

CUDA_VISIBLE_DEVICES="0,1" python your_file.py

第二种在代码里指定:

import os

os.environ["CUDA_VISIBLE_DEVICES"] = "1"
os.environ["CUDA_VISIBLE_DEVICES"] = "0,1"
原文地址:https://www.cnblogs.com/Xycdada/p/13749447.html