Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
async transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
ist187691 committed May 18, 2021
1 parent dcf4ee7 commit d4ce2a5
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/ballAlg-mpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void mpi_get_transfer_send_info(int *receive_counts, int *send_counts, int *send
Transfers the left partition points to the respective team such that
the points retain their original order and are evenly split among the new team
*/
long mpi_transfer_left_partition(long n_points_local_left, long n_points_global_left, double** send_buf, double** recv_buf) {
long mpi_async_transfer_left_partition(long n_points_local_left, long n_points_global_left, double** send_buf, double** recv_buf, MPI_Request *request) {
long processes_n_points_left[n_procs];
int receive_counts[n_procs];
int receive_displacement[n_procs];
Expand All @@ -400,7 +400,7 @@ long mpi_transfer_left_partition(long n_points_local_left, long n_points_global_
mpi_get_transfer_send_info(receive_counts, send_counts, send_displacement);

/*transfer owned left partition points (send_buf) and receive new owned left partition points at recv_buf */
MPI_Alltoallv(
MPI_Ialltoallv(
*send_buf, /* starting address of sent data */
send_counts, /* number of elements to send to each process */
send_displacement, /* buffer offset of data elements to send to each process */
Expand All @@ -409,7 +409,8 @@ long mpi_transfer_left_partition(long n_points_local_left, long n_points_global_
receive_counts, /* number of elements to receive from each process */
receive_displacement, /* buffer offset of data elements received from each process */
MPI_DOUBLE, /* receive values of type double */
communicator /* sending and receiving to all processes in the current team */
communicator, /* sending and receiving to all processes in the current team */
request
);

return size;
Expand All @@ -419,7 +420,7 @@ long mpi_transfer_left_partition(long n_points_local_left, long n_points_global_
Transfers the right partition points to the respective team such that
the points retain their original order and are evenly split among the new team
*/
long mpi_transfer_right_partition(long n_points_local_right, long n_points_global_right, double** send_buf, double** recv_buf) {
long mpi_async_transfer_right_partition(long n_points_local_right, long n_points_global_right, double** send_buf, double** recv_buf, MPI_Request *request) {
long processes_n_points_right[n_procs];
int receive_counts[n_procs];
int send_counts[n_procs];
Expand All @@ -443,7 +444,7 @@ long mpi_transfer_right_partition(long n_points_local_right, long n_points_globa


/*transfer owned right partition points (send_buf) and receive new owned right partition points at recv_buf */
MPI_Alltoallv(
MPI_Ialltoallv(
*send_buf, /* starting address of sent data */
send_counts, /* number of elements to send to each process */
send_displacement, /* buffer offset of data elements to send to each process */
Expand All @@ -452,7 +453,8 @@ long mpi_transfer_right_partition(long n_points_local_right, long n_points_globa
receive_counts, /* number of elements to receive from each process */
receive_displacement, /* buffer offset of data elements received from each process */
MPI_DOUBLE, /* receive values of type double */
communicator /* sending and receiving to all processes in the current team */
communicator, /* sending and receiving to all processes in the current team */
request
);

return size;
Expand Down Expand Up @@ -504,8 +506,14 @@ void mpi_build_tree() {
}

/* transfer partition points to correct team */
n_points_local_right = mpi_transfer_right_partition(n_points_local_right, n_points_global_right, pts_aux + n_points_local_left, pts);
n_points_local_left = mpi_transfer_left_partition(n_points_local_left, n_points_global_left, pts_aux, pts);
MPI_Request left_request;
MPI_Request right_request;

n_points_local_right = mpi_async_transfer_right_partition(n_points_local_right, n_points_global_right, pts_aux + n_points_local_left, pts, &right_request);
n_points_local_left = mpi_async_transfer_left_partition(n_points_local_left, n_points_global_left, pts_aux, pts, &left_request);

MPI_Wait(&left_request, MPI_STATUS_IGNORE);
MPI_Wait(&right_request, MPI_STATUS_IGNORE);

if (mpi_split_communication_group()) {
/* belong to right team */
Expand Down

0 comments on commit d4ce2a5

Please sign in to comment.