From c1638e7d4fa7d450608ada0f45245c6fdd919944 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Sun, 25 Jul 2021 17:16:11 -0600 Subject: [PATCH] Deprecated autopartition parameter. --- .../changes/incompatibilities/20210724Fehling | 5 ++ .../distributed/fully_distributed_tria.h | 12 ++++- include/deal.II/distributed/tria.h | 38 ++++++++++---- include/deal.II/distributed/tria_base.h | 11 +++- source/distributed/fully_distributed_tria.cc | 20 ++++--- source/distributed/tria.cc | 44 ++++++++++------ ...ransfer_02.with_p4est=true.mpirun=8.output | 16 +++--- ...ransfer_02.with_p4est=true.mpirun=8.output | 52 +++++-------------- 8 files changed, 116 insertions(+), 82 deletions(-) create mode 100644 doc/news/changes/incompatibilities/20210724Fehling diff --git a/doc/news/changes/incompatibilities/20210724Fehling b/doc/news/changes/incompatibilities/20210724Fehling new file mode 100644 index 0000000000..70e4785e29 --- /dev/null +++ b/doc/news/changes/incompatibilities/20210724Fehling @@ -0,0 +1,5 @@ +Deprecated: The autopartition parameter has been removed from +parallel::DistributedTriangulationBase::load() and all inheriting +classes. +
+(Marc Fehling, 2021/07/24) diff --git a/include/deal.II/distributed/fully_distributed_tria.h b/include/deal.II/distributed/fully_distributed_tria.h index 326dec1120..2de0ba3d75 100644 --- a/include/deal.II/distributed/fully_distributed_tria.h +++ b/include/deal.II/distributed/fully_distributed_tria.h @@ -252,8 +252,16 @@ namespace parallel * in with notify_ready_to_unpack() after calling load(). */ virtual void - load(const std::string &filename, - const bool autopartition = false) override; + load(const std::string &filename) override; + + /** + * @copydoc load() + * + * @deprecated The autopartition parameter has been removed. + */ + DEAL_II_DEPRECATED_EARLY + virtual void + load(const std::string &filename, const bool autopartition) override; private: virtual unsigned int diff --git a/include/deal.II/distributed/tria.h b/include/deal.II/distributed/tria.h index f64343ccc1..51f22b9712 100644 --- a/include/deal.II/distributed/tria.h +++ b/include/deal.II/distributed/tria.h @@ -604,16 +604,18 @@ namespace parallel * be read in with * DistributedTriangulationBase::DataTransfer::notify_ready_to_unpack() * after calling load(). + */ + virtual void + load(const std::string &filename) override; + + /** + * @copydoc load() * - * The @p autopartition flag tells p4est to ignore the partitioning that - * the triangulation had when it was saved and make it uniform upon - * loading. If @p autopartition is set to true, the triangulation will - * always be repartitioned. If set to false, it is only repartitioned if - * needed (i.e., if a different number of MPI processes is encountered). + * @deprecated The autopartition parameter has been removed. */ + DEAL_II_DEPRECATED_EARLY virtual void - load(const std::string &filename, - const bool autopartition = true) override; + load(const std::string &filename, const bool autopartition) override; /** * Load the refinement information from a given parallel forest. This @@ -870,8 +872,15 @@ namespace parallel * compiler. */ virtual void - load(const std::string &filename, - const bool autopartition = true) override; + load(const std::string &filename) override; + + /** + * This function is not implemented, but needs to be present for the + * compiler. + */ + DEAL_II_DEPRECATED_EARLY + virtual void + load(const std::string &filename, const bool autopartition) override; /** * This function is not implemented, but needs to be present for the @@ -1000,8 +1009,17 @@ namespace parallel * this class. */ virtual void + load(const std::string & /*filename*/) override + {} + + /** + * Dummy replacement to allow for better error messages when compiling + * this class. + */ + DEAL_II_DEPRECATED_EARLY + virtual void load(const std::string & /*filename*/, - const bool /*autopartition*/ = true) override + const bool /*autopartition*/) override {} /** diff --git a/include/deal.II/distributed/tria_base.h b/include/deal.II/distributed/tria_base.h index 076a4e6e06..96fb2a5d4b 100644 --- a/include/deal.II/distributed/tria_base.h +++ b/include/deal.II/distributed/tria_base.h @@ -480,7 +480,16 @@ namespace parallel * notify_ready_to_unpack() after calling load(). */ virtual void - load(const std::string &filename, const bool autopartition = true) = 0; + load(const std::string &filename) = 0; + + /** + * @copydoc load() + * + * @deprecated The autopartition parameter has been removed. + */ + DEAL_II_DEPRECATED_EARLY + virtual void + load(const std::string &filename, const bool autopartition) = 0; /** * Register a function that can be used to attach data of fixed size diff --git a/source/distributed/fully_distributed_tria.cc b/source/distributed/fully_distributed_tria.cc index 22033a0afa..098f7951fc 100644 --- a/source/distributed/fully_distributed_tria.cc +++ b/source/distributed/fully_distributed_tria.cc @@ -558,15 +558,9 @@ namespace parallel template void - Triangulation::load(const std::string &filename, - const bool autopartition) + Triangulation::load(const std::string &filename) { #ifdef DEAL_II_WITH_MPI - AssertThrow( - autopartition == false, - ExcMessage( - "load() only works if run with the same number of MPI processes used for saving the triangulation, hence autopartition is disabled.")); - Assert(this->n_cells() == 0, ExcMessage("load() only works if the Triangulation is empty!")); @@ -694,7 +688,6 @@ namespace parallel this->update_number_cache(); #else (void)filename; - (void)autopartition; AssertThrow(false, ExcNeedsMPI()); #endif @@ -702,6 +695,17 @@ namespace parallel + template + void + Triangulation::load(const std::string &filename, + const bool autopartition) + { + (void)autopartition; + load(filename); + } + + + template void Triangulation::update_number_cache() diff --git a/source/distributed/tria.cc b/source/distributed/tria.cc index 384da4c465..648aab7efb 100644 --- a/source/distributed/tria.cc +++ b/source/distributed/tria.cc @@ -1477,8 +1477,7 @@ namespace parallel template void - Triangulation::load(const std::string &filename, - const bool autopartition) + Triangulation::load(const std::string &filename) { Assert( this->n_cells() > 0, @@ -1535,23 +1534,18 @@ namespace parallel this->mpi_communicator, 0, 0, - static_cast(autopartition), + 1, 0, this, &connectivity); - if (numcpus != Utilities::MPI::n_mpi_processes(this->mpi_communicator)) - { - // We are changing the number of CPUs so we need to repartition. - // Note that p4est actually distributes the cells between the changed - // number of CPUs and so everything works without this call, but - // this command changes the distribution for some reason, so we - // will leave it in here. - dealii::internal::p4est::functions::partition( - parallel_forest, - /* prepare coarsening */ 1, - /* weight_callback */ nullptr); - } + // We partition the p4est mesh that it conforms to the requirements of the + // deal.II mesh, i.e., partition for coarsening. + // This function call is optional. + dealii::internal::p4est::functions::partition( + parallel_forest, + /* prepare coarsening */ 1, + /* weight_callback */ nullptr); try { @@ -1581,6 +1575,17 @@ namespace parallel + template + void + Triangulation::load(const std::string &filename, + const bool autopartition) + { + (void)autopartition; + load(filename); + } + + + template void Triangulation::load( @@ -3489,6 +3494,15 @@ namespace parallel + template + void + Triangulation<1, spacedim>::load(const std::string &) + { + Assert(false, ExcNotImplemented()); + } + + + template void Triangulation<1, spacedim>::load(const std::string &, const bool) diff --git a/tests/mpi/cell_data_transfer_02.with_p4est=true.mpirun=8.output b/tests/mpi/cell_data_transfer_02.with_p4est=true.mpirun=8.output index 2597c8c23c..2d5542914e 100644 --- a/tests/mpi/cell_data_transfer_02.with_p4est=true.mpirun=8.output +++ b/tests/mpi/cell_data_transfer_02.with_p4est=true.mpirun=8.output @@ -7,6 +7,8 @@ DEAL:0:2d::cellid=0_1:3 parentid=0 DEAL:0:2d::reading DEAL:0:2d::cellid=0_1:0 parentid=0 DEAL:0:2d::cellid=0_1:1 parentid=0 +DEAL:0:2d::cellid=0_1:2 parentid=0 +DEAL:0:2d::cellid=0_1:3 parentid=0 DEAL:0:2d::OK DEAL:0:3d::writing DEAL:0:3d::cellid=0_1:0 parentid=0 @@ -30,8 +32,6 @@ DEAL:0:3d::OK DEAL:1:2d::writing DEAL:1:2d::reading -DEAL:1:2d::cellid=0_1:2 parentid=0 -DEAL:1:2d::cellid=0_1:3 parentid=0 DEAL:1:2d::OK DEAL:1:3d::writing DEAL:1:3d::cellid=1_1:0 parentid=1 @@ -62,6 +62,8 @@ DEAL:2:2d::cellid=1_1:3 parentid=1 DEAL:2:2d::reading DEAL:2:2d::cellid=1_1:0 parentid=1 DEAL:2:2d::cellid=1_1:1 parentid=1 +DEAL:2:2d::cellid=1_1:2 parentid=1 +DEAL:2:2d::cellid=1_1:3 parentid=1 DEAL:2:2d::OK DEAL:2:3d::writing DEAL:2:3d::cellid=2_1:0 parentid=2 @@ -86,8 +88,6 @@ DEAL:2:3d::OK DEAL:3:2d::writing DEAL:3:2d::reading -DEAL:3:2d::cellid=1_1:2 parentid=1 -DEAL:3:2d::cellid=1_1:3 parentid=1 DEAL:3:2d::OK DEAL:3:3d::writing DEAL:3:3d::cellid=3_1:0 parentid=3 @@ -118,6 +118,8 @@ DEAL:4:2d::cellid=2_1:3 parentid=2 DEAL:4:2d::reading DEAL:4:2d::cellid=2_1:0 parentid=2 DEAL:4:2d::cellid=2_1:1 parentid=2 +DEAL:4:2d::cellid=2_1:2 parentid=2 +DEAL:4:2d::cellid=2_1:3 parentid=2 DEAL:4:2d::OK DEAL:4:3d::writing DEAL:4:3d::cellid=4_1:0 parentid=4 @@ -142,8 +144,6 @@ DEAL:4:3d::OK DEAL:5:2d::writing DEAL:5:2d::reading -DEAL:5:2d::cellid=2_1:2 parentid=2 -DEAL:5:2d::cellid=2_1:3 parentid=2 DEAL:5:2d::OK DEAL:5:3d::writing DEAL:5:3d::cellid=5_1:0 parentid=5 @@ -174,6 +174,8 @@ DEAL:6:2d::cellid=3_1:3 parentid=3 DEAL:6:2d::reading DEAL:6:2d::cellid=3_1:0 parentid=3 DEAL:6:2d::cellid=3_1:1 parentid=3 +DEAL:6:2d::cellid=3_1:2 parentid=3 +DEAL:6:2d::cellid=3_1:3 parentid=3 DEAL:6:2d::OK DEAL:6:3d::writing DEAL:6:3d::cellid=6_1:0 parentid=6 @@ -198,8 +200,6 @@ DEAL:6:3d::OK DEAL:7:2d::writing DEAL:7:2d::reading -DEAL:7:2d::cellid=3_1:2 parentid=3 -DEAL:7:2d::cellid=3_1:3 parentid=3 DEAL:7:2d::OK DEAL:7:3d::writing DEAL:7:3d::cellid=7_1:0 parentid=7 diff --git a/tests/mpi/hp_active_fe_indices_transfer_02.with_p4est=true.mpirun=8.output b/tests/mpi/hp_active_fe_indices_transfer_02.with_p4est=true.mpirun=8.output index 4c2d16a67d..40214f5a67 100644 --- a/tests/mpi/hp_active_fe_indices_transfer_02.with_p4est=true.mpirun=8.output +++ b/tests/mpi/hp_active_fe_indices_transfer_02.with_p4est=true.mpirun=8.output @@ -7,10 +7,13 @@ DEAL:0:2d::cellid=0_1:3 fe_index=3 DEAL:0:2d::reading DEAL:0:2d::cellid=0_1:0 fe_index=0 DEAL:0:2d::cellid=0_1:1 fe_index=1 -DEAL:0:2d::cellid=0_1:2 fe_index=2 ghost -DEAL:0:2d::cellid=0_1:3 fe_index=3 ghost +DEAL:0:2d::cellid=0_1:2 fe_index=2 +DEAL:0:2d::cellid=0_1:3 fe_index=3 DEAL:0:2d::cellid=1_1:0 fe_index=0 ghost DEAL:0:2d::cellid=1_1:2 fe_index=2 ghost +DEAL:0:2d::cellid=2_1:0 fe_index=0 ghost +DEAL:0:2d::cellid=2_1:1 fe_index=1 ghost +DEAL:0:2d::cellid=3_1:0 fe_index=0 ghost DEAL:0:2d::OK DEAL:0:3d::writing DEAL:0:3d::cellid=0_1:0 fe_index=0 @@ -53,15 +56,6 @@ DEAL:0:3d::OK DEAL:1:2d::writing DEAL:1:2d::reading -DEAL:1:2d::cellid=0_1:0 fe_index=0 ghost -DEAL:1:2d::cellid=0_1:1 fe_index=1 ghost -DEAL:1:2d::cellid=0_1:2 fe_index=2 -DEAL:1:2d::cellid=0_1:3 fe_index=3 -DEAL:1:2d::cellid=1_1:0 fe_index=0 ghost -DEAL:1:2d::cellid=1_1:2 fe_index=2 ghost -DEAL:1:2d::cellid=2_1:0 fe_index=0 ghost -DEAL:1:2d::cellid=2_1:1 fe_index=1 ghost -DEAL:1:2d::cellid=3_1:0 fe_index=0 ghost DEAL:1:2d::OK DEAL:1:3d::writing DEAL:1:3d::cellid=1_1:0 fe_index=0 @@ -113,8 +107,11 @@ DEAL:2:2d::cellid=0_1:1 fe_index=1 ghost DEAL:2:2d::cellid=0_1:3 fe_index=3 ghost DEAL:2:2d::cellid=1_1:0 fe_index=0 DEAL:2:2d::cellid=1_1:1 fe_index=1 -DEAL:2:2d::cellid=1_1:2 fe_index=2 ghost -DEAL:2:2d::cellid=1_1:3 fe_index=3 ghost +DEAL:2:2d::cellid=1_1:2 fe_index=2 +DEAL:2:2d::cellid=1_1:3 fe_index=3 +DEAL:2:2d::cellid=2_1:1 fe_index=1 ghost +DEAL:2:2d::cellid=3_1:0 fe_index=0 ghost +DEAL:2:2d::cellid=3_1:1 fe_index=1 ghost DEAL:2:2d::OK DEAL:2:3d::writing DEAL:2:3d::cellid=2_1:0 fe_index=0 @@ -158,15 +155,6 @@ DEAL:2:3d::OK DEAL:3:2d::writing DEAL:3:2d::reading -DEAL:3:2d::cellid=0_1:1 fe_index=1 ghost -DEAL:3:2d::cellid=0_1:3 fe_index=3 ghost -DEAL:3:2d::cellid=1_1:0 fe_index=0 ghost -DEAL:3:2d::cellid=1_1:1 fe_index=1 ghost -DEAL:3:2d::cellid=1_1:2 fe_index=2 -DEAL:3:2d::cellid=1_1:3 fe_index=3 -DEAL:3:2d::cellid=2_1:1 fe_index=1 ghost -DEAL:3:2d::cellid=3_1:0 fe_index=0 ghost -DEAL:3:2d::cellid=3_1:1 fe_index=1 ghost DEAL:3:2d::OK DEAL:3:3d::writing DEAL:3:3d::cellid=3_1:0 fe_index=0 @@ -219,8 +207,8 @@ DEAL:4:2d::cellid=0_1:3 fe_index=3 ghost DEAL:4:2d::cellid=1_1:2 fe_index=2 ghost DEAL:4:2d::cellid=2_1:0 fe_index=0 DEAL:4:2d::cellid=2_1:1 fe_index=1 -DEAL:4:2d::cellid=2_1:2 fe_index=2 ghost -DEAL:4:2d::cellid=2_1:3 fe_index=3 ghost +DEAL:4:2d::cellid=2_1:2 fe_index=2 +DEAL:4:2d::cellid=2_1:3 fe_index=3 DEAL:4:2d::cellid=3_1:0 fe_index=0 ghost DEAL:4:2d::cellid=3_1:2 fe_index=2 ghost DEAL:4:2d::OK @@ -266,12 +254,6 @@ DEAL:4:3d::OK DEAL:5:2d::writing DEAL:5:2d::reading -DEAL:5:2d::cellid=2_1:0 fe_index=0 ghost -DEAL:5:2d::cellid=2_1:1 fe_index=1 ghost -DEAL:5:2d::cellid=2_1:2 fe_index=2 -DEAL:5:2d::cellid=2_1:3 fe_index=3 -DEAL:5:2d::cellid=3_1:0 fe_index=0 ghost -DEAL:5:2d::cellid=3_1:2 fe_index=2 ghost DEAL:5:2d::OK DEAL:5:3d::writing DEAL:5:3d::cellid=5_1:0 fe_index=0 @@ -326,8 +308,8 @@ DEAL:6:2d::cellid=2_1:1 fe_index=1 ghost DEAL:6:2d::cellid=2_1:3 fe_index=3 ghost DEAL:6:2d::cellid=3_1:0 fe_index=0 DEAL:6:2d::cellid=3_1:1 fe_index=1 -DEAL:6:2d::cellid=3_1:2 fe_index=2 ghost -DEAL:6:2d::cellid=3_1:3 fe_index=3 ghost +DEAL:6:2d::cellid=3_1:2 fe_index=2 +DEAL:6:2d::cellid=3_1:3 fe_index=3 DEAL:6:2d::OK DEAL:6:3d::writing DEAL:6:3d::cellid=6_1:0 fe_index=0 @@ -371,12 +353,6 @@ DEAL:6:3d::OK DEAL:7:2d::writing DEAL:7:2d::reading -DEAL:7:2d::cellid=2_1:1 fe_index=1 ghost -DEAL:7:2d::cellid=2_1:3 fe_index=3 ghost -DEAL:7:2d::cellid=3_1:0 fe_index=0 ghost -DEAL:7:2d::cellid=3_1:1 fe_index=1 ghost -DEAL:7:2d::cellid=3_1:2 fe_index=2 -DEAL:7:2d::cellid=3_1:3 fe_index=3 DEAL:7:2d::OK DEAL:7:3d::writing DEAL:7:3d::cellid=7_1:0 fe_index=0 -- 2.39.5