YetAnotherCoupler 3.5.2
Loading...
Searching...
No Matches
yac_mpi.c
Go to the documentation of this file.
1// Copyright (c) 2024 The YAC Authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifdef HAVE_CONFIG_H
6#include "config.h"
7#endif
8
9#include <assert.h>
10#include <inttypes.h>
11#include <limits.h>
12#include <stdbool.h>
13#include <stdlib.h>
14#include <stdio.h>
15#include <string.h>
16
17#include <mpi.h>
18#include "yac_mpi_internal.h"
19#include "geometry.h"
20#include "ensure_array_size.h"
21#include "ppm/core.h"
22
25static int init_count = 0;
26static int yaxt_init_count = 0;
27
28static size_t * comm_buffer = NULL;
29static size_t comm_buffer_array_size = 0;
30static int comm_buffer_in_use = 0;
31
33
34 int mpi_initialized;
35 MPI_Initialized(&mpi_initialized);
36
37 return mpi_initialized;
38}
39
40void yac_yaxt_init(MPI_Comm comm) {
41
44 "ERROR(yac_yaxt_init): MPI has not yet been initialised");
45
48 "ERROR(yac_yaxt_init): YAXT was initialised by YAC. \n"
49 "In case there are multiple instances of YAC in parallel, the user has "
50 "to initialise YAXT such that it is available on all processes that "
51 "use YAC.")
52
53 if ((yaxt_init_count == 0) && (!xt_initialized() || xt_finalized())) {
54 xt_initialize(comm);
56 }
58}
59
60void yac_yaxt_init_f2c(MPI_Fint comm) {
61
62 yac_yaxt_init(MPI_Comm_f2c(comm));
63}
64
65static void yac_yaxt_cleanup() {
66
68 xt_finalize();
70 }
72}
73
74#define XSTR(s) STR(s)
75#define STR(s) #s
76
78
80 sizeof(size_t) == sizeof(YAC_MPI_SIZE_T_TYPE),
81 "ERROR(yac_mpi_init_core): "
82 "could not determine MPI data type for size_t "
83 "(sizeof(size_t): %zu; sizeof(%s): %zu)",
84 sizeof(size_t), XSTR(YAC_MPI_SIZE_T_TYPE),
85 sizeof(YAC_MPI_SIZE_T_TYPE))
86
87 if ((init_count == 0) && (!yac_mpi_is_initialised())) {
88 MPI_Init(NULL, NULL);
90 }
91
92 init_count++;
93}
94
96
97 if (init_count == 1) {
99 !comm_buffer_in_use, "ERROR(yac_mpi_finalize): comm_buffer still in use")
100 free(comm_buffer);
101 comm_buffer = NULL;
103 }
104 init_count--;
106}
107
109
112 yac_mpi_call(MPI_Finalize(), MPI_COMM_WORLD);
113}
114
115// GCOVR_EXCL_START
116//taken from http://beige.ucs.indiana.edu/I590/node85.html
117void yac_mpi_error(int error_code, MPI_Comm comm) {
118 int rank;
119 MPI_Comm_rank(comm, &rank);
120
121 char error_string[MPI_MAX_ERROR_STRING];
122 int length_of_error_string, error_class;
123
124 MPI_Error_class(error_code, &error_class);
125 MPI_Error_string(error_class, error_string, &length_of_error_string);
126 fprintf(stderr, "%3d: %s\n", rank, error_string);
127 MPI_Abort(comm, error_code);
128}
129// GCOVR_EXCL_STOP
130
132 void const * send_buffer, size_t const * sendcounts, size_t const * sdispls,
133 void * recv_buffer, size_t const * recvcounts, size_t const * rdispls,
134 size_t dt_size, MPI_Datatype dt, MPI_Comm comm) {
135
136#define USE_P2P_ALLTOALLV
137#ifdef USE_P2P_ALLTOALLV
138 int comm_rank, comm_size;
139 yac_mpi_call(MPI_Comm_rank(comm, &comm_rank), comm);
140 yac_mpi_call(MPI_Comm_size(comm, &comm_size), comm);
141
142 int req_count = 0;
143 for (int i = 0; i < comm_size; ++i)
144 req_count += (sendcounts[i] > 0) + (recvcounts[i] > 0);
145 MPI_Request * req = xmalloc((size_t)req_count * sizeof(*req));
146
147 req_count = 0;
148 for (int j = 0, lb = comm_rank, ub = comm_size; j < 2;
149 ++j, lb = 0, ub = comm_rank) {
150 for (int i = lb; i < ub; ++i) {
151 if (sendcounts[i] > 0) {
153 sendcounts[i] <= INT_MAX,
154 "ERROR(yac_alltoallv_p2p): sendcounts[%d] = %zu exceeds INT_MAX (%d)",
155 i, sendcounts[i], (int)INT_MAX)
157 MPI_Isend(
158 (void const *)((unsigned char *)send_buffer +
159 dt_size * sdispls[i]),
160 (int)(sendcounts[i]), dt, i, 0,
161 comm, req + req_count), comm);
162 ++req_count;
163 }
164 if (recvcounts[i] > 0) {
166 recvcounts[i] <= INT_MAX,
167 "ERROR(yac_alltoallv_p2p): recvcounts[%d] = %zu exceeds INT_MAX (%d)",
168 i, recvcounts[i], (int)INT_MAX)
170 MPI_Irecv(
171 (void *)((unsigned char *)recv_buffer +
172 dt_size * rdispls[i]),
173 (int)(recvcounts[i]), dt, i, 0,
174 comm, req + req_count), comm);
175 ++req_count;
176 }
177 }
178 }
179 yac_mpi_call(MPI_Waitall(req_count, req, MPI_STATUSES_IGNORE), comm);
180 free(req);
181#else // USE_P2P_ALLTOALLV
182 int comm_size;
183 yac_mpi_call(MPI_Comm_size(comm, &comm_size), comm);
184 int * int_buffer = xmalloc(4 * comm_size * sizeof(*int_buffer));
185 int * int_sendcounts = int_buffer + 0 * comm_size;
186 int * int_sdispls = int_buffer + 1 * comm_size;
187 int * int_recvcounts = int_buffer + 2 * comm_size;
188 int * int_rdispls = int_buffer + 3 * comm_size;
189 for (int i = 0; i < comm_size; ++i) {
191 sendcounts[i] <= INT_MAX,
192 "ERROR(yac_alltoallv_p2p): sendcounts[%d] = %zu exceeds INT_MAX (%d)",
193 i, sendcounts[i], (int)INT_MAX)
195 sdispls[i] <= INT_MAX,
196 "ERROR(yac_alltoallv_p2p): sdispls[%d] = %zu exceeds INT_MAX (%d)",
197 i, sdispls[i], (int)INT_MAX)
199 recvcounts[i] <= INT_MAX,
200 "ERROR(yac_alltoallv_p2p): recvcounts[%d] = %zu exceeds INT_MAX (%d)",
201 i, recvcounts[i], (int)INT_MAX)
203 rdispls[i] <= INT_MAX,
204 "ERROR(yac_alltoallv_p2p): rdispls[%d] = %zu exceeds INT_MAX (%d)",
205 i, rdispls[i], (int)INT_MAX)
206 int_sendcounts[i] = (int)(sendcounts[i]);
207 int_sdispls[i] = (int)(sdispls[i]);
208 int_recvcounts[i] = (int)(recvcounts[i]);
209 int_rdispls[i] = (int)(rdispls[i]);
210 }
212 MPI_Alltoallv(send_buffer, int_sendcounts, int_sdispls, dt,
213 recv_buffer, int_recvcounts, int_rdispls, dt, comm), comm);
214 free(int_buffer);
215#endif // USE_P2P_ALLTOALLV
216}
217
218#define YAC_ALLTOALL_P2P_TYPE(NAME, TYPE, TYPE_SIZE, MPI_TYPE) \
219 void yac_alltoallv_ ## NAME ## _p2p( \
220 TYPE const * send_buffer, size_t const * sendcounts, size_t const * sdispls, \
221 TYPE * recv_buffer, size_t const * recvcounts, size_t const * rdispls, \
222 MPI_Comm comm) { \
223 yac_alltoallv_p2p( \
224 (void const *)send_buffer, sendcounts, sdispls, \
225 (void *)recv_buffer, recvcounts, rdispls, \
226 TYPE_SIZE, MPI_TYPE, comm); \
227 }
228
229YAC_ALLTOALL_P2P_TYPE(int, int, sizeof(int), MPI_INT)
231YAC_ALLTOALL_P2P_TYPE(uint64, uint64_t, sizeof(uint64_t), MPI_UINT64_T)
232YAC_ALLTOALL_P2P_TYPE(packed, void, 1, MPI_PACKED)
233YAC_ALLTOALL_P2P_TYPE(dble, double, sizeof(double), MPI_DOUBLE)
234YAC_ALLTOALL_P2P_TYPE(size_t, size_t, sizeof(size_t), YAC_MPI_SIZE_T)
235
237 void const * send_buffer, int const * sendcounts, int const * sdispls,
238 void * recv_buffer, int const * recvcounts, int const * rdispls,
239 size_t dt_size, MPI_Datatype dt, struct yac_group_comm group_comm) {
240
241 MPI_Comm comm = group_comm.comm;
242 int comm_rank;
243 yac_mpi_call(MPI_Comm_rank(comm, &comm_rank), comm);
244 int rank = comm_rank - group_comm.start;
245
246 int req_count = 0;
247 for (int i = 0; i < group_comm.size; ++i)
248 req_count += (sendcounts[i] > 0) + (recvcounts[i] > 0);
249 MPI_Request * req = xmalloc((size_t)req_count * sizeof(*req));
250
251 req_count = 0;
252 for (int j = 0, lb = rank, ub = group_comm.size; j < 2;
253 ++j, lb = 0, ub = rank) {
254 for (int i = lb; i < ub; ++i) {
255 if (sendcounts[i] > 0) {
256
258 MPI_Isend(
259 (void const *)((unsigned char *)send_buffer +
260 dt_size * (size_t)(sdispls[i])),
261 sendcounts[i], dt, i + group_comm.start, 0,
262 comm, req + req_count), comm);
263 ++req_count;
264 }
265 if (recvcounts[i] > 0) {
267 MPI_Irecv(
268 (void *)((unsigned char *)recv_buffer +
269 dt_size * (size_t)(rdispls[i])),
270 recvcounts[i], dt, i + group_comm.start, 0,
271 comm, req + req_count), comm);
272 ++req_count;
273 }
274 }
275 }
276 yac_mpi_call(MPI_Waitall(req_count, req, MPI_STATUSES_IGNORE), comm);
277 free(req);
278}
279
280static int nearest_power_of_two(int x) {
281 int power = 1;
282
283 while(power < x) power *= 2;
284
285 return power / 2;
286}
287
288// based on https://doi.org/10.1016/j.parco.2017.08.004
290 double * buffer, int count, struct yac_group_comm group_comm) {
291
292 int comm_rank;
293 yac_mpi_call(MPI_Comm_rank(group_comm.comm, &comm_rank), group_comm.comm);
294
295 int rank = comm_rank - group_comm.start;
296 int pof2 = nearest_power_of_two(group_comm.size);
297 int rem = group_comm.size - pof2;
298 int my_rank;
299 double * recv_buffer = xmalloc((size_t)count * sizeof(*recv_buffer));
300
301 if (rank < 2 * rem) {
302
303 if (rank & 1) {
305 MPI_Recv(
306 (void*)recv_buffer, count, MPI_DOUBLE, rank - 1 + group_comm.start, 0,
307 group_comm.comm, MPI_STATUS_IGNORE), group_comm.comm);
308 for (int i = 0; i < count; ++i) buffer[i] += recv_buffer[i];
309 my_rank = rank / 2;
310 } else {
312 MPI_Send(
313 (void const *)buffer, count, MPI_DOUBLE, rank + 1 + group_comm.start,
314 0, group_comm.comm), group_comm.comm);
315 my_rank = -1;
316 }
317 } else {
318 my_rank = rank - rem;
319 }
320 if (my_rank != -1) {
321 int mask = 1;
322 while (mask < pof2) {
323 int newdst = my_rank ^ mask;
324 int dst;
325 if (newdst < rem) dst = newdst * 2 + 1;
326 else dst = newdst + rem;
328 MPI_Sendrecv(
329 (void const*)buffer, count, MPI_DOUBLE, dst + group_comm.start, 0,
330 (void*)recv_buffer, count, MPI_DOUBLE, dst + group_comm.start, 0,
331 group_comm.comm, MPI_STATUS_IGNORE),
332 group_comm.comm);
333 for (int i = 0; i < count; ++i) buffer[i] += recv_buffer[i];
334 mask <<= 1;
335 }
336 }
337 free(recv_buffer);
338 if (rank < 2 * rem) {
339 if (rank & 1) {
341 MPI_Send(
342 (void const*)buffer, count, MPI_DOUBLE, rank - 1 + group_comm.start,
343 0, group_comm.comm), group_comm.comm);
344 } else {
346 MPI_Recv(
347 (void*)buffer, count, MPI_DOUBLE, rank + 1 + group_comm.start, 0,
348 group_comm.comm, MPI_STATUS_IGNORE), group_comm.comm);
349 }
350 }
351}
352
353static int log2_(int x) {
354 if (x <= 1) return 0;
355 int l2 = 0;
356 while (x >>= 1) ++l2;
357 return l2;
358}
359
360// based on https://doi.org/10.1109/71.642949
362 const uint64_t * sendbuf, uint64_t * recvbuf, int count,
363 struct yac_group_comm group_comm) {
364
365 int comm_rank;
366 yac_mpi_call(MPI_Comm_rank(group_comm.comm, &comm_rank), group_comm.comm);
367 int rank = comm_rank - group_comm.start;
368
369 uint64_t * temp = xmalloc((size_t)group_comm.size * (size_t)count * sizeof(*temp));
370
371 int lg2 = log2_(group_comm.size);
372 memcpy(temp, sendbuf, (size_t)count * sizeof(*temp));
373 int nblk = 1;
374 int curr_len = count;
375
376 for (int r = 0; r < lg2; ++r) {
377 int dst = (rank - nblk + group_comm.size) % group_comm.size;
378 int src = (rank + nblk) % group_comm.size;
380 MPI_Sendrecv(
381 (void const*)temp, curr_len, MPI_UINT64_T, dst + group_comm.start, 0,
382 (void *)(temp + (size_t)curr_len), curr_len, MPI_UINT64_T,
383 src + group_comm.start, 0, group_comm.comm, MPI_STATUS_IGNORE),
384 group_comm.comm);
385 nblk *= 2;
386 curr_len *= 2;
387 }
388 int rest = count * group_comm.size - curr_len;
389 int dst = (rank - nblk + group_comm.size) % group_comm.size;
390 int src = (rank + nblk) % group_comm.size;
392 MPI_Sendrecv(
393 (void const*)temp, rest, MPI_UINT64_T, dst + group_comm.start, 0,
394 (void*)(temp + (size_t)curr_len), rest, MPI_UINT64_T,
395 src + group_comm.start, 0, group_comm.comm, MPI_STATUS_IGNORE),
396 group_comm.comm);
397 memcpy(recvbuf + (size_t)count * (size_t)rank,
398 temp, (size_t)count * (size_t)(group_comm.size - rank) * sizeof(*temp));
399 memcpy(recvbuf, temp + (size_t)count * (size_t)(group_comm.size - rank),
400 (size_t)count * (size_t)rank * sizeof(*temp));
401
402 free(temp);
403}
404
406 void * buffer, int count, MPI_Datatype datatype, int root,
407 struct yac_group_comm group_comm) {
408
409 int comm_rank;
410 yac_mpi_call(MPI_Comm_rank(group_comm.comm, &comm_rank), group_comm.comm);
411 int rank = comm_rank - group_comm.start;
412
413 // if root is not part of the group
414 if ((root < group_comm.start) ||
415 (root >= group_comm.start + group_comm.size)) {
416
417 if (comm_rank == root) {
419 MPI_Send(
420 (void const*)buffer, count, datatype, group_comm.start, 0,
421 group_comm.comm), group_comm.comm);
422 return;
423 } else if (comm_rank == group_comm.start) {
425 MPI_Recv(
426 buffer, count, datatype, root, 0, group_comm.comm,
427 MPI_STATUS_IGNORE), group_comm.comm);
428 }
429 root = 0;
430 } else {
431 root -= group_comm.start;
432 }
433
434 // if not root, receive data
435 if (rank != root) {
436
437 int temp_rank = (group_comm.size + rank - root) % group_comm.size;
438 int bit = 1;
439
440 while (bit <= temp_rank) bit <<= 1;
441 bit >>= 1;
442
443 int src_rank =
444 (((temp_rank ^ bit) + root) % group_comm.size) + group_comm.start;
445
447 MPI_Recv(buffer, count, datatype, src_rank, 0, group_comm.comm,
448 MPI_STATUS_IGNORE), group_comm.comm);
449 }
450
451 // relative rank in respect to root
452 int temp_rank = (group_comm.size + rank - root) % group_comm.size;
453 int bit = 1, send_rank;
454
455 while(bit <= temp_rank) bit <<= 1;
456
457 while ((send_rank = temp_rank | bit) < group_comm.size) {
458
459 bit <<= 1;
460
461 send_rank = ((send_rank + root) % group_comm.size) + group_comm.start;
462
464 MPI_Send(
465 (void const*)buffer, count, datatype, send_rank, 0, group_comm.comm),
466 group_comm.comm);
467 }
468}
469
471
472 struct yac_group_comm group_comm;
473 group_comm.start = 0;
474 yac_mpi_call(MPI_Comm_size(comm, &(group_comm.size)), comm);
475 yac_mpi_call(MPI_Comm_dup(comm, &(group_comm.comm)), comm);
476
477 return group_comm;
478}
479
480void yac_group_comm_delete(struct yac_group_comm group_comm) {
481
482 yac_mpi_call(MPI_Comm_free(&(group_comm.comm)), group_comm.comm);
483}
484
486 return yac_group_comm_get_global_rank(group_comm) - group_comm.start;
487}
488
490 return group_comm.size;
491}
492
494 int comm_rank;
495 yac_mpi_call(MPI_Comm_rank(group_comm.comm, &comm_rank), group_comm.comm);
496 return comm_rank;
497}
498
500 int comm_size;
501 yac_mpi_call(MPI_Comm_size(group_comm.comm, &comm_size), group_comm.comm);
502 return comm_size;
503}
504
506 struct yac_group_comm group_comm, int split_rank,
507 struct yac_group_comm * local_group_comm,
508 struct yac_group_comm * remote_group_comm) {
509
510 int comm_rank;
511 MPI_Comm comm = group_comm.comm;
512 yac_mpi_call(MPI_Comm_rank(comm, &comm_rank), comm);
513
515 (split_rank >= 0) && (split_rank < group_comm.size),
516 "ERROR(yac_group_comm_split): invalid split rank")
517
518 int start[2] = {group_comm.start, group_comm.start + split_rank};
519 int size[2] = {split_rank, group_comm.size - split_rank};
520 int local_idx = (comm_rank - group_comm.start) >= split_rank;
521
522 local_group_comm->start = start[local_idx];
523 local_group_comm->size = size[local_idx];
524 local_group_comm->comm = comm;
525 remote_group_comm->start = start[local_idx^1];
526 remote_group_comm->size = size[local_idx^1];
527 remote_group_comm->comm = comm;
528}
529
531
532 struct bounding_circle dummy;
533 MPI_Datatype bnd_circle_dt;
534 int array_of_blocklengths[] = {3, 1, 1};
535 const MPI_Aint array_of_displacements[] =
536 {(MPI_Aint)(intptr_t)(const void *)&(dummy.base_vector[0]) -
537 (MPI_Aint)(intptr_t)(const void *)&dummy,
538 (MPI_Aint)(intptr_t)(const void *)&(dummy.inc_angle.sin) -
539 (MPI_Aint)(intptr_t)(const void *)&dummy,
540 (MPI_Aint)(intptr_t)(const void *)&(dummy.inc_angle.cos) -
541 (MPI_Aint)(intptr_t)(const void *)&dummy};
542 const MPI_Datatype array_of_types[] =
543 {MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE};
545 MPI_Type_create_struct(3, array_of_blocklengths, array_of_displacements,
546 array_of_types, &bnd_circle_dt), comm);
547 return yac_create_resized(bnd_circle_dt, sizeof(dummy), comm);
548}
549
551 MPI_Datatype dt, size_t new_size, MPI_Comm comm) {
552
553 MPI_Datatype resized_dt;
554
555#define OPENMPI_WORKAROUND
556#ifdef OPENMPI_WORKAROUND
557 MPI_Aint lb, extent;
558 MPI_Type_get_extent(dt, &lb, &extent);
560 MPI_Type_create_resized(dt, lb, (MPI_Aint)new_size, &resized_dt), comm);
561#else
563 MPI_Type_create_resized(dt, 0, (MPI_Aint)new_size, &resized_dt), comm);
564#endif
565#undef OPENMPI_WORKAROUND
566 yac_mpi_call(MPI_Type_free(&dt), comm);
567 yac_mpi_call(MPI_Type_commit(&resized_dt), comm);
568 return resized_dt;
569}
570
572 int count, size_t const * sendcounts, size_t * recvcounts,
573 size_t * sdispls, size_t * rdispls, MPI_Comm comm) {
574
575 int comm_size;
576 yac_mpi_call(MPI_Comm_size(comm, &comm_size), comm);
577
578 // exchange the number of requested points
580 MPI_Alltoall(
581 (void const*)sendcounts, count, YAC_MPI_SIZE_T,
582 (void*)recvcounts, count, YAC_MPI_SIZE_T, comm), comm);
583
584 // sdispls are offset by one position, this is intentional because this is
585 // usefull for packing of data
586 sdispls[0] = 0;
587 size_t iter_count = (size_t)(count * comm_size);
588 for (size_t i = 0, saccu = 0, raccu = 0; i < iter_count; ++i) {
589 sdispls[i+1] = saccu;
590 rdispls[i] = raccu;
591 saccu += sendcounts[i];
592 raccu += recvcounts[i];
593 }
594}
595
597 int count, size_t ** sendcounts, size_t ** recvcounts,
598 size_t ** sdispls, size_t ** rdispls, MPI_Comm comm) {
599
600 int comm_size;
601 yac_mpi_call(MPI_Comm_size(comm, &comm_size), comm);
602
603 size_t * comm_buffer_;
604 if (!comm_buffer_in_use) {
607 4 * (size_t)count * (size_t)comm_size + 1);
608 comm_buffer_ = comm_buffer;
610 } else {
611 comm_buffer_ =
612 xmalloc(
613 (4 * (size_t)count * (size_t)comm_size + 1) * sizeof(*comm_buffer_));
614 }
615
616 size_t offset = (size_t)count * (size_t)comm_size;
617 *sendcounts = comm_buffer_ + 0 * offset;
618 *recvcounts = comm_buffer_ + 1 * offset;
619 *rdispls = comm_buffer_ + 2 * offset;
620 *sdispls = comm_buffer_ + 3 * offset; // sdispls is bigger by one element,
621 // which is usefull when packing data
622 // for alltoallv operation
623 memset(
624 comm_buffer_, 0, (size_t)count * (size_t)comm_size * sizeof(*comm_buffer_));
625}
626
628 size_t * sendcounts, size_t * recvcounts,
629 size_t * sdispls, size_t * rdispls) {
630
631 UNUSED(recvcounts);
632 UNUSED(sdispls);
633 UNUSED(rdispls);
634
635 if (sendcounts != comm_buffer) free(sendcounts);
636 else comm_buffer_in_use = 0;
637}
638
639/*
640 * Local Variables:
641 * c-basic-offset: 2
642 * coding: utf-8
643 * indent-tabs-mode: nil
644 * show-trailing-whitespace: t
645 * require-trailing-newline: t
646 * End:
647 */
#define UNUSED(x)
Definition core.h:73
#define ENSURE_ARRAY_SIZE(arrayp, curr_array_size, req_size)
Definition __init__.py:1
#define xmalloc(size)
Definition ppm_xfuncs.h:66
struct sin_cos_angle inc_angle
angle between the middle point and the boundary of the spherical cap
Definition geometry.h:61
double base_vector[3]
Definition geometry.h:59
double sin
Definition geometry.h:41
double cos
Definition geometry.h:41
#define YAC_ASSERT_F(exp, format,...)
Definition yac_assert.h:19
#define YAC_ASSERT(exp, msg)
Definition yac_assert.h:16
#define XSTR(s)
Definition yac_mpi.c:74
static int mpi_initialised_by_yac
Definition yac_mpi.c:23
#define YAC_ALLTOALL_P2P_TYPE(NAME, TYPE, TYPE_SIZE, MPI_TYPE)
Definition yac_mpi.c:218
void yac_mpi_finalize()
Definition yac_mpi.c:108
void yac_mpi_cleanup()
Definition yac_mpi.c:95
void yac_alltoallv_p2p_group(void const *send_buffer, int const *sendcounts, int const *sdispls, void *recv_buffer, int const *recvcounts, int const *rdispls, size_t dt_size, MPI_Datatype dt, struct yac_group_comm group_comm)
Definition yac_mpi.c:236
int yac_group_comm_get_global_rank(struct yac_group_comm group_comm)
Definition yac_mpi.c:493
void yac_generate_alltoallv_args(int count, size_t const *sendcounts, size_t *recvcounts, size_t *sdispls, size_t *rdispls, MPI_Comm comm)
Definition yac_mpi.c:571
static int yaxt_initialised_by_yac
Definition yac_mpi.c:24
void yac_free_comm_buffers(size_t *sendcounts, size_t *recvcounts, size_t *sdispls, size_t *rdispls)
Definition yac_mpi.c:627
int yac_group_comm_get_rank(struct yac_group_comm group_comm)
Definition yac_mpi.c:485
int yac_mpi_is_initialised()
Definition yac_mpi.c:32
static int init_count
Definition yac_mpi.c:25
void yac_group_comm_split(struct yac_group_comm group_comm, int split_rank, struct yac_group_comm *local_group_comm, struct yac_group_comm *remote_group_comm)
Definition yac_mpi.c:505
MPI_Datatype yac_get_bounding_circle_mpi_datatype(MPI_Comm comm)
Definition yac_mpi.c:530
static size_t * comm_buffer
Definition yac_mpi.c:28
int yac_group_comm_get_global_size(struct yac_group_comm group_comm)
Definition yac_mpi.c:499
void yac_yaxt_init(MPI_Comm comm)
Definition yac_mpi.c:40
struct yac_group_comm yac_group_comm_new(MPI_Comm comm)
Definition yac_mpi.c:470
void yac_mpi_error(int error_code, MPI_Comm comm)
Definition yac_mpi.c:117
static size_t comm_buffer_array_size
Definition yac_mpi.c:29
static int yaxt_init_count
Definition yac_mpi.c:26
void yac_allreduce_sum_dble(double *buffer, int count, struct yac_group_comm group_comm)
Definition yac_mpi.c:289
void yac_yaxt_init_f2c(MPI_Fint comm)
Definition yac_mpi.c:60
void yac_get_comm_buffers(int count, size_t **sendcounts, size_t **recvcounts, size_t **sdispls, size_t **rdispls, MPI_Comm comm)
Definition yac_mpi.c:596
static int log2_(int x)
Definition yac_mpi.c:353
int yac_group_comm_get_size(struct yac_group_comm group_comm)
Definition yac_mpi.c:489
MPI_Datatype yac_create_resized(MPI_Datatype dt, size_t new_size, MPI_Comm comm)
Definition yac_mpi.c:550
void yac_alltoallv_p2p(void const *send_buffer, size_t const *sendcounts, size_t const *sdispls, void *recv_buffer, size_t const *recvcounts, size_t const *rdispls, size_t dt_size, MPI_Datatype dt, MPI_Comm comm)
Definition yac_mpi.c:131
void yac_bcast_group(void *buffer, int count, MPI_Datatype datatype, int root, struct yac_group_comm group_comm)
Definition yac_mpi.c:405
void yac_allgather_uint64(const uint64_t *sendbuf, uint64_t *recvbuf, int count, struct yac_group_comm group_comm)
Definition yac_mpi.c:361
static int nearest_power_of_two(int x)
Definition yac_mpi.c:280
static int comm_buffer_in_use
Definition yac_mpi.c:30
static void yac_yaxt_cleanup()
Definition yac_mpi.c:65
void yac_group_comm_delete(struct yac_group_comm group_comm)
Definition yac_mpi.c:480
void yac_mpi_init()
Definition yac_mpi.c:77
#define yac_mpi_call(call, comm)
#define YAC_MPI_SIZE_T_TYPE
#define YAC_MPI_SIZE_T
Xt_int yac_int
Definition yac_types.h:15
#define yac_int_dt
Definition yac_types.h:16