From: David Wells Date: Tue, 25 May 2021 22:14:41 +0000 (-0400) Subject: Add some more AssertThrowMPIs. X-Git-Tag: v9.4.0-rc1~1335^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=accede746c897ada9047107b146f5221a23de8ec;p=dealii.git Add some more AssertThrowMPIs. --- diff --git a/include/deal.II/base/aligned_vector.h b/include/deal.II/base/aligned_vector.h index 0d9385108b..9f216af047 100644 --- a/include/deal.II/base/aligned_vector.h +++ b/include/deal.II/base/aligned_vector.h @@ -1536,7 +1536,8 @@ AlignedVector::replicate_across_communicator(const MPI_Comm & communicator, // Make sure that the shared memory host has copied the data before we try to // access it. - MPI_Barrier(shmem_group_communicator); + const int ierr = MPI_Barrier(shmem_group_communicator); + AssertThrowMPI(ierr); // **** Step 7 **** // Finally, we need to set the pointers of this object to what we just diff --git a/include/deal.II/base/mpi.h b/include/deal.II/base/mpi.h index 7d99cddb9b..d0f416a5a3 100644 --- a/include/deal.II/base/mpi.h +++ b/include/deal.II/base/mpi.h @@ -1398,8 +1398,9 @@ namespace Utilities std::vector size_all_data(n_procs, 0); // Exchanging the size of each buffer - MPI_Allgather( + int ierr = MPI_Allgather( &n_local_data, 1, MPI_INT, size_all_data.data(), 1, MPI_INT, comm); + AssertThrowMPI(ierr); // Now computing the displacement, relative to recvbuf, // at which to store the incoming buffer @@ -1412,14 +1413,15 @@ namespace Utilities std::vector received_unrolled_buffer(rdispls.back() + size_all_data.back()); - MPI_Allgatherv(buffer.data(), - n_local_data, - MPI_CHAR, - received_unrolled_buffer.data(), - size_all_data.data(), - rdispls.data(), - MPI_CHAR, - comm); + ierr = MPI_Allgatherv(buffer.data(), + n_local_data, + MPI_CHAR, + received_unrolled_buffer.data(), + size_all_data.data(), + rdispls.data(), + MPI_CHAR, + comm); + AssertThrowMPI(ierr); std::vector received_objects(n_procs); for (unsigned int i = 0; i < n_procs; ++i) diff --git a/include/deal.II/base/mpi_compute_index_owner_internal.h b/include/deal.II/base/mpi_compute_index_owner_internal.h index 7b00cfea4f..71cdc86d21 100644 --- a/include/deal.II/base/mpi_compute_index_owner_internal.h +++ b/include/deal.II/base/mpi_compute_index_owner_internal.h @@ -359,7 +359,7 @@ namespace Utilities { // wait for an incoming message MPI_Status status; - auto ierr = + int ierr = MPI_Probe(MPI_ANY_SOURCE, mpi_tag, comm, &status); AssertThrowMPI(ierr); @@ -876,9 +876,8 @@ namespace Utilities ++c) { // wait for an incoming message - MPI_Status status; - unsigned int ierr = - MPI_Probe(MPI_ANY_SOURCE, mpi_tag, comm, &status); + MPI_Status status; + int ierr = MPI_Probe(MPI_ANY_SOURCE, mpi_tag, comm, &status); AssertThrowMPI(ierr); // retrieve size of incoming message diff --git a/include/deal.II/base/mpi_consensus_algorithms.templates.h b/include/deal.II/base/mpi_consensus_algorithms.templates.h index eb6945da09..2fd8e28279 100644 --- a/include/deal.II/base/mpi_consensus_algorithms.templates.h +++ b/include/deal.II/base/mpi_consensus_algorithms.templates.h @@ -346,19 +346,20 @@ namespace Utilities } - const int ierr = MPI_Wait(&barrier_request, MPI_STATUS_IGNORE); + int ierr = MPI_Wait(&barrier_request, MPI_STATUS_IGNORE); AssertThrowMPI(ierr); for (auto &i : request_requests) { - const auto ierr = MPI_Wait(i.get(), MPI_STATUS_IGNORE); + ierr = MPI_Wait(i.get(), MPI_STATUS_IGNORE); AssertThrowMPI(ierr); } # ifdef DEBUG // note: IBarrier seems to make problem during testing, this // additional Barrier seems to help - MPI_Barrier(this->comm); + ierr = MPI_Barrier(this->comm); + AssertThrowMPI(ierr); # endif } diff --git a/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h b/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h index e3a1447d70..38a15b4151 100644 --- a/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h +++ b/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h @@ -106,7 +106,7 @@ namespace Utilities AssertIndexRange(recv_ranks.size(), recv_ptr.size()); for (types::global_dof_index i = 0; i < recv_ranks.size(); i++) { - const auto ierr = + const int ierr = MPI_Irecv(buffers.data() + recv_ptr[i], recv_ptr[i + 1] - recv_ptr[i], Utilities::MPI::internal::mpi_type_id(buffers.data()), @@ -135,7 +135,7 @@ namespace Utilities (send_ptr[i] == buffers.size() && send_ptr[i + 1] == send_ptr[i]), ExcMessage("The input buffer doesn't contain enough entries")); - const auto ierr = + const int ierr = MPI_Isend(buffers.data() + send_ptr[i], send_ptr[i + 1] - send_ptr[i], Utilities::MPI::internal::mpi_type_id(buffers.data()), @@ -182,7 +182,7 @@ namespace Utilities } // wait that all data packages have been sent - const auto ierr = + const int ierr = MPI_Waitall(send_ranks.size(), requests.data(), MPI_STATUSES_IGNORE); AssertThrowMPI(ierr); #endif diff --git a/include/deal.II/base/mpi_remote_point_evaluation.h b/include/deal.II/base/mpi_remote_point_evaluation.h index ebd3f3a5b8..74dc477e78 100644 --- a/include/deal.II/base/mpi_remote_point_evaluation.h +++ b/include/deal.II/base/mpi_remote_point_evaluation.h @@ -310,13 +310,14 @@ namespace Utilities requests.push_back(MPI_Request()); - MPI_Isend(buffer.data(), - buffer.size(), - MPI_CHAR, - send_ranks[i], - internal::Tags::remote_point_evaluation, - tria->get_communicator(), - &requests.back()); + const int ierr = MPI_Isend(buffer.data(), + buffer.size(), + MPI_CHAR, + send_ranks[i], + internal::Tags::remote_point_evaluation, + tria->get_communicator(), + &requests.back()); + AssertThrowMPI(ierr); } for (const auto recv_rank : recv_ranks) @@ -325,30 +326,35 @@ namespace Utilities continue; MPI_Status status; - MPI_Probe(MPI_ANY_SOURCE, - internal::Tags::remote_point_evaluation, - tria->get_communicator(), - &status); + int ierr = MPI_Probe(MPI_ANY_SOURCE, + internal::Tags::remote_point_evaluation, + tria->get_communicator(), + &status); + AssertThrowMPI(ierr); int message_length; - MPI_Get_count(&status, MPI_CHAR, &message_length); + ierr = MPI_Get_count(&status, MPI_CHAR, &message_length); + AssertThrowMPI(ierr); std::vector buffer(message_length); - MPI_Recv(buffer.data(), - buffer.size(), - MPI_CHAR, - status.MPI_SOURCE, - internal::Tags::remote_point_evaluation, - tria->get_communicator(), - MPI_STATUS_IGNORE); + ierr = MPI_Recv(buffer.data(), + buffer.size(), + MPI_CHAR, + status.MPI_SOURCE, + internal::Tags::remote_point_evaluation, + tria->get_communicator(), + MPI_STATUS_IGNORE); + AssertThrowMPI(ierr); temp_recv_map[status.MPI_SOURCE] = Utilities::unpack>(buffer, false); } // make sure all messages have been sent - MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE); + const int ierr = + MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE); + AssertThrowMPI(ierr); // copy received data into output vector auto it = recv_permutation.begin(); @@ -443,13 +449,14 @@ namespace Utilities requests.push_back(MPI_Request()); - MPI_Isend(buffer_send.data(), - buffer_send.size(), - MPI_CHAR, - recv_rank, - internal::Tags::remote_point_evaluation, - tria->get_communicator(), - &requests.back()); + const int ierr = MPI_Isend(buffer_send.data(), + buffer_send.size(), + MPI_CHAR, + recv_rank, + internal::Tags::remote_point_evaluation, + tria->get_communicator(), + &requests.back()); + AssertThrowMPI(ierr); } for (unsigned int i = 0; i < send_ranks.size(); ++i) @@ -474,24 +481,26 @@ namespace Utilities } MPI_Status status; - MPI_Probe(MPI_ANY_SOURCE, - internal::Tags::remote_point_evaluation, - tria->get_communicator(), - &status); + int ierr = MPI_Probe(MPI_ANY_SOURCE, + internal::Tags::remote_point_evaluation, + tria->get_communicator(), + &status); + AssertThrowMPI(ierr); int message_length; - MPI_Get_count(&status, MPI_CHAR, &message_length); + ierr = MPI_Get_count(&status, MPI_CHAR, &message_length); + AssertThrowMPI(ierr); std::vector recv_buffer(message_length); - MPI_Recv(recv_buffer.data(), - recv_buffer.size(), - MPI_CHAR, - status.MPI_SOURCE, - internal::Tags::remote_point_evaluation, - tria->get_communicator(), - MPI_STATUS_IGNORE); - + ierr = MPI_Recv(recv_buffer.data(), + recv_buffer.size(), + MPI_CHAR, + status.MPI_SOURCE, + internal::Tags::remote_point_evaluation, + tria->get_communicator(), + MPI_STATUS_IGNORE); + AssertThrowMPI(ierr); const auto recv_buffer_unpacked = Utilities::unpack>(recv_buffer, false); @@ -515,7 +524,9 @@ namespace Utilities } } - MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE); + const int ierr = + MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE); + AssertThrowMPI(ierr); // sort for easy access during function call for (unsigned int i = 0; i < send_permutation.size(); ++i) diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index bf55d336bd..4073de0829 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -164,9 +164,11 @@ namespace LinearAlgebra std::vector others(size_sm); MPI_Info info; - MPI_Info_create(&info); + int ierr = MPI_Info_create(&info); + AssertThrowMPI(ierr); - MPI_Info_set(info, "alloc_shared_noncontig", "true"); + ierr = MPI_Info_set(info, "alloc_shared_noncontig", "true"); + AssertThrowMPI(ierr); const std::size_t align_by = 64; @@ -175,7 +177,7 @@ namespace LinearAlgebra sizeof(Number)) * sizeof(Number); - auto ierr = MPI_Win_allocate_shared( + ierr = MPI_Win_allocate_shared( s, sizeof(Number), info, comm_shared, &data_this, &mpi_window); AssertThrowMPI(ierr); diff --git a/include/deal.II/matrix_free/face_setup_internal.h b/include/deal.II/matrix_free/face_setup_internal.h index 89935c6f4c..504bd6dc63 100644 --- a/include/deal.II/matrix_free/face_setup_internal.h +++ b/include/deal.II/matrix_free/face_setup_internal.h @@ -299,46 +299,50 @@ namespace internal MPI_Status status; unsigned int mysize = inner_face.second.shared_faces.size(); unsigned int othersize = numbers::invalid_unsigned_int; - MPI_Sendrecv(&mysize, - 1, - MPI_UNSIGNED, - inner_face.first, - 600 + my_domain, - &othersize, - 1, - MPI_UNSIGNED, - inner_face.first, - 600 + inner_face.first, - comm, - &status); + + int ierr = MPI_Sendrecv(&mysize, + 1, + MPI_UNSIGNED, + inner_face.first, + 600 + my_domain, + &othersize, + 1, + MPI_UNSIGNED, + inner_face.first, + 600 + inner_face.first, + comm, + &status); + AssertThrowMPI(ierr); AssertDimension(mysize, othersize); mysize = inner_face.second.n_hanging_faces_smaller_subdomain; - MPI_Sendrecv(&mysize, - 1, - MPI_UNSIGNED, - inner_face.first, - 700 + my_domain, - &othersize, - 1, - MPI_UNSIGNED, - inner_face.first, - 700 + inner_face.first, - comm, - &status); + ierr = MPI_Sendrecv(&mysize, + 1, + MPI_UNSIGNED, + inner_face.first, + 700 + my_domain, + &othersize, + 1, + MPI_UNSIGNED, + inner_face.first, + 700 + inner_face.first, + comm, + &status); + AssertThrowMPI(ierr); AssertDimension(mysize, othersize); mysize = inner_face.second.n_hanging_faces_larger_subdomain; - MPI_Sendrecv(&mysize, - 1, - MPI_UNSIGNED, - inner_face.first, - 800 + my_domain, - &othersize, - 1, - MPI_UNSIGNED, - inner_face.first, - 800 + inner_face.first, - comm, - &status); + ierr = MPI_Sendrecv(&mysize, + 1, + MPI_UNSIGNED, + inner_face.first, + 800 + my_domain, + &othersize, + 1, + MPI_UNSIGNED, + inner_face.first, + 800 + inner_face.first, + comm, + &status); + AssertThrowMPI(ierr); AssertDimension(mysize, othersize); # endif @@ -463,44 +467,47 @@ namespace internal // make sure the splitting is consistent between both sides # if defined(DEAL_II_WITH_MPI) && defined(DEBUG) - MPI_Sendrecv(&split_index, - 1, - MPI_UNSIGNED, - inner_face.first, - 900 + my_domain, - &othersize, - 1, - MPI_UNSIGNED, - inner_face.first, - 900 + inner_face.first, - comm, - &status); + ierr = MPI_Sendrecv(&split_index, + 1, + MPI_UNSIGNED, + inner_face.first, + 900 + my_domain, + &othersize, + 1, + MPI_UNSIGNED, + inner_face.first, + 900 + inner_face.first, + comm, + &status); + AssertThrowMPI(ierr); AssertDimension(split_index, othersize); - MPI_Sendrecv(&n_faces_lower_proc, - 1, - MPI_UNSIGNED, - inner_face.first, - 1000 + my_domain, - &othersize, - 1, - MPI_UNSIGNED, - inner_face.first, - 1000 + inner_face.first, - comm, - &status); + ierr = MPI_Sendrecv(&n_faces_lower_proc, + 1, + MPI_UNSIGNED, + inner_face.first, + 1000 + my_domain, + &othersize, + 1, + MPI_UNSIGNED, + inner_face.first, + 1000 + inner_face.first, + comm, + &status); + AssertThrowMPI(ierr); AssertDimension(n_faces_lower_proc, othersize); - MPI_Sendrecv(&n_faces_higher_proc, - 1, - MPI_UNSIGNED, - inner_face.first, - 1100 + my_domain, - &othersize, - 1, - MPI_UNSIGNED, - inner_face.first, - 1100 + inner_face.first, - comm, - &status); + ierr = MPI_Sendrecv(&n_faces_higher_proc, + 1, + MPI_UNSIGNED, + inner_face.first, + 1100 + my_domain, + &othersize, + 1, + MPI_UNSIGNED, + inner_face.first, + 1100 + inner_face.first, + comm, + &status); + AssertThrowMPI(ierr); AssertDimension(n_faces_higher_proc, othersize); # endif diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index 53fe0202be..54ed7d273d 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -3741,7 +3741,11 @@ namespace internal } if (Utilities::MPI::job_supports_mpi()) - MPI_Barrier(matrix_free.get_task_info().communicator_sm); + { + const int ierr = + MPI_Barrier(matrix_free.get_task_info().communicator_sm); + AssertThrowMPI(ierr); + } # endif } } diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h index d38b2eb6e3..ae60aa9154 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -723,7 +723,7 @@ namespace internal for (unsigned int i = 0; i < ranks.size(); ++i) { MPI_Status status; - const auto ierr_1 = MPI_Probe( + const int ierr_1 = MPI_Probe( MPI_ANY_SOURCE, Utilities::MPI::internal::Tags::fine_dof_handler_view_reinit, communicator, @@ -732,8 +732,8 @@ namespace internal std::vector buffer; - int message_length; - const auto ierr_2 = + int message_length; + const int ierr_2 = MPI_Get_count(&status, Utilities::MPI::internal::mpi_type_id( buffer.data()), @@ -742,7 +742,7 @@ namespace internal buffer.resize(message_length); - const auto ierr_3 = MPI_Recv( + const int ierr_3 = MPI_Recv( buffer.data(), buffer.size(), Utilities::MPI::internal::mpi_type_id(buffer.data()), @@ -779,7 +779,7 @@ namespace internal } } - const auto ierr_1 = + const int ierr_1 = MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE); AssertThrowMPI(ierr_1); }