TrioCFD 1.9.9_beta
TrioCFD documentation
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 Constructor for the "All" group.
24 *
25 */
28
29/*! @brief Constructor for a sub-group.
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
Constructor for a sub-group.
int reverse_send_recv_list(const ArrOfInt &src_list, ArrOfInt &dest_list) const
Comm_Group_Noparallel()
Constructor for the "All" group.
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
: This class describes a group of processors on which
Definition Comm_Group.h:37
virtual void init_group(const ArrOfInt &pe_list)
This function must be called simultaneously by all PEs of the current_group with the same parameters.
void init_group_trio(int nproc, int rank)
Initializes groupe_TRUST().
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
static void barrier()
Synchronizes all processors in the current group (waits until all processors have reached the barrier...
Definition Process.cpp:133
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52
_SIZE_ size_array() const