PB3D [2.47]
Ideal linear high-n MHD stability in 3-D
Loading...
Searching...
No Matches
mpi_utilities Module Reference

Numerical utilities related to MPI. More...

Interfaces and Types

interface  get_ser_var
 Gather parallel variable in serial version on group master. More...
interface  get_ghost_arr
 Fill the ghost regions in an array. More...
interface  broadcast_var
 Wrapper function to broadcast a single variable using MPI. More...

Functions/Subroutines

integer function, public redistribute_var (var, dis_var, lims, lims_dis)
 Redistribute variables according to new limits.
integer function, public wait_mpi ()
 Wait for all processes, wrapper to MPI barrier.
integer function, public lock_req_acc (lock, blocking)
 Request access to lock of a BL (blocking) or optionally a NB (non-blocking) type.
integer function, public lock_return_acc (lock)
 Returns access to a lock.
integer function, public lock_wl_change (wl_action, blocking, lock_loc, wl, ranks)
 Adds, removes or sets to active a rank from the waiting list for a lock and returns the lock waiting list:
character(len=max_str_ln) function, public lock_header (lock_loc)
 Returns the header for lock debug messages.

Variables

logical, public debug_lock = .false.
 print debug information about lock operations
integer, public n_waits = 0
 number of waits

Detailed Description

Numerical utilities related to MPI.

This includes a lock system, which can be both BL (blocking) or NB (non-blocking). It is based on the implementation of an MPI-IO atomic mode without file support, described in [13].

See also
See mpi_vars.

The reason for this was the fact that using a simple lock file can lead to crashes.

Note
A downside of this method is that in some rare cases a deadlock may occur as the master process, which contains the shared variable with a window that other processes may use, is idle and waiting, whereas the others are still performing lock options. As the master is idle and waiting, its MPI asynchronous communication is not performed. To remedy this, just call wait_MPI() after procedures where lock operations are performed.

Function/Subroutine Documentation

◆ lock_header()

character(len=max_str_ln) function, public mpi_utilities::lock_header ( type(lock_type), intent(in) lock_loc)

Returns the header for lock debug messages.

Note
Debug version only
Parameters
[in]lock_loclock

Definition at line 1216 of file MPI_utilities.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lock_req_acc()

integer function, public mpi_utilities::lock_req_acc ( type(lock_type), intent(inout) lock,
logical, intent(in), optional blocking )

Request access to lock of a BL (blocking) or optionally a NB (non-blocking) type.

Note
Based on [13].
Returns
ierr

Definition at line 764 of file MPI_utilities.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lock_return_acc()

integer function, public mpi_utilities::lock_return_acc ( type(lock_type), intent(inout) lock)

Returns access to a lock.

The blocking property has been set when requesting the lock.

Note
Based on [13].
Returns
ierr

Definition at line 871 of file MPI_utilities.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lock_wl_change()

integer function, public mpi_utilities::lock_wl_change ( integer, intent(in) wl_action,
logical, intent(in) blocking,
type(lock_type), intent(inout) lock_loc,
integer, dimension(:), intent(inout), allocatable wl,
integer, dimension(:), intent(in), optional ranks )

Adds, removes or sets to active a rank from the waiting list for a lock and returns the lock waiting list:

Actions:

  • wl_action = 0: remove
  • wl_action = 1: add
  • wl_action = 2: active

Or negative equivalents for non-blocking (NB) procs.

Optionally, the rank(s) of the process for which to perform this action can be passed. This is useful for doing the same action on multiple processes.

Note
Based on [13].
Debug version only
Returns
ierr
Parameters
[in]wl_actionaction to perform
[in]blockingthe ranks to be changed are blocking
[in,out]lock_loclock
[in,out]wlwaiting list
[in]ranksrank(s) for which to perform option

Definition at line 1109 of file MPI_utilities.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ redistribute_var()

integer function, public mpi_utilities::redistribute_var ( real(dp), dimension(:), intent(in) var,
real(dp), dimension(:), intent(inout) dis_var,
integer, dimension(2), intent(in) lims,
integer, dimension(2), intent(in) lims_dis )

Redistribute variables according to new limits.

Parameters
[in]varparallel vector
[in,out]dis_varredistributed vector
[in]limsindices of parallel vector
[in]lims_disindices of redistributed parallel vector

Definition at line 329 of file MPI_utilities.f90.

Here is the caller graph for this function:

◆ wait_mpi()

integer function, public mpi_utilities::wait_mpi

Wait for all processes, wrapper to MPI barrier.

Returns
ierr

Definition at line 743 of file MPI_utilities.f90.

Here is the caller graph for this function:

Variable Documentation

◆ debug_lock

logical, public mpi_utilities::debug_lock = .false.

print debug information about lock operations

Note
Debug version only

Definition at line 40 of file MPI_utilities.f90.

◆ n_waits

integer, public mpi_utilities::n_waits = 0

number of waits

Note
Debug version only

Definition at line 41 of file MPI_utilities.f90.