Octopus
multicomm_oct_m Module Reference

This module handles the communicators for the various parallelization strategies. More...

Detailed Description

This module handles the communicators for the various parallelization strategies.

Given a number n_index of indices and their ranges index_range(1:n_index), we divide the n_nodes in groups and create communicators for each group. Each group is associated with one index. The min_range indicates the minimum number of elements in each processor. For example, given min_range(1) = 25000, the algorithm will try to put at least 25000 points in each processor.

Example:

 Given 3 indices with ranges
 index_range(1) = 100000, (number of points in the mesh)
 index_range(2) = 15, (number of states)
 index_range(3) = 2, (number of k-points)

and 12 processors, we could get

 mc%group_sizes = (2, 3, 2)

which means that

  • space is divided in 2 domains per state,
  • the states are divided in 3 groups, i.e. 5 states per processor, and
  • the whole setting is duplicated because of the 2 k-points.

To perform collective operations (like a reduce), you can use the communicators provided in mcgroup_comm(:). For example, to sum over states, the communicator to use is mcgroup_comm(P_STRATEGY_STATES)

You can use the routine multicomm_strategy_is_parallel to know if a certain index is parallelized.

Data Types

type  multicomm_all_pairs_t
 An all-pairs communication schedule for a given group. More...
 
type  multicomm_t
 Stores all communicators and groups. More...
 

Functions/Subroutines

subroutine, public multicomm_all_pairs_copy (apout, apin)
 
subroutine, public multicomm_init (mc, namespace, base_grp, mode_para, n_node, index_range, min_range)
 create index and domain communicators More...
 
subroutine, public multicomm_end (mc)
 
logical pure function, public multicomm_strategy_is_parallel (mc, level)
 
subroutine, public multicomm_create_all_pairs (mpi_grp, ap)
 This routine uses the one-factorization (or near-one-factorization of a complete graph to construct an all-pair communication schedule (cf. Wang, X., Blum, E. K., Parker, D. S., and Massey, D. 1997. The dance-party problem and its application to collective communication in computer networks. Parallel Comput. 23, 8 (Aug. 1997), 1141-1156. More...
 
subroutine, public multicomm_divide_range (nobjs, nprocs, istart, ifinal, lsize, scalapack_compat)
 Divide the range of numbers [1, nobjs] between nprocs processors. More...
 
subroutine, public multicomm_divide_range_omp (nobjs, ini, nobjs_loc)
 Function to divide the range of numbers from 1 to nobjs between all available threads with OpenMP. More...
 
logical pure function, public multicomm_is_slave (this)
 
logical pure function, public multicomm_have_slaves (this)
 

Variables

integer, parameter, public p_master = 1
 
integer, parameter, public p_slave = 2
 
integer, parameter, public par_auto = -1
 
integer, parameter, public par_no = 0
 
integer, parameter n_par_types = 4
 
character(len=11), dimension(0:n_par_types), parameter par_types = (/ "serial ", "ParDomains", "ParStates ", "ParKPoints", "ParOther " /)
 
integer, parameter max_index = 5
 

Function/Subroutine Documentation

◆ multicomm_all_pairs_copy()

subroutine, public multicomm_oct_m::multicomm_all_pairs_copy ( type(multicomm_all_pairs_t), intent(inout)  apout,
type(multicomm_all_pairs_t), intent(in)  apin 
)

Definition at line 245 of file multicomm.F90.

◆ multicomm_init()

subroutine, public multicomm_oct_m::multicomm_init ( type(multicomm_t), intent(out)  mc,
type(namespace_t), intent(in)  namespace,
type(mpi_grp_t), intent(in)  base_grp,
type(calc_mode_par_t), intent(in)  mode_para,
integer, intent(in)  n_node,
integer(int64), dimension(:), intent(inout)  index_range,
integer, dimension(:), intent(in)  min_range 
)

create index and domain communicators

Definition at line 263 of file multicomm.F90.

◆ multicomm_end()

subroutine, public multicomm_oct_m::multicomm_end ( type(multicomm_t), intent(inout)  mc)

Definition at line 890 of file multicomm.F90.

◆ multicomm_strategy_is_parallel()

logical pure function, public multicomm_oct_m::multicomm_strategy_is_parallel ( type(multicomm_t), intent(in)  mc,
integer, intent(in)  level 
)

Definition at line 926 of file multicomm.F90.

◆ multicomm_create_all_pairs()

subroutine, public multicomm_oct_m::multicomm_create_all_pairs ( type(mpi_grp_t), intent(in)  mpi_grp,
type(multicomm_all_pairs_t), intent(out)  ap 
)

This routine uses the one-factorization (or near-one-factorization of a complete graph to construct an all-pair communication schedule (cf. Wang, X., Blum, E. K., Parker, D. S., and Massey, D. 1997. The dance-party problem and its application to collective communication in computer networks. Parallel Comput. 23, 8 (Aug. 1997), 1141-1156.

Definition at line 944 of file multicomm.F90.

◆ multicomm_divide_range()

subroutine, public multicomm_oct_m::multicomm_divide_range ( integer, intent(in)  nobjs,
integer, intent(in)  nprocs,
integer, dimension(:), intent(out)  istart,
integer, dimension(:), intent(out)  ifinal,
integer, dimension(:), intent(out), optional  lsize,
logical, intent(in), optional  scalapack_compat 
)

Divide the range of numbers [1, nobjs] between nprocs processors.

Routine is "thread safe" but cannot be made pure due to the use of ASSERT macro

Parameters
[in]nobjsNumber of points to divide
[in]nprocsNumber of processors
[out]lsizeNumber of objects in each partition

Definition at line 1036 of file multicomm.F90.

◆ multicomm_divide_range_omp()

subroutine, public multicomm_oct_m::multicomm_divide_range_omp ( integer, intent(in)  nobjs,
integer, intent(out)  ini,
integer, intent(out)  nobjs_loc 
)

Function to divide the range of numbers from 1 to nobjs between all available threads with OpenMP.

Parameters
[in]nobjsNumber of points to divide
[out]iniStart point of the partition
[out]nobjs_locNumber of objects in each partition

Definition at line 1112 of file multicomm.F90.

◆ multicomm_is_slave()

logical pure function, public multicomm_oct_m::multicomm_is_slave ( type(multicomm_t), intent(in)  this)

Definition at line 1134 of file multicomm.F90.

◆ multicomm_have_slaves()

logical pure function, public multicomm_oct_m::multicomm_have_slaves ( type(multicomm_t), intent(in)  this)

Definition at line 1142 of file multicomm.F90.

Variable Documentation

◆ p_master

integer, parameter, public multicomm_oct_m::p_master = 1

Definition at line 181 of file multicomm.F90.

◆ p_slave

integer, parameter, public multicomm_oct_m::p_slave = 2

Definition at line 181 of file multicomm.F90.

◆ par_auto

integer, parameter, public multicomm_oct_m::par_auto = -1

Definition at line 185 of file multicomm.F90.

◆ par_no

integer, parameter, public multicomm_oct_m::par_no = 0

Definition at line 185 of file multicomm.F90.

◆ n_par_types

integer, parameter multicomm_oct_m::n_par_types = 4
private

Definition at line 189 of file multicomm.F90.

◆ par_types

character(len=11), dimension(0:n_par_types), parameter multicomm_oct_m::par_types = (/ "serial ", "ParDomains", "ParStates ", "ParKPoints", "ParOther " /)
private

Definition at line 190 of file multicomm.F90.

◆ max_index

integer, parameter multicomm_oct_m::max_index = 5
private

Definition at line 199 of file multicomm.F90.