简体   繁体   English

sbatch --array 命令中的值与作业任务 ID 不同,它们每个都在不同的作业中运行

[英]Values in a sbatch --array command different from the job task IDs, each of them run in a different job

Is it possible to feed a script some values in the sbatch --array command line different from the job task IDs , and each of them be run in a different job?是否可以在 sbatch --array 命令行中为脚本提供一些与作业任务 ID 不同的值,并且每个值都在不同的作业中运行?

sbatch --array=1-2 script.sh 4 6

with script.sh being使用 script.sh

#!/bin/bash

VALUE=$"$SLURM_ARRAY_TASK_ID"

echo $VALUE

then, after they have run,然后,在他们跑完之后,

cat slurm*

returns返回

1
2

But I wonder whether it is possible to make the 2 jobs return instead the "4 6" values fed in the sbatch --array command, one apiece:但我想知道是否有可能让 2 个作业返回 sbatch --array 命令中输入的“4 6”值,一个一个:

4
6

You can use indirect variable expansion :您可以使用间接变量扩展

#!/bin/bash

VALUE=${!SLURM_ARRAY_TASK_ID}

echo $VALUE

Note the exclamation mark.注意感叹号。 After

sbatch --array=1-2 script.sh 4 6

you should have two output files, one with 4 and one with 6 .你应该有两个输出文件,一个是4 ,一个是6

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM