【发布时间】:2019-11-18 17:55:01
【问题描述】:
我有 run_command_list.txt 每行限制一个命令:
time python3 train.py --dataroot ./datasets/maps --name maps_pix2pix --model pix2pix --direction AtoB --checkpoints_dir maps_pix2pix_a_to_b_bs_1 --batch_size 1 > bs_1.log
time python3 train.py --dataroot ./datasets/maps --name maps_pix2pix --model pix2pix --direction AtoB --checkpoints_dir maps_pix2pix_a_to_b_bs_2 --batch_size 2 > bs_2.log
time python3 train.py --dataroot ./datasets/maps --name maps_pix2pix --model pix2pix --direction AtoB --checkpoints_dir maps_pix2pix_a_to_b_bs_4 --batch_size 4 > bs_4.log
...
我想并行运行不超过 2 个作业,并且我想根据当前可用的 GPU 设置 CUDA_VISIBLE_DEVICES=0 或 CUDA_VISIBLE_DEVICES=1,我如何使用 parallel 或 xargs 执行此操作?
即类似cat run_command_list.txt | xargs -n 1 -P 2
【问题讨论】:
-
你如何确定哪个 GPU 可用?
标签: bash gpu xargs gnu-parallel