Skip to content
Snippets Groups Projects
Commit dc5acb1b authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

Change sub-array offsets to save data move.

parent 945a3f8c
No related branches found
No related tags found
No related merge requests found
......@@ -716,9 +716,9 @@ exchange_pos_ext_modifications(
MPI_Request * requests
= xmalloc((size_t)(num_src_intersections + 2 * num_dst_intersections) *
sizeof(*requests));
MPI_Request *restrict recv_requests = requests,
*restrict send_header_requests = requests + num_src_intersections,
*restrict send_data_requests = send_header_requests + num_dst_intersections;
MPI_Request *restrict send_header_requests = requests,
*restrict recv_requests = requests + num_dst_intersections,
*restrict send_data_requests = recv_requests + num_src_intersections;
// set up receives for indices that need to be removed from the send messages
for (int i = 0; i < num_src_intersections; ++i)
......@@ -758,7 +758,7 @@ exchange_pos_ext_modifications(
// wait for the receiving of headers to complete
xt_mpi_call(MPI_Waitall(num_src_intersections + num_dst_intersections,
recv_requests, MPI_STATUSES_IGNORE), comm);
requests, MPI_STATUSES_IGNORE), comm);
size_t total_num_pos_ext_to_recv = 0;
......@@ -777,26 +777,23 @@ exchange_pos_ext_modifications(
size_t offset = 0;
for (int i = 0; i < num_src_intersections; ++i)
if (src_removals_per_intersection[i][1] > 0) {
++num_src_changes;
xt_mpi_call(MPI_Irecv(
src_updated_pos_ext + offset,
src_removals_per_intersection[i][1], MPI_2INT,
src_com[i].rank,
tag_offset + xt_mpi_tag_xmap_intersection_data_exchange,
comm, recv_requests + num_src_changes), comm);
comm, send_data_requests - num_src_changes), comm);
offset += (size_t)src_removals_per_intersection[i][1];
++num_src_changes;
}
} else
src_updated_pos_ext = NULL;
/* move data request handles for compact wait */
memcpy(recv_requests + num_src_changes, send_data_requests,
num_dst_changes * sizeof (recv_requests[0]));
// wait until all communication is completed
xt_mpi_call(MPI_Waitall((int)num_src_changes + (int)num_dst_changes,
recv_requests, MPI_STATUSES_IGNORE), comm);
send_data_requests - num_src_changes,
MPI_STATUSES_IGNORE), comm);
free(requests);
return src_updated_pos_ext;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment