Appearance
adam_mpih_nvf_object
ADAM, MPI handler class definition, NVF backend.
Extend common mpih class adding NVF features.
Source: src/lib/nvf/adam_mpih_nvf_object.F90
Dependencies
Contents
- mpih_nvf_object
- initialize
- check_cuda_error
- load_from_file
- print_device_properties
- set_cuda_dimensions
- description
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
CUDA_SILENT_ERR | integer(kind=I4P) | parameter | CUDA silent error code. |
INI_SECTION_NAME | character(len=4) | parameter | INI (config) file section name containing configs. |
Derived Types
mpih_nvf_object
MPI handler class, NVF backend.
Inheritance
Extends: mpih_object
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
myrank | integer(kind=I4P) | MPI rank process. | |
myrankstr | character(len=:) | allocatable | MPI rank process stringified. |
procs_number | integer(kind=I4P) | Number of MPI processes (MPI_COMM_WORLD). | |
node_comm | integer(kind=I4P) | Node-local (shared-memory) communicator. | |
has_node_comm | logical | node_comm split already. | |
is_initialized | logical | initialize ran: later calls return at once (#80 P3). | |
node_procs_number | integer(kind=I4P) | Number of MPI processes sharing THIS node's RAM. | |
memory_avail | real(kind=R8P) | CPU memory available (GB) for each process. | |
error | integer(kind=I4P) | Error traping flag. | |
timing | real(kind=R8P) | Tic toc timing. | |
tictoc | integer(kind=I4P) | Next is tic or toc? | |
mydev | integer(kind=I4P) | My GPU rank. | |
local_comm | integer(kind=I4P) | Local communicator. | |
iercuda | integer(kind=I4P) | Error trapping flag for CUDAFortran. | |
cblk | integer(kind=I4P) | Default CUDA block dimensions. | |
grid | type(dim3) | CUDA grid and block. | |
tBlock | type(dim3) | CUDA grid and block. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
abort | pass(self) | Handy MPI abort wrapper. |
barrier | pass(self) | Handy MPI barrier wrapper. |
error_stop | pass(self) | Stop run with error output. |
finalize | pass(self) | Handy MPI finalize wrapper. |
print_message | pass(self) | Print a message on stdout with rank prefix. |
tictoc_timing | pass(self) | Return the last tic toc timing. |
tic | pass(self) | Start a tic toc timing. |
toc | pass(self) | Stop a tic toc timing. |
initialize | pass(self) | Initialize MPI handler data. |
check_cuda_error | pass(self) | Check if CUDA error occurs and abort in case. |
description | pass(self) | Return pretty-printed object description. |
load_from_file | pass(self) | Load config from file. |
print_device_properties | pass(self) | Pretty print device properties. |
set_cuda_dimensions | pass(self) | Compute CUDA grid dimensions for GPU parallel computations. |
mpih_nvf_object%abort
Handy MPI abort wrapper.
fortran
subroutine abort(self, error_code, msg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_object) | inout | MPI handler. | |
error_code | integer(kind=I4P) | in | optional | Abort error code. |
msg | character(len=*) | in | optional | Error message. |
mpih_nvf_object%barrier
Handy MPI barrier wrapper.
fortran
subroutine barrier(self, tictoc, timing, single)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_object) | inout | MPI handler. | |
tictoc | logical | in | optional | Activate tic toc timing between 2 barrier calls. |
timing | real(kind=R8P) | out | optional | Current timing. |
single | logical | in | optional | Single tictoc for one-shot timing. |
Call graph
mpih_nvf_object%error_stop
Stop the run with error output, aborting every rank.
The error may be rank-local (a check only some ranks evaluate): MPI_ABORT on MPI_COMM_WORLD terminates all the ranks. MPI_FINALIZE would block the failing rank until the others finalize, while they block forever in their next collective (issue #43). The message is flushed first and the rank sleeps 0.5 s before the abort, so the launcher forwards it (Open MPI kills the ranks at once, and output not yet forwarded is lost: measured). Without MPI (not yet initialized, or already finalized) the process stops alone.
fortran
subroutine error_stop(self, msg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_object) | inout | MPI handler. | |
msg | character(len=*) | in | optional | Error message. |
Call graph
mpih_nvf_object%finalize
Handy MPI finalize wrapper.
fortran
subroutine finalize(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_object) | inout | MPI handler. |
Call graph
mpih_nvf_object%print_message
Print a message on stdout with rank prefix.
fortran
subroutine print_message(self, msg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_object) | in | MPI handler. | |
msg | character(len=*) | in | Message to print. |
Call graph
mpih_nvf_object%tictoc_timing
Return the last tic toc timing.
Returns: real(kind=R8P)
fortran
function tictoc_timing(self) result(timing)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_object) | in | MPI handler. |
Call graph
mpih_nvf_object%tic
Start a tic toc timing.
fortran
subroutine tic(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_object) | inout | MPI handler. |
mpih_nvf_object%toc
Stop a tic toc timing.
Returns: real(kind=R8P)
fortran
function toc(self) result(timing)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_object) | inout | MPI handler. |
Call graph
Subroutines
initialize
Initialize MPI handler data.
fortran
subroutine initialize(self, do_mpi_init, do_device_init, myrankstr_char_length, verbose)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_nvf_object) | inout | MPI handler. | |
do_mpi_init | logical | in | optional | Flag to activate MPI init call. |
do_device_init | logical | in | optional | Flag to activate device init call. |
myrankstr_char_length | integer(kind=I4P) | in | optional | MPI ID string length. |
verbose | logical | in | optional | Trigger verbose output. |
Call graph
check_cuda_error
Check if CUDA error occurs and abort in case.
fortran
subroutine check_cuda_error(self, error_code, msg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_nvf_object) | inout | MPI handler. | |
error_code | integer(kind=I4P) | in | optional | Abort error code. |
msg | character(len=*) | in | optional | Error message. |
Call graph
load_from_file
Load config from file.
fortran
subroutine load_from_file(self, file_parameters)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_nvf_object) | inout | MPI handler. | |
file_parameters | type(file_ini) | in | Simulation parameters ini file handler. |
Call graph
print_device_properties
Pretty print device properties.
fortran
subroutine print_device_properties(self, device_properties)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_nvf_object) | in | MPI handler. | |
device_properties | type(cudadeviceprop) | in | Device properties. |
Call graph
set_cuda_dimensions
Compute CUDA grid dimensions for GPU parallel computations.
fortran
subroutine set_cuda_dimensions(self, cgrd, cblk)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_nvf_object) | inout | MPI handler. | |
cgrd | integer(kind=I4P) | in | CUDA grid dimensions. | |
cblk | integer(kind=I4P) | in | optional | CUDA block dimensions. |
Functions
description
Return a pretty-formatted object description.
Attributes: pure
Returns: character(len=:)
fortran
function description(self) result(desc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(mpih_nvf_object) | in | MPI handler. |
Call graph