MatrixReduceModule Module

Module for reducing matrices across processes.



Contents


Interfaces

public interface ReduceAndComposeMatrixSizes

  • private subroutine ReduceAndComposeMatrixSizes_lsr(matrix, comm, gathered_matrix, helper)

    The first routine to call, gathers the sizes of the data to be sent.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsr), intent(in) :: matrix

    The matrix to send.

    integer, intent(inout) :: comm

    The communicator to send along.

    type(Matrix_lsr), intent(inout) :: gathered_matrix

    The matrix we are gathering.

    type(ReduceHelper_t), intent(inout) :: helper

    The helper associated with this gather.

  • private subroutine ReduceAndComposeMatrixSizes_lsc(matrix, comm, gathered_matrix, helper)

    The first routine to call, gathers the sizes of the data to be sent.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsc), intent(in) :: matrix
    integer, intent(inout) :: comm
    type(Matrix_lsc), intent(inout) :: gathered_matrix

    The matrix we are gathering.

    type(ReduceHelper_t), intent(inout) :: helper

public interface ReduceAndComposeMatrixData

  • private subroutine ReduceAndComposeMatrixData_lsr(matrix, comm, gathered_matrix, helper)

    Second function to call, will gather the data and align one matrix next to another.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsr), intent(in) :: matrix

    The matrix to send.

    integer, intent(inout) :: comm

    The communicator to send along.

    type(Matrix_lsr), intent(inout) :: gathered_matrix

    The matrix we are gathering.

    type(ReduceHelper_t), intent(inout) :: helper

    The helper associated with this gather.

  • private subroutine ReduceAndComposeMatrixData_lsc(matrix, comm, gathered_matrix, helper)

    Second function to call, will gather the data and align one matrix next to another.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsc), intent(in) :: matrix

    The matrix to send.

    integer, intent(inout) :: comm

    The communicator to send along.

    type(Matrix_lsc), intent(inout) :: gathered_matrix

    The matrix we are gathering.

    type(ReduceHelper_t), intent(inout) :: helper

    The helper associated with this gather.

  • private pure subroutine ReduceAndComposeMatrixCleanup_lsr(matrix, gathered_matrix, helper)

    Third function to call, finishes setting up the matrices.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsr), intent(in) :: matrix

    The matrix to send.

    type(Matrix_lsr), intent(inout) :: gathered_matrix

    The matrix we are gathering.

    type(ReduceHelper_t), intent(inout) :: helper

    The helper associated with this gather.

  • private pure subroutine ReduceAndComposeMatrixCleanup_lsc(matrix, gathered_matrix, helper)

    Third function to call, finishes setting up the matrices.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsc), intent(in) :: matrix

    The matrix to send.

    type(Matrix_lsc), intent(inout) :: gathered_matrix

    The matrix we are gathering.

    type(ReduceHelper_t), intent(inout) :: helper

    The helper associated with this gather.

public interface ReduceAndComposeMatrix

  • private subroutine ReduceAndComposeMatrix_lsr(matrix, comm, gathered_matrix)

    Reduce and sum the matrices in one step. If you use this method, you lose the opportunity for overlapping communication.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsr), intent(in) :: matrix

    The matrix to send.

    integer, intent(inout) :: comm

    The communicator to send along.

    type(Matrix_lsr), intent(inout) :: gathered_matrix

    The matrix we are gathering.

  • private subroutine ReduceAndComposeMatrix_lsc(matrix, comm, gathered_matrix)

    Reduce and sum the matrices in one step. If you use this method, you lose the opportunity for overlapping communication.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsc), intent(in) :: matrix

    The matrix to send.

    integer, intent(inout) :: comm

    The communicator to send along.

    type(Matrix_lsc), intent(inout) :: gathered_matrix

    The matrix we are gathering.

public interface ReduceAndSumMatrixSizes

  • private subroutine ReduceAndSumMatrixSizes_lsr(matrix, comm, gathered_matrix, helper)

    The first routine to call, gathers the sizes of the data to be sent.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsr), intent(in) :: matrix

    The matrix to send.

    integer, intent(inout) :: comm

    The communicator to send along.

    type(Matrix_lsr), intent(inout) :: gathered_matrix

    The matrix we are gathering.

    type(ReduceHelper_t), intent(inout) :: helper

    The helper associated with this gather.

  • private subroutine ReduceAndSumMatrixSizes_lsc(matrix, comm, gathered_matrix, helper)

    The first routine to call, gathers the sizes of the data to be sent.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsc), intent(in) :: matrix

    The matrix to send.

    integer, intent(inout) :: comm

    The communicator to send along.

    type(Matrix_lsc), intent(inout) :: gathered_matrix

    The matrix we are gathering.

    type(ReduceHelper_t), intent(inout) :: helper

    The helper associated with this gather.

public interface ReduceAndSumMatrixData

  • private subroutine ReduceAndSumMatrixData_lsr(matrix, comm, gathered_matrix, helper)

    Second routine to call for gathering and summing up the data.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsr), intent(in) :: matrix

    The matrix to send.

    integer, intent(inout) :: comm

    The communicator to send along.

    type(Matrix_lsr), intent(inout) :: gathered_matrix

    The matrix we are gathering.

    type(ReduceHelper_t), intent(inout) :: helper

    The helper associated with this gather.

  • private subroutine ReduceAndSumMatrixData_lsc(matrix, comm, gathered_matrix, helper)

    Second routine to call for gathering and summing up the data.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsc), intent(in) :: matrix

    The matrix to send.

    integer, intent(inout) :: comm

    The communicator to send along.

    type(Matrix_lsc), intent(inout) :: gathered_matrix

    The matrix we are gathering.

    type(ReduceHelper_t), intent(inout) :: helper

    The helper associated with this gather.

public interface ReduceAndSumMatrixCleanup

  • private pure subroutine ReduceAndSumMatrixCleanup_lsr(matrix, gathered_matrix, threshold, helper)

    Finally routine to sum up the matrices.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsr), intent(in) :: matrix

    The matrix to send.

    type(Matrix_lsr), intent(inout) :: gathered_matrix

    The gathered_matrix the matrix being gathered.

    real(kind=NTREAL), intent(in) :: threshold

    The threshold the threshold for flushing values.

    type(ReduceHelper_t), intent(inout) :: helper

    The helper associated with this gather.

  • private pure subroutine ReduceAndSumMatrixCleanup_lsc(matrix, gathered_matrix, threshold, helper)

    Finally routine to sum up the matrices.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsc), intent(in) :: matrix

    The matrix to send.

    type(Matrix_lsc), intent(inout) :: gathered_matrix

    The threshold the threshold for flushing values.

    real(kind=NTREAL), intent(in) :: threshold

    The threshold the threshold for flushing values.

    type(ReduceHelper_t), intent(inout) :: helper

    The helper associated with this gather.

public interface ReduceAndSumMatrix

  • private subroutine ReduceAndSumMatrix_lsr(matrix, comm, gathered_matrix, threshold)

    Reduce and sum the matrices in one step. If you use this method, you lose the opportunity for overlapping communication.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsr), intent(in) :: matrix

    The matrix to send.

    integer, intent(inout) :: comm

    The communicator to send along.

    type(Matrix_lsr), intent(inout) :: gathered_matrix

    The gathered_matrix the matrix being gathered.

    real(kind=NTREAL), intent(in) :: threshold

    The threshold the threshold for flushing values.

  • private subroutine ReduceAndSumMatrix_lsc(matrix, comm, gathered_matrix, threshold)

    Reduce and sum the matrices in one step. If you use this method, you lose the opportunity for overlapping communication.

    Arguments

    Type IntentOptional Attributes Name
    type(Matrix_lsc), intent(in) :: matrix

    The matrix to send.

    integer, intent(inout) :: comm

    The communicator to send along.

    type(Matrix_lsc), intent(inout) :: gathered_matrix

    The threshold the threshold for flushing values.

    real(kind=NTREAL), intent(in) :: threshold

    The threshold the threshold for flushing values.


Derived Types

type, public ::  ReduceHelper_t

A data structure to stores internal information about a reduce call.

Components

Type Visibility Attributes Name Initial
integer, public :: comm_size

Number of processors involved in this gather.

integer, public :: outer_request

A request object for gathering outer indices.

integer, public :: inner_request

A request object for gathering inner indices.

integer, public :: data_request

A request object for gathering data.

integer, public :: error_code

The error code after an MPI call.

integer, public, DIMENSION(:), ALLOCATABLE :: values_per_process

Number of values to gather from each process.

integer, public, DIMENSION(:), ALLOCATABLE :: displacement

The displacements for where those gathered values should go.


Functions

public function TestReduceSizeRequest(helper) result(request_completed)

Test if a request for the size of the matrices is complete.

Arguments

Type IntentOptional Attributes Name
type(ReduceHelper_t), intent(inout) :: helper

The gatherer helper structure.

Return Value logical

True if the request is finished.

public function TestReduceInnerRequest(helper) result(request_completed)

Test if a request for the inner indices of the matrices is complete.

Arguments

Type IntentOptional Attributes Name
type(ReduceHelper_t), intent(inout) :: helper

The gatherer helper structure.

Return Value logical

True if the request is finished.

public function TestReduceDataRequest(helper) result(request_completed)

Test if a request for the data of the matrices is complete.

Arguments

Type IntentOptional Attributes Name
type(ReduceHelper_t), intent(inout) :: helper

The gatherer helper structure.

Return Value logical

True if the request is finished.