m_io_backend Module

(ADaptive Input Output System v2) library. It acts as a translation layer converting generic I/O calls from the session interface into specific calls to the ADIOS2 API.

The adios2_reader_t and adios2_writer_t types defined here extend the abstract base types from m_io_base and implement required procedures

This backend leverages several key features of the underlying ADIOS2 library - engine abstraction - the same API can be used for different transport methods (e.g. BP4, BP5, HDF5) - Asynchronous I/O - by default ADIOS2 uses a deferred transport mode which can improve performance by overlapping computation and I/O - MPI integration - it is designed for large-scale parallel I/O and integrates with MPI, though serial operation is also supported

GPU-aware writes (built with WITH_ADIOS2_GPU_AWARE, which defines X3D2_ADIOS2_CUDA) hand device memory straight to ADIOS2: - the solver backend packs each field into a contiguous, unpadded device buffer (base_backend_t%export_field_to_device), so this module needs no knowledge of the backend's field layout or allocator types - one staging buffer belongs to the open file and is reused across fields and steps, so no device memory is allocated per write - puts are synchronous: ADIOS2 2.12's BP5 engine copies GPU buffers during Put whatever mode is requested, so the buffer is free again as soon as the put returns

Runtime options, read from the environment when the first writer starts: - X3D2_ADIOS2_GPU_WRITE_MODE=auto|gpu|host (default auto): host forces the device-to-host staged path even when GPU-aware writes are available - X3D2_ADIOS2_IO_BENCH=0|1 (default 0): time Put and EndStep per step and print a summary when the file closes, excluding the first bench_warmup_steps steps

Note

This is an internal backend module and should never be used directly. All user interaction must go through m_io_session.


Uses

  • module~~m_io_backend~2~~UsesGraph module~m_io_backend~2 m_io_backend adios2 adios2 module~m_io_backend~2->adios2 cudafor cudafor module~m_io_backend~2->cudafor iso_c_binding iso_c_binding module~m_io_backend~2->iso_c_binding iso_fortran_env iso_fortran_env module~m_io_backend~2->iso_fortran_env m_mpi m_mpi module~m_io_backend~2->m_mpi module~m_base_backend m_base_backend module~m_io_backend~2->module~m_base_backend module~m_common m_common module~m_io_backend~2->module~m_common module~m_field m_field module~m_io_backend~2->module~m_field module~m_io_base m_io_base module~m_io_backend~2->module~m_io_base module~m_logger m_logger module~m_io_backend~2->module~m_logger module~m_nvtx m_nvtx module~m_io_backend~2->module~m_nvtx module~m_base_backend->iso_c_binding module~m_base_backend->m_mpi module~m_base_backend->module~m_common module~m_base_backend->module~m_field module~m_base_backend->module~m_logger module~m_allocator m_allocator module~m_base_backend->module~m_allocator module~m_mesh m_mesh module~m_base_backend->module~m_mesh module~m_poisson_fft m_poisson_fft module~m_base_backend->module~m_poisson_fft module~m_tdsops m_tdsops module~m_base_backend->module~m_tdsops module~m_common->m_mpi module~m_common->module~m_logger module~m_field->iso_c_binding module~m_field->module~m_common module~m_io_base->module~m_base_backend module~m_io_base->module~m_common module~m_io_base->module~m_field module~m_logger->iso_fortran_env module~m_logger->m_mpi module~m_nvtx->iso_c_binding module~m_allocator->module~m_common module~m_allocator->module~m_field module~m_mesh->m_mpi module~m_mesh->module~m_common module~m_mesh->module~m_field module~m_mesh->module~m_logger module~m_mesh_content m_mesh_content module~m_mesh->module~m_mesh_content module~m_poisson_fft->module~m_common module~m_poisson_fft->module~m_field module~m_poisson_fft->module~m_logger module~m_poisson_fft->module~m_mesh module~m_poisson_fft->module~m_tdsops module~m_tdsops->module~m_common module~m_tdsops->module~m_logger module~m_mesh_content->module~m_common module~m_mesh_content->module~m_logger

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: IO_BACKEND_DUMMY = 0
integer, public, parameter :: IO_BACKEND_ADIOS2 = 1
integer, public, parameter :: gpu_write_mode_force_host = 2
character(len=4), public, parameter :: gpu_write_mode_names(0:2) = ["auto", "gpu ", "host"]

Names of the gpu_write_mode_* values, indexed by value


Functions

public function get_default_backend() result(backend)

Arguments

None

Return Value integer

public pure function parse_gpu_write_mode(raw) result(mode)

Map the text of X3D2_ADIOS2_GPU_WRITE_MODE to a gpu_write_mode_* value. Case is ignored, an unknown or empty text gives auto.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: raw

Return Value integer

public function gpu_write_mode_from_env() result(mode)

The gpu_write_mode_* value of the environment variable X3D2_ADIOS2_GPU_WRITE_MODE. An unset or empty variable gives auto.

Arguments

None

Return Value integer

public function count_steps_up_to(filename, variable_name, limit, comm) result(n)

Count the leading steps of a file whose scalar variable_name is no greater than limit. Returns 0 if the variable is not in the file.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename
character(len=*), intent(in) :: variable_name
real(kind=dp), intent(in) :: limit
integer, intent(in) :: comm

Return Value integer

public function read_string_attribute(filename, attribute_name, comm) result(value)

Read a string attribute of a file. Returns an empty string if the attribute is not in the file.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename
character(len=*), intent(in) :: attribute_name
integer, intent(in) :: comm

Return Value character(len=:), allocatable


Subroutines

public subroutine allocate_io_reader(reader)

Arguments

Type IntentOptional Attributes Name
class(io_reader_t), intent(out), allocatable :: reader

public subroutine allocate_io_writer(writer)

Arguments

Type IntentOptional Attributes Name
class(io_writer_t), intent(out), allocatable :: writer