From 64d78446d84c49074e5ada7aae420ded0b721496 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 25 Feb 2022 17:13:53 -0700 Subject: [PATCH] Rename the new variable. --- include/deal.II/base/mpi.h | 14 ++--- include/deal.II/base/mpi.templates.h | 4 +- .../mpi_noncontiguous_partitioner.templates.h | 30 +++++----- .../mg_transfer_global_coarsening.templates.h | 6 +- source/base/mpi.cc | 30 +++++----- source/base/partitioner.cc | 2 +- source/base/process_grid.cc | 2 +- .../repartitioning_policy_tools.cc | 27 ++++----- source/distributed/tria_base.cc | 30 +++++----- source/lac/scalapack.cc | 4 +- source/matrix_free/vector_data_exchange.cc | 58 ++++++++++--------- 11 files changed, 106 insertions(+), 101 deletions(-) diff --git a/include/deal.II/base/mpi.h b/include/deal.II/base/mpi.h index ef19e0a024..61bb98aab2 100644 --- a/include/deal.II/base/mpi.h +++ b/include/deal.II/base/mpi.h @@ -1450,16 +1450,16 @@ namespace Utilities * template argument to the corresponding * `MPI_Datatype` to be used for MPI communication. * - * As an example, the value of `mpi_type_id` is `MPI_INT`. A + * As an example, the value of `mpi_type_id_for_type` is `MPI_INT`. A * common way to use this variable is when sending an object `obj` * via MPI functions to another process, and using - * `mpi_type_id` to infer the correct MPI type to + * `mpi_type_id_for_type` to infer the correct MPI type to * use for the communication. */ template - const MPI_Datatype mpi_type_id = internal::MPIDataTypes::mpi_type_id( - static_cast>> *>(nullptr)); + const MPI_Datatype + mpi_type_id_for_type = internal::MPIDataTypes::mpi_type_id( + static_cast> *>(nullptr)); #endif #ifndef DOXYGEN @@ -1820,7 +1820,7 @@ namespace Utilities const int ierr = MPI_Bcast(buffer + total_sent_count, current_count, - mpi_type_id, + mpi_type_id_for_type, root, comm); AssertThrowMPI(ierr); @@ -1860,7 +1860,7 @@ namespace Utilities // Exchange the size of buffer int ierr = MPI_Bcast(&buffer_size, 1, - mpi_type_id, + mpi_type_id_for_type, root_process, comm); AssertThrowMPI(ierr); diff --git a/include/deal.II/base/mpi.templates.h b/include/deal.II/base/mpi.templates.h index 0af2709a1c..ccccc91c1b 100644 --- a/include/deal.II/base/mpi.templates.h +++ b/include/deal.II/base/mpi.templates.h @@ -85,7 +85,7 @@ namespace Utilities MPI_IN_PLACE, static_cast(output.data()), static_cast(values.size()), - mpi_type_id, + mpi_type_id_for_type, mpi_op, mpi_communicator); AssertThrowMPI(ierr); @@ -125,7 +125,7 @@ namespace Utilities MPI_IN_PLACE, static_cast(output.data()), static_cast(values.size() * 2), - mpi_type_id, + mpi_type_id_for_type, mpi_op, mpi_communicator); AssertThrowMPI(ierr); diff --git a/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h b/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h index e342968988..e0bb073137 100644 --- a/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h +++ b/include/deal.II/base/mpi_noncontiguous_partitioner.templates.h @@ -106,13 +106,14 @@ namespace Utilities AssertIndexRange(recv_ranks.size(), recv_ptr.size()); for (types::global_dof_index i = 0; i < recv_ranks.size(); ++i) { - const int ierr = MPI_Irecv(buffers.data() + recv_ptr[i], - recv_ptr[i + 1] - recv_ptr[i], - Utilities::MPI::mpi_type_id, - recv_ranks[i], - tag, - communicator, - &requests[i + send_ranks.size()]); + const int ierr = + MPI_Irecv(buffers.data() + recv_ptr[i], + recv_ptr[i + 1] - recv_ptr[i], + Utilities::MPI::mpi_type_id_for_type, + recv_ranks[i], + tag, + communicator, + &requests[i + send_ranks.size()]); AssertThrowMPI(ierr); } @@ -134,13 +135,14 @@ namespace Utilities (send_ptr[i] == buffers.size() && send_ptr[i + 1] == send_ptr[i]), ExcMessage("The input buffer doesn't contain enough entries")); - const int ierr = MPI_Isend(buffers.data() + send_ptr[i], - send_ptr[i + 1] - send_ptr[i], - Utilities::MPI::mpi_type_id, - send_ranks[i], - tag, - communicator, - &requests[i]); + const int ierr = + MPI_Isend(buffers.data() + send_ptr[i], + send_ptr[i + 1] - send_ptr[i], + Utilities::MPI::mpi_type_id_for_type, + send_ranks[i], + tag, + communicator, + &requests[i]); 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 742f8bc05a..4e4e88db04 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -571,7 +571,7 @@ namespace internal const auto ierr_1 = MPI_Isend( buffer.data(), buffer.size(), - Utilities::MPI::mpi_type_id, + Utilities::MPI::mpi_type_id_for_type, i.first, Utilities::MPI::internal::Tags::fine_dof_handler_view_reinit, communicator, @@ -640,7 +640,7 @@ namespace internal int message_length; const int ierr_2 = MPI_Get_count( &status, - Utilities::MPI::mpi_type_id, + Utilities::MPI::mpi_type_id_for_type, &message_length); AssertThrowMPI(ierr_2); @@ -649,7 +649,7 @@ namespace internal const int ierr_3 = MPI_Recv( buffer.data(), buffer.size(), - Utilities::MPI::mpi_type_id, + Utilities::MPI::mpi_type_id_for_type, status.MPI_SOURCE, Utilities::MPI::internal::Tags::fine_dof_handler_view_reinit, communicator, diff --git a/source/base/mpi.cc b/source/base/mpi.cc index 3a94760614..b43397d77e 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -89,21 +89,21 @@ namespace Utilities { #ifdef DEAL_II_WITH_MPI // Provide definitions of template variables for all valid instantiations. - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id; - template const MPI_Datatype mpi_type_id>; - template const MPI_Datatype mpi_type_id>; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type; + template const MPI_Datatype mpi_type_id_for_type>; + template const MPI_Datatype mpi_type_id_for_type>; #endif diff --git a/source/base/partitioner.cc b/source/base/partitioner.cc index e6b12f3a2e..c83ba56042 100644 --- a/source/base/partitioner.cc +++ b/source/base/partitioner.cc @@ -80,7 +80,7 @@ namespace Utilities MPI_Exscan(&local_size, &prefix_sum, 1, - Utilities::MPI::mpi_type_id, + Utilities::MPI::mpi_type_id_for_type, MPI_SUM, communicator); AssertThrowMPI(ierr); diff --git a/source/base/process_grid.cc b/source/base/process_grid.cc index d7e97a616b..090f738941 100644 --- a/source/base/process_grid.cc +++ b/source/base/process_grid.cc @@ -250,7 +250,7 @@ namespace Utilities const int ierr = MPI_Bcast(value, count, - Utilities::MPI::mpi_type_id, + Utilities::MPI::mpi_type_id_for_type, 0 /*from root*/, mpi_communicator_inactive_with_root); AssertThrowMPI(ierr); diff --git a/source/distributed/repartitioning_policy_tools.cc b/source/distributed/repartitioning_policy_tools.cc index 10b56b5dc7..bce7f27867 100644 --- a/source/distributed/repartitioning_policy_tools.cc +++ b/source/distributed/repartitioning_policy_tools.cc @@ -89,7 +89,7 @@ namespace RepartitioningPolicyTools const int ierr = MPI_Exscan(&process_has_active_locally_owned_cells, &offset, 1, - Utilities::MPI::mpi_type_id, MPI_SUM, comm); @@ -308,23 +308,24 @@ namespace RepartitioningPolicyTools // determine partial sum of weights of this process uint64_t process_local_weight_offset = 0; - int ierr = - MPI_Exscan(&process_local_weight, - &process_local_weight_offset, - 1, - Utilities::MPI::mpi_type_id, - MPI_SUM, - tria->get_communicator()); + int ierr = MPI_Exscan( + &process_local_weight, + &process_local_weight_offset, + 1, + Utilities::MPI::mpi_type_id_for_type, + MPI_SUM, + tria->get_communicator()); AssertThrowMPI(ierr); // total weight of all processes uint64_t total_weight = process_local_weight_offset + process_local_weight; - ierr = MPI_Bcast(&total_weight, - 1, - Utilities::MPI::mpi_type_id, - n_subdomains - 1, - mpi_communicator); + ierr = + MPI_Bcast(&total_weight, + 1, + Utilities::MPI::mpi_type_id_for_type, + n_subdomains - 1, + mpi_communicator); AssertThrowMPI(ierr); // setup partition diff --git a/source/distributed/tria_base.cc b/source/distributed/tria_base.cc index 9cbaeb6895..6c83d1fc30 100644 --- a/source/distributed/tria_base.cc +++ b/source/distributed/tria_base.cc @@ -423,13 +423,13 @@ namespace parallel // 2) determine the offset of each process types::global_cell_index cell_index = 0; - const int ierr = - MPI_Exscan(&n_locally_owned_cells, - &cell_index, - 1, - Utilities::MPI::mpi_type_id, - MPI_SUM, - this->mpi_communicator); + const int ierr = MPI_Exscan( + &n_locally_owned_cells, + &cell_index, + 1, + Utilities::MPI::mpi_type_id_for_type, + MPI_SUM, + this->mpi_communicator); AssertThrowMPI(ierr); // 3) give global indices to locally-owned cells and mark all other cells as @@ -493,13 +493,13 @@ namespace parallel std::vector cell_index( this->n_global_levels(), 0); - int ierr = MPI_Exscan( - n_locally_owned_cells.data(), - cell_index.data(), - this->n_global_levels(), - Utilities::MPI::mpi_type_id, - MPI_SUM, - this->mpi_communicator); + int ierr = MPI_Exscan(n_locally_owned_cells.data(), + cell_index.data(), + this->n_global_levels(), + Utilities::MPI::mpi_type_id_for_type, + MPI_SUM, + this->mpi_communicator); AssertThrowMPI(ierr); // 3) determine global number of "active" cells on each level @@ -512,7 +512,7 @@ namespace parallel ierr = MPI_Bcast( n_cells_level.data(), this->n_global_levels(), - Utilities::MPI::mpi_type_id, + Utilities::MPI::mpi_type_id_for_type, this->n_subdomains - 1, this->mpi_communicator); AssertThrowMPI(ierr); diff --git a/source/lac/scalapack.cc b/source/lac/scalapack.cc index 666056d90d..641be56c3c 100644 --- a/source/lac/scalapack.cc +++ b/source/lac/scalapack.cc @@ -184,14 +184,14 @@ ScaLAPACKMatrix::ScaLAPACKMatrix( } int ierr = MPI_Bcast(&n_rows, 1, - Utilities::MPI::mpi_type_id, + Utilities::MPI::mpi_type_id_for_type, 0 /*from root*/, process_grid->mpi_communicator); AssertThrowMPI(ierr); ierr = MPI_Bcast(&n_columns, 1, - Utilities::MPI::mpi_type_id, + Utilities::MPI::mpi_type_id_for_type, 0 /*from root*/, process_grid->mpi_communicator); AssertThrowMPI(ierr); diff --git a/source/matrix_free/vector_data_exchange.cc b/source/matrix_free/vector_data_exchange.cc index dd6a1d4618..e652a11fb7 100644 --- a/source/matrix_free/vector_data_exchange.cc +++ b/source/matrix_free/vector_data_exchange.cc @@ -893,15 +893,15 @@ namespace internal n_ghost_indices_in_larger_set_by_remote_rank[i] - ghost_targets_data[i][2]; - const int ierr = - MPI_Irecv(buffer.data() + ghost_targets_data[i][1] + offset, - ghost_targets_data[i][2], - Utilities::MPI::mpi_type_id, - ghost_targets_data[i][0], - communication_channel + 1, - comm, - requests.data() + sm_import_ranks.size() + - sm_ghost_ranks.size() + i); + const int ierr = MPI_Irecv( + buffer.data() + ghost_targets_data[i][1] + offset, + ghost_targets_data[i][2], + Utilities::MPI::mpi_type_id_for_type, + ghost_targets_data[i][0], + communication_channel + 1, + comm, + requests.data() + sm_import_ranks.size() + sm_ghost_ranks.size() + + i); AssertThrowMPI(ierr); } @@ -920,7 +920,7 @@ namespace internal const int ierr = MPI_Isend( temporary_storage.data() + import_targets_data[i][1], import_targets_data[i][2], - Utilities::MPI::mpi_type_id, + Utilities::MPI::mpi_type_id_for_type, import_targets_data[i][0], communication_channel + 1, comm, @@ -1169,29 +1169,31 @@ namespace internal } } - const int ierr = - MPI_Isend(buffer.data() + ghost_targets_data[i][1], - ghost_targets_data[i][2], - Utilities::MPI::mpi_type_id, - ghost_targets_data[i][0], - communication_channel + 0, - comm, - requests.data() + sm_ghost_ranks.size() + - sm_import_ranks.size() + i); + const int ierr = MPI_Isend( + buffer.data() + ghost_targets_data[i][1], + ghost_targets_data[i][2], + Utilities::MPI::mpi_type_id_for_type, + ghost_targets_data[i][0], + communication_channel + 0, + comm, + requests.data() + sm_ghost_ranks.size() + sm_import_ranks.size() + + i); AssertThrowMPI(ierr); } for (unsigned int i = 0; i < import_targets_data.size(); ++i) { - const int ierr = MPI_Irecv( - temporary_storage.data() + import_targets_data[i][1], - import_targets_data[i][2], - Utilities::MPI::mpi_type_id, - import_targets_data[i][0], - communication_channel + 0, - comm, - requests.data() + sm_ghost_ranks.size() + sm_import_ranks.size() + - ghost_targets_data.size() + i); + const int ierr = + MPI_Irecv(temporary_storage.data() + import_targets_data[i][1], + import_targets_data[i][2], + Utilities::MPI::mpi_type_id_for_type, + import_targets_data[i][0], + communication_channel + 0, + comm, + requests.data() + sm_ghost_ranks.size() + + sm_import_ranks.size() + ghost_targets_data.size() + + i); AssertThrowMPI(ierr); } #endif -- 2.39.5