YetAnotherCoupler 3.2.0_a
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//taken from http://beige.ucs.indiana.edu/I590/node85.html
116void yac_mpi_error(int error_code, MPI_Comm comm) {
117 int rank;
118 MPI_Comm_rank(comm, &rank);
119
120 char error_string[MPI_MAX_ERROR_STRING];
121 int length_of_error_string, error_class;
122
123 MPI_Error_class(error_code, &error_class);
124 MPI_Error_string(error_class, error_string, &length_of_error_string);
125 fprintf(stderr, "%3d: %s\n", rank, error_string);
126 MPI_Abort(comm, error_code);
127}
128
130 void const * send_buffer, size_t const * sendcounts, size_t const * sdispls,
131 void * recv_buffer, size_t const * recvcounts, size_t const * rdispls,
132 size_t dt_size, MPI_Datatype dt, MPI_Comm comm) {
133
134#define USE_P2P_ALLTOALLV
135#ifdef USE_P2P_ALLTOALLV
136 int comm_rank, comm_size;
137 yac_mpi_call(MPI_Comm_rank(comm, &comm_rank), comm);
138 yac_mpi_call(MPI_Comm_size(comm, &comm_size), comm);
139
140 int req_count = 0;
141 for (int i = 0; i < comm_size; ++i)
142 req_count += (sendcounts[i] > 0) + (recvcounts[i] > 0);
143 MPI_Request * req = xmalloc((size_t)req_count * sizeof(*req));
144
145 req_count = 0;
146 for (int j = 0, lb = comm_rank, ub = comm_size; j < 2;
147 ++j, lb = 0, ub = comm_rank) {
148 for (int i = lb; i < ub; ++i) {
149 if (sendcounts[i] > 0) {
151 sendcounts[i] <= INT_MAX,
152 "ERROR(yac_alltoallv_p2p): sendcounts[%d] = %zu exceeds INT_MAX (%d)",
153 i, sendcounts[i], (int)INT_MAX)
155 MPI_Isend(
156 (void const *)((unsigned char *)send_buffer +
157 dt_size * sdispls[i]),
158 (int)(sendcounts[i]), dt, i, 0,
159 comm, req + req_count), comm);
160 ++req_count;
161 }
162 if (recvcounts[i] > 0) {
164 recvcounts[i] <= INT_MAX,
165 "ERROR(yac_alltoallv_p2p): recvcounts[%d] = %zu exceeds INT_MAX (%d)",
166 i, recvcounts[i], (int)INT_MAX)
168 MPI_Irecv(
169 (void *)((unsigned char *)recv_buffer +
170 dt_size * rdispls[i]),
171 (int)(recvcounts[i]), dt, i, 0,
172 comm, req + req_count), comm);
173 ++req_count;
174 }
175 }
176 }
177 yac_mpi_call(MPI_Waitall(req_count, req, MPI_STATUSES_IGNORE), comm);
178 free(req);
179#else // USE_P2P_ALLTOALLV
180 int comm_size;
181 yac_mpi_call(MPI_Comm_size(comm, &comm_size), comm);
182 int * int_buffer = xmalloc(4 * comm_size * sizeof(*int_buffer));
183 int * int_sendcounts = int_buffer + 0 * comm_size;
184 int * int_sdispls = int_buffer + 1 * comm_size;
185 int * int_recvcounts = int_buffer + 2 * comm_size;
186 int * int_rdispls = int_buffer + 3 * comm_size;
187 for (int i = 0; i < comm_size; ++i) {
189 sendcounts[i] <= INT_MAX,
190 "ERROR(yac_alltoallv_p2p): sendcounts[%d] = %zu exceeds INT_MAX (%d)",
191 i, sendcounts[i], (int)INT_MAX)
193 sdispls[i] <= INT_MAX,
194 "ERROR(yac_alltoallv_p2p): sdispls[%d] = %zu exceeds INT_MAX (%d)",
195 i, sdispls[i], (int)INT_MAX)
197 recvcounts[i] <= INT_MAX,
198 "ERROR(yac_alltoallv_p2p): recvcounts[%d] = %zu exceeds INT_MAX (%d)",
199 i, recvcounts[i], (int)INT_MAX)
201 rdispls[i] <= INT_MAX,
202 "ERROR(yac_alltoallv_p2p): rdispls[%d] = %zu exceeds INT_MAX (%d)",
203 i, rdispls[i], (int)INT_MAX)
204 int_sendcounts[i] = (int)(sendcounts[i]);
205 int_sdispls[i] = (int)(sdispls[i]);
206 int_recvcounts[i] = (int)(recvcounts[i]);
207 int_rdispls[i] = (int)(rdispls[i]);
208 }
210 MPI_Alltoallv(send_buffer, int_sendcounts, int_sdispls, dt,
211 recv_buffer, int_recvcounts, int_rdispls, dt, comm), comm);
212 free(int_buffer);
213#endif // USE_P2P_ALLTOALLV
214}
215
216#define YAC_ALLTOALL_P2P_TYPE(NAME, TYPE, TYPE_SIZE, MPI_TYPE) \
217 void yac_alltoallv_ ## NAME ## _p2p( \
218 TYPE const * send_buffer, size_t const * sendcounts, size_t const * sdispls, \
219 TYPE * recv_buffer, size_t const * recvcounts, size_t const * rdispls, \
220 MPI_Comm comm) { \
221 yac_alltoallv_p2p( \
222 (void const *)send_buffer, sendcounts, sdispls, \
223 (void *)recv_buffer, recvcounts, rdispls, \
224 TYPE_SIZE, MPI_TYPE, comm); \
225 }
226
227YAC_ALLTOALL_P2P_TYPE(int, int, sizeof(int), MPI_INT)
229YAC_ALLTOALL_P2P_TYPE(uint64, uint64_t, sizeof(uint64_t), MPI_UINT64_T)
230YAC_ALLTOALL_P2P_TYPE(packed, void, 1, MPI_PACKED)
231YAC_ALLTOALL_P2P_TYPE(dble, double, sizeof(double), MPI_DOUBLE)
232YAC_ALLTOALL_P2P_TYPE(size_t, size_t, sizeof(size_t), YAC_MPI_SIZE_T)
233
235 void const * send_buffer, int const * sendcounts, int const * sdispls,
236 void * recv_buffer, int const * recvcounts, int const * rdispls,
237 size_t dt_size, MPI_Datatype dt, struct yac_group_comm group_comm) {
238
239 MPI_Comm comm = group_comm.comm;
240 int comm_rank;
241 yac_mpi_call(MPI_Comm_rank(comm, &comm_rank), comm);
242 int rank = comm_rank - group_comm.start;
243
244 int req_count = 0;
245 for (int i = 0; i < group_comm.size; ++i)
246 req_count += (sendcounts[i] > 0) + (recvcounts[i] > 0);
247 MPI_Request * req = xmalloc((size_t)req_count * sizeof(*req));
248
249 req_count = 0;
250 for (int j = 0, lb = rank, ub = group_comm.size; j < 2;
251 ++j, lb = 0, ub = rank) {
252 for (int i = lb; i < ub; ++i) {
253 if (sendcounts[i] > 0) {
254
256 MPI_Isend(
257 (void const *)((unsigned char *)send_buffer +
258 dt_size * (size_t)(sdispls[i])),
259 sendcounts[i], dt, i + group_comm.start, 0,
260 comm, req + req_count), comm);
261 ++req_count;
262 }
263 if (recvcounts[i] > 0) {
265 MPI_Irecv(
266 (void *)((unsigned char *)recv_buffer +
267 dt_size * (size_t)(rdispls[i])),
268 recvcounts[i], dt, i + group_comm.start, 0,
269 comm, req + req_count), comm);
270 ++req_count;
271 }
272 }
273 }
274 yac_mpi_call(MPI_Waitall(req_count, req, MPI_STATUSES_IGNORE), comm);
275 free(req);
276}
277
278static int nearest_power_of_two(int x) {
279 int power = 1;
280
281 while(power < x) power *= 2;
282
283 return power / 2;
284}
285
286// based on https://doi.org/10.1016/j.parco.2017.08.004
288 double * buffer, int count, struct yac_group_comm group_comm) {
289
290 int comm_rank;
291 yac_mpi_call(MPI_Comm_rank(group_comm.comm, &comm_rank), group_comm.comm);
292
293 int rank = comm_rank - group_comm.start;
294 int pof2 = nearest_power_of_two(group_comm.size);
295 int rem = group_comm.size - pof2;
296 int my_rank;
297 double * recv_buffer = xmalloc((size_t)count * sizeof(*recv_buffer));
298
299 if (rank < 2 * rem) {
300
301 if (rank & 1) {
303 MPI_Recv(
304 (void*)recv_buffer, count, MPI_DOUBLE, rank - 1 + group_comm.start, 0,
305 group_comm.comm, MPI_STATUS_IGNORE), group_comm.comm);
306 for (int i = 0; i < count; ++i) buffer[i] += recv_buffer[i];
307 my_rank = rank / 2;
308 } else {
310 MPI_Send(
311 (void const *)buffer, count, MPI_DOUBLE, rank + 1 + group_comm.start,
312 0, group_comm.comm), group_comm.comm);
313 my_rank = -1;
314 }
315 } else {
316 my_rank = rank - rem;
317 }
318 if (my_rank != -1) {
319 int mask = 1;
320 while (mask < pof2) {
321 int newdst = my_rank ^ mask;
322 int dst;
323 if (newdst < rem) dst = newdst * 2 + 1;
324 else dst = newdst + rem;
326 MPI_Sendrecv(
327 (void const*)buffer, count, MPI_DOUBLE, dst + group_comm.start, 0,
328 (void*)recv_buffer, count, MPI_DOUBLE, dst + group_comm.start, 0,
329 group_comm.comm, MPI_STATUS_IGNORE),
330 group_comm.comm);
331 for (int i = 0; i < count; ++i) buffer[i] += recv_buffer[i];
332 mask <<= 1;
333 }
334 }
335 free(recv_buffer);
336 if (rank < 2 * rem) {
337 if (rank & 1) {
339 MPI_Send(
340 (void const*)buffer, count, MPI_DOUBLE, rank - 1 + group_comm.start,
341 0, group_comm.comm), group_comm.comm);
342 } else {
344 MPI_Recv(
345 (void*)buffer, count, MPI_DOUBLE, rank + 1 + group_comm.start, 0,
346 group_comm.comm, MPI_STATUS_IGNORE), group_comm.comm);
347 }
348 }
349}
350
351static int log2_(int x) {
352 if (x <= 1) return 0;
353 int l2 = 0;
354 while (x >>= 1) ++l2;
355 return l2;
356}
357
358// based on https://doi.org/10.1109/71.642949
360 const uint64_t * sendbuf, uint64_t * recvbuf, int count,
361 struct yac_group_comm group_comm) {
362
363 int comm_rank;
364 yac_mpi_call(MPI_Comm_rank(group_comm.comm, &comm_rank), group_comm.comm);
365 int rank = comm_rank - group_comm.start;
366
367 uint64_t * temp = xmalloc((size_t)group_comm.size * (size_t)count * sizeof(*temp));
368
369 int lg2 = log2_(group_comm.size);
370 memcpy(temp, sendbuf, (size_t)count * sizeof(*temp));
371 int nblk = 1;
372 int curr_len = count;
373
374 for (int r = 0; r < lg2; ++r) {
375 int dst = (rank - nblk + group_comm.size) % group_comm.size;
376 int src = (rank + nblk) % group_comm.size;
378 MPI_Sendrecv(
379 (void const*)temp, curr_len, MPI_UINT64_T, dst + group_comm.start, 0,
380 (void *)(temp + (size_t)curr_len), curr_len, MPI_UINT64_T,
381 src + group_comm.start, 0, group_comm.comm, MPI_STATUS_IGNORE),
382 group_comm.comm);
383 nblk *= 2;
384 curr_len *= 2;
385 }
386 int rest = count * group_comm.size - curr_len;
387 int dst = (rank - nblk + group_comm.size) % group_comm.size;
388 int src = (rank + nblk) % group_comm.size;
390 MPI_Sendrecv(
391 (void const*)temp, rest, MPI_UINT64_T, dst + group_comm.start, 0,
392 (void*)(temp + (size_t)curr_len), rest, MPI_UINT64_T,
393 src + group_comm.start, 0, group_comm.comm, MPI_STATUS_IGNORE),
394 group_comm.comm);
395 memcpy(recvbuf + (size_t)count * (size_t)rank,
396 temp, (size_t)count * (size_t)(group_comm.size - rank) * sizeof(*temp));
397 memcpy(recvbuf, temp + (size_t)count * (size_t)(group_comm.size - rank),
398 (size_t)count * (size_t)rank * sizeof(*temp));
399
400 free(temp);
401}
402
404 void * buffer, int count, MPI_Datatype datatype, int root,
405 struct yac_group_comm group_comm) {
406
407 int comm_rank;
408 yac_mpi_call(MPI_Comm_rank(group_comm.comm, &comm_rank), group_comm.comm);
409 int rank = comm_rank - group_comm.start;
410
411 // if root is not part of the group
412 if ((root < group_comm.start) ||
413 (root >= group_comm.start + group_comm.size)) {
414
415 if (comm_rank == root) {
417 MPI_Send(
418 (void const*)buffer, count, datatype, group_comm.start, 0,
419 group_comm.comm), group_comm.comm);
420 return;
421 } else if (comm_rank == group_comm.start) {
423 MPI_Recv(
424 buffer, count, datatype, root, 0, group_comm.comm,
425 MPI_STATUS_IGNORE), group_comm.comm);
426 }
427 root = 0;
428 } else {
429 root -= group_comm.start;
430 }
431
432 // if not root, receive data
433 if (rank != root) {
434
435 int temp_rank = (group_comm.size + rank - root) % group_comm.size;
436 int bit = 1;
437
438 while (bit <= temp_rank) bit <<= 1;
439 bit >>= 1;
440
441 int src_rank =
442 (((temp_rank ^ bit) + root) % group_comm.size) + group_comm.start;
443
445 MPI_Recv(buffer, count, datatype, src_rank, 0, group_comm.comm,
446 MPI_STATUS_IGNORE), group_comm.comm);
447 }
448
449 // relative rank in respect to root
450 int temp_rank = (group_comm.size + rank - root) % group_comm.size;
451 int bit = 1, send_rank;
452
453 while(bit <= temp_rank) bit <<= 1;
454
455 while ((send_rank = temp_rank | bit) < group_comm.size) {
456
457 bit <<= 1;
458
459 send_rank = ((send_rank + root) % group_comm.size) + group_comm.start;
460
462 MPI_Send(
463 (void const*)buffer, count, datatype, send_rank, 0, group_comm.comm),
464 group_comm.comm);
465 }
466}
467
469
470 struct yac_group_comm group_comm;
471 group_comm.start = 0;
472 yac_mpi_call(MPI_Comm_size(comm, &(group_comm.size)), comm);
473 yac_mpi_call(MPI_Comm_dup(comm, &(group_comm.comm)), comm);
474
475 return group_comm;
476}
477
478void yac_group_comm_delete(struct yac_group_comm group_comm) {
479
480 yac_mpi_call(MPI_Comm_free(&(group_comm.comm)), group_comm.comm);
481}
482
484 return yac_group_comm_get_global_rank(group_comm) - group_comm.start;
485}
486
488 return group_comm.size;
489}
490
492 int comm_rank;
493 yac_mpi_call(MPI_Comm_rank(group_comm.comm, &comm_rank), group_comm.comm);
494 return comm_rank;
495}
496
498 int comm_size;
499 yac_mpi_call(MPI_Comm_size(group_comm.comm, &comm_size), group_comm.comm);
500 return comm_size;
501}
502
504 struct yac_group_comm group_comm, int split_rank,
505 struct yac_group_comm * local_group_comm,
506 struct yac_group_comm * remote_group_comm) {
507
508 int comm_rank;
509 MPI_Comm comm = group_comm.comm;
510 yac_mpi_call(MPI_Comm_rank(comm, &comm_rank), comm);
511
513 (split_rank >= 0) && (split_rank < group_comm.size),
514 "ERROR(yac_group_comm_split): invalid split rank")
515
516 int start[2] = {group_comm.start, group_comm.start + split_rank};
517 int size[2] = {split_rank, group_comm.size - split_rank};
518 int local_idx = (comm_rank - group_comm.start) >= split_rank;
519
520 local_group_comm->start = start[local_idx];
521 local_group_comm->size = size[local_idx];
522 local_group_comm->comm = comm;
523 remote_group_comm->start = start[local_idx^1];
524 remote_group_comm->size = size[local_idx^1];
525 remote_group_comm->comm = comm;
526}
527
529
530 struct bounding_circle dummy;
531 MPI_Datatype bnd_circle_dt;
532 int array_of_blocklengths[] = {3, 1, 1};
533 const MPI_Aint array_of_displacements[] =
534 {(MPI_Aint)(intptr_t)(const void *)&(dummy.base_vector[0]) -
535 (MPI_Aint)(intptr_t)(const void *)&dummy,
536 (MPI_Aint)(intptr_t)(const void *)&(dummy.inc_angle.sin) -
537 (MPI_Aint)(intptr_t)(const void *)&dummy,
538 (MPI_Aint)(intptr_t)(const void *)&(dummy.inc_angle.cos) -
539 (MPI_Aint)(intptr_t)(const void *)&dummy};
540 const MPI_Datatype array_of_types[] =
541 {MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE};
543 MPI_Type_create_struct(3, array_of_blocklengths, array_of_displacements,
544 array_of_types, &bnd_circle_dt), comm);
545 return yac_create_resized(bnd_circle_dt, sizeof(dummy), comm);
546}
547
549 MPI_Datatype dt, size_t new_size, MPI_Comm comm) {
550
551 MPI_Datatype resized_dt;
552
553#define OPENMPI_WORKAROUND
554#ifdef OPENMPI_WORKAROUND
555 MPI_Aint lb, extent;
556 MPI_Type_get_extent(dt, &lb, &extent);
558 MPI_Type_create_resized(dt, lb, (MPI_Aint)new_size, &resized_dt), comm);
559#else
561 MPI_Type_create_resized(dt, 0, (MPI_Aint)new_size, &resized_dt), comm);
562#endif
563#undef OPENMPI_WORKAROUND
564 yac_mpi_call(MPI_Type_free(&dt), comm);
565 yac_mpi_call(MPI_Type_commit(&resized_dt), comm);
566 return resized_dt;
567}
568
570 int count, size_t const * sendcounts, size_t * recvcounts,
571 size_t * sdispls, size_t * rdispls, MPI_Comm comm) {
572
573 int comm_size;
574 yac_mpi_call(MPI_Comm_size(comm, &comm_size), comm);
575
576 // exchange the number of requested points
578 MPI_Alltoall(
579 (void const*)sendcounts, count, YAC_MPI_SIZE_T,
580 (void*)recvcounts, count, YAC_MPI_SIZE_T, comm), comm);
581
582 // sdispls are offset by one position, this is intentional because this is
583 // usefull for packing of data
584 sdispls[0] = 0;
585 for (size_t i = 0, saccu = 0, raccu = 0; i < count * comm_size; ++i) {
586 sdispls[i+1] = saccu;
587 rdispls[i] = raccu;
588 saccu += sendcounts[i];
589 raccu += recvcounts[i];
590 }
591}
592
594 int count, size_t ** sendcounts, size_t ** recvcounts,
595 size_t ** sdispls, size_t ** rdispls, MPI_Comm comm) {
596
597 int comm_size;
598 yac_mpi_call(MPI_Comm_size(comm, &comm_size), comm);
599
600 size_t * comm_buffer_;
601 if (!comm_buffer_in_use) {
604 4 * (size_t)count * (size_t)comm_size + 1);
605 comm_buffer_ = comm_buffer;
607 } else {
608 comm_buffer_ =
609 xmalloc(
610 (4 * (size_t)count * (size_t)comm_size + 1) * sizeof(*comm_buffer_));
611 }
612
613 size_t offset = (size_t)count * (size_t)comm_size;
614 *sendcounts = comm_buffer_ + 0 * offset;
615 *recvcounts = comm_buffer_ + 1 * offset;
616 *rdispls = comm_buffer_ + 2 * offset;
617 *sdispls = comm_buffer_ + 3 * offset; // sdispls is bigger by one element,
618 // which is usefull when packing data
619 // for alltoallv operation
620 memset(
621 comm_buffer_, 0, (size_t)count * (size_t)comm_size * sizeof(*comm_buffer_));
622}
623
625 size_t * sendcounts, size_t * recvcounts,
626 size_t * sdispls, size_t * rdispls) {
627
628 if (sendcounts != comm_buffer) free(sendcounts);
629 else comm_buffer_in_use = 0;
630}
631
632/*
633 * Local Variables:
634 * c-basic-offset: 2
635 * coding: utf-8
636 * indent-tabs-mode: nil
637 * show-trailing-whitespace: t
638 * require-trailing-newline: t
639 * End:
640 */
#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:18
#define YAC_ASSERT(exp, msg)
Definition yac_assert.h:15
#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:216
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:234
int yac_group_comm_get_global_rank(struct yac_group_comm group_comm)
Definition yac_mpi.c:491
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:569
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:624
int yac_group_comm_get_rank(struct yac_group_comm group_comm)
Definition yac_mpi.c:483
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:503
MPI_Datatype yac_get_bounding_circle_mpi_datatype(MPI_Comm comm)
Definition yac_mpi.c:528
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:497
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:468
void yac_mpi_error(int error_code, MPI_Comm comm)
Definition yac_mpi.c:116
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:287
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:593
static int log2_(int x)
Definition yac_mpi.c:351
int yac_group_comm_get_size(struct yac_group_comm group_comm)
Definition yac_mpi.c:487
MPI_Datatype yac_create_resized(MPI_Datatype dt, size_t new_size, MPI_Comm comm)
Definition yac_mpi.c:548
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:129
void yac_bcast_group(void *buffer, int count, MPI_Datatype datatype, int root, struct yac_group_comm group_comm)
Definition yac_mpi.c:403
void yac_allgather_uint64(const uint64_t *sendbuf, uint64_t *recvbuf, int count, struct yac_group_comm group_comm)
Definition yac_mpi.c:359
static int nearest_power_of_two(int x)
Definition yac_mpi.c:278
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:478
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