YAC 3.14.0
Yet Another Coupler
Loading...
Searching...
No Matches
yac_mpi_internal.h
Go to the documentation of this file.
1// Copyright (c) 2024 The YAC Authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef YAC_MPI_INTERNAL_H
6#define YAC_MPI_INTERNAL_H
7
8#include <stdint.h>
9#include <mpi.h>
10#include "utils_core.h"
11#include "yac_mpi_common.h"
12#include "yac_mpi.h"
13
14#if SIZE_MAX == UINT8_MAX
15#define YAC_MPI_SIZE_T MPI_UINT8_T
16#define YAC_MPI_SIZE_T_TYPE uint8_t
17#elif SIZE_MAX == UINT16_MAX
18#define YAC_MPI_SIZE_T MPI_UINT16_T
19#define YAC_MPI_SIZE_T_TYPE uint16_t
20#elif SIZE_MAX == UINT32_MAX
21#define YAC_MPI_SIZE_T MPI_UINT32_T
22#define YAC_MPI_SIZE_T_TYPE uint32_t
23#elif SIZE_MAX == UINT64_MAX
24#define YAC_MPI_SIZE_T MPI_UINT64_T
25#define YAC_MPI_SIZE_T_TYPE uint64_t
26#else
27#error "YAC: unable to determine MPI data type for size_t"
28#endif
29
31 int start;
32 int size;
33 MPI_Comm comm;
34};
35
36#define YAC_ALLTOALLV_P2P_DEC(N, T) \
37void yac_alltoallv_ ## N ## _p2p( \
38 T const * send_buffer, size_t const * sendcounts, size_t const * sdispls, \
39 T * recv_buffer, size_t const * recvcounts, size_t const * rdispls, \
40 MPI_Comm comm, char const * caller, int line); \
41
44YAC_ALLTOALLV_P2P_DEC(uint64, uint64_t)
45YAC_ALLTOALLV_P2P_DEC(packed, void)
46YAC_ALLTOALLV_P2P_DEC(dble, double)
47YAC_ALLTOALLV_P2P_DEC(size_t, size_t)
48
49#undef YAC_ALLTOALLV_P2P_DEC
50
52 void const * send_buffer, size_t const * sendcounts, size_t const * sdispls,
53 void * recv_buffer, size_t const * recvcounts, size_t const * rdispls,
54 size_t dt_size, MPI_Datatype dt, MPI_Comm comm,
55 char const * caller, int line);
56
58 void const * send_buffer, int const * sendcounts, int const * sdispls,
59 void * recv_buffer, int const * recvcounts, int const * rdispls,
60 size_t dt_size, MPI_Datatype dt, struct yac_group_comm group_comm);
61
63 double * buffer, int count, struct yac_group_comm group_comm);
64
66 const size_t * sendbuf, size_t * recvbuf, int count,
67 struct yac_group_comm group_comm);
68
70 void * buffer, int count, MPI_Datatype datatype, int root,
71 struct yac_group_comm group_comm);
72
74void yac_group_comm_delete(struct yac_group_comm group_comm);
75int yac_group_comm_get_rank(struct yac_group_comm group_comm);
76int yac_group_comm_get_size(struct yac_group_comm group_comm);
79
81 struct yac_group_comm group_comm, int split_rank,
82 struct yac_group_comm * local_group_comm,
83 struct yac_group_comm * remote_group_comm);
84
85MPI_Datatype yac_get_bounding_circle_mpi_datatype(MPI_Comm comm);
86MPI_Datatype yac_create_resized(
87 MPI_Datatype dt, size_t new_size, MPI_Comm comm);
88
90 int count, size_t const * sendcounts, size_t * recvcounts,
91 size_t * sdispls, size_t * rdispls, MPI_Comm comm);
92
94 int count, size_t ** sendcounts, size_t ** recvcounts,
95 size_t ** sdispls, size_t ** rdispls, MPI_Comm comm);
97 size_t * sendcounts, size_t * recvcounts,
98 size_t * sdispls, size_t * rdispls);
99
117 char const * caller, char const * string, MPI_Comm comm, int allow_null);
118
141void yac_string_pack(
142 char const * caller, char const * string, void * buffer, int buffer_size,
143 int * position, MPI_Comm comm, int allow_null);
144
161char * yac_string_unpack(
162 void const * buffer, int buffer_size, int * position, MPI_Comm comm);
163
164#endif // YAC_MPI_INTERNAL_H
165
166/*
167 * Local Variables:
168 * c-basic-offset: 2
169 * coding: utf-8
170 * indent-tabs-mode: nil
171 * show-trailing-whitespace: t
172 * require-trailing-newline: t
173 * End:
174 */
double * buffer
double * send_buffer
double * recv_buffer
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:243
int yac_group_comm_get_global_rank(struct yac_group_comm group_comm)
Definition yac_mpi.c:500
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:578
void yac_free_comm_buffers(size_t *sendcounts, size_t *recvcounts, size_t *sdispls, size_t *rdispls)
Definition yac_mpi.c:634
int yac_group_comm_get_rank(struct yac_group_comm group_comm)
Definition yac_mpi.c:492
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:512
MPI_Datatype yac_get_bounding_circle_mpi_datatype(MPI_Comm comm)
Definition yac_mpi.c:537
int yac_group_comm_get_global_size(struct yac_group_comm group_comm)
Definition yac_mpi.c:506
struct yac_group_comm yac_group_comm_new(MPI_Comm comm)
Definition yac_mpi.c:477
void yac_allreduce_sum_dble(double *buffer, int count, struct yac_group_comm group_comm)
Definition yac_mpi.c:296
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:603
#define YAC_ALLTOALLV_P2P_DEC(N, T)
int yac_group_comm_get_size(struct yac_group_comm group_comm)
Definition yac_mpi.c:496
size_t yac_string_get_pack_size(char const *caller, char const *string, MPI_Comm comm, int allow_null)
Compute number of bytes required to pack a string for MPI transport.
Definition yac_mpi.c:646
MPI_Datatype yac_create_resized(MPI_Datatype dt, size_t new_size, MPI_Comm comm)
Definition yac_mpi.c:557
void yac_bcast_group(void *buffer, int count, MPI_Datatype datatype, int root, struct yac_group_comm group_comm)
Definition yac_mpi.c:412
char * yac_string_unpack(void const *buffer, int buffer_size, int *position, MPI_Comm comm)
Unpack a C string from a buffer packed with yac_string_pack.
Definition yac_mpi.c:697
void yac_allgather_size_t(const size_t *sendbuf, size_t *recvbuf, int count, struct yac_group_comm group_comm)
Definition yac_mpi.c:368
void yac_string_pack(char const *caller, char const *string, void *buffer, int buffer_size, int *position, MPI_Comm comm, int allow_null)
Pack a C string into a provided buffer using MPI_Pack semantics.
Definition yac_mpi.c:667
void yac_group_comm_delete(struct yac_group_comm group_comm)
Definition yac_mpi.c:487
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, char const *caller, int line)
Definition yac_mpi.c:132
YAC_INT yac_int
Definition yac_types.h:15