Slurm作业数组与Stata

huangapple go评论47阅读模式
英文:

Slurm job arrays with Stata

问题

我想使用Slurm作业数组并行运行一些Stata代码。

我知道可以运行100个作业,如下所示:

#!/bin/bash
#SBATCH --array=1-100

module load stata
stata my_code.do $SLURM_ARRAY_TASK_ID

现在每个代码都需要读取一个带有SLURM_ARRAY_TASK_ID的文件。

也就是说,在my_code.do中有一条指令:

use "my_data.dta" in `j', clear

其中j是Slurm数组任务ID。我应该如何做这个?

英文:

I want to run some Stata code in parallel using slurm job arrays.

I know that I can run 100 jobs doing:

#!/bin/bash
#SBATCH --array=1-100

module load stata
stata my_code.do $SLURM_ARRAY_TASK_ID

Now each code will have to read a file that takes the slurm_array_task_id.

I.e. inside the my_code.do there is an instruction that makes:

use "my_data.dta" in `j', clear

where `j' is the slurm array task id.
How can I do this?

答案1

得分: 2

你可以使用`1'来访问传递给你的 do 文件的第一个参数。所以我认为在你的代码示例中,你可以这样写:

use "my_data.dta" in `1', clear

更多信息请查看这里

英文:

You can access the first argument passed to your do-file with `1'. So I think in your code example you could just put:

use "my_data.dta" in `1', clear

More info here.

huangapple
  • 本文由 发表于 2023年7月14日 06:14:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76683574.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定