Slurm Generic Resource (GRES) Plugin API

Overview

This document describes Slurm generic resource (GRES) plugins and the API that defines them. It is intended as a resource to programmers wishing to write their own Slurm GRES plugins.
このドキュメントでは、Slurm汎用リソース(GRES)プラグインとそれらを定義するAPIについて説明します。独自のSlurm GRESプラグインを作成したいプログラマ向けのリソースとして意図されています。

Slurm GRES plugins must conform to the Slurm Plugin API with the following specifications:
Slurm GRESプラグインは、次の仕様のSlurm Plugin APIに準拠している必要があります。

const char *plugin_type="major/minor"

major must be gres. minor can be any suitable name representing the GRES type of the plugin.
メジャーはグレスでなければなりません。マイナーは、プラグインのGRESタイプを表す適切な名前にすることができます。

const char *plugin_name

Some descriptive name for the plugin. There is no requirement with respect to its format.
プラグインの説明的な名前。その形式に関して要件はありません。

const uint32_t plugin_version

If specified, identifies the version of Slurm used to build this plugin and any attempt to load the plugin from a different version of Slurm will result in an error. If not specified, then the plugin may be loaded by Slurm commands and daemons from any version; however, this may result in difficult to diagnose failures due to changes in the arguments to plugin functions or changes in other Slurm functions used by the plugin.
指定した場合、このプラグインのビルドに使用されたSlurmのバージョンを識別し、異なるバージョンのSlurmからプラグインをロードしようとすると、エラーが発生します。指定しない場合、プラグインはSlurmコマンドとデーモンによって任意のバージョンからロードできます。ただし、これにより、プラグイン関数の引数の変更やプラグインで使用される他のSlurm関数の変更が原因で、障害の診断が困難になる可能性があります。

We include samples in the Slurm distribution for:
以下のサンプルをSlurmディストリビューションに含めます。

  • gpu — Manage GPUs (Graphics Processing Units).
    gpu — GPU(グラフィックスプロセッシングユニット)を管理します。
  • mps — Manage MPS (CUDA Multi-Process Service).
    mps — MPS(CUDAマルチプロセスサービス)を管理します。

API Functions

All of the following functions are required. Functions which are not implemented must be stubbed.
以下の機能がすべて必要です。実装されていない関数はスタブする必要があります。

int init(void)

Description:
Called when the plugin is loaded, before any other functions are called. Put global initialization here.
プラグインがロードされたとき、他の関数が呼び出される前に呼び出されます。ここにグローバル初期化を配置します。

Arguments: None.

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

void fini(void)

Description:
Called when the plugin is removed. Clear any allocated storage here.
プラグインが削除されたときに呼び出されます。ここで割り当て済みのストレージをすべてクリアします。

Arguments: None.

Returns: None.

Note: init() and fini() are not the same as those described in the dlopen(3) system library. The C run-time system co-opts those symbols for its own initialization. The system _init() is called before the Slurm init(), and the Slurm fini() is called before the system's _fini().
注:init()およびfini()は、dlopen(3)システムライブラリで説明されているものと同じではありません。Cランタイムシステムは、これらのシンボルを独自の初期化用にco-optします。システムの_init()はSlurm init()の前に呼び出され、Slurm fini()はシステムの_fini()の前に呼び出されます。

int node_config_load(List gres_conf_list, node_config_load_t *config)

Description:
This function is called by the slurmd daemon after the slurm.conf and gres.conf files have been read. It can be used to validate or infer the system configuration by testing the actual hardware resources available or just confirm that an entry for the resource was included in the gres.conf file.
この関数は、slurm.confファイルとgres.confファイルが読み取られた後に、slurmdデーモンによって呼び出されます。使用可能な実際のハードウェアリソースをテストしてシステム構成を検証または推測したり、リソースのエントリがgres.confファイルに含まれていることを確認したりするために使用できます。

Arguments:
gres_conf_list (input/output) a list of configuration records generated by reading the slurm.conf and gres.conf files
config (input) Additional data. Contains fields cpu_cnt and xcpuinfo_mac_to_abs.
gres_conf_list(入力/出力)slurm.confおよびgres.confファイルの読み取りによって生成された構成レコードのリストconfig(入力)追加データ。フィールドcpu_cntおよびxcpuinfo_mac_to_absが含まれます。

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

void job_set_env(char ***job_env_ptr, void *gres_ptr, int node_inx)

Description:
This function is called by the slurmd daemon after the getting a job credential and can be used to set environment variables for the job based upon GRES state information in that credential.
この関数は、ジョブの資格情報を取得した後にslurmdデーモンによって呼び出され、その資格情報のGRES状態情報に基づいてジョブの環境変数を設定するために使用できます。

Arguments:
job_env_ptr (input/output) pointer to the job's environment variable structure.
job_env_ptr(入力/出力)ジョブの環境変数構造へのポインター。

gres_ptr (input) pointer to the job's GRES allocation information.
gres_ptr(入力)ジョブのGRES割り当て情報へのポインタ。

node_inx (input) zero origin node index, used to interpret node-specific GRES data.
node_inx(入力)ゼロ起点ノードインデックス。ノード固有のGRESデータを解釈するために使用されます。

Returns: None.

void step_set_env(char ***job_env_ptr, void *gres_ptr)

Description:
This function is called by the slurmd daemon after the getting a job step credential and can be used to set environment variables for the job step based upon GRES state information in that credential.
この関数は、ジョブステップの資格情報を取得した後にslurmdデーモンによって呼び出され、その資格情報のGRES状態情報に基づいてジョブステップの環境変数を設定するために使用できます。

Arguments:
job_env_ptr (input/output) pointer to the job step's environment variable structure.
job_env_ptr(入力/出力)ジョブステップの環境変数構造へのポインター。

gres_ptr (input) pointer to the step's GRES allocation information.
ステップのGRES割り当て情報へのgres_ptr(入力)ポインター。

Returns: None.

void send_stepd(int fd)

Description:
This function is called by the slurmd daemon to send any needed information to the slurmstepd step shepherd.
この関数は、必要な情報をslurmstepdステップシェパードに送信するためにslurmdデーモンによって呼び出されます。

Arguments:
fd (input) file descriptor to write information to.
情報を書き込むfd(入力)ファイル記述子。

Returns: None.

void recv_stepd(int fd)

Description:
This function is called by the slurmstepd step shepherd to read any needed information from the slurmd daemon.
この関数は、必要な情報をslurmdデーモンから読み取るために、slurmstepdステップシェパードによって呼び出されます。

Arguments:
fd (input) file descriptor to read information from.
情報を読み取るfd(入力)ファイル記述子。

Returns: None.

int job_info(gres_job_state_t *job_gres_data, uint32_t node_inx, enum gres_job_data_type data_type, void *data)

Description:
This function is used to extract plugin-specific data from the job's GRES data structure. Note that enum gres_job_data_type values GRES_JOB_DATA_COUNT and GRES_JOB_DATA_BITMAP are processed in common code rather than within the plugin and return data types of uint32_t* and bitstr_t**, respectively.
この関数は、ジョブのGRESデータ構造からプラグイン固有のデータを抽出するために使用されます。列挙型のgres_job_data_type値GRES_JOB_DATA_COUNTおよびGRES_JOB_DATA_BITMAPは、プラグイン内ではなく共通のコードで処理され、それぞれuint32_t *およびbitstr_t **のデータ型を返すことに注意してください。

Arguments:
job_gres_data (input) Information about the job's GRES resources.
job_gres_data(入力)ジョブのGRESリソースに関する情報。

node_inx (input) Zero origin index within the job's resource allocation for which data is desired.
node_inx(入力)データが必要なジョブのリソース割り当て内のゼロ原点インデックス。

data_type (input) Type of information to be gathered from the data structure.
data_type(入力)データ構造から収集される情報のタイプ。

data (output) Pointer to data within job_gres_data. No data is copied or needs to be freed. Data type depends upon the value of data_type.
data(出力)job_gres_data内のデータへのポインター。データはコピーされないか、解放する必要があります。データ型はdata_typeの値に依存します。

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

int step_info(gres_step_state_t *step_gres_data, uint32_t node_inx, enum gres_step_data_type data_type, void *data)

Description:
This function is used to extract plugin-specific data from the step's GRES data structure. Note that enum gres_job_data_type values GRES_JOB_DATA_COUNT and GRES_JOB_DATA_BITMAP are processed in common code rather than within the plugin and return data types of uint32_t* and bitstr_t**, respectively.
この関数は、ステップのGRESデータ構造からプラグイン固有のデータを抽出するために使用されます。列挙型のgres_job_data_type値GRES_JOB_DATA_COUNTおよびGRES_JOB_DATA_BITMAPは、プラグイン内ではなく共通のコードで処理され、それぞれuint32_t *およびbitstr_t **のデータ型を返すことに注意してください。

Arguments:
step_gres_data (input) Information about the step's GRES resources.
step_gres_data(入力)ステップのGRESリソースに関する情報。

node_inx (input) Zero origin index within the job's resource allocation for which data is desired.
node_inx(入力)データが必要なジョブのリソース割り当て内のゼロ原点インデックス。

data_type (input) Type of information to be gathered from the data structure.
data_type(入力)データ構造から収集される情報のタイプ。

data (output) Pointer to data within step_gres_data. No data is copied or needs to be freed. Data type depends upon the value of data_type.
data(出力)step_gres_data内のデータへのポインター。データはコピーされないか、解放する必要があります。データ型はdata_typeの値に依存します。

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

List get_devices(void)

Description:
This function returns the list of GRES devices.
この関数は、GRESデバイスのリストを返します。

Arguments: None.

Returns:
Returns a List of GRES device records of type gres_slurmd_conf_t.
タイプgres_slurmd_conf_tのGRESデバイスレコードのリストを返します。

void step_hardware_init(bitstr_t *usable_gres, char *settings)

Description:
Configure device hardware corresponding to all the GRES devices of the plugin type. The slurmstepd calls this function while privileged and before tasks are forked and executed. The gres/gpu plugin sets GPU frequencies here.
プラグインタイプのすべてのGRESデバイスに対応するデバイスハードウェアを構成します。slurmstepdは、特権付きでタスクが分岐されて実行される前にこの関数を呼び出します。gres / gpuプラグインは、ここでGPU周波数を設定します。

Arguments:
usable_gres (input) A bit string specifying all GRES devices of the plugin type allocated to the step.
available_gres(入力)ステップに割り当てられたプラグインタイプのすべてのGRESデバイスを指定するビット文字列。

settings (input) A string containing device hardware settings to be set for all specified hardware devices.
settings(入力)指定されたすべてのハードウェアデバイスに設定されるデバイスハードウェア設定を含む文字列。

Returns: None.

void step_hardware_fini(void)

Description:
Do hardware configuration after the step is finished while privileged. This is meant to allow Slurm to undo hardware configuration changes performed by step_hardware_init(). The slurmstepd calls this function while privileged and after tasks complete. The gres/gpu plugin resets GPU frequencies to high here.
特権を与えられた状態でステップが完了した後でハードウェア構成を行います。これは、Slurmがstep_hardware_init()によって実行されたハードウェア構成の変更を取り消せるようにするためのものです。slurmstepdは、特権が与えられている間およびタスクの完了後にこの関数を呼び出します。ここでは、gres / gpuプラグインがGPU周波数を高にリセットします。

Arguments: None.

Returns: None.

gres_epilog_info_t *epilog_build_env(gres_job_state_t *gres_job_ptr)

Description:
Given a job's GRES allocation data, translated that to the data required by epilog_set_env() to set environment variables for the Prolog and Epilog programs.
ジョブのGRES割り当てデータを前提として、それをepilog_set_env()がPrologおよびEpilogプログラムの環境変数を設定するために必要なデータに変換しました。

Arguments:
gres_job_ptr (input) job's GRES allocation data.
gres_job_ptr(入力)ジョブのGRES割り当てデータ。

Returns: Data structure containing the information required by epilog_set_env() to set environment variables for the Prolog and Epilog programs.
戻り値:epilog_set_env()がPrologおよびEpilogプログラムの環境変数を設定するために必要な情報を含むデータ構造。

void epilog_set_env(char ***epilog_env_ptr, gres_epilog_info_t *epilog_info, int node_inx)

Description:
Set GRES specific environment variables for the Prolog and Epilog programs.
PrologおよびEpilogプログラムのGRES固有の環境変数を設定します。

Arguments:
epilog_env_ptr (input) environment variables set for the Prolog and Epilog programs. This array may be reallocated as needed to contain additional environment variables.
epilog_env_ptr(入力)環境変数は、PrologおよびEpilogプログラムに設定されます。この配列は、追加の環境変数を含めるために必要に応じて再割り当てできます。

epilog_info (input) GRES specific job allocation information. Built by epilog_build_env().
epilog_info(入力)GRES固有のジョブ割り当て情報。epilog_build_env()によって構築されます。

node_inx (input) zero-origin index of this node in the job's allocation. Needed to identify the resources on a specific node allocated to this job.
node_inx(入力)ジョブの割り当てにおけるこのノードのゼロ起点インデックス。このジョブに割り当てられた特定のノード上のリソースを識別するために必要です。

Returns: None.

Last modified 5 March 2019