[cig-commits] [commit] master: set ASPECT_USE_PETSC for test plugins if necessary (949c5d7)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Wed Aug 13 04:30:53 PDT 2014


Repository : https://github.com/geodynamics/aspect

On branch  : master
Link       : https://github.com/geodynamics/aspect/compare/0cde46a6f6b52f31e84a2da92bd44e09b85d8525...87089066634e9d7af35660b68195b862c2973c44

>---------------------------------------------------------------

commit 949c5d7d30d7c36bc5443b4dbe0b513960e5b5ca
Author: Timo Heister <timo.heister at gmail.com>
Date:   Tue Aug 12 12:06:59 2014 -0400

    set ASPECT_USE_PETSC for test plugins if necessary
    
    this fixes the problems that plugins would think they have to compile
    with Trilinos even though ASPECT is compiled with PETSc.


>---------------------------------------------------------------

949c5d7d30d7c36bc5443b4dbe0b513960e5b5ca
 tests/CMakeLists.txt                               |  4 ++
 tests/{plugin.cc => petsc_use_petsc.cc}            |  7 +++-
 ...c_composition_names.prm => petsc_use_petsc.prm} |  2 +
 tests/petsc_use_petsc/screen-output                | 47 ++++++++++++++++++++++
 4 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 360618e..17cfe4c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -119,6 +119,10 @@ FOREACH(_test ${_tests})
 
     IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_test}.cc)
       ADD_LIBRARY(${_test} SHARED EXCLUDE_FROM_ALL ${_test}.cc)
+      IF (ASPECT_USE_PETSC)
+        SET_PROPERTY(SOURCE ${_test}.cc
+	APPEND PROPERTY COMPILE_DEFINITIONS ASPECT_USE_PETSC="1")
+      ENDIF()
       DEAL_II_SETUP_TARGET(${_test})
       SET(_testlib 'set Additional shared libraries = ./lib${_test}.so')
       SET(_testdepends ${_test})
diff --git a/tests/plugin.cc b/tests/petsc_use_petsc.cc
similarity index 73%
copy from tests/plugin.cc
copy to tests/petsc_use_petsc.cc
index 89c6994..205db6c 100644
--- a/tests/plugin.cc
+++ b/tests/petsc_use_petsc.cc
@@ -9,8 +9,11 @@
 // and that produces some output
 int f()
 {
-  std::cout << typeid(dealii::Triangulation<2>).name() << " "
-	    << typeid(aspect::Simulator<2>).name() << std::endl;
+#ifdef ASPECT_USE_PETSC
+  std::cout << "hey petsc!" << std::endl;
+#else
+  std::cout << "no petsc :-(" << std::endl;
+#endif
   return 42;
 }
 
diff --git a/tests/petsc_composition_names.prm b/tests/petsc_use_petsc.prm
similarity index 97%
copy from tests/petsc_composition_names.prm
copy to tests/petsc_use_petsc.prm
index baceae0..43dd1c6 100644
--- a/tests/petsc_composition_names.prm
+++ b/tests/petsc_use_petsc.prm
@@ -1,5 +1,7 @@
 # LINEAR ALGEBRA: PETSC
 
+# this test is here to make sure ASPECT_USE_PETSC is set for our plugin if ASPECT is compiled with PETSC
+
 # Listing of Parameters
 # ---------------------
 # In order to make the problem in the first time step easier to solve, we need
diff --git a/tests/petsc_use_petsc/screen-output b/tests/petsc_use_petsc/screen-output
new file mode 100644
index 0000000..a52364f
--- /dev/null
+++ b/tests/petsc_use_petsc/screen-output
@@ -0,0 +1,47 @@
+-----------------------------------------------------------------------------
+-- This is ASPECT, the Advanced Solver for Problems in Earth's ConvecTion.
+--     . version 1.2.pre
+--     . running in DEBUG mode
+--     . running with 1 MPI process
+--     . using PETSc
+-----------------------------------------------------------------------------
+
+Loading shared library <./libpetsc_use_petsc.so>
+hey petsc!
+
+Number of active cells: 1 (on 1 levels)
+Number of degrees of freedom: 49 (18+4+9+9+9)
+
+*** Timestep 0:  t=0 years
+   Solving temperature system... 0 iterations.
+   Solving peridotite system ... 0 iterations.
+   Solving eclogite system ... 0 iterations.
+   Rebuilding Stokes preconditioner...
+   Solving Stokes system... 7 iterations.
+
+   Postprocessing:
+     Writing graphical output:  output-petsc_use_petsc/solution-00000
+     Compositions min/max/mass: 0/0/0 // 0/0/0
+
+Termination requested by criterion: end time
+
+
++---------------------------------------------+------------+------------+
+| Total wallclock time elapsed since start    |     0.367s |            |
+|                                             |            |            |
+| Section                         | no. calls |  wall time | % of total |
++---------------------------------+-----------+------------+------------+
+| Assemble Stokes system          |         1 |    0.0127s |       3.5% |
+| Assemble composition system     |         2 |     0.062s |        17% |
+| Assemble temperature system     |         1 |    0.0462s |        13% |
+| Build Stokes preconditioner     |         1 |    0.0223s |       6.1% |
+| Build composition preconditioner|         2 |   0.00114s |      0.31% |
+| Build temperature preconditioner|         1 |  0.000874s |      0.24% |
+| Solve Stokes system             |         1 |    0.0732s |        20% |
+| Solve composition system        |         2 |    0.0121s |       3.3% |
+| Solve temperature system        |         1 |   0.00637s |       1.7% |
+| Initialization                  |         2 |    0.0546s |        15% |
+| Postprocessing                  |         1 |   0.00776s |       2.1% |
+| Setup dof systems               |         1 |    0.0612s |        17% |
++---------------------------------+-----------+------------+------------+
+



More information about the CIG-COMMITS mailing list