Job Launch Design Guide

Overview

This guide describes at a high level the processes which occur in order to initiate a job including the daemons and plugins involved in the process. It describes the process of job allocation, step allocation, task launch and job termination. The functionality of tens of thousands of lines of code has been distilled here to a couple of pages of text, so much detail is missing.
このガイドでは、プロセスに関与するデーモンとプラグインを含むジョブを開始するために発生するプロセスを高レベルで説明します。ジョブの割り当て、ステップの割り当て、タスクの起動、およびジョブの終了のプロセスについて説明します。数万行のコードの機能がここで数ページのテキストに抽出されているので、詳細はほとんどありません。

Job Allocation

The first step of the process is to create a job allocation, which is a claim on compute resources. A job allocation can be created using the salloc, sbatch or srun command. The salloc and sbatch commands create resource allocations while the srun command will create a resource allocation (if not already running within one) plus launch tasks. Each of these commands will fill in a data structure identifying the specifications of the job allocation requirement (e.g. node count, task count, etc.) based upon command line options and environment variables and send the RPC to the slurmctld daemon. If the new job request is the highest priority, the slurmctld daemon will attempt to select resources for it immediately, otherwise it will validate that the job request can be satisfied at some time and queue the request. In either case the request will receive a response almost immediately containing one of the following:
プロセスの最初のステップは、計算リソースの要求であるジョブ割り当てを作成することです。ジョブの割り当ては、salloc、sbatch、またはsrunコマンドを使用して作成できます。sallocコマンドとsbatchコマンドはリソース割り当てを作成しますが、srunコマンドはリソース割り当て(まだ実行されていない場合)と起動タスクを作成します。これらの各コマンドは、コマンドラインオプションと環境変数に基づいてジョブ割り当て要件の仕様(ノード数、タスク数など)を識別するデータ構造を入力し、RPCをslurmctldデーモンに送信します。新しいジョブ要求が最高の優先順位である場合、slurmctldデーモンはそのリソースをすぐに選択しようとします。それ以外の場合は、ジョブ要求がいつか満たされ、要求をキューに入れることができることを検証します。

  • A job ID and the resource allocation specification (nodes, cpus, etc.)
    ジョブIDとリソース割り当ての仕様(ノード、CPUなど)
  • A job ID and notification of the job being in a queued state OR
    ジョブIDおよびジョブがキューに入れられた状態であることの通知または
  • An error code
    エラーコード

The process of selecting resources for a job request involves multiple steps, some of which involve plugins. The process is as follows:
ジョブリクエストのリソースを選択するプロセスには複数のステップが含まれ、その一部にはプラグインが含まれます。プロセスは次のとおりです。

  1. Call job_submit plugins to modify the request as appropriate
    job_submitプラグインを呼び出して、要求を適切に変更します
  2. Validate that the options are valid for this user (e.g. valid partition name, valid limits, etc.)
    オプションがこのユーザーに対して有効であることを検証します(たとえば、有効なパーティション名、有効な制限など)。
  3. Determine if this job is the highest priority runnable job, if so then really try to allocate resources for it now, otherwise only validate that it could run if no other jobs existed
    このジョブが最も優先度の高い実行可能なジョブであるかどうかを判断します。そうである場合は、実際にリソースを割り当ててみてください。そうでない場合は、他のジョブが存在しない場合にのみ実行できることを確認してください
  4. Determine which nodes could be used for the job. If the feature specification uses an exclusive OR option, then multiple iterations of the selection process below will be required with disjoint sets of nodes
    ジョブに使用できるノードを決定します。フィーチャー仕様で排他的ORオプションを使用する場合、ノードの互いに素なセットを使用して、以下の選択プロセスを複数回繰り返す必要があります。
  5. Call the select plugin to select the best resources for the request
    selectプラグインを呼び出して、リクエストに最適なリソースを選択します
  6. The select plugin will consider network topology and the topology within a node (e.g. sockets, cores, and threads) to select the best resources for the job
    選択プラグインは、ネットワークトポロジとノード内のトポロジ(ソケット、コア、スレッドなど)を考慮して、ジョブに最適なリソースを選択します
  7. If the job can not be initiated using available resources and preemption support is configured, the select plugin will also determine if the job can be initiated after preempting lower priority jobs. If so then initiate preemption as needed to start the job
    利用可能なリソースを使用してジョブを開始できず、プリエンプションサポートが構成されている場合、selectプラグインは、優先度の低いジョブをプリエンプトした後にジョブを開始できるかどうかも決定します。その場合、ジョブを開始するために必要に応じてプリエンプションを開始します

Step Allocation

The srun command is always used for job step creation. It fills in a job step request RPC using information from the command line and environment variables then sends that request to the slurmctld daemon. It is important to note that many of the srun options are intended for job allocation and are not supported by the job step request RPC (for example the socket, core and thread information is not supported). If a job step uses all of the resources allocated to the job then the lack of support for some options is not important. If one wants to execute multiple job steps using various subsets of resources allocated to the job, this shortcoming could prove problematic. It is also worth noting that the logic used to select resources for a job step is relatively simple and entirely contained within the slurmctld daemon code (the select plugin is not used for job steps). If the request can not be immediately satisfied due to a request for exclusive access to resources, the appropriate error message will be sent and the srun command will retry the request on a periodic basis.
srunコマンドは、ジョブステップの作成に常に使用されます。コマンドラインと環境変数からの情報を使用してジョブステップリクエストRPCを入力し、そのリクエストをslurmctldデーモンに送信します。srunオプションの多くはジョブの割り当てを目的としており、ジョブステップ要求RPCではサポートされないことに注意してください(たとえば、ソケット、コア、およびスレッドの情報はサポートされていません)。ジョブステップがジョブに割り当てられたすべてのリソースを使用する場合、一部のオプションに対するサポートの欠如は重要ではありません。ジョブに割り当てられたリソースのさまざまなサブセットを使用して複数のジョブステップを実行したい場合、この欠点が問題となる可能性があります。ジョブステップのリソースを選択するために使用されるロジックは比較的シンプルであり、slurmctldデーモンコード内に完全に含まれていることにも注目に値します(selectプラグインはジョブステップには使用されません)。リソースへの排他的アクセスの要求のために要求をすぐに満たすことができない場合、適切なエラーメッセージが送信され、srunコマンドは定期的に要求を再試行します。
(NOTE: It would be desirable to queue the job step requests to support job step dependencies and better performance in the initiation of job steps, but that is not currently supported.)
(注:ジョブステップの開始におけるジョブステップの依存関係とパフォーマンスの向上をサポートするには、ジョブステップ要求をキューに入れることが望ましいですが、現在はサポートされていません。)
If the request can be satisfied, the response contains a digitally signed credential (by the cred plugin) identifying the resources to be used.
要求が満たされる場合、応答には、使用されるリソースを識別する(credプラグインによって)デジタル署名された資格が含まれます。

Task Launch

The srun command builds a task launch request data structure including the credential, executable name, file names, etc. and sends it to the slurmd daemon on node zero of the job step allocation. The slurmd daemon validates the signature and forwards the request to the slurmd daemons on other nodes to launch tasks for that job step. The degree of fanout in this message forwarding is configurable using the TreeWidth parameter. Each slurmd daemon tests that the job has not been cancelled since the credential was issued (due to a possible race condition) and spawns a slurmstepd program to manage the job step. Note that the slurmctld daemon is not directly involved in task launch in order to minimize the overhead on this critical resource.
srunコマンドは、資格情報、実行可能ファイル名、ファイル名などを含むタスク起動要求データ構造を構築し、それをジョブステップ割り当てのノード0のslurmdデーモンに送信します。slurmdデーモンは署名を検証し、要求を他のノードのslurmdデーモンに転送して、そのジョブステップのタスクを起動します。このメッセージ転送のファンアウトの程度は、TreeWidthパラメーターを使用して構成できます。各slurmdデーモンは、クレデンシャルが発行されてからジョブがキャンセルされていないことをテストし(競合状態の可能性があるため)、ジョブステップを管理するためにslurmstepdプログラムを起動します。この重要なリソースのオーバーヘッドを最小限に抑えるために、slurmctldデーモンはタスクの起動に直接関与していないことに注意してください。

Each slurmstepd program executes a single job step. Besides the functions listed below, the slurmstepd program also executes several SPANK plugin functions at various times.
各slurmstepdプログラムは、単一のジョブステップを実行します。以下にリストされている関数の他に、slurmstepdプログラムは、さまざまな時点でいくつかのSPANKプラグイン関数も実行します。

  1. Performs MPI setup (using the appropriate plugin)
    MPIセットアップを実行します(適切なプラグインを使用)
  2. Calls the switch plugin to perform any needed network configuration
    スイッチプラグインを呼び出して、必要なネットワーク構成を実行します
  3. Creates a container for the job step using a proctrack plugin
    proctrackプラグインを使用してジョブステップのコンテナを作成します
  4. Change user ID to that of the user
    ユーザーIDをユーザーのIDに変更します
  5. Configures I/O for the tasks (either using files or a socket connection back to the srun command
    タスクのI / Oを構成します(ファイルまたはsrunコマンドへのソケット接続を使用して)
  6. Sets up environment variables for the tasks including many task-specific environment variables
    多くのタスク固有の環境変数を含む、タスクの環境変数を設定します
  7. Fork/exec the tasks
    タスクをフォーク/実行する

Job Step Termination

There are several ways in which a job step or job can terminate, each with slight variation in the logic executed. The simplest case is if the tasks run to completion. The srun will note the termination of output from the tasks and notify the slurmctld daemon that the job step has completed. slurmctld will simply log the job step termination. The job step can also be explicitly cancelled by a user, reach the end of its time limit, etc. and those follow a sequence of steps very similar to that for job termination, which is described below.
ジョブステップまたはジョブを終了する方法はいくつかあり、それぞれ実行されるロジックにわずかな変動があります。最も単純なケースは、タスクが完了するまで実行される場合です。srunは、タスクからの出力の終了を記録し、ジョブステップが完了したことをslurmctldデーモンに通知します。slurmctldは、ジョブステップの終了をログに記録するだけです。ジョブステップは、ユーザーが明示的にキャンセルしたり、制限時間の最後に到達したりすることもできます。ジョブステップは、以下で説明するジョブの終了と非常によく似た一連のステップに従います。

Job Termination

Job termination can either be user initiated (e.g. scancel command) or system initiated (e.g. time limit reached). The termination ultimately requires the slurmctld daemon to notify the slurmd daemons on allocated nodes that the job is to be ended. The slurmd daemon does the following:
ジョブの終了は、ユーザーが開始する(scancelコマンドなど)か、システムが開始する(時間制限に達するなど)ことができます。最終的に、slurmctldデーモンは、ジョブが終了することを、割り当てられたノードのslurmdデーモンに通知する必要があります。slurmdデーモンは次のことを行います。

  1. Send a SIGCONT and SIGTERM signal to any user tasks
    SIGCONTおよびSIGTERMシグナルを任意のユーザータスクに送信する
  2. Wait KilLWait seconds if there are any user tasks
    ユーザータスクがある場合はKilLWait秒待機します
  3. Send a SIGKILL signal to any user tasks
    SIGKILLシグナルをユーザータスクに送信する
  4. Wait for all tasks to complete
    すべてのタスクが完了するまで待ちます
  5. Execute any Epilog program
    Epilogプログラムを実行する
  6. Send an epilog_complete RPC to the slurmctld daemon
    epilog_complete RPCをslurmctldデーモンに送信します

Last modified 7 January 2019