in activemri/experimental/cvpr19_models/options/base_options.py [0:0]
def parse(self, silent=True):
opt = self.gather_options()
# set gpu ids
str_ids = opt.gpu_ids.split(",")
opt.gpu_ids = []
# for str_id in str_ids:
for str_id in range(len(str_ids)):
id = int(str_id)
if id >= 0:
opt.gpu_ids.append(id)
if len(opt.gpu_ids) > 0:
torch.cuda.set_device(opt.gpu_ids[0])
opt.batchSize *= len(opt.gpu_ids)
print(
f"Use multiple GPUs, batchSize are increased by {len(opt.gpu_ids)} "
f"times to {opt.batchSize}"
)
if not silent:
self.print_options(opt)
return opt