From d2972eae04cdab1bbc7ab19cb502a5589d1a9016 Mon Sep 17 00:00:00 2001 From: vishalkenchan Date: Wed, 10 Jan 2018 11:42:45 +0100 Subject: [PATCH] suppress PHG warning saying: PHG_EDGE_SIZE_THRESHOLD is low --- source/lac/sparsity_tools.cc | 15 +++++ tests/zoltan/tria_zoltan_01.cc | 70 +++++++++++++++++++++ tests/zoltan/tria_zoltan_01.mpirun=2.output | 3 + tests/zoltan/tria_zoltan_01.output | 3 + 4 files changed, 91 insertions(+) create mode 100644 tests/zoltan/tria_zoltan_01.cc create mode 100644 tests/zoltan/tria_zoltan_01.mpirun=2.output create mode 100644 tests/zoltan/tria_zoltan_01.output diff --git a/source/lac/sparsity_tools.cc b/source/lac/sparsity_tools.cc index 5bf24eb8a2..ffadb21f64 100644 --- a/source/lac/sparsity_tools.cc +++ b/source/lac/sparsity_tools.cc @@ -245,6 +245,21 @@ namespace SparsityTools zz->Set_Param( "LB_METHOD", "GRAPH" ); //graph based partition method (LB-load balancing) zz->Set_Param( "NUM_LOCAL_PARTS", std::to_string(n_partitions) ); //set number of partitions + // The PHG partitioner is a hypergraph partitioner that Zoltan could use + // for graph partitioning. + // If number of vertices in hyperedge divided by total vertices in + // hypergraph exceeds PHG_EDGE_SIZE_THRESHOLD, + // then the hyperedge will be omitted as such (dense) edges will likely + // incur high communication costs regardless of the partition. + // PHG_EDGE_SIZE_THRESHOLD value is raised to 0.5 from the default + // value of 0.25 so that the PHG partitioner doesn't throw warning saying + // "PHG_EDGE_SIZE_THRESHOLD is low ..." after removing all dense edges. + // For instance, in two dimensions if the triangulation being partitioned + // is two quadrilaterals sharing an edge and if PHG_EDGE_SIZE_THRESHOLD + // value is set to 0.25, PHG will remove all the edges throwing the + // above warning. + zz->Set_Param( "PHG_EDGE_SIZE_THRESHOLD", "0.5" ); + //Need a non-const object equal to sparsity_pattern SparsityPattern graph; graph.copy_from(sparsity_pattern); diff --git a/tests/zoltan/tria_zoltan_01.cc b/tests/zoltan/tria_zoltan_01.cc new file mode 100644 index 0000000000..ece6ffd777 --- /dev/null +++ b/tests/zoltan/tria_zoltan_01.cc @@ -0,0 +1,70 @@ + +#include "../tests.h" + +#include +#include +#include + +#include + +using namespace dealii; + +// Test to check whether Zoltan PHG throws warning because +// PHG_EDGE_SIZE_THRESHOLD value is low. + +template +void test (const MPI_Comm &mpi_communicator) +{ + parallel::shared::Triangulation + triangulation (mpi_communicator, + Triangulation::limit_level_difference_at_vertices); + + GridGenerator::subdivided_hyper_cube (triangulation, 2, 0, 1); + + // Some dummy output. + if (Utilities::MPI::this_mpi_process(mpi_communicator)==0) + std::cout << "Number of vertices: " + << triangulation.n_vertices() + << std::endl; +} + +int main (int argc, char *argv[]) +{ + try + { + dealii::Utilities::MPI::MPI_InitFinalize + mpi_initialization (argc, + argv, + dealii::numbers::invalid_unsigned_int); + + test<1>(MPI_COMM_WORLD); + test<2>(MPI_COMM_WORLD); + test<3>(MPI_COMM_WORLD); + + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + throw; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + throw; + } + + return 0; +} diff --git a/tests/zoltan/tria_zoltan_01.mpirun=2.output b/tests/zoltan/tria_zoltan_01.mpirun=2.output new file mode 100644 index 0000000000..744ee60e56 --- /dev/null +++ b/tests/zoltan/tria_zoltan_01.mpirun=2.output @@ -0,0 +1,3 @@ +Number of vertices: 3 +Number of vertices: 9 +Number of vertices: 27 diff --git a/tests/zoltan/tria_zoltan_01.output b/tests/zoltan/tria_zoltan_01.output new file mode 100644 index 0000000000..744ee60e56 --- /dev/null +++ b/tests/zoltan/tria_zoltan_01.output @@ -0,0 +1,3 @@ +Number of vertices: 3 +Number of vertices: 9 +Number of vertices: 27 -- 2.39.5