TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Comm_Group_Noparallel.cpp
1/****************************************************************************
2* Copyright (c) 2026, 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#include <Comm_Group_Noparallel.h>
17#include <cstring>
18
19Implemente_instanciable_sans_constructeur_ni_destructeur(Comm_Group_Noparallel,"Comm_Group_Noparallel",Comm_Group);
20
21int Comm_Group_Noparallel::sending_ = 0;
22
23/*! @brief constructeur pour le groupe Tous
24 *
25 */
28
29/*! @brief constructeur pour un sous-groupe //
30 *
31 */
32void Comm_Group_Noparallel::init_group(const ArrOfInt& pe_list)
33{
34 assert(pe_list.size_array() == 1);
36}
37
39
41{
42 assert(0);
43 exit();
44 return os;
45}
46
48{
49 assert(0);
50 exit();
51 return is;
52}
53
54void Comm_Group_Noparallel::barrier(int tag) const { return; }
55
56int Comm_Group_Noparallel::reverse_send_recv_list(const ArrOfInt& src_list, ArrOfInt& dest_list) const
57{
58 assert(src_list.size_array() == 0);
59 assert(dest_list.size_array() == 0);
60 return 0;
61}
62
63void Comm_Group_Noparallel::send_recv_start(const ArrOfInt& send_list, const ArrOfInt& send_size, const char *const*const send_buffers, const ArrOfInt& recv_list, const ArrOfInt& recv_size,
64 char *const*const recv_buffers, TypeHint typehint) const
65{
66 assert(sending_ == 0);
67 if (send_list.size_array() == 1 && send_list[0] == 0 &&
68 recv_list.size_array() == 1 && recv_list[0] == 0 &&
69 send_size.size_array() == 1 && recv_size.size_array() == 1
70 && send_size[0] == recv_size[0])
71 {
72 memcpy(recv_buffers[0], send_buffers[0], send_size[0]);
73 }
74 else
75 {
76 assert(recv_list.size_array() == 0);
77 assert(send_list.size_array() == 0);
78 }
79 sending_ = 1;
80 return;
81}
82
84{
85 assert(sending_);
86 sending_ = 0;
87}
88
89void Comm_Group_Noparallel::send(int pe, const void *buffer, int size, int tag) const { assert(0); }
90
91void Comm_Group_Noparallel::recv(int pe, void *buffer, int size, int tag) const { assert(0); }
92
93void Comm_Group_Noparallel::broadcast(void *buffer, int size, int pe_source) const { return; }
94
95void Comm_Group_Noparallel::all_to_all(const void *src_buffer, void *dest_buffer, int data_size) const
96{
97 memcpy(dest_buffer, src_buffer, data_size);
98}
99
100void Comm_Group_Noparallel::gather(const void *src_buffer, void *dest_buffer, int data_size, int root) const
101{
102 memcpy(dest_buffer, src_buffer, data_size);
103}
104
105void Comm_Group_Noparallel::all_gather(const void *src_buffer, void *dest_buffer, int data_size) const
106{
107 memcpy(dest_buffer, src_buffer, data_size);
108}
109
110void Comm_Group_Noparallel::all_gatherv(const void *src_buffer, void *dest_buffer, int send_size, const int* recv_size, const int* displs) const
111{
112 memcpy(dest_buffer, src_buffer, recv_size[0]);
113}
114
void recv(int pe, void *buffer, int size, int tag) const override
void send_recv_finish() const override
void all_gather(const void *src_buffer, void *dest_buffer, int data_size) const override
void abort() const override
void all_to_all(const void *src_buffer, void *dest_buffer, int data_size) const override
void init_group(const ArrOfInt &pe_list) override
constructeur pour un sous-groupe //
int reverse_send_recv_list(const ArrOfInt &src_list, ArrOfInt &dest_list) const
Comm_Group_Noparallel()
constructeur pour le groupe Tous
void send_recv_start(const ArrOfInt &send_list, const ArrOfInt &send_size, const char *const *const send_buffers, const ArrOfInt &recv_list, const ArrOfInt &recv_size, char *const *const recv_buffers, TypeHint typehint=CHAR) const override
void broadcast(void *buffer, int size, int pe_source) const override
void gather(const void *src_buffer, void *dest_buffer, int data_size, int root) const override
void all_gatherv(const void *src_buffer, void *dest_buffer, int send_size, const int *recv_size, const int *displs) const override
void send(int pe, const void *buffer, int size, int tag) const override
: Cette classe decrit un groupe de processeurs sur lesquels
Definition Comm_Group.h:40
virtual void init_group(const ArrOfInt &pe_list)
Cette fonction doit etre appelee simultanement par tous les PEs du groupe current_group avec les meme...
void init_group_trio(int nproc, int rank)
Initialise le groupe_TRUST().
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static void barrier()
Synchronise tous les processeurs du groupe courant (attend que tous les processeurs soient arrives a ...
Definition Process.cpp:136
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52
_SIZE_ size_array() const