17 MPI_Datatype remote_point_info_dt;
18 int array_of_blocklengths[] = {1, 1};
19 const MPI_Aint array_of_displacements[] =
20 {(MPI_Aint)(intptr_t)(
const void *)&(dummy.
rank) -
21 (MPI_Aint)(intptr_t)(
const void *)&dummy,
22 (MPI_Aint)(intptr_t)(
const void *)&(dummy.
orig_pos) -
23 (MPI_Aint)(intptr_t)(
const void *)&dummy};
24 const MPI_Datatype array_of_types[] =
25 {MPI_INT, MPI_UINT64_T};
27 MPI_Type_create_struct(2, array_of_blocklengths, array_of_displacements,
28 array_of_types, &remote_point_info_dt), comm);
41 "ERROR(yac_remote_point_infos_get_pack_size): "
42 "count has to be > 0 (got %d)", infos->
count)
44 yac_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &pack_size_count), comm);
46 MPI_Pack_size(infos->
count, point_info_dt, comm, &pack_size_data), comm);
48 return pack_size_count + pack_size_data;
52 struct remote_point * point, MPI_Datatype point_info_dt, MPI_Comm comm) {
55 pack_size_remote_point_infos;
58 pack_size_remote_point_infos =
61 return pack_size_id + pack_size_remote_point_infos;
66 int * position, MPI_Datatype point_info_dt, MPI_Comm comm) {
68 int count = infos->
count;
72 "ERROR(yac_remote_point_infos_pack): "
73 "count has to be > 0 (got %d)", count)
79 MPI_Pack(&count, 1, MPI_INT,
buffer, buffer_size, position, comm), comm);
81 MPI_Pack(
info, count, point_info_dt,
buffer, buffer_size, position, comm),
87 MPI_Datatype point_info_dt, MPI_Comm comm) {
91 buffer_size, position, comm), comm);
94 &(point->
data),
buffer, buffer_size, position, point_info_dt, comm);
98 void *
buffer,
int buffer_size,
int * position,
103 MPI_Unpack(
buffer, buffer_size, position, &count, 1, MPI_INT, comm), comm);
105 infos->
count = count;
108 count > 0,
"ERROR(yac_remote_point_infos_unpack): "
109 "count has to be > 0 (got %d)", count)
119 MPI_Unpack(
buffer, buffer_size, position, point_infos, count,
120 point_info_dt, comm), comm);
125 MPI_Datatype point_info_dt, MPI_Comm comm) {
132 buffer, buffer_size, position, &(point->
data), point_info_dt, comm);
136 struct remote_points * points, MPI_Datatype point_info_dt, MPI_Comm comm) {
138 size_t count = points->count;
142 remote_points_pack_size;
144 yac_mpi_call(MPI_Pack_size(2, MPI_UINT64_T, comm, &count_pack_size), comm);
145 remote_points_pack_size = 0;
146 for (
size_t i = 0; i < count; ++i)
147 remote_points_pack_size +=
150 return count_pack_size + remote_points_pack_size;
155 MPI_Datatype point_info_dt, MPI_Comm comm) {
157 size_t count = points->count;
159 uint64_t counts[2] = {(uint64_t)count, 0};
160 for (
size_t i = 0; i < count; ++i)
161 if (point_data[i].
data.count > 1)
162 counts[1] += (uint64_t)(point_data[i].
data.count);
165 MPI_Pack(counts, 2, MPI_UINT64_T,
buffer,
166 buffer_size, position, comm), comm);
167 for (
size_t i = 0; i < count; ++i)
169 point_data + i,
buffer, buffer_size, position, point_info_dt, comm);
173 void *
buffer,
int buffer_size,
int * position,
179 MPI_Unpack(
buffer, buffer_size, position, &count, 1, MPI_INT, comm), comm);
181 infos->
count = count;
188 (infos->
data.
multi = info_buffer + *info_buffer_position);
189 *info_buffer_position += count;
193 MPI_Unpack(
buffer, buffer_size, position, point_infos, count,
194 point_info_dt, comm), comm);
198 void *
buffer,
int buffer_size,
int * position,
200 struct remote_point * point, MPI_Datatype point_info_dt, MPI_Comm comm) {
207 buffer, buffer_size, position, info_buffer, info_buffer_position,
208 &(point->
data), point_info_dt, comm);
212 void *
buffer,
int buffer_size,
int * position,
213 struct remote_points ** points, MPI_Datatype point_info_dt, MPI_Comm comm) {
219 buffer, buffer_size, position, counts, 2, MPI_UINT64_T, comm), comm);
224 size_t count = ((*points)->count = (size_t)(counts[0]));
226 ((*points)->data =
xmalloc(count *
sizeof(*((*points)->data))));
228 &((*points)->buffer[0]);
230 for (
size_t i = 0, offset = 0; i < count; ++i) {
233 buffer, buffer_size, position, remote_point_info_buffer, &offset,
234 point_data + i, point_info_dt, comm);
void yac_remote_point_pack(struct remote_point *point, void *buffer, int buffer_size, int *position, MPI_Datatype point_info_dt, MPI_Comm comm)
void yac_remote_point_unpack(void *buffer, int buffer_size, int *position, struct remote_point *point, MPI_Datatype point_info_dt, MPI_Comm comm)
void yac_remote_point_infos_unpack(void *buffer, int buffer_size, int *position, struct remote_point_infos *infos, MPI_Datatype point_info_dt, MPI_Comm comm)
int yac_remote_point_infos_get_pack_size(struct remote_point_infos const *infos, MPI_Datatype point_info_dt, MPI_Comm comm)
void yac_remote_points_pack(struct remote_points *points, void *buffer, int buffer_size, int *position, MPI_Datatype point_info_dt, MPI_Comm comm)
void yac_remote_points_unpack(void *buffer, int buffer_size, int *position, struct remote_points **points, MPI_Datatype point_info_dt, MPI_Comm comm)
int yac_remote_points_get_pack_size(struct remote_points *points, MPI_Datatype point_info_dt, MPI_Comm comm)
MPI_Datatype yac_get_remote_point_info_mpi_datatype(MPI_Comm comm)
static void yac_remote_point_infos_unpack_info_buffer(void *buffer, int buffer_size, int *position, struct remote_point_info *info_buffer, size_t *info_buffer_position, struct remote_point_infos *infos, MPI_Datatype point_info_dt, MPI_Comm comm)
void yac_remote_point_unpack_info_buffer(void *buffer, int buffer_size, int *position, struct remote_point_info *info_buffer, size_t *info_buffer_position, struct remote_point *point, MPI_Datatype point_info_dt, MPI_Comm comm)
void yac_remote_point_infos_pack(struct remote_point_infos const *infos, void *buffer, int buffer_size, int *position, MPI_Datatype point_info_dt, MPI_Comm comm)
int yac_remote_point_get_pack_size(struct remote_point *point, MPI_Datatype point_info_dt, MPI_Comm comm)
single location information of a point
location information about a point that is located on one or
union remote_point_infos::@53 data
struct remote_point_info single
struct remote_point_info * multi
information (global id and location) about a point that
struct remote_point_infos data
structure containing the information (global id and location)
#define YAC_ASSERT_F(exp, format,...)
MPI_Datatype yac_create_resized(MPI_Datatype dt, size_t new_size, MPI_Comm comm)
#define yac_mpi_call(call, comm)