深度学习实验连续不断运行操作

1、使用bash脚本

😜 👍👌

1.1 1️⃣ nohup + nohup方式1️⃣

#!/bin/bash
for num in 1 2 3 4 5
do
    nohup python test.py --num $num >test{$num}.log &
    wait
done
nohup bash start.sh

这样的方式可以啊。这样会让里面的Python命令一条接着一条的执行,上一条执行完了,下一条才会开始执行。

1.3 ❌ 👎 仅wait方式 或者 仅&方式 2>&1 &方式 ,

#!/bin/bash
nohup python main.py --dataset yelp2018 --lr 0.001 --batch_size 2048 --gpu_id 2  >yelp_dim_topk0.1.log 
wait

nohup python main.py --dataset amazon --lr 0.001 --batch_size 2048 --gpu_id 2  >amazon_dim_topk0.1.log &
nohup python main.py --dataset yelp2018 --lr 0.001 --batch_size 2048 --gpu_id 2  >yelp_dim_topk0.1.log 2>&1 &
nohup python main.py --dataset amazon --lr 0.001 --batch_size 2048 --gpu_id 2  >amazon_dim_topk0.1.log 2>&1 &

这样的方式不行。这样会一下子把所有的进程都挂上去,让他们同时执行,而不是一条接着一条执行。

1.4 & wait方式

#!/bin/bash
nohup python main.py --dataset yelp2018 --lr 0.001 --batch_size 2048 --gpu_id 2  >yelp_dim_topk0.1.log &
wait

nohup python main.py --dataset amazon --lr 0.001 --batch_size 2048 --gpu_id 2  >amazon_dim_topk0.1.log &
wait

  • 9
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值