指定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"
posted @ 2020-09-29 14:27  Xycdada  阅读(497)  评论(0编辑  收藏  举报