12#define TIMPI_UNIT_ASSERT(expr) \
19 "three",
"four",
"five",
"six",
"seven",
"eight",
"nine"};
47 template <
typename T2>
64template <
int i,
typename T>
72template <
int i,
typename T>
84template <
int i,
typename T, std::
size_t N>
95template <
typename T,
typename U>
96inline void my_resize(std::pair<T,U> &, std::size_t) {}
98template <
typename ...
Types>
99inline void my_resize(std::tuple<Types...> &, std::size_t) {}
101template <
typename T, std::
size_t N>
105#if __cplusplus > 201402L
116 static unsigned int packed_size(
typename std::vector<int>::const_iterator) {
return 1; }
117 static unsigned int packable_size(
const std::unique_ptr<int> &,
const void *) {
return 1; }
119 template <
typename Iter>
122 template <
typename BufferIter>
125 return std::make_unique<int>(*
in++);
132using namespace TIMPI;
138 std::vector<std::string> send(1);
140 send[0].assign(
"Hello");
142 send[0].assign(
"Goodbye");
145 ((
void *)(
NULL), send.begin(), send.end(),
152 template <
typename PairAtLeast>
155 std::vector<PairAtLeast>
sendv(2);
161 s0.assign(
"Is it me you're looking for?\n");
162 for (
int i=0;
i != 6; ++
i)
168 s1.assign(
"to you! Guess it's better to say, goodbye\n");
169 for (
int i=0;
i != 6; ++
i)
173 std::vector<PairAtLeast> send(1);
181 std::vector<PairAtLeast> recv;
184 ((
void *)(
NULL), send.begin(), send.end(),
185 std::back_inserter(recv));
188 const std::size_t
vec_size = recv.size();
226#ifdef TIMPI_HAVE_CXX17
236 std::vector<std::tuple<std::string, std::string, int>>
sendv(2);
238 auto &
s0 = std::get<1>(
sendv[0]);
239 std::get<0>(
sendv[0]).assign(
"Hello");
240 s0.assign(
"Is it me you're looking for?\n");
241 for (
int i=0;
i != 6; ++
i)
244 std::get<2>(
sendv[0]) = 257;
246 auto &
s1 = std::get<1>(
sendv[1]);
247 std::get<0>(
sendv[1]).assign(
"Goodbye");
248 s1.assign(
"to you! Guess it's better to say, goodbye\n");
249 for (
int i=0;
i != 6; ++
i)
252 std::get<2>(
sendv[1]) = 258;
254 std::vector<std::tuple<std::string, std::string, int>> send(1);
260 std::vector<std::tuple<std::string, std::string, int>> recv;
263 ((
void *)(
NULL), send.begin(), send.end(),
264 std::back_inserter(recv));
267 const std::size_t
vec_size = recv.size();
281 typedef std::tuple<unsigned int, std::vector<std::tuple<char,int,std::size_t>>,
unsigned int>
send_type;
283#ifdef TIMPI_HAVE_CXX17
288 std::vector<send_type>
sendv(2);
290 std::get<0>(
sendv[0]) = 100;
291 std::get<1>(
sendv[0]) = {{
'a', -4, 1000},{
'b', -5, 2000}};
292 std::get<2>(
sendv[0]) = 3000;
294 std::get<0>(
sendv[1]) = 200;
295 std::get<1>(
sendv[1]) = {{
'c', -6, 4000},{
'd', -7, 5000}};
296 std::get<2>(
sendv[1]) = 6000;
298 std::vector<send_type> send(1);
304 std::vector<send_type> recv;
307 ((
void *)(
NULL), send.begin(), send.end(),
308 std::back_inserter(recv));
311 const std::size_t
vec_size = recv.size();
323 std::vector<std::string> send(1);
331 std::ostringstream
os;
348 std::vector<std::string>
vals;
363 std::vector<processor_id_type>
vals;
365 std::vector<std::string> send(1), recv;
374 std::ostringstream
os;
382 std::back_inserter(recv),
389 std::ostringstream
os;
433 std::map<processor_id_type, std::multiset<std::string>>
439 "three",
"four",
"five",
"six",
"seven",
"eight",
"nine"};
451 for (
int d=0;
d !=
M; ++
d)
491 for (
int p=rank;
p <
M;
p += size)
531 template <
typename FillFunctor,
typename PushFunctor>
539 typedef std::vector<fill_type>
vec_type;
542 for (
int d=0;
d != size; ++
d)
601 typedef std::tuple<unsigned int, std::vector<char>,
unsigned int,
618 typedef std::tuple<unsigned int, std::vector<char>,
unsigned int,
630 typedef std::tuple<std::unordered_map<unsigned int, std::string>>
tuple_type;
631#ifdef TIMPI_HAVE_CXX17
664 typedef std::tuple<std::size_t, int, std::unordered_map<unsigned int, std::string>>
tuple_type;
684#if __cplusplus > 201402L
690 std::map<processor_id_type, std::vector<std::unique_ptr<int>>>
693 for (
int d=0;
d !=
M; ++
d)
709 received.emplace_back(std::move(val));
718 for (
int p=rank;
p <
M;
p += size)
727 std::size_t
count = 0;
739 std::size_t
count = 0;
785#if __cplusplus > 201402L
797#if __cplusplus > 201402L
809#if __cplusplus > 201402L
Encapsulates the MPI_Comm object.
void allgather_packed_range(Context *context, Iter range_begin, const Iter range_end, OutputIter out, std::size_t approx_buffer_size=1000000) const
Take a range of local variables, combine it with ranges from all processors, and write the output to ...
processor_id_type size() const
processor_id_type rank() const
void set_union(T &data, const unsigned int root_id) const
Take a container (set, map, unordered_set, multimap, etc) of local variables on each processor,...
void sync_type(const SyncType st)
Explicitly sets the SyncType used for sync operations.
void send_receive_packed_range(const unsigned int dest_processor_id, const Context1 *context1, RangeIter send_begin, const RangeIter send_end, const unsigned int source_processor_id, Context2 *context2, OutputIter out, const T *output_type, const MessageTag &send_tag=no_tag, const MessageTag &recv_tag=any_tag, std::size_t approx_buffer_size=1000000) const
Send a range-of-pointers to one processor while simultaneously receiving another range from a (potent...
void allgather(const T &send_data, std::vector< T, A > &recv_data) const
Take a vector of length this->size(), and fill in recv[processor_id] = the value of send on that proc...
Templated class to provide the appropriate MPI datatype for use with built-in C types or simple C++ c...
The TIMPIInit class, when constructed, initializes any dependent libraries (e.g.
static unsigned int packed_size(typename std::vector< int >::const_iterator)
static void pack(const std::unique_ptr< int > &object, Iter data_out, const void *)
static std::unique_ptr< int > unpack(BufferIter in, const void *)
static unsigned int packable_size(const std::unique_ptr< int > &, const void *)
Define data types and (un)serialization functions for use when encoding a potentially-variable-size o...
uint8_t processor_id_type
void push_parallel_vector_data(const Communicator &comm, MapToVectors &&data, const ActionFunctor &act_on_data)
Send and receive and act on vectors of data.
Tnew cast_int(Told oldvar)
void push_parallel_packed_range(const Communicator &comm, MapToVectors &&data, Context *context, const ActionFunctor &act_on_data)
Send and receive and act on vectors of data.
void testPushPackedNestedImpl(FillFunctor fill_functor, PushFunctor push_functor)
void testContainerSendReceive()
void testPushPackedNested()
std::vector< char > fake_stringy_number(int number)
Communicator * TestCommWorld
void testGettableStringAllGather()
void testPushPackedImplMove(int M)
auto my_get(T &container) -> decltype(std::get< i >(container))
std::string stringy_number(int number)
void testArrayStringAllGather()
void testTupleStringAllGather()
void testPushPackedOneTuple()
void testPushPackedMoveOversized()
void testPushPackedFailureCase()
void testNullSendReceive()
void testPushPackedOversized()
void testNestingAllGather()
void testPairStringAllGather()
void testListStringAllGather()
void testPushPackedMove()
void my_resize(T &container, std::size_t size)
void testPushPackedImpl(int M)
void testContainerAllGather()
void testPushPackedDispatch()
void testVectorStringAllGather()
null_output_iterator operator++(int)
null_output_iterator & operator++()
std::ptrdiff_t difference_type
void operator=(const T2 &)
std::output_iterator_tag iterator_category
null_output_iterator & operator*()