术语"工作","任务"和"步骤"如何相互关联?

kjo*_*kjo 7 slurm

SLURM文档中使用的术语"作业","任务"和"步骤"如何相互关联?

AFAICT,一个工作可能包含多个任务,并且它由多个步骤组成,但是,假设这是真的,我仍然不清楚任务和步骤是如何相关的.

查看显示作业/任务/步骤完全复杂性的示例会很有帮助.

dam*_*ois 14

一个工作由一个或多个步骤,每个由一个或多个任务的每一个使用一个或多个CPU.

乔布斯通常与所创建的sbatch命令,与创建步骤srun的命令中,要求任务(作业级或步级)与--ntasks和CPU请求每个任务使用--cpus-per-task.请注意,提交的作业sbatch有一个隐含的步骤; Bash脚本本身.

假设假设的工作:

#SBATCH --nodes 8
#SBATCH --tasks-per-node 8
# The job requests 64 CPUs, on 8 nodes.    

# First step, with a sub-allocation of 8 tasks (one per node) to create a tmp dir. 
# No need for more than one task per node, but it has to run on every node
srun --nodes 8 --tasks 8 mkdir -p /tmp/$USER/$SLURM_JOBID

# Second step with the full allocation (64 tasks) to run an MPI 
# program on some data to produce some output.
srun process.mpi <input.dat >output.txt

# Third step with a sub allocation of 48 tasks (because for instance 
# that program does not scale as well) to post-process the output and 
# extract meaningful information
srun --ntasks 48 --nodes 6 --exclusive postprocess.mpi <output.txt >result.txt &

# Four step with a sub-allocation on a single node (because maybe 
# it is a multithreaded program that cannot use CPUs on distinct nodes)    
# to compress the raw output. This step runs at the same time as 
# the previous one thanks to the ampersand `&` 
OMP_NUM_THREAD=12 srun --ntasks 12 --nodes 1 --exclusive compress output.txt &

wait
Run Code Online (Sandbox Code Playgroud)

创建了四个步骤,因此该作业的会计信息将有5行; 每步一个加一个Bash脚本本身.

  • 还有一个问题:为什么最后要“wait”?如果“wait”之后有后续步骤需要所有前面的步骤完成才能继续,我可以理解“wait”,但如果它是脚本中的最后一个命令,我不明白它的目的。换句话说,如果省略最后的 wait 命令会发生什么? (4认同)
  • `wait`命令用于确保在作业被认为完成和终止之前,以'&`符号(步骤3和4)发送到后台的`srun`命令都已完成.如果不存在,脚本将在步骤之前终止; 这项工作将由Slurm完成,所有仍在运行的步骤将被Slurm杀死. (3认同)
  • 所有任务不一定都做完全相同的事情。在 MPI 程序中,任务根据其“等级”执行不同的操作。通常,编写最终输出只是等级 0 的任务(即“主任务”)的职责。 (2认同)
  • “任务”与“进程”相同吗? (2认同)
  • @nn0p 简短的回答是肯定的。长答案是,一个任务是一个 Slurm 分配单元,一个进程是一个运行 Linux 的进程;进程由提交脚本中的命令创建,并映射到与分配给作业的任务相关的 CPU。 (2认同)