简体   繁体   English

使用 Linux bash 脚本在 HPCC 上同时运行多个作业

[英]Using Linux bash scripting to run multiple jobs simultaneously on HPCC

I want to run 20 jobs simultaneously on HPCC using a bash script.我想使用 bash 脚本在 HPCC 上同时运行 20 个作业。 I wrote the code below, but this code cannot run the jobs simultaneously.我写了下面的代码,但是这段代码不能同时运行这些作业。 Can everyone help me out with how can I modify this code to do that?每个人都可以帮我解决如何修改此代码来做到这一点吗?

cd $SLURM_SUBMIT_DIR

for((i=0;i<20;i++))
do
    cd $i
    #running a code
    cd ../
    
done

~ ~
~ ~

Put jobs to background and wait for completion?将作业置于后台并等待完成?

declare -a pids

for ((i=0;i<20;i++))
do
    (
        cd $i
        #running a code
    ) &
    pids+=($!)
done

wait ${pids[*]}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用单独的线程运行多个 shell 作业并在同时执行每个作业后等待每个作业完成? - How to run multiple shell jobs using separate threads and wait for each to finish after executing each simultaneously? 在Python中同时运行多个bash命令 - Run multiple bash commands simultaneously in Python 如何在linux上的cron作业中安排bash文件 - How to schedule a bash file in cron jobs on linux RabbitMQ:防止作业在两个不同的工人上同时运行 - RabbitMQ: Preventing jobs to run simultaneously on two different workers Cron作业是否同时在Google App Engine中运行? - Do cron jobs run simultaneously in google app engine? 使用 Python Schedule 同时运行多个调度作业 - Run multiple schedule jobs at same time using Python Schedule 如何同时运行多个进程? - How to run multiple process simultaneously? 在 linux 中编写脚本 - Scripting in linux 使用Python子进程运行SLURM脚本以将多个长作业提交到队列中,并在继续python脚本之前等待作业完成 - Using Python subprocess to run SLURM script to submit multiple long jobs to queue and waiting for jobs to finish before continuing python script 从 PHP 同时运行多个 Python 脚本 - Run multiple Python scripts simultaneously from PHP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM