使用srun设置sbatch环境变量

时间:2021-09-07 11:25:17

In a blog post by Pierre Lindenbaum, srun is called within a Makefile to run jobs. I rely on this technique, but it makes no use of sbatch at all, so I am missing the chance to set sbatch-like environment variables. Where can I put the following so SLURM knows what to do?

在Pierre Lindenbaum的博客文章中,srun在Makefile中被调用来运行作业。我依赖这项技术,但是它根本不使用sbatch,所以我错过了设置像sbatch一样的环境变量的机会。我可以把下面的东西放在哪里,让思玛知道该怎么做?

#SBATCH -J testing
#SBATCH -A account
#SBATCH --time=1:00:00
#SBATCH --cpus-per-task=1
#SBATCH --begin=now
#SBATCH --mem=1G
#SBATCH -C sb

1 个解决方案

#1


2  

The srun command accepts nearly all of the sbatch parameters (with the notable exception of --array). In the referred blog post, these arguments are set at the line:

srun命令接受几乎所有的sbatch参数(值得注意的例外是——array)。在引用的博客文章中,这些参数设置在一行:

.SHELLFLAGS= -N1 -n1  bash -c 

so you would write

所以你会写

.SHELLFLAGS= -J testing  -A account  --time=1:00:00 --cpus-per-task --begin=now --mem=1G -C sb bash -c 

Note that if you specify --cpu-per-task=1, and you keep the default of one tasks, it probably means that nodes are shared in your setup ; in that case, --mem-per-cpu=1G makes more sense than --mem=1G

注意,如果您指定——cpu-per-task=1,并且保留一个任务的默认值,这可能意味着在您的设置*享节点;在这种情况下,-每cpu内存=1G比-mem=1G更有意义

#1


2  

The srun command accepts nearly all of the sbatch parameters (with the notable exception of --array). In the referred blog post, these arguments are set at the line:

srun命令接受几乎所有的sbatch参数(值得注意的例外是——array)。在引用的博客文章中,这些参数设置在一行:

.SHELLFLAGS= -N1 -n1  bash -c 

so you would write

所以你会写

.SHELLFLAGS= -J testing  -A account  --time=1:00:00 --cpus-per-task --begin=now --mem=1G -C sb bash -c 

Note that if you specify --cpu-per-task=1, and you keep the default of one tasks, it probably means that nodes are shared in your setup ; in that case, --mem-per-cpu=1G makes more sense than --mem=1G

注意,如果您指定——cpu-per-task=1,并且保留一个任务的默认值,这可能意味着在您的设置*享节点;在这种情况下,-每cpu内存=1G比-mem=1G更有意义