pytorch 指定gpu训练与多gpu并行训练
一.指定一个gpu训练的两种方法:
1.代码中指定
import torch
torch.cuda.set_device(id)
2.终端中指定
CUDA_VISIBLE_DEVICES=1 python 你的程序
其中id就是你的gpu编号
二.多gpu并行训练:
torch.nn.DataParallel(module, device_ids=None, output_de...
原创
2019-03-11 19:37:56 ·
4124 阅读 ·
0 评论