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. 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).
Jobs which are part of a job array will have the environment variable
SLURM_ARRAY_TASK_ID set to its array index value.
ジョブ配列はバッチジョブでのみサポートされ、配列のインデックス値はsbatchコマンドの--arrayまたは-aオプションを使用して指定されます。以下の例に示すように、オプションの引数には、特定の配列インデックス値、インデックス値の範囲、およびオプションのステップサイズを指定できます。最小インデックス値はゼロであり、最大値はSlurm構成パラメーター(MaxArraySize-1)であることに注意してください。ジョブ配列の一部であるジョブでは、環境変数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. If the sbatch command responds
3つのジョブを含むジョブ配列を生成します。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.
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.
Using the example above, "37" or "36_2" would be equivalent ways to identify
the second array element of job 36.
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.
The function response consists of an array identifying the various error codes
for various tasks of a job 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.
すべてのSlurmコマンドとAPIはSLURM_JOB_ID値を認識します。ほとんどのコマンドは、SLURM_ARRAY_JOB_IDと、アンダースコアで区切られたSLURM_ARRAY_TASK_IDの値も、ジョブ配列の要素を識別するものとして認識します。上記の例を使用すると、「37」または「36_2」は、ジョブ36の2番目の配列要素を識別する同等の方法です。APIのセットは、ジョブ配列全体を操作するか、単一のジョブ配列のタスクを選択するために開発されました関数呼び出し。関数の応答は、ジョブIDのさまざまなタスクのさまざまなエラーコードを識別する配列で構成されます。たとえば、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).
The default output file format for a job array is "slurm-%A_%a.out".
An example of explicit use of the formatting is:
ジョブのstdin、stdout、およびstderrファイル名を指定するには、2つの追加オプションがあります。%AはSLURM_ARRAY_JOB_ID(上記で定義)の値で置き換えられ、%aはSLURM_ARRAY_TASK_ID(上記で定義)の値で置き換えられます。ジョブ配列のデフォルトの出力ファイル形式は「slurm-%A_%a.out」です。書式の明示的な使用例は次のとおりです。
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".
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).
これにより、このような「slurm-36_1.out」、「slurm-36_2.out」、「slurm-36_3.out」という名前の出力ファイルが生成されます。これらのファイル名オプションをジョブ配列の一部ではなく使用すると、 "%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.
Alternately an array ID, optionally using regular expressions, may be specified
for job cancellation.
ジョブ配列のジョブIDがscancelコマンドへの入力として指定されている場合、そのジョブ配列のすべての要素がキャンセルされます。または、オプションで正規表現を使用して、アレイ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.
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.
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.
ジョブ配列がSlurmに送信されると、1つのジョブレコードのみが作成されます。追加のジョブレコードは、ジョブ配列内のタスクの状態が変化した場合にのみ作成されます。通常、タスクにリソースが割り当てられている場合、またはscontrolコマンドを使用してその状態が変更されている場合です。デフォルトでは、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.
The environment variable "SQUEUE_ARRAY" is equivalent to including the "--array"
option on the squeue command line.
以下に示すように、「-array」または「-r」のオプションもsqueueコマンドに追加され、1行に1つのジョブ配列要素を出力します。環境変数「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.
The JobID is a unique identifier for the job.
The ArrayJobID is the JobID of the first element of the job
array.
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").
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 show jobオプションを使用すると、ジョブ配列サポートに関連する2つの新しいフィールドが表示されます。JobIDは、ジョブの一意の識別子です。ArrayJobIDは、ジョブ配列の最初の要素のJobIDです。ArrayTaskIDは、この特定のエントリの配列インデックスであり、このジョブレコードで表されるエントリを識別する単一の式(例: "5-1024")のいずれかです。ジョブがジョブ配列の一部でない場合、どちらのフィールドも表示されません。scontrol show jobまたはscontrol show stepコマンドで指定されたオプションのジョブIDは、ArrayJobIdとArrayTaskIdの間にアンダースコアを付けて指定することで、ジョブ配列要素を識別できます(例:_)。
The scontrol command will operate on all elements of a job array if the
job ID specified is ArrayJobID.
Individual job array tasks can be modifed using the
ArrayJobID_ArrayTaskID as shown below.
指定されたジョブIDがArrayJobIDである場合、scontrolコマンドはジョブ配列のすべての要素を操作します。以下に示すように、個々のジョブ配列タスクは、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.
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.
ジョブ配列全体に依存するジョブは、ArrayJobIDに依存するジョブを指定する必要があります。各配列要素は異なる終了コードを持つことができるため、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).
指定されたジョブの対応するタスクIDが正常に完了した(終了コード0で完了まで実行された)後、aftercorr句が満たされます。
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.
The sacct, sattach and strigger commands have been modified to permit
specification of either job IDs or job array elements.
The sview command has been modified to permit display of a job's ArrayJobId
and ArrayTaskId fields. Both fields are displayed with a value of "N/A" if
the job is not part of a job array.
次のSlurmコマンドは現在ジョブ配列を認識せず、その使用にはSlurmジョブID(sbcast、sprio、sreport、sshare、sstat)を使用する必要があります。sacct、sattach、およびstriggerコマンドが変更され、ジョブIDまたはジョブ配列要素のいずれかを指定できるようになりました。sviewコマンドが変更され、ジョブのArrayJobIdおよびArrayTaskIdフィールドを表示できるようになりました。ジョブがジョブ配列の一部でない場合は、両方のフィールドに「N / A」の値が表示されます。
System Administration
A new configuration parameter has been added to control the maximum
job array size: MaxArraySize. The smallest index that can be specified
by a user is zero and the maximum index is MaxArraySize minus one.
The default value of MaxArraySize is 1001.
The maximum MaxArraySize supported in Slurm is 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が追加されました。ユーザーが指定できる最小のインデックスは0で、最大のインデックスはMaxArraySize-1です。MaxArraySizeのデフォルト値は1001です。Slurmでサポートされている最大MaxArraySizeは4000001です。MaxArraySizeの値に注意してください。ジョブ配列は、ユーザーが多数のジョブを非常に迅速に送信する簡単な方法を提供するためです。
The sched/backfill plugin has been modified to improve performance with
job arrays. 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.
sched / backfillプラグインが変更され、ジョブ配列のパフォーマンスが向上しました。ジョブ配列の1つの要素が実行不可能であるか、保留中のジョブのスケジューリングに影響を与えることが検出されると、そのジョブ配列の残りの要素はすぐにスキップされます。
Slurm creates a single job record when a job array is submitted.
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は、ジョブ配列が送信されると単一のジョブレコードを作成します。追加のジョブレコードは、通常はジョブアレイのタスクが開始されたときに、必要に応じてのみ作成されます。これにより、大量のジョブ数を管理するための非常にスケーラブルなメカニズムが提供されます。ジョブ配列の各タスクには一意のSlurm "job_id"がありますが、すべて同じ "array_job_id"値になります。
Last modified 23 September 2019