pc_type Derived Type

type, private :: pc_type

This is the type which controls/organises the parallel data decomposition etc.


Contents

Source Code


Components

Type Visibility Attributes Name Initial
integer, public, dimension(:,:), allocatable :: is_local

Is the given it,ik on this proc?

type(comm_type), public, dimension(:,:), allocatable :: itik_subcom

Cell level sub-communicators

integer, public, dimension(:,:), allocatable :: nproc_per_cell

How many procs have this cell

integer, public, dimension(:,:), allocatable :: nresp_per_cell

How many rows are we personally responsible for in each cell

integer, public, dimension(:,:), allocatable :: navail_per_cell

How many rows could we be responsible for in each cell

integer, public :: nresp_tot

Total number of rows available/potentially available

integer, public :: navail_tot

Total number of rows available/potentially available

logical, public :: force_local_invert = .false.

If true then we force local inversion

logical, public :: has_to_gather = .true.

If true we have to gather when calling getfieldeq, determined by decomp routine

integer, public :: decomp_type = 3

This sets what type of decomposition is done


Type-Bound Procedures

procedure, private, :: deallocate => pc_deallocate

  • private subroutine pc_deallocate(self)

    Deallocate storage space

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(inout) :: self

procedure, private, :: allocate => pc_allocate

  • private subroutine pc_allocate(self)

    Allocate storage space

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(inout) :: self

procedure, private, :: debug_print => pc_debug_print

  • private subroutine pc_debug_print(self)

    Debug printing

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(in) :: self

procedure, private, :: current_nresp => pc_current_nresp

  • private function pc_current_nresp(self)

    Return the current number of rows we're responsible for

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(in) :: self

    Return Value integer

procedure, private, :: find_locality => pc_find_locality

  • private subroutine pc_find_locality(self)

    Work out which cells are local

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(inout) :: self

procedure, private, :: count_avail => pc_count_avail

  • private subroutine pc_count_avail(self)

    Work out how many rows are available in each cell

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(inout) :: self

procedure, private, :: has_ik => pc_has_ik

  • private function pc_has_ik(self, ik)

    Determine if we have any cells with passed ik.

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(in) :: self
    integer, intent(in) :: ik

    Return Value logical

procedure, private, :: has_it => pc_has_it

  • private function pc_has_it(self, it)

    Determine if we have any cells with passed it.

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(in) :: self
    integer, intent(in) :: it

    Return Value logical

procedure, private, :: make_decomp => pc_make_decomp

  • private subroutine pc_make_decomp(self)

    A wrapper routine to do the decomposition

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(inout) :: self

procedure, private, :: init => pc_init

  • private subroutine pc_init(self)

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(inout) :: self

procedure, private, :: reset => pc_reset

  • private subroutine pc_reset(self)

    A routine to reset the pc object

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(inout) :: self

procedure, private, :: decomp_all_serial_local => pc_decomp_all_serial_local

  • private subroutine pc_decomp_all_serial_local(self)

    All serial and local || Decomp_type=0

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(inout) :: self

procedure, private, :: decomp_own_serial_local => pc_decomp_own_serial_local

  • private subroutine pc_decomp_own_serial_local(self)

    Serial and local but only for the supercells || Decomp_type=1 for which we have some data

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(inout) :: self

procedure, private, :: decomp_owncells_serial_local => pc_decomp_owncells_serial_local

  • private subroutine pc_decomp_owncells_serial_local(self)

    Serial and local but only for the cells || Decomp_type=2 for which we have some data

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(inout) :: self

procedure, private, :: decomp_owncells_simplempi => pc_decomp_owncells_simplempi

  • private subroutine pc_decomp_owncells_simplempi(self)

    Cells are decomposed based on proc || Decomp_type=3

    Arguments

    Type IntentOptional Attributes Name
    class(pc_type), intent(inout) :: self

Source Code

  type, private :: pc_type
     integer, dimension(:,:), allocatable :: is_local !< Is the given it,ik on this proc?
     !NOTE: We have is_local as integer rather than logical so we can reduce across procs
     !to count how many procs have a given cell
     type(comm_type), dimension(:,:), allocatable :: itik_subcom !< Cell level sub-communicators
     integer, dimension(:,:), allocatable :: nproc_per_cell !< How many procs have this cell
     integer, dimension(:,:), allocatable :: nresp_per_cell !< How many rows are we personally responsible for in each cell
     integer, dimension(:,:), allocatable :: navail_per_cell !< How many rows could we be responsible for in each cell
     integer :: nresp_tot, navail_tot !< Total number of rows available/potentially available
     logical :: force_local_invert=.false. !< If true then we force local inversion
     !the local fields. This may impact diagnostics/parallel writing as it means only the processors g_lo local section
     !of the fields are evolved on this processor.
     !NOTE: If we're doing force local invert really when we populate the supercell we should store all of the 
     !data locally so we don't need to fetch it later.
     logical :: has_to_gather=.true. !< If true we have to gather when calling getfieldeq, determined by decomp routine
     integer :: decomp_type=3 !< This sets what type of decomposition is done
     !By defining your own decomposition routine and associating it with a
     !particular value of decomp_type you should be able to easily add in
     !new parallel decompositions easily without having to rewrite any other
     !routines (although I don't promise this!)
     !//List of currently supported decomp_types
     !0  : Force everything to be done locally and serially, i.e. every proc has all field mat data
     !1  : Force local/serial but only for the supercells we would have anyway
     !2  : Force local/serial but only for the cells we would have anyway
     !3  : Simple mpi, minimal attempt to load balance or avoid splitting small blocks
     !4  : As above but with attempts to avoid splitting small blocks 
   contains
     private
     procedure :: deallocate => pc_deallocate
     procedure :: allocate => pc_allocate
     procedure :: debug_print => pc_debug_print
     procedure :: current_nresp => pc_current_nresp
     procedure :: find_locality => pc_find_locality
     procedure :: count_avail => pc_count_avail
     procedure :: has_ik => pc_has_ik
     procedure :: has_it => pc_has_it
     procedure :: make_decomp => pc_make_decomp
     procedure :: init => pc_init
     procedure :: reset => pc_reset
     !//The different decomposition routines
     procedure :: decomp_all_serial_local => pc_decomp_all_serial_local
     procedure :: decomp_own_serial_local => pc_decomp_own_serial_local
     procedure :: decomp_owncells_serial_local => pc_decomp_owncells_serial_local
     procedure :: decomp_owncells_simplempi => pc_decomp_owncells_simplempi
  end type pc_type