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);
39 yac_mpi_call(MPI_Pack_size(1, MPI_INT, comm, &pack_size_count), comm);
41 MPI_Pack_size(infos->
count, point_info_dt, comm, &pack_size_data), comm);
43 return pack_size_count + pack_size_data;
47 struct remote_point * point, MPI_Datatype point_info_dt, MPI_Comm comm) {
50 pack_size_remote_point_infos;
53 pack_size_remote_point_infos =
56 return pack_size_id + pack_size_remote_point_infos;
61 int * position, MPI_Datatype point_info_dt, MPI_Comm comm) {
63 int count = infos->
count;
69 MPI_Pack(&count, 1, MPI_INT,
buffer, buffer_size, position, comm), comm);
71 MPI_Pack(info, count, point_info_dt,
buffer, buffer_size, position, comm),
77 MPI_Datatype point_info_dt, MPI_Comm comm) {
81 buffer_size, position, comm), comm);
84 &(point->
data),
buffer, buffer_size, position, point_info_dt, comm);
88 void *
buffer,
int buffer_size,
int * position,
93 MPI_Unpack(
buffer, buffer_size, position, &count, 1, MPI_INT, comm), comm);
98 count > 0,
"ERROR(yac_remote_point_infos_unpack): invalid count")
108 MPI_Unpack(
buffer, buffer_size, position, point_infos, count,
109 point_info_dt, comm), comm);
114 MPI_Datatype point_info_dt, MPI_Comm comm) {
121 buffer, buffer_size, position, &(point->
data), point_info_dt, comm);
127 size_t count =
points->count;
131 remote_points_pack_size;
133 yac_mpi_call(MPI_Pack_size(2, MPI_UINT64_T, comm, &count_pack_size), comm);
134 remote_points_pack_size = 0;
135 for (
size_t i = 0; i < count; ++i)
136 remote_points_pack_size +=
139 return count_pack_size + remote_points_pack_size;
144 MPI_Datatype point_info_dt, MPI_Comm comm) {
146 size_t count =
points->count;
148 uint64_t counts[2] = {(uint64_t)count, 0};
149 for (
size_t i = 0; i < count; ++i)
150 if (point_data[i].
data.count > 1)
151 counts[1] += (uint64_t)(point_data[i].
data.count);
154 MPI_Pack(counts, 2, MPI_UINT64_T,
buffer,
155 buffer_size, position, comm), comm);
156 for (
size_t i = 0; i < count; ++i)
158 point_data + i,
buffer, buffer_size, position, point_info_dt, comm);
162 void *
buffer,
int buffer_size,
int * position,
168 MPI_Unpack(
buffer, buffer_size, position, &count, 1, MPI_INT, comm), comm);
170 infos->
count = count;
177 (infos->
data.
multi = info_buffer + *info_buffer_position);
178 *info_buffer_position += count;
182 MPI_Unpack(
buffer, buffer_size, position, point_infos, count,
183 point_info_dt, comm), comm);
187 void *
buffer,
int buffer_size,
int * position,
189 struct remote_point * point, MPI_Datatype point_info_dt, MPI_Comm comm) {
196 buffer, buffer_size, position, info_buffer, info_buffer_position,
197 &(point->
data), point_info_dt, comm);
201 void *
buffer,
int buffer_size,
int * position,
208 buffer, buffer_size, position, counts, 2, MPI_UINT64_T, comm), comm);
213 size_t count = ((*points)->count = (size_t)(counts[0]));
215 ((*points)->data =
xmalloc(count *
sizeof(*((*points)->data))));
217 &((*points)->buffer[0]);
219 for (
size_t i = 0, offset = 0; i < count; ++i) {
222 buffer, buffer_size, position, remote_point_info_buffer, &offset,
223 point_data + i, point_info_dt, comm);
#define YAC_ASSERT(exp, msg)
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)
static struct user_input_data_points ** points
MPI_Datatype yac_create_resized(MPI_Datatype dt, size_t new_size, MPI_Comm comm)
#define yac_mpi_call(call, comm)