ProcessGridModule Module

A module to manage the process grid.



Contents


Variables

Type Visibility Attributes Name Initial
type(ProcessGrid_t), public, TARGET, SAVE :: global_grid

The default process grid.


Interfaces

public interface ConstructProcessGrid

  • private subroutine ConstructProcessGrid_full(world_comm, process_rows, process_columns, process_slices, be_verbose_in)

    Setup the default process grid.

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: world_comm

    A communicator that every process in the grid is a part of.

    integer, intent(in) :: process_rows

    The number of grid rows.

    integer, intent(in) :: process_columns

    The number of grid columns.

    integer, intent(in) :: process_slices

    The number of grid slices.

    logical, intent(in), optional :: be_verbose_in

    Set true to print process grid info.

  • private subroutine ConstructProcessGrid_onlyslice(world_comm, process_slices_in, be_verbose_in)

    Setup a process grid specifying only the slices

    Arguments

    Type IntentOptional Attributes Name
    integer, intent(in) :: world_comm

    A communicator that every process in the grid is a part of.

    integer, intent(in), optional :: process_slices_in

    The number of grid slices.

    logical, intent(in), optional :: be_verbose_in

    Set true to print process grid info.

public interface ConstructNewProcessGrid

  • private subroutine ConstructNewProcessGrid_full(grid, world_comm, process_rows, process_columns, process_slices)

    Construct a process grid.

    Arguments

    Type IntentOptional Attributes Name
    type(ProcessGrid_t), intent(inout) :: grid

    The grid to construct

    integer, intent(in) :: world_comm

    A communicator that every process in the grid is a part of.

    integer, intent(in) :: process_rows

    The number of grid rows.

    integer, intent(in) :: process_columns

    The number of grid columns.

    integer, intent(in) :: process_slices

    The number of grid slices.

  • private subroutine ConstructNewProcessGrid_onlyslice(grid, world_comm, process_slices_in)

    Setup a process grid specifying only the slices

    Arguments

    Type IntentOptional Attributes Name
    type(ProcessGrid_t), intent(inout) :: grid

    The grid to construct

    integer, intent(in) :: world_comm

    A communicator that every process in the grid is a part of.

    integer, intent(in), optional :: process_slices_in

    The number of grid slices.


Derived Types

type, public ::  ProcessGrid_t

A datatype which stores a process grid and all its communicators.

Components

Type Visibility Attributes Name Initial
integer, public :: total_processors

total processors in the grid.

integer, public :: num_process_rows

number of rows in the grid.

integer, public :: num_process_columns

number of columns in the grid.

integer, public :: num_process_slices

number of 2D slices in the grid.

integer, public :: slice_size

the size of a 2D slice.

integer, public :: my_slice

which slice is the current process in.

integer, public :: my_row

which row is the current process in.

integer, public :: my_column

which column is the current process in.

integer, public :: global_rank

current process rank amongst processes.

integer, public :: within_slice_rank

rank for within slice communication.

integer, public :: between_slice_rank

rank for between slice communication.

integer, public :: column_rank

rank for within column communication.

integer, public :: row_rank

rank for within row communication.

integer, public :: global_comm

communicator with every other process.

integer, public :: row_comm

communicator within a row.

integer, public :: column_comm

communicator within a column.

integer, public :: within_slice_comm

communicator within a slice.

integer, public :: between_slice_comm

communicator between slices.

integer, public :: grid_error

stores errors from MPI calls.

integer, public :: RootID = 0

Which rank is root?

integer, public :: block_multiplier

Block scaling factor.

integer, public :: number_of_blocks_columns

number of column blocks.

integer, public :: number_of_blocks_rows

number of row blocks.

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

blocked communicator within a row.

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

blocked communicator within a column.

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

blocked communicator within a slice.

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

blocked communicator between slices.

integer, public :: omp_max_threads

The maximum number of openmp threads.


Functions

public function IsRoot(grid_in) result(is_root)

Check if the current process is the root process.

Arguments

Type IntentOptional Attributes Name
type(ProcessGrid_t), intent(in), optional :: grid_in

The process grid.

Return Value logical

True if the current process is root.

public function GetMySlice(grid) result(return_val)

Get the slice of the current process.

Arguments

Type IntentOptional Attributes Name
type(ProcessGrid_t), intent(in), optional :: grid

The process grid.

Return Value integer

Slice number of the current process.

public function GetMyColumn(grid) result(return_val)

Get the column of the current process.

Arguments

Type IntentOptional Attributes Name
type(ProcessGrid_t), intent(in), optional :: grid

The process grid.

Return Value integer

The column number of the current process.

public function GetMyRow(grid) result(return_val)

Get the row of the current process.

Arguments

Type IntentOptional Attributes Name
type(ProcessGrid_t), intent(in), optional :: grid

The process grid.

Return Value integer

The row number of the current process.


Subroutines

public subroutine CopyProcessGrid(old_grid, new_grid)

Copy a process grid. Note that this makes a complete and independent copy of the process grid. Which of course means that whatever is currently stored in new_grid will be destroyed, so do not leave any matrices pointing to it.

Arguments

Type IntentOptional Attributes Name
type(ProcessGrid_t), intent(in) :: old_grid

The grid to copy.

type(ProcessGrid_t), intent(inout) :: new_grid

New_grid = old_grid

public recursive subroutine DestructProcessGrid(grid_in)

Destruct a process grid. Be careful about doing this. Matrices have pointers to process grids. If you destruct a process grid without destructing the matrices pointing to it, they will become unusable.

Arguments

Type IntentOptional Attributes Name
type(ProcessGrid_t), intent(inout), optional :: grid_in

The grid to destruct. If none specified this destroys the global grid.

public subroutine SplitProcessGrid(old_grid, new_grid, my_color, split_slice, between_grid_comm)

Given a process grid, this splits it into two grids of even size

Arguments

Type IntentOptional Attributes Name
type(ProcessGrid_t), intent(inout) :: old_grid

The old grid to split

type(ProcessGrid_t), intent(inout) :: new_grid

The new grid that we are creating

integer, intent(out) :: my_color

A color value indicating which set this process was split into

logical, intent(out) :: split_slice

True if we were able to split along slices.

integer, intent(out) :: between_grid_comm

A communicator for sending messages between groups.

public subroutine ComputeGridSize(total_processors, set_slices, rows, columns)

Sometimes we only want to specify for a process grid the number of slices and then automatically compute the right number of rows and columns.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: total_processors

Total processors in the grid

integer, intent(in) :: set_slices

Desired number of slices

integer, intent(out) :: rows

Computed number of rows

integer, intent(out) :: columns

Computed number of columns

public recursive subroutine WriteProcessGridInfo(this)

Write out some basic information about this process grid to the log.

Arguments

Type IntentOptional Attributes Name
type(ProcessGrid_t), intent(in), optional :: this

The grid to print about. If not specified, global information printed.