mpi_controller_procedures Submodule

Contains module procedures associated with the mpi controller class


Uses


Module Functions

pure module function getWorldRank(this) result(rank)

Getter for worldRank

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(in) :: this

Return Value integer(kind=ik)

pure module function getWorldSize(this) result(size)

Getter for worldSize

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(in) :: this

Return Value integer(kind=ik)

pure module function getRowRank(this) result(rank)

Getter for rowRank

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(in) :: this

Return Value integer(kind=ik)

pure module function getRowSize(this) result(size)

Getter for rowSize

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(in) :: this

Return Value integer(kind=ik)

pure module function getColRank(this) result(rank)

Getter for columnRank

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(in) :: this

Return Value integer(kind=ik)

pure module function getColSize(this) result(size)

Getter for columnSize

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(in) :: this

Return Value integer(kind=ik)

pure module function getXHaloWidth(this) result(xHaloWidth)

Getter for xHaloWidth

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(in) :: this

Return Value integer(kind=ik)

module function isTrueEverywhere(this, input) result(isTrue)

Return true if input is true on every processor

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
logical, intent(inout) :: input

Return Value logical

module function allreduceMin(this, input) result(min)

Return min value on all processors

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
real(kind=rk), intent(inout) :: input

Return Value real(kind=rk)

module function allreduceMax(this, input) result(max)

Return max value on all processors

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
real(kind=rk), intent(inout) :: input

Return Value real(kind=rk)


Module Subroutines

module subroutine initMPIController(this, numProcsX, numProcsH)

MPI controller initialization routine - initializes communicators used outside of PETSc. Optionally sets up row/column communicators.

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
integer(kind=ik), intent(in), optional :: numProcsX

Number of processes in the x-direction

integer(kind=ik), intent(in), optional :: numProcsH

Number of processes in the h-direction

module subroutine broadcastVarInRow(this, varContainer, name)

Broadcast variable with given name from row rank 0 process to other row processes - to be used only with non-distribution variables

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
type(VariableContainer), intent(inout) :: varContainer

Variable container in which to broadcasty

character(len=*), intent(in) :: name

Name of variable to broadcast

module subroutine calculateRowDistData(this, partitionObj, xHaloWidth, numV)

Initialize distribution DoF data used in exchanging distribution data in a row

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
type(Partition), intent(in) :: partitionObj

Partition object used to retrieve DoF information

integer(kind=ik), intent(in) :: xHaloWidth

Halo width in x-direction

integer(kind=ik), intent(in) :: numV

Number of cells in v-grid

module subroutine exchangeDistVarInRow(this, varContainer, name)

Exchanges a distribution variable in a processor row

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
type(VariableContainer), intent(inout) :: varContainer

Variable container in which to broadcast

character(len=*), intent(in) :: name

Name of variable to broadcast

module subroutine initializeNeighbourPairs(this, periodic)

Initialize neighbour pairs - if periodic in X adds additional pair to handle this

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
logical, intent(in) :: periodic

module subroutine exchangeVarXHalos(this, varContainer, name, varIsDist)

Exchanges a halos in x direction for given variable

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
type(VariableContainer), intent(inout) :: varContainer

Variable container in which to perform halo exchange

character(len=*), intent(in) :: name

Name of variable to exchange

logical, intent(in) :: varIsDist

Set to true if variable is a distribution

module subroutine setUpRows(this, numProcsX, numProcsH)

Set up row/column communication in controller

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
integer(kind=ik), intent(in) :: numProcsX

Number of processes in the x-direction

integer(kind=ik), intent(in) :: numProcsH

Number of processes in the h-direction

module subroutine gatherVar(this, localVec, globVec, varIsDist)

Gather variable values into global vector for output on rank 0. If globVec in not allocated it will be allocated to the correct size, otherwise it is assumed it is of the correct size.

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
real(kind=rk), intent(in), dimension(:) :: localVec

Local vector to gather

real(kind=rk), intent(inout), allocatable, dimension(:) :: globVec

Global vector on rank 0 to gather into

logical, intent(in) :: varIsDist

Set to true if the gathered variable is a distribution

module subroutine scatterVar(this, globVec, localVec, varIsDist)

Scatter global variable values into local vectors from rank 0.

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
real(kind=rk), intent(inout), dimension(:) :: globVec

Global vector on rank 0 to scatter from

real(kind=rk), intent(inout), allocatable, dimension(:) :: localVec

Local vector to scatter into

logical, intent(in) :: varIsDist

Set to true if the scattered variable is a distribution

module subroutine broadcastReal(this, vec, rootProc)

Broadcast real vector from rank rootProc

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
real(kind=rk), intent(inout), dimension(:) :: vec
integer(kind=ik), intent(in), optional :: rootProc

module subroutine broadcastInt(this, vec)

Broadcast integer vector from rank 0

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
integer(kind=ik), intent(inout), dimension(:) :: vec

module subroutine broadcastLogical(this, vec)

Broadcast logical vector from rank 0

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
logical, intent(inout), dimension(:) :: vec

module subroutine broadcastCharacter(this, vec)

Broadcast character vector from rank 0

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this
character(len=:), intent(inout), allocatable :: vec

module subroutine barrier(this)

Calls MPI barrier on commWorld

Arguments

Type IntentOptional Attributes Name
class(MPIController), intent(inout) :: this