第一种:
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"
第一种:
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"