]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
split size and timing
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 28 May 2007 19:06:16 +0000 (19:06 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 28 May 2007 19:06:16 +0000 (19:06 +0000)
git-svn-id: https://svn.dealii.org/trunk@14724 0785d39b-7218-0410-832d-ea1e28bc413d

tests/benchmarks/Makefile
tests/benchmarks/dof_handler_size.cc
tests/benchmarks/dof_handler_timing.cc [new file with mode: 0644]

index 51f3adc50322576f7c5b5c15e4ea8451e33a72c3..cee896d02b541da8e438c20ec6cb848e9ee1577e 100644 (file)
@@ -11,13 +11,14 @@ D=../../deal.II
 include $D/common/Make.global_options
 debug-mode = on
 
-libraries += $(lib-deal2-2d.o) $(lib-deal2-3d.o) $(lib-lac.o) $(lib-base.o)
+libraries = $(lib-deal2-2d.o) $(lib-deal2-3d.o) $(lib-lac.o) $(lib-base.o)
+libraries.g = $(lib-deal2-2d.g) $(lib-deal2-3d.g) $(lib-lac.g) $(lib-base.g)
 
 default: run-tests 
 
 ############################################################
 
-tests_x =  dof_handler_size
+tests_x =  dof_handler_*
 
 # from above list of regular expressions, generate the real set of
 # tests
@@ -47,10 +48,12 @@ endif
        @echo Compiling > $*/status
        @$(CXX) $(CXXFLAGS.o) -c $< -o $@
 
-######################################################################
-# Don't put $(libraries) into this line since it is already in $^
-######################################################################
-%/exe : %/obj.$(OBJEXT)
+%/exe : %/obj.$(OBJEXT) $(libraries)
+       @echo =====linking======= $@
+       @echo Linking > $*/status
+       @$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+%/g.exe : %/obj.g.$(OBJEXT) $(libraries.g)
        @echo =====linking======= $@
        @echo Linking > $*/status
        @$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)
@@ -68,13 +71,6 @@ build: $(tests:%=%/exe)
 refs: $(tests:%=%/ref)
 
 
-Makefile.tests: Makefile $(shell echo *.cc)
-       @echo =====Targets======= $@
-       @for i in $(tests) ; do \
-               echo "$$i/exe : $$i/obj.\$$(OBJEXT) \$$(libraries)"; \
-        done \
-               > $@
-
 Makefile.depend: $(shell echo *.cc)
        @echo =====Dependencies== $@
        @$D/common/scripts/make_dependencies $(INCLUDE) $^ > $@ \
@@ -82,7 +78,4 @@ Makefile.depend: $(shell echo *.cc)
        @$(PERL) -pi -e 's#\.((g\.)?$(OBJEXT):)#/obj.\1#g;' $@
 
 
-
-
 include Makefile.depend
-include Makefile.tests
index d80980c325919dae8a648f0ffbf62d0b3faae02b..e454b94de7ca1fbf20577711fd54c26504fc455b 100644 (file)
 
 using namespace dealii;
 
-template <int dim>
-void indices (const DoFHandler<dim>& dof)
-{
-  typedef typename DoFHandler<dim>::active_cell_iterator I;
-  
-  std::vector<unsigned int> dofs(dof.get_fe().dofs_per_cell);
-  const I end = dof.end();
-  
-  for (I i=dof.begin_active(); i!=end;++i)
-    {
-      i->get_dof_indices(dofs);
-    }
-}
-
-
 template <int dim>
 void check ()
 {
   deallog << "Dimension " << dim << std::endl;
   Triangulation<dim> tr;
   GridGenerator::hyper_cube(tr);
-  tr.refine_global(21/dim);
-
+  tr.refine_global(18/dim);
+  
   deallog << "Cells " << std::setw(12)  << tr.n_cells()
          << " active " << std::setw(12)  << tr.n_active_cells()
          << " memory " << std::setw(12)  << tr.memory_consumption()
          << " quotient " << (1./tr.n_cells()*tr.memory_consumption())
          << std::endl;
-
+  
   FE_Q<dim> q1(1);
   FE_Q<dim> q3(3);
   FESystem<dim> sys1(q3, 1);
@@ -65,22 +50,12 @@ void check ()
          << " quotient " << (1./dof.n_dofs()*dof.memory_consumption())
          << std::endl;
   
-  indices(dof);
-  deallog << "Index1" << std::endl;
-  indices(dof);
-  deallog << "Index2" << std::endl;
-  
   dof.distribute_dofs(q3);
   deallog << "Dofs Q3   " << std::setw(12) << dof.n_dofs()
          << " memory " << std::setw(12) << dof.memory_consumption()
          << " quotient " << (1./dof.n_dofs()*dof.memory_consumption())
          << std::endl;
   
-  indices(dof);
-  deallog << "Index1" << std::endl;
-  indices(dof);
-  deallog << "Index2" << std::endl;
-  
   dof.distribute_dofs(sys1);
   deallog << "Dofs Sys1 " << std::setw(12) << dof.n_dofs()
          << " memory " << std::setw(12) << dof.memory_consumption()
@@ -92,17 +67,10 @@ void check ()
          << " memory " << std::setw(12) << dof.memory_consumption()
          << " quotient " << (1./dof.n_dofs()*dof.memory_consumption())
          << std::endl;  
-  
-  indices(dof);
-  deallog << "Index1" << std::endl;
-  indices(dof);
-  deallog << "Index2" << std::endl;
 }
 
 int main()
 {
-  deallog.log_execution_time(true);
-  deallog.log_time_differences(true);
   check<2>();
   check<3>();
 }
diff --git a/tests/benchmarks/dof_handler_timing.cc b/tests/benchmarks/dof_handler_timing.cc
new file mode 100644 (file)
index 0000000..08f7c4c
--- /dev/null
@@ -0,0 +1,105 @@
+//----------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2007 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.
+//
+//----------------------------------------------------------------------
+
+// Refinement base: perform REF/dim refinements
+// REF 21 needs 9GBytes on a 64 Bit architecture
+
+#ifdef DEBUG
+#define REF 6
+#else
+#define REF 21
+#endif
+
+#include <iomanip>
+
+#include <base/logstream.h>
+#include <base/quadrature_lib.h>
+#include <grid/tria.h>
+#include <grid/grid_generator.h>
+#include <dofs/dof_handler.h>
+#include <dofs/dof_accessor.h>
+#include <fe/mapping_q1.h>
+#include <fe/fe_q.h>
+#include <fe/fe_dgq.h>
+#include <fe/fe_values.h>
+#include <fe/fe_system.h>
+
+using namespace dealii;
+
+template <int dim>
+void indices (const DoFHandler<dim>& dof)
+{
+  typedef typename DoFHandler<dim>::active_cell_iterator I;
+  
+  std::vector<unsigned int> dofs(dof.get_fe().dofs_per_cell);
+  const I end = dof.end();
+
+  for (unsigned int k=0;k<10;++k)
+    for (I i=dof.begin_active(); i!=end;++i)
+      i->get_dof_indices(dofs);
+}
+
+
+template <int dim>
+void fevalues (const DoFHandler<dim>& dof,
+              UpdateFlags updates)
+{
+  typedef typename DoFHandler<dim>::active_cell_iterator I;
+  const I end = dof.end();
+  
+  QGauss<dim> quadrature(5);
+  MappingQ1<dim> mapping;
+  FEValues<dim> fe(mapping, dof.get_fe(), quadrature, updates);
+  
+  for (I i=dof.begin_active(); i!=end;++i)
+    fe.reinit(i);
+}
+
+
+template <int dim>
+void check ()
+{
+  deallog << "Mesh" << std::endl;
+  Triangulation<dim> tr;
+  GridGenerator::hyper_cube(tr);
+  tr.refine_global(REF/dim);
+  
+  for (unsigned int i=1;i<5;++i)
+    {
+      FE_Q<dim> q(i);
+      deallog.push(q.get_name());
+      deallog << "Dofs per cell " << q.dofs_per_cell << std::endl;
+      DoFHandler<dim> dof(tr);
+      dof.distribute_dofs(q);
+      deallog << "Dofs " << dof.n_dofs() << std::endl;
+      indices(dof);
+      deallog << "Index" << std::endl;
+      fevalues(dof,  update_q_points | update_JxW_values);
+      deallog << "qpoints|JxW" << std::endl;
+      fevalues(dof,  update_values | update_JxW_values);
+      deallog << "values|JxW" << std::endl;
+      fevalues(dof,  update_values | update_gradients | update_JxW_values);
+      deallog << "values|gradients|JxW" << std::endl;
+      deallog.pop();
+    }
+}
+
+
+int main()
+{
+  deallog.log_execution_time(true);
+  deallog.log_time_differences(true);
+  check<2>();
+  check<3>();
+}
+

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.