TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
PE_Groups.h
1/****************************************************************************
2* Copyright (c) 2025, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#ifndef PE_Groups_included
17#define PE_Groups_included
18
19#include <TRUSTTabs_forward.h>
20#include <TRUST_Vector.h>
21#include <TRUST_Deriv.h>
22#include <Comm_Group.h>
23
24/*! @brief : Cette classe regroupe des fonctions permettant la creation, la
25 *
26 * destruction et le changement du groupe de processeurs actif.
27 * La creation du groupe principal doit etre dans le MAIN.cpp
28 * et il faut initialiser PE_Groups en lui donnant le groupe principal.
29 * Les autres groupes crees seront du meme type.
30 *
31 * @sa la class Comm_Group
32 *
33 */
35{
36public:
37 inline static const Comm_Group& current_group();
38 static void create_group(const ArrOfInt& liste_pe, OWN_PTR(Comm_Group) &group, int force_Comm_Group_NoParallel = 0);
39 static void init_group(const ArrOfInt& liste_pe, OWN_PTR(Comm_Group) &group);
40 static int enter_group(const Comm_Group& group);
41 static void exit_group();
42 static const int& get_nb_groups();
43 static int rank_translate(int rank, const Comm_Group& group, const Comm_Group& dest_group = current_group());
44 static const Comm_Group& groupe_TRUST();
45 static const Comm_Group& get_node_group();
46 static const Comm_Group& get_node_master();
47 static const Comm_Group& get_user_defined_group();
48 static bool has_user_defined_group();
49
50 static void initialize(const Comm_Group& groupe_trio_u);
51 static void initialize_node(const Comm_Group& ngrp);
52 static void initialize_node_master(const Comm_Group& ngrp);
53 static void initialize_user_defined_group(const Comm_Group& ngrp);
54 static void finalize();
55
56private:
57 static int check_current_group();
58 // This pointer always points to the last element of the "groups" vector in the .cpp file
59 static const Comm_Group *current_group_;
60};
61
62/*! @brief renvoie une reference au groupe de processeurs actif courant
63 *
64 */
66{
67 assert(check_current_group());
68 return *current_group_;
69}
70
71#endif
: Cette classe decrit un groupe de processeurs sur lesquels
Definition Comm_Group.h:40
: Cette classe regroupe des fonctions permettant la creation, la
Definition PE_Groups.h:35
static void initialize_user_defined_group(const Comm_Group &ngrp)
static int enter_group(const Comm_Group &group)
Si le processeur local appartient au groupe, le groupe courant pour ce processeur devient "group" et ...
static void create_group(const ArrOfInt &liste_pe, OWN_PTR(Comm_Group) &group, int force_Comm_Group_NoParallel=0)
Creation d'un nouveau groupe de processeurs (utilisation possible n'importe ou dans le code).
Definition PE_Groups.cpp:53
static void init_group(const ArrOfInt &liste_pe, OWN_PTR(Comm_Group) &group)
Initialisation d'un nouveau groupe de processeurs deja instantie (utilisation possible n'importe ou d...
Definition PE_Groups.cpp:79
static void initialize_node_master(const Comm_Group &ngrp)
Methode a appeler apres l'initialisation de trio_u_world et de node_group et l'initialisation des com...
static const int & get_nb_groups()
static void finalize()
Methode a appeler en fin d'execution, une fois qu'on est revenu dans le groupe_TRUST() et juste avant...
static const Comm_Group & get_node_master()
Renvoie le groupe contenant le maitre de mon noeud.
static void initialize(const Comm_Group &groupe_trio_u)
Methode a appeler au debut de l'execution (MAIN.
static void initialize_node(const Comm_Group &ngrp)
Methode a appeler apres l'initialisation de trio_u_world et l'initialisation des compteurs statistiqu...
static const Comm_Group & get_user_defined_group()
Renvoie une reference au groupe sur defini par l'utilisateur.
static const Comm_Group & get_node_group()
Renvoie une reference au groupe sur les noeuds.
static bool has_user_defined_group()
static const Comm_Group & current_group()
renvoie une reference au groupe de processeurs actif courant
Definition PE_Groups.h:65
static int rank_translate(int rank, const Comm_Group &group, const Comm_Group &dest_group=current_group())
Calcule le rank dans le groupe courant du processeur de rang "rank" dans le "group".
static const Comm_Group & groupe_TRUST()
Renvoie une reference au groupe de tous les processeurs TRUST.
static void exit_group()
Retourne dans le groupe ou l'on etait avant le dernier enter_group() reussi (dont le resultat a ete 1...