Job Array Support

Overview

Job arrays offer a mechanism for submitting and managing collections of similar jobs quickly and easily; job arrays with millions of tasks can be submitted in milliseconds (subject to configured size limits).
ジョブ配列は、類似したジョブのコレクションをすばやく簡単に送信および管理するためのメカニズムを提供します。数百万のタスクを含むジョブ配列をミリ秒単位で送信できます(構成されたサイズ制限が適用されます)。
All jobs must have the same initial options (e.g. size, time limit, etc.), however it is possible to change some of these options after the job has begun execution using the scontrol command specifying the JobID of the array or individual ArrayJobID.
すべてのジョブには同じ初期オプション(サイズ、制限時間など)が必要ですが、配列のJobIDまたは個々のArrayJobIDを指定するscontrolコマンドを使用して、ジョブの実行開始後にこれらのオプションの一部を変更できます。

$ scontrol update job=101 ...
$ scontrol update job=101_1 ...

Job arrays are only supported for batch jobs and the array index values are specified using the --array or -a option of the sbatch command.
ジョブ配列はバッチジョブでのみサポートされており、配列のインデックス値はsbatchコマンドの--arrayまたは-aオプションを使用して指定されます。
The option argument can be specific array index values, a range of index values, and an optional step size as shown in the examples below.
オプション引数には、以下の例に示すように、特定の配列インデックス値、インデックス値の範囲、およびオプションのステップサイズを指定できます。
Note that the minimum index value is zero and the maximum value is a Slurm configuration parameter (MaxArraySize minus one).
最小インデックス値はゼロであり、最大値はSlurm構成パラメーター(MaxArraySizeから1を引いたもの)であることに注意してください。
Jobs which are part of a job array will have the environment variable SLURM_ARRAY_TASK_ID set to its array index value.
ジョブ配列の一部であるジョブでは、環境変数SLURM_ARRAY_TASK_IDがその配列インデックス値に設定されます。

# Submit a job array with index values between 0 and 31
$ sbatch --array=0-31    -N1 tmp

# Submit a job array with index values of 1, 3, 5 and 7
$ sbatch --array=1,3,5,7 -N1 tmp

# Submit a job array with index values between 1 and 7
# with a step size of 2 (i.e. 1, 3, 5 and 7)
$ sbatch --array=1-7:2   -N1 tmp

A maximum number of simultaneously running tasks from the job array may be specified using a "%" separator.
ジョブ配列から同時に実行されるタスクの最大数は、「%」区切り文字を使用して指定できます。
For example "--array=0-15%4" will limit the number of simultaneously running tasks from this job array to 4.
たとえば、「-array = 0-15%4」は、このジョブ配列から同時に実行されるタスクの数を4に制限します。

Job ID and Environment Variables

Job arrays will have two additional environment variable set.
ジョブ配列には、2つの追加の環境変数セットがあります。
SLURM_ARRAY_JOB_ID will be set to the first job ID of the array.
SLURM_ARRAY_JOB_IDは、アレイの最初のジョブIDに設定されます。
SLURM_ARRAY_TASK_ID will be set to the job array index value.
SLURM_ARRAY_TASK_IDは、ジョブ配列のインデックス値に設定されます。
SLURM_ARRAY_TASK_COUNT will be set to the number of tasks in the job array.
SLURM_ARRAY_TASK_COUNTは、ジョブ配列内のタスクの数に設定されます。
SLURM_ARRAY_TASK_MAX will be set to the highest job array index value.
SLURM_ARRAY_TASK_MAXは、最高のジョブ配列インデックス値に設定されます。
SLURM_ARRAY_TASK_MIN will be set to the lowest job array index value.
SLURM_ARRAY_TASK_MINは、最小のジョブ配列インデックス値に設定されます。
For example a job submission of this sort
たとえば、この種の求人情報

sbatch --array=1-3 -N1 tmp
will generate a job array containing three jobs.
3つのジョブを含むジョブ配列を生成します。
If the sbatch command responds
sbatchコマンドが応答した場合

Submitted batch job 36
then the environment variables will be set as follows:
次に、環境変数は次のように設定されます。


SLURM_JOB_ID=36
SLURM_ARRAY_JOB_ID=36
SLURM_ARRAY_TASK_ID=1
SLURM_ARRAY_TASK_COUNT=3
SLURM_ARRAY_TASK_MAX=3
SLURM_ARRAY_TASK_MIN=1

SLURM_JOB_ID=37
SLURM_ARRAY_JOB_ID=36
SLURM_ARRAY_TASK_ID=2
SLURM_ARRAY_TASK_COUNT=3
SLURM_ARRAY_TASK_MAX=3
SLURM_ARRAY_TASK_MIN=1

SLURM_JOB_ID=38
SLURM_ARRAY_JOB_ID=36
SLURM_ARRAY_TASK_ID=3
SLURM_ARRAY_TASK_COUNT=3
SLURM_ARRAY_TASK_MAX=3
SLURM_ARRAY_TASK_MIN=1

All Slurm commands and APIs recognize the SLURM_JOB_ID value.
すべてのSlurmコマンドおよびAPIは、SLURM_JOB_ID値を認識します。
Most commands also recognize the SLURM_ARRAY_JOB_ID plus SLURM_ARRAY_TASK_ID values separated by an underscore as identifying an element of a job array.
ほとんどのコマンドは、ジョブ配列の要素を識別するものとして、アンダースコアで区切られたSLURM_ARRAY_JOB_IDとSLURM_ARRAY_TASK_IDの値も認識します。
Using the example above, "37" or "36_2" would be equivalent ways to identify the second array element of job 36.
上記の例を使用すると、「37」または「36_2」は、ジョブ36の2番目の配列要素を識別する同等の方法になります。
A set of APIs has been developed to operate on an entire job array or select tasks of a job array in a single function call.
APIのセットは、ジョブ配列全体を操作したり、単一の関数呼び出しでジョブ配列のタスクを選択したりするために開発されました。
The function response consists of an array identifying the various error codes for various tasks of a job ID.
関数応答は、ジョブIDのさまざまなタスクのさまざまなエラーコードを識別する配列で構成されます。
For example the job_resume2() function might return an array of error codes indicating that tasks 1 and 2 have already completed; tasks 3 through 5 are resumed successfully, and tasks 6 through 99 have not yet started.
たとえば、job_resume2()関数は、タスク1と2がすでに完了していることを示すエラーコードの配列を返す場合があります。タスク3から5は正常に再開され、タスク6から99はまだ開始されていません。

File Names

Two additional options are available to specify a job's stdin, stdout, and stderr file names: %A will be replaced by the value of SLURM_ARRAY_JOB_ID (as defined above) and %a will be replaced by the value of SLURM_ARRAY_TASK_ID (as defined above).
ジョブのstdin、stdout、およびstderrファイル名を指定するために2つの追加オプションを使用できます。%AはSLURM_ARRAY_JOB_IDの値(上記で定義)に置き換えられ、%aはSLURM_ARRAY_TASK_IDの値(上記で定義)に置き換えられます。
The default output file format for a job array is "slurm-%A_%a.out".
ジョブ配列のデフォルトの出力ファイル形式は「slurm-%A_%a.out」です。
An example of explicit use of the formatting is:
sbatch -o slurm-%A_%a.out --array=1-3 -N1 tmp
which would generate output files names of this sort "slurm-36_1.out", "slurm-36_2.out" and "slurm-36_3.out".
書式設定の明示的な使用例は次のとおりです。sbatch-oslurm-%A_%a.out --array = 1-3 -N1 tmpは、この種の出力ファイル名を生成します "slurm-36_1.out"、 "slurm -36_2.out」および「slurm-36_3.out」。
If these file name options are used without being part of a job array then "%A" will be replaced by the current job ID and "%a" will be replaced by 4,294,967,294 (equivalent to 0xfffffffe or NO_VAL).
これらのファイル名オプションがジョブ配列の一部として使用されていない場合、「%A」は現在のジョブIDに置き換えられ、「%a」は4,294,967,294(0xfffffffeまたはNO_VALに相当)に置き換えられます。

Scancel Command Use

If the job ID of a job array is specified as input to the scancel command then all elements of that job array will be cancelled.
scancelコマンドへの入力としてジョブ配列のジョブIDが指定されている場合、そのジョブ配列のすべての要素が取り消されます。
Alternately an array ID, optionally using regular expressions, may be specified for job cancellation.
または、オプションで正規表現を使用する配列IDを指定して、ジョブをキャンセルすることもできます。

# Cancel array ID 1 to 3 from job array 20
$ scancel 20_[1-3]

# Cancel array ID 4 and 5 from job array 20
$ scancel 20_4 20_5

# Cancel all elements from job array 20
$ scancel 20

# Cancel the current job or job array element (if job array)
if [[-z $SLURM_ARRAY_JOB_ID]]; then
  scancel $SLURM_JOB_ID
else
  scancel ${SLURM_ARRAY_JOB_ID}_${SLURM_ARRAY_TASK_ID}
fi

Squeue Command Use

When a job array is submitted to Slurm, only one job record is created.
ジョブ配列がSlurmに送信されると、1つのジョブレコードのみが作成されます。
Additional job records will only be created when the state of a task in the job array changes, typically when a task is allocated resources or its state is modified using the scontrol command.
追加のジョブレコードは、ジョブ配列内のタスクの状態が変更された場合にのみ作成されます。通常、タスクにリソースが割り当てられているか、scontrolコマンドを使用してその状態が変更された場合です。
By default, the squeue command will report all of the tasks associated with a single job record on one line and use a regular expression to indicate the "array_task_id" values as shown below.
デフォルトでは、squeueコマンドは、単一のジョブレコードに関連付けられているすべてのタスクを1行で報告し、正規表現を使用して、以下に示すように「array_task_id」値を示します。

$ squeue
 JOBID     PARTITION  NAME  USER  ST  TIME  NODES NODELIST(REASON)
1080_[5-1024]  debug   tmp   mac  PD  0:00      1 (Resources)
1080_1         debug   tmp   mac   R  0:17      1 tux0
1080_2         debug   tmp   mac   R  0:16      1 tux1
1080_3         debug   tmp   mac   R  0:03      1 tux2
1080_4         debug   tmp   mac   R  0:03      1 tux3

An option of "--array" or "-r" has also been added to the squeue command to print one job array element per line as shown below.
以下に示すように、「-array」または「-r」のオプションもsqueueコマンドに追加され、1行に1つのジョブ配列要素を出力します。
The environment variable "SQUEUE_ARRAY" is equivalent to including the "--array" option on the squeue command line.
環境変数「SQUEUE_ARRAY」は、squeueコマンドラインに「--array」オプションを含めることと同じです。

$ squeue -r
 JOBID PARTITION  NAME  USER  ST  TIME  NODES NODELIST(REASON)
1082_3     debug   tmp   mac  PD  0:00      1 (Resources)
1082_4     debug   tmp   mac  PD  0:00      1 (Priority)
  1080     debug   tmp   mac   R  0:17      1 tux0
  1081     debug   tmp   mac   R  0:16      1 tux1
1082_1     debug   tmp   mac   R  0:03      1 tux2
1082_2     debug   tmp   mac   R  0:03      1 tux3

The squeue --step/-s and --job/-j options can accept job or step specifications of the same format.
squeue --step / -sおよび--job / -jオプションは、同じ形式のジョブまたはステップの指定を受け入れることができます。

$ squeue -j 1234_2,1234_3
...
$ squeue -s 1234_2.0,1234_3.0
...

Two additional job output format field options have been added to squeue:
2つの追加のジョブ出力フォーマットフィールドオプションがsqueueに追加されました。

%F prints the array_job_id value
%Fはarray_job_id値を出力します

%K prints the array_task_id value
%Kはarray_task_id値を出力します

(all of the obvious letters to use were already assigned to other job fields).
(使用する明らかな文字はすべて、すでに他の職種に割り当てられています)。

Scontrol Command Use

Use of the scontrol show job option shows two new fields related to job array support.
scontrol show jobオプションを使用すると、ジョブ配列のサポートに関連する2つの新しいフィールドが表示されます。
The JobID is a unique identifier for the job.
JobIDは、ジョブの一意の識別子です。
The ArrayJobID is the JobID of the first element of the job array.
ArrayJobIDは、ジョブ配列の最初の要素のJobIDです。
The ArrayTaskID is the array index of this particular entry, either a single number of an expression identifying the entries represented by this job record (e.g. "5-1024").
ArrayTaskIDは、この特定のエントリの配列インデックスであり、このジョブレコードによって表されるエントリを識別する式の単一の番号(「5-1024」など)です。
Neither field is displayed if the job is not part of a job array.
ジョブがジョブ配列の一部でない場合、どちらのフィールドも表示されません。
The optional job ID specified with the scontrol show job or scontrol show step commands can identify job array elements by specifying ArrayJobId and ArrayTaskId with an underscore between them (eg. <ArrayJobID>_<ArrayTaskId>).
scontrol showjobまたはscontrolshow stepコマンドで指定されたオプションのジョブIDは、ArrayJobIdとArrayTaskIdをアンダースコアで指定することにより、ジョブ配列要素を識別できます(例:<ArrayJobID> _ <ArrayTaskId>)。

The scontrol command will operate on all elements of a job array if the job ID specified is ArrayJobID.
指定されたジョブIDがArrayJobIDの場合、scontrolコマンドはジョブ配列のすべての要素に対して動作します。
Individual job array tasks can be modifed using the ArrayJobID_ArrayTaskID as shown below.
個々のジョブ配列タスクは、以下に示すようにArrayJobID_ArrayTaskIDを使用して変更できます。

$ sbatch --array=1-4 -J array ./sleepme 86400
Submitted batch job 21845

$ squeue
 JOBID   PARTITION     NAME     USER  ST  TIME NODES NODELIST
 21845_1    canopo    array    david  R  0:13  1     dario
 21845_2    canopo    array    david  R  0:13  1     dario
 21845_3    canopo    array    david  R  0:13  1     dario
 21845_4    canopo    array    david  R  0:13  1     dario

$ scontrol update JobID=21845_2 name=arturo
$ squeue
 JOBID   PARTITION     NAME     USER  ST   TIME  NODES NODELIST
 21845_1    canopo    array    david  R   17:03   1    dario
 21845_2    canopo   arturo    david  R   17:03   1    dario
 21845_3    canopo    array    david  R   17:03   1    dario
 21845_4    canopo    array    david  R   17:03   1    dario

The scontrol hold, holdu, release, requeue, requeuehold, suspend and resume commands can also either operate on all elements of a job array or individual elements as shown below.
scontrol hold、holdu、release、requeue、requeuehold、suspend、resumeコマンドは、以下に示すように、ジョブ配列のすべての要素または個々の要素に対して操作することもできます。

$ scontrol suspend 21845
$ squeue
 JOBID PARTITION      NAME     USER  ST TIME  NODES NODELIST
21845_1    canopo    array    david  S 25:12  1     dario
21845_2    canopo   arturo    david  S 25:12  1     dario
21845_3    canopo    array    david  S 25:12  1     dario
21845_4    canopo    array    david  S 25:12  1     dario
$ scontrol resume 21845
$ squeue
 JOBID PARTITION      NAME     USER  ST TIME  NODES NODELIST
21845_1    canopo    array    david  R 25:14  1     dario
21845_2    canopo   arturo    david  R 25:14  1     dario
21845_3    canopo    array    david  R 25:14  1     dario
21845_4    canopo    array    david  R 25:14  1     dario

scontrol suspend 21845_3
$ squeue
 JOBID PARTITION      NAME     USER  ST TIME  NODES NODELIST
21845_1    canopo    array    david  R 25:14  1     dario
21845_2    canopo   arturo    david  R 25:14  1     dario
21845_3    canopo    array    david  S 25:14  1     dario
21845_4    canopo    array    david  R 25:14  1     dario
scontrol resume 21845_3
$ squeue
 JOBID PARTITION      NAME     USER  ST TIME  NODES NODELIST
21845_1    canopo    array    david  R 25:14  1     dario
21845_2    canopo   arturo    david  R 25:14  1     dario
21845_3    canopo    array    david  R 25:14  1     dario
21845_4    canopo    array    david  R 25:14  1     dario

Job Dependencies

A job which is to be dependent upon an entire job array should specify itself dependent upon the ArrayJobID.
ジョブ配列全体に依存するジョブは、ArrayJobIDに依存するように指定する必要があります。
Since each array element can have a different exit code, the interpretation of the afterok and afternotok clauses will be based upon the highest exit code from any task in the job array.
各配列要素は異なる終了コードを持つことができるため、afterok句とafternotok句の解釈は、ジョブ配列内の任意のタスクからの最高の終了コードに基づいて行われます。

When a job dependency specifies the job ID of a job array:
ジョブの依存関係がジョブ配列のジョブIDを指定する場合:

The after clause is satisfied after all tasks in the job array start.
after句は、ジョブ配列内のすべてのタスクが開始した後に満たされます。

The afterany clause is satisfied after all tasks in the job array complete.
afterany句は、ジョブ配列内のすべてのタスクが完了した後に満たされます。

The aftercorr clause is satisfied after the corresponding task ID in the specified job has completed successfully (ran to completion with an exit code of zero).
aftercorr節は、指定されたジョブの対応するタスクIDが正常に完了した(終了コード0で完了まで実行された)後に満たされます。

The afterok clause is satisfied after all tasks in the job array complete successfully.
afterok句は、ジョブ配列内のすべてのタスクが正常に完了した後に満たされます。

The afternotok clause is satisfied after all tasks in the job array complete with at least one tasks not completing successfully.
afternotok句は、ジョブ配列内のすべてのタスクが完了し、少なくとも1つのタスクが正常に完了しなかった後に満たされます。

Examples of use are shown below:
使用例を以下に示します。

# Wait for specific job array elements
sbatch --depend=after:123_4 my.job
sbatch --depend=afterok:123_4:123_8 my.job2

# Wait for entire job array to complete
sbatch --depend=afterany:123 my.job

# Wait for corresponding job array elements
sbatch --depend=aftercorr:123 my.job

# Wait for entire job array to complete successfully
sbatch --depend=afterok:123 my.job

# Wait for entire job array to complete and at least one task fails
sbatch --depend=afternotok:123 my.job

Other Command Use

The following Slurm commands do not currently recognize job arrays and their use requires the use of Slurm job IDs, which are unique for each array element: sbcast, sprio, sreport, sshare and sstat.
次のSlurmコマンドは現在、ジョブ配列を認識しません。それらを使用するには、配列要素ごとに一意のSlurmジョブIDを使用する必要があります:sbcast、sprio、sreport、sshare、sstat。
The sacct, sattach and strigger commands have been modified to permit specification of either job IDs or job array elements.
sacct、sattach、およびstriggerコマンドが変更され、ジョブIDまたはジョブ配列要素のいずれかを指定できるようになりました。
The sview command has been modified to permit display of a job's ArrayJobId and ArrayTaskId fields.
sviewコマンドが変更され、ジョブのArrayJobIdフィールドとArrayTaskIdフィールドを表示できるようになりました。
Both fields are displayed with a value of "N/A" if the job is not part of a job array.
ジョブがジョブ配列の一部でない場合、両方のフィールドは「N / A」の値で表示されます。

System Administration

A new configuration parameter has been added to control the maximum job array size: MaxArraySize.
ジョブ配列の最大サイズを制御するための新しい構成パラメーターMaxArraySizeが追加されました。
The smallest index that can be specified by a user is zero and the maximum index is MaxArraySize minus one.
ユーザーが指定できる最小のインデックスはゼロで、最大のインデックスはMaxArraySizeから1を引いたものです。
The default value of MaxArraySize is 1001.
MaxArraySizeのデフォルト値は1001です。
The maximum MaxArraySize supported in Slurm is 4000001.
Slurmでサポートされる最大MaxArraySizeは4000001です。
Be mindful about the value of MaxArraySize as job arrays offer an easy way for users to submit large numbers of jobs very quickly.
ジョブ配列は、ユーザーが多数のジョブを非常に迅速に送信するための簡単な方法を提供するため、MaxArraySizeの値に注意してください。

The sched/backfill plugin has been modified to improve performance with job arrays.
sched / backfillプラグインが変更され、ジョブ配列のパフォーマンスが向上しました。
Once one element of a job array is discovered to not be runable or impact the scheduling of pending jobs, the remaining elements of that job array will be quickly skipped.
ジョブ配列の1つの要素が実行不可能であるか、保留中のジョブのスケジュールに影響を与えることが判明すると、そのジョブ配列の残りの要素はすぐにスキップされます。

Slurm creates a single job record when a job array is submitted.
Slurmは、ジョブ配列が送信されると単一のジョブレコードを作成します。
Additional job records are only created as needed, typically when a task of a job array is started, which provides a very scalable mechanism to manage large job counts.
追加のジョブレコードは、通常、ジョブ配列のタスクが開始されたときに必要な場合にのみ作成されます。これにより、大量のジョブ数を管理するための非常にスケーラブルなメカニズムが提供されます。
Each task of the job array will have a unique Slurm "job_id", but all will have the same "array_job_id" value.
ジョブ配列の各タスクには一意のSlurm「job_id」がありますが、すべて同じ「array_job_id」値になります。

Last modified 23 September 2019