MPIの初期化・集約を抽象化し、非MPIビルドでは単一ランク動作へフォールバックする。
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=i32), | public | :: | rank | = | 0_i32 | ||
| integer(kind=i32), | public | :: | size | = | 1_i32 | ||
| logical, | public | :: | enabled | = | .false. | ||
| integer(kind=i32), | public | :: | thread_level | = | 0_i32 |
|
rank 0 が保持する 64 bit カウンタを全 rank が fetch-and-add で取り合う、バッチ粒子 slot pool の claim 窓口。
claim は OpenMP の critical 区間から呼ぶ前提で、MPI は MPI_THREAD_SERIALIZED 以上を要求する。
非 MPI build や 1 rank では rank 内のカウンタに落ちる。
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | public | :: | active | = | .false. | ||
| logical, | public | :: | distributed | = | .false. | ||
| logical, | public | :: | hosts_window | = | .false. |
この rank が窓を持つ(rank 0)。remote の fetch-and-add は窓を持つ rank の MPI 進行で処理される。 |
|
| logical, | public | :: | prefetch_pending | = | .false. |
次の chunk の fetch-and-add を先に発行してある(結果は |
|
| integer(kind=i64), | public | :: | local_value | = | 0_i64 |
| procedure, public :: init => shared_counter_init | |
| procedure, public :: reset => shared_counter_reset | |
| procedure, public :: claim => shared_counter_claim | |
| procedure, public :: progress => shared_counter_progress | |
| procedure, public :: complete_prefetch => shared_counter_complete_prefetch | |
| procedure, public :: destroy => shared_counter_destroy |
root rank (rank=0) かどうかを返す。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx |
MPI world size を返す(size<=0 は 1 へ補正)。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in), | optional | :: | ctx |
総数 total_count をrankへ均等分割したときの局所個数を返す。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i32), | intent(in) | :: | total_count | |||
| integer(kind=i32), | intent(in) | :: | rank | |||
| integer(kind=i32), | intent(in) | :: | size |
MPIを初期化して rank / size を取得する。非MPIビルドでは単一ランクを返す。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(out) | :: | ctx |
mpi_initialize が実際に初期化した場合のみ MPI_Finalize を呼ぶ。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(inout) | :: | ctx |
mpi_context から rank/size を取得する。未指定時は単一rank(0/1)。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=i32), | intent(out) | :: | rank | |||
| integer(kind=i32), | intent(out) | :: | size | |||
| type(mpi_context), | intent(in), | optional | :: | ctx |
Select values supplied by the lowest MPI rank whose local flag is true.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| logical, | intent(in) | :: | local_present | |||
| integer(kind=i32), | intent(in) | :: | local_values(:) | |||
| integer(kind=i32), | intent(out) | :: | selected_rank | |||
| integer(kind=i32), | intent(out) | :: | selected_values(:) |
倍精度配列の総和Allreduceをin-placeで実行する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| real(kind=dp), | intent(inout) | :: | values(:) |
倍精度スカラの総和Allreduceをin-placeで実行する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| real(kind=dp), | intent(inout) | :: | value |
倍精度配列の最小値Allreduceをin-placeで実行する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| real(kind=dp), | intent(inout) | :: | values(:) |
倍精度配列の最大値Allreduceをin-placeで実行する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| real(kind=dp), | intent(inout) | :: | values(:) |
32bit整数配列の総和Allreduceをin-placeで実行する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| integer(kind=i32), | intent(inout) | :: | values(:) |
64bit整数配列の総和Allreduceをin-placeで実行する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| integer(kind=i64), | intent(inout) | :: | values(:) |
32bit整数スカラの総和Allreduceをin-placeで実行する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| integer(kind=i32), | intent(inout) | :: | value |
32bit整数スカラの最小値Allreduceをin-placeで実行する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| integer(kind=i32), | intent(inout) | :: | value |
32bit整数スカラの最大値Allreduceをin-placeで実行する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| integer(kind=i32), | intent(inout) | :: | value |
root rankの32bit整数配列を全rankへbroadcastする。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| integer(kind=i32), | intent(inout) | :: | values(:) | |||
| integer(kind=i32), | intent(in) | :: | root |
root rankの倍精度配列を全rankへbroadcastする。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| real(kind=dp), | intent(inout) | :: | values(:) | |||
| integer(kind=i32), | intent(in) | :: | root |
各rankの可変長倍精度配列をrootへrank順に連結する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| real(kind=dp), | intent(in) | :: | local_values(:) | |||
| real(kind=dp), | intent(out), | allocatable | :: | global_values(:) | ||
| integer(kind=i32), | intent(in) | :: | root |
各rankが values の自分の区間 (displacements(rank+1)+1 から counts(rank+1) 要素) を持ち寄り、
全rankで values の全区間を揃える。非MPIまたは単一rankでは何もしない。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| real(kind=dp), | intent(inout) | :: | values(*) | |||
| integer(kind=i32), | intent(in) | :: | counts(:) | |||
| integer(kind=i32), | intent(in) | :: | displacements(:) |
mpi_allgatherv_inplace_real_dp の 32 bit 整数版。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mpi_context), | intent(in) | :: | ctx | |||
| integer(kind=i32), | intent(inout) | :: | values(*) | |||
| integer(kind=i32), | intent(in) | :: | counts(:) | |||
| integer(kind=i32), | intent(in) | :: | displacements(:) |