From: kanschat Date: Mon, 28 May 2007 19:06:16 +0000 (+0000) Subject: split size and timing X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b4b12c326411761b138c0c366f51d4c8bbef132;p=dealii-svn.git split size and timing git-svn-id: https://svn.dealii.org/trunk@14724 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/benchmarks/Makefile b/tests/benchmarks/Makefile index 51f3adc503..cee896d02b 100644 --- a/tests/benchmarks/Makefile +++ b/tests/benchmarks/Makefile @@ -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 diff --git a/tests/benchmarks/dof_handler_size.cc b/tests/benchmarks/dof_handler_size.cc index d80980c325..e454b94de7 100644 --- a/tests/benchmarks/dof_handler_size.cc +++ b/tests/benchmarks/dof_handler_size.cc @@ -24,35 +24,20 @@ using namespace dealii; -template -void indices (const DoFHandler& dof) -{ - typedef typename DoFHandler::active_cell_iterator I; - - std::vector 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 void check () { deallog << "Dimension " << dim << std::endl; Triangulation 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 q1(1); FE_Q q3(3); FESystem 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 index 0000000000..08f7c4cb98 --- /dev/null +++ b/tests/benchmarks/dof_handler_timing.cc @@ -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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace dealii; + +template +void indices (const DoFHandler& dof) +{ + typedef typename DoFHandler::active_cell_iterator I; + + std::vector 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 +void fevalues (const DoFHandler& dof, + UpdateFlags updates) +{ + typedef typename DoFHandler::active_cell_iterator I; + const I end = dof.end(); + + QGauss quadrature(5); + MappingQ1 mapping; + FEValues fe(mapping, dof.get_fe(), quadrature, updates); + + for (I i=dof.begin_active(); i!=end;++i) + fe.reinit(i); +} + + +template +void check () +{ + deallog << "Mesh" << std::endl; + Triangulation tr; + GridGenerator::hyper_cube(tr); + tr.refine_global(REF/dim); + + for (unsigned int i=1;i<5;++i) + { + FE_Q q(i); + deallog.push(q.get_name()); + deallog << "Dofs per cell " << q.dofs_per_cell << std::endl; + DoFHandler 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>(); +} +