16#include "arcane/utils/String.h"
17#include "arcane/utils/ArrayView.h"
18#include "arcane/utils/FatalErrorException.h"
19#include "arcane/utils/PlatformUtils.h"
20#include "arcane/utils/ITraceMng.h"
21#include "arcane/utils/Math.h"
23#include "arcane/core/IParallelMng.h"
24#include "arcane/core/IParallelMng.h"
25#include "arcane/core/IParallelTopology.h"
26#include "arcane/core/IParallelReplication.h"
27#include "arcane/core/SerializeBuffer.h"
68 const int nsize = 256;
70 Int32 max_sbuf[nsize];
78 buf_as_bytes.
copy(name_as_bytes.
subView(0, name_len));
84 max_buf[nsize - 1] = 0;
86 ARCANE_FATAL(
"Bad namedBarrier expected='{0}' found='{1}'",
98 const Int32 nb_string = input_strings.
size();
102 send_buf.
setMode(ISerializer::ModeReserve);
104 for (
Integer i = 0; i < nb_string; ++i) {
105 send_buf.
reserve(input_strings[i]);
111 for (
Integer i = 0; i < nb_string; ++i) {
112 send_buf.
put(input_strings[i]);
119 std::map<String, Int32> string_occurences;
123 for (
Integer i = 0; i < nb_rank; ++i) {
125 for (
Integer z = 0; z < nb_string_rank; ++z) {
128 auto vo = string_occurences.find(x);
129 if (vo == string_occurences.end())
130 string_occurences.insert(std::make_pair(x, 1));
132 vo->second = vo->second + 1;
138 std::set<String> common_set;
140 auto end_iter = string_occurences.end();
141 for (
Integer i = 0; i < nb_string; ++i) {
142 String str = input_strings[i];
143 auto i_str = string_occurences.find(str);
144 if (i_str == end_iter)
147 if (i_str->second != nb_rank)
149 common_set.insert(str);
155 common_strings.
clear();
156 for (
const String& s : common_set)
157 common_strings.
add(s);
173 Int32 mem_min_rank = 0;
174 Int32 mem_max_rank = 0;
175 pm->
computeMinMaxSum(mem_used, mem_min, mem_max, mem_sum, mem_min_rank, mem_max_rank);
177 <<
" MAX_MEM=" << (
Int64)(mem_max / 1e6)
178 <<
" MIN_MEM=" << (
Int64)(mem_min / 1e6)
180 <<
" MIN_RANK=" << mem_min_rank <<
" MAX_RANK=" << mem_max_rank;
#define ARCANE_CHECK_POINTER(ptr)
Macro returning the pointer ptr if it is not null or throwing an exception if it is null.
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
File containing declarations concerning the message passing model.
void copy(const U ©_array)
Copies the array copy_array into the instance.
void fill(const T &o) noexcept
Fills the array with the value o.
constexpr pointer unguardedBasePointer() noexcept
Pointer to the beginning of the view.
constexpr Integer size() const noexcept
Returns the size of the array.
Base class for 1D data vectors.
void clear()
Removes the elements from the array.
void add(ConstReferenceType val)
Adds element val to the end of the array.
void put(Span< const Real > values) override
Add the array values.
void reserve(eBasicDataType dt, Int64 n) override
Reserves memory for n objects of type dt.
void putInt32(Int32 value) override
Add the integer value.
void allocateBuffer() override
Allocates the serializer memory.
void get(ArrayView< Real > values) override
Retrieve the array values.
Int32 getInt32() override
Retrieve an integer.
void setMode(eMode new_mode) override
Sets the current mode.
Constant view of an array of type T.
constexpr ConstArrayView< T > subView(Integer abegin, Integer asize) const noexcept
Sub-view (constant) starting from element abegin and containing asize elements.
constexpr Integer size() const noexcept
Number of elements in the array.
Interface of the parallelism manager for a subdomain.
virtual void computeMinMaxSum(char val, char &min_val, char &max_val, char &sum_val, Int32 &min_rank, Int32 &max_rank)=0
Calculates the sum, min, and max of a value in one operation.
virtual Int32 commSize() const =0
Number of instances in the communicator.
virtual void allGather(ConstArrayView< char > send_buf, ArrayView< char > recv_buf)=0
Performs an all-gather operation across all processors. This is a collective operation....
virtual ARCANE_DEPRECATED_120 void * mpiCommunicator()
Address of the MPI communicator associated with this manager.
virtual void * getMPICommunicator()=0
Address of the MPI communicator associated with this manager.
virtual char reduce(eReduceType rt, char v)=0
Performs a reduction of type rt on the real v and returns the value.
@ ModePut
The serializer expects reserve().
@ ModeGet
The serializer expects get().
virtual TraceMessage info()=0
Stream for an information message.
Implementation of a buffer for serialization.
Unicode character string.
Int64 length() const
Returns the length of the string.
const char * localstr() const
Returns the conversion of the instance into UTF-8 encoding.
__host__ __device__ Real2 min(Real2 a, Real2 b)
Returns the minimum of two Real2.
void namedBarrier(IParallelMng *pm, const String &name)
Performs a named barrier with name name.
void dumpDateAndMemoryUsage(IParallelMng *pm, ITraceMng *tm)
Writes the date and memory consumed into tm.
void filterCommonStrings(IParallelMng *pm, ConstArrayView< String > input_strings, Array< String > &common_strings)
Filters strings common to all ranks of pm.
@ ReduceMax
Maximum of values.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Integer arcaneCheckArraySize(unsigned long long size)
Checks that size can be converted into an 'Integer' to serve as the size of an array....
ArrayView< Byte > ByteArrayView
C equivalent of a 1D array of characters.
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
double Real
Type representing a real number.
ConstArrayView< Byte > ByteConstArrayView
C equivalent of a 1D array of characters.
unsigned char Byte
Type of a byte.
@ DT_Int32
32-bit integer data type
std::int32_t Int32
Signed integer type of 32 bits.