From: Martin Kronbichler Date: Mon, 7 Nov 2016 21:04:38 +0000 (+0100) Subject: Add test X-Git-Tag: v8.5.0-rc1~436^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3489%2Fhead;p=dealii.git Add test --- diff --git a/tests/mpi/parallel_block_vector_03.cc b/tests/mpi/parallel_block_vector_03.cc new file mode 100644 index 0000000000..9fdd89369c --- /dev/null +++ b/tests/mpi/parallel_block_vector_03.cc @@ -0,0 +1,71 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2016 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 memory consumption parallel vector + +#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; + + + // each processor from processor 1 to 8 owns 2 indices (the other processors + // do not own any dof), and all processors are ghosting element 1 + IndexSet local_owned(30); + if (myid == 0) + local_owned.add_range(0,20); + else + local_owned.add_range(std::min(20U,20*myid),30U); + IndexSet local_relevant(30); + local_relevant = local_owned; + local_relevant.add_range(19,20); + + LinearAlgebra::distributed::Vector v(local_owned, local_relevant, + MPI_COMM_WORLD); + + deallog << v.memory_consumption() << std::endl; + + LinearAlgebra::distributed::BlockVector w(3); + for (unsigned int i=0; i<3; ++i) + { + w.block(i) = v; + w.block(i) *= (i+1); + } + w.collect_sizes(); + + deallog << w.memory_consumption() << 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_block_vector_03.with_64bit_indices=off.mpirun=2.output b/tests/mpi/parallel_block_vector_03.with_64bit_indices=off.mpirun=2.output new file mode 100644 index 0000000000..b9dc03e0e3 --- /dev/null +++ b/tests/mpi/parallel_block_vector_03.with_64bit_indices=off.mpirun=2.output @@ -0,0 +1,8 @@ + +DEAL:0::numproc=2 +DEAL:0::599 +DEAL:0::1476 + +DEAL:1::519 +DEAL:1::1254 + diff --git a/tests/mpi/parallel_block_vector_03.with_64bit_indices=on.mpirun=2.output b/tests/mpi/parallel_block_vector_03.with_64bit_indices=on.mpirun=2.output new file mode 100644 index 0000000000..8b07f9e7fb --- /dev/null +++ b/tests/mpi/parallel_block_vector_03.with_64bit_indices=on.mpirun=2.output @@ -0,0 +1,8 @@ + +DEAL:0::numproc=2 +DEAL:0::643 +DEAL:0::1501 + +DEAL:1::563 +DEAL:1::1279 + diff --git a/tests/mpi/parallel_block_vector_03.with_64bit_indices=on.mpirun=2.output.2 b/tests/mpi/parallel_block_vector_03.with_64bit_indices=on.mpirun=2.output.2 new file mode 100644 index 0000000000..e252434c1f --- /dev/null +++ b/tests/mpi/parallel_block_vector_03.with_64bit_indices=on.mpirun=2.output.2 @@ -0,0 +1,8 @@ + +DEAL:0::numproc=2 +DEAL:0::643 +DEAL:0::1525 + +DEAL:1::563 +DEAL:1::1303 +