TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
PE_Groups Class Reference

This class groups functions for creating, destroying and changing the active processor group. More...

#include <PE_Groups.h>

Static Public Member Functions

static const Comm_Groupcurrent_group ()
 Returns a reference to the current active processor group.
static void create_group (const ArrOfInt &liste_pe, OWN_PTR(Comm_Group) &group, int force_Comm_Group_NoParallel=0)
 Creates a new processor group (can be called anywhere in the code).
static void init_group (const ArrOfInt &liste_pe, OWN_PTR(Comm_Group) &group)
 Initializes a new processor group that is already instantiated (can be called anywhere in the code).
static int enter_group (const Comm_Group &group)
 If the local processor belongs to the group, the current group for this processor becomes "group" and returns 1; otherwise returns 0.
static void exit_group ()
 Returns to the group that was active before the last successful enter_group() call (which returned 1).
static const int & get_nb_groups ()
static int rank_translate (int rank, const Comm_Group &group, const Comm_Group &dest_group=current_group())
 Computes the rank in the current group of the processor with rank "rank" in "group".
static const Comm_Groupgroupe_TRUST ()
 Returns a reference to the group containing all TRUST processors.
static const Comm_Groupget_node_group ()
 Returns a reference to the node-level communicator group.
static const Comm_Groupget_node_master ()
 Returns the group containing the master of my node.
static const Comm_Groupget_user_defined_group ()
 Returns a reference to the user-defined group.
static bool has_user_defined_group ()
static void initialize (const Comm_Group &groupe_trio_u)
 Method to call at the beginning of execution (MAIN.cpp). Initializes current_group() with groupe_trio_u.
static void initialize_node (const Comm_Group &ngrp)
 Method to call after the initialization of trio_u_world and TRUST's statistical counters.
static void initialize_node_master (const Comm_Group &ngrp)
 Method to call after the initialization of trio_u_world, node_group, and TRUST's statistical counters.
static void initialize_user_defined_group (const Comm_Group &ngrp)
static void finalize ()
 Method to call at the end of execution, once back in groupe_TRUST() and just before destroying the main Comm_Group.

Detailed Description

This class groups functions for creating, destroying and changing the active processor group.

The creation of the main group must be done in MAIN.cpp and PE_Groups must be initialized by providing it with the main group. Other groups created will be of the same type.

See also
Comm_Group

Definition at line 32 of file PE_Groups.h.

Member Function Documentation

◆ create_group()

void PE_Groups::create_group ( const ArrOfInt & liste_pe,
OWN_PTR(Comm_Group) & group,
int force_Comm_Group_NoParallel = 0 )
static

Creates a new processor group (can be called anywhere in the code).

Must be called simultaneously on all processors of current_group() with the same liste_pe array. liste_pe is the list of ranks within the current group of processors to include in the new group. The first in the list will be the group master. The list must not contain duplicates and must include at least one processor. This method types and initializes the group object. enter_group() and exit_group() must then be called (as many times as desired).

Parameters
liste_peList of PE ranks within current_group().
groupThe group object to initialize.
force_Comm_Group_NoParallelIf non-zero, force a non-parallel group when possible.

Definition at line 55 of file PE_Groups.cpp.

◆ current_group()

const Comm_Group & PE_Groups::current_group ( )
inlinestatic

Returns a reference to the current active processor group.

Returns
Reference to the current Comm_Group.

Definition at line 64 of file PE_Groups.h.

◆ enter_group()

int PE_Groups::enter_group ( const Comm_Group & group)
static

If the local processor belongs to the group, the current group for this processor becomes "group" and returns 1; otherwise returns 0.

A reference to the current group is saved and will be restored when exit_group() is called. This method must be called simultaneously on all processors of "group". Each enter_group() must be matched by a corresponding exit_group(). However, it is allowed to enter the same group multiple times in a row, or to enter a larger group than the current one. Example: group1 and group2 form a partition of groupe_TRUST().

int sync_point(int x) { PE_Groups::enter_group(groupe_TRUST()); int i = mp_sum(x); PE_Groups::exit_group(); return i; } if (PE_Groups::enter_group(group1)) { s1 = mp_sum(x); // Sum over group 1 // Sync point with the other group: s_all = sync_point(x); } else if (PE_Groups::enter_group(group2)) { s2 = mp_sum(x); // Sync point with the other group: s_all = sync_point(x); } else { Cerr << "Error: processor " << me() << " is not within a subgroup."; exit(); } PE_Groups::exit_group(); // Exit the subgroup

Parameters
groupThe group to enter.
Returns
1 if the local processor is in the group, 0 otherwise.

Definition at line 120 of file PE_Groups.cpp.

◆ exit_group()

void PE_Groups::exit_group ( )
static

Returns to the group that was active before the last successful enter_group() call (which returned 1).

This method must be called simultaneously on all processors of the current current_group() just before exit_group().

Definition at line 154 of file PE_Groups.cpp.

◆ finalize()

void PE_Groups::finalize ( )
static

Method to call at the end of execution, once back in groupe_TRUST() and just before destroying the main Comm_Group.

Definition at line 272 of file PE_Groups.cpp.

◆ get_nb_groups()

const int & PE_Groups::get_nb_groups ( )
static

Definition at line 283 of file PE_Groups.cpp.

◆ get_node_group()

const Comm_Group & PE_Groups::get_node_group ( )
static

Returns a reference to the node-level communicator group.

Returns
Reference to the node Comm_Group.

Definition at line 200 of file PE_Groups.cpp.

◆ get_node_master()

const Comm_Group & PE_Groups::get_node_master ( )
static

Returns the group containing the master of my node.

Returns
Reference to the node-master Comm_Group.

Definition at line 210 of file PE_Groups.cpp.

◆ get_user_defined_group()

const Comm_Group & PE_Groups::get_user_defined_group ( )
static

Returns a reference to the user-defined group.

Returns
Reference to the user-defined Comm_Group.

Definition at line 220 of file PE_Groups.cpp.

◆ groupe_TRUST()

const Comm_Group & PE_Groups::groupe_TRUST ( )
static

Returns a reference to the group containing all TRUST processors.

Returns
Reference to the global TRUST Comm_Group.

Definition at line 190 of file PE_Groups.cpp.

◆ has_user_defined_group()

bool PE_Groups::has_user_defined_group ( )
static

Definition at line 254 of file PE_Groups.cpp.

◆ init_group()

void PE_Groups::init_group ( const ArrOfInt & liste_pe,
OWN_PTR(Comm_Group) & group )
static

Initializes a new processor group that is already instantiated (can be called anywhere in the code).

Must be called simultaneously on all processors of current_group() with the same liste_pe array. liste_pe is the list of ranks within the current group of processors to include in the new group. The first in the list will be the group master. The list must not contain duplicates and must include at least one processor. enter_group() and exit_group() must then be called (as many times as desired).

Parameters
liste_peList of PE ranks within current_group().
groupThe already-instantiated group object to initialize.

Definition at line 81 of file PE_Groups.cpp.

◆ initialize()

void PE_Groups::initialize ( const Comm_Group & groupe_trio_u)
static

Method to call at the beginning of execution (MAIN.cpp). Initializes current_group() with groupe_trio_u.

Parameters
groupe_trio_uThe main TRUST communicator group to initialize with.

Definition at line 230 of file PE_Groups.cpp.

◆ initialize_node()

void PE_Groups::initialize_node ( const Comm_Group & ngrp)
static

Method to call after the initialization of trio_u_world and TRUST's statistical counters.

Parameters
ngrpThe node-level communicator group.

Definition at line 242 of file PE_Groups.cpp.

◆ initialize_node_master()

void PE_Groups::initialize_node_master ( const Comm_Group & ngrp)
static

Method to call after the initialization of trio_u_world, node_group, and TRUST's statistical counters.

Parameters
ngrpThe node-master communicator group.

Definition at line 263 of file PE_Groups.cpp.

◆ initialize_user_defined_group()

void PE_Groups::initialize_user_defined_group ( const Comm_Group & ngrp)
static

Definition at line 248 of file PE_Groups.cpp.

◆ rank_translate()

int PE_Groups::rank_translate ( int rank,
const Comm_Group & group,
const Comm_Group & dest_group = current_group() )
static

Computes the rank in the current group of the processor with rank "rank" in "group".

Requires 0 <= rank < group.nproc(). Returns -1 if the processor is not in the current group.

Parameters
rankRank in the source group.
groupThe source group.
dest_groupThe destination group.
Returns
Rank in the destination group, or -1 if not present.

Definition at line 178 of file PE_Groups.cpp.


The documentation for this class was generated from the following files: