]> https://gitweb.dealii.org/ - dealii.git/commitdiff
test for GrowingVectorMemory and PETSc
authorTimo Heister <timo.heister@gmail.com>
Sat, 3 Nov 2012 03:58:21 +0000 (03:58 +0000)
committerTimo Heister <timo.heister@gmail.com>
Sat, 3 Nov 2012 03:58:21 +0000 (03:58 +0000)
git-svn-id: https://svn.dealii.org/trunk@27332 0785d39b-7218-0410-832d-ea1e28bc413d

tests/mpi/petsc_03.cc [new file with mode: 0644]
tests/mpi/petsc_03/ncpu_1/cmp/generic [new file with mode: 0644]
tests/mpi/petsc_03/ncpu_10/cmp/generic [new file with mode: 0644]
tests/mpi/petsc_03/ncpu_4/cmp/generic [new file with mode: 0644]

diff --git a/tests/mpi/petsc_03.cc b/tests/mpi/petsc_03.cc
new file mode 100644 (file)
index 0000000..3ae6c7e
--- /dev/null
@@ -0,0 +1,73 @@
+//---------------------------------------------------------------------------
+//    $Id: petsc_02.cc 25686 2012-07-04 14:18:43Z bangerth $
+//    Version: $Name$
+//
+//    Copyright (C) 2009, 2011 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//---------------------------------------------------------------------------
+
+
+// PETScWrappers: document bug when using GrowingVectorMemory
+// at the end of a run.
+
+#include "../tests.h"
+
+#include <deal.II/lac/petsc_parallel_vector.h>
+#include <deal.II/lac/petsc_parallel_block_vector.h>
+#include <deal.II/lac/petsc_vector.h>
+#include <deal.II/lac/petsc_parallel_vector.h>
+#include <deal.II/lac/vector_memory.h>
+#include <deal.II/base/logstream.h>
+#include <deal.II/base/utilities.h>
+
+#include <fstream>
+//#include <mpi.h>
+
+template<class v>
+void testit()
+{
+  GrowingVectorMemory<v> m;
+  m.free(m.alloc());
+}
+
+
+
+void test()
+{
+  unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
+  unsigned int numprocs = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD);
+
+  if (myid==0)
+    deallog << "Running on " << numprocs << " CPU(s)." << std::endl;
+
+  testit<PETScWrappers::MPI::Vector>();
+  testit<PETScWrappers::MPI::BlockVector>();
+  testit<PETScWrappers::Vector>();
+  testit<PETScWrappers::BlockVector>();
+
+  if (myid==0)
+    deallog << "done" << std::endl;
+}
+
+
+int main(int argc, char *argv[])
+{
+  Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv);
+
+  if (Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0)
+    {
+      std::ofstream logfile(output_file_for_mpi(JobIdentifier::base_name(__FILE__)).c_str());
+      deallog.attach(logfile);
+      deallog.depth_console(0);
+      deallog.threshold_double(1.e-10);
+
+      test();
+    }
+  else
+    test();
+}
diff --git a/tests/mpi/petsc_03/ncpu_1/cmp/generic b/tests/mpi/petsc_03/ncpu_1/cmp/generic
new file mode 100644 (file)
index 0000000..721906e
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::Running on 1 CPU(s).
+DEAL::done
diff --git a/tests/mpi/petsc_03/ncpu_10/cmp/generic b/tests/mpi/petsc_03/ncpu_10/cmp/generic
new file mode 100644 (file)
index 0000000..7430da6
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::Running on 10 CPU(s).
+DEAL::done
diff --git a/tests/mpi/petsc_03/ncpu_4/cmp/generic b/tests/mpi/petsc_03/ncpu_4/cmp/generic
new file mode 100644 (file)
index 0000000..befd397
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::Running on 4 CPU(s).
+DEAL::done

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.