From 9c423fc14452733fa9adef95a014c2cc1c006116 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Mon, 7 Dec 2015 13:04:36 +0100 Subject: [PATCH] Add test, mention change --- doc/news/changes.h | 12 ++- tests/mpi/parallel_vector_17.cc | 102 +++++++++++++++++++ tests/mpi/parallel_vector_17.mpirun=3.output | 36 +++++++ 3 files changed, 147 insertions(+), 3 deletions(-) create mode 100644 tests/mpi/parallel_vector_17.cc create mode 100644 tests/mpi/parallel_vector_17.mpirun=3.output diff --git a/doc/news/changes.h b/doc/news/changes.h index ceeaa7988f..18a1212e10 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -184,9 +184,9 @@ inconvenience this causes.

General

  1. New: OpenCASCADE::read_IGES() and OpenCASCADE::read_STEP() have - been unified in behaviour, and now they allow to extract *all* elements of - the IGES and STEP files instead of only the faces. This allows the - use of iges files describing edges only to be used as input for some of + been unified in behaviour, and now they allow to extract *all* elements of + the IGES and STEP files instead of only the faces. This allows the + use of iges files describing edges only to be used as input for some of the OpenCASCADE Manifold wrappers.
    (Luca Heltai, 2015/12/13) @@ -528,6 +528,12 @@ inconvenience this causes. (Wolfgang Bangerth, 2015/12/10)
  2. +
  3. New: parallel::distributed::Vector has now a method to return a shared + pointer to the underlying partitioner object. +
    + (Martin Kronbichler, 2015/12/07) +
  4. +
  5. Improved: Many more functions in namespace GridTools and class InterGridMap are now consistely instantiated also for types parallel::distributed::Triangulation and parallel::shared::Triangulation. diff --git a/tests/mpi/parallel_vector_17.cc b/tests/mpi/parallel_vector_17.cc new file mode 100644 index 0000000000..5146d6fec8 --- /dev/null +++ b/tests/mpi/parallel_vector_17.cc @@ -0,0 +1,102 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2011 - 2015 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +// check parallel::distributed::Vector::partitioners_are_compatible and +// partitioners_are_globally_compatible + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + + +void test () +{ + unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + unsigned int numproc = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD); + + if (myid==0) deallog << "numproc=" << numproc << std::endl; + + + // all processors own 2 elements + IndexSet local_owned(numproc*2); + local_owned.add_range(myid*2,myid*2+2); + IndexSet local_relevant(local_owned.size()); + local_relevant = local_owned; + local_relevant.add_range(1,2); + + parallel::distributed::Vector v1, v2, v3, v4, v5, v6; + v1.reinit(local_owned, MPI_COMM_WORLD); + v2.reinit(local_owned, local_relevant, MPI_COMM_WORLD); + v3.reinit(local_owned, local_relevant, MPI_COMM_WORLD); + v4.reinit(v3); + IndexSet local_owned_5(numproc*3); + local_owned_5.add_range(myid*3,myid*3+3); + v5.reinit(local_owned_5, MPI_COMM_WORLD); + + // create sub-communicator on two processors + MPI_Comm newcomm; + MPI_Comm_split(MPI_COMM_WORLD, myid/2, myid%2, &newcomm); + IndexSet local_owned_b(6); + if (myid<2) + local_owned_b.add_range(myid*3,myid*3+3); + v6.reinit(local_owned_b, newcomm); + + deallog << "local compatibility v1-v2: " + << v1.partitioners_are_compatible(*v2.get_partitioner()) << " " + << v2.partitioners_are_compatible(*v1.get_partitioner()) << std::endl; + deallog << "global compatibility v1-v2: " + << v1.partitioners_are_globally_compatible(*v2.get_partitioner()) << " " + << v2.partitioners_are_globally_compatible(*v1.get_partitioner()) << std::endl; + deallog << "local compatibility v2-v3: " + << v2.partitioners_are_compatible(*v3.get_partitioner()) << " " + << v3.partitioners_are_compatible(*v2.get_partitioner()) << std::endl; + deallog << "global compatibility v2-v3: " + << v2.partitioners_are_globally_compatible(*v3.get_partitioner()) << " " + << v3.partitioners_are_globally_compatible(*v2.get_partitioner()) << std::endl; + deallog << "local compatibility v3-v4: " + << v4.partitioners_are_compatible(*v3.get_partitioner()) << " " + << v3.partitioners_are_compatible(*v4.get_partitioner()) << std::endl; + deallog << "global compatibility v3-v4: " + << v4.partitioners_are_globally_compatible(*v3.get_partitioner()) << " " + << v3.partitioners_are_globally_compatible(*v4.get_partitioner()) << std::endl; + deallog << "local compatibility v4-v5: " + << v4.partitioners_are_compatible(*v5.get_partitioner()) << " " + << v5.partitioners_are_compatible(*v4.get_partitioner()) << std::endl; + deallog << "global compatibility v4-v5: " + << v4.partitioners_are_globally_compatible(*v5.get_partitioner()) << " " + << v5.partitioners_are_globally_compatible(*v4.get_partitioner()) << std::endl; + deallog << "local compatibility v5-v6: " + << v6.partitioners_are_compatible(*v5.get_partitioner()) << " " + << v5.partitioners_are_compatible(*v6.get_partitioner()) << std::endl; + deallog << "global compatibility v5-v6: " + << v6.partitioners_are_globally_compatible(*v5.get_partitioner()) << " " + << v5.partitioners_are_globally_compatible(*v6.get_partitioner()) << std::endl; +} + + + +int main (int argc, char **argv) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, testing_max_num_threads()); + MPILogInitAll log; + + test(); + +} diff --git a/tests/mpi/parallel_vector_17.mpirun=3.output b/tests/mpi/parallel_vector_17.mpirun=3.output new file mode 100644 index 0000000000..e52fd76048 --- /dev/null +++ b/tests/mpi/parallel_vector_17.mpirun=3.output @@ -0,0 +1,36 @@ + +DEAL:0::numproc=3 +DEAL:0::local compatibility v1-v2: 1 1 +DEAL:0::global compatibility v1-v2: 0 0 +DEAL:0::local compatibility v2-v3: 1 1 +DEAL:0::global compatibility v2-v3: 1 1 +DEAL:0::local compatibility v3-v4: 1 1 +DEAL:0::global compatibility v3-v4: 1 1 +DEAL:0::local compatibility v4-v5: 0 0 +DEAL:0::global compatibility v4-v5: 0 0 +DEAL:0::local compatibility v5-v6: 0 0 +DEAL:0::global compatibility v5-v6: 0 0 + +DEAL:1::local compatibility v1-v2: 0 0 +DEAL:1::global compatibility v1-v2: 0 0 +DEAL:1::local compatibility v2-v3: 1 1 +DEAL:1::global compatibility v2-v3: 1 1 +DEAL:1::local compatibility v3-v4: 1 1 +DEAL:1::global compatibility v3-v4: 1 1 +DEAL:1::local compatibility v4-v5: 0 0 +DEAL:1::global compatibility v4-v5: 0 0 +DEAL:1::local compatibility v5-v6: 0 0 +DEAL:1::global compatibility v5-v6: 0 0 + + +DEAL:2::local compatibility v1-v2: 0 0 +DEAL:2::global compatibility v1-v2: 0 0 +DEAL:2::local compatibility v2-v3: 1 1 +DEAL:2::global compatibility v2-v3: 1 1 +DEAL:2::local compatibility v3-v4: 1 1 +DEAL:2::global compatibility v3-v4: 1 1 +DEAL:2::local compatibility v4-v5: 0 0 +DEAL:2::global compatibility v4-v5: 0 0 +DEAL:2::local compatibility v5-v6: 0 0 +DEAL:2::global compatibility v5-v6: 0 0 + -- 2.39.5