From: kanschat Date: Sun, 27 May 2007 23:00:55 +0000 (+0000) Subject: benchmark for triangulation and dof handler sizes X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3cfa5b37c50cc1eff972d12c79c3c31abbf374cc;p=dealii-svn.git benchmark for triangulation and dof handler sizes git-svn-id: https://svn.dealii.org/trunk@14718 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/benchmarks/Makefile b/tests/benchmarks/Makefile new file mode 100644 index 0000000000..8a6cf43f27 --- /dev/null +++ b/tests/benchmarks/Makefile @@ -0,0 +1,82 @@ +############################################################ +# $Id$ +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors +############################################################ + +############################################################ +# Include general settings for including DEAL libraries +############################################################ + +D=../../deal.II +include $D/common/Make.global_options +debug-mode = on + +libraries += $(lib-deal2-2d.g) $(lib-deal2-3d.g) $(lib-lac) $(lib-base) + +default: run-tests + +############################################################ + +tests_x = dof_handler_size + +# from above list of regular expressions, generate the real set of +# tests +expand = $(shell echo $(addsuffix .cc,$(1)) \ + | $(PERL) -pi -e 's/\.cc//g;') +tests = $(call expand,$(tests_x)) + + +############################################################ +# First how to create executables, including all necessary +# flags: +############################################################ + +flags = $(CXXFLAGS.g) + +ifeq ($(findstring gcc,$(GXX_VERSION)),gcc) +flags += -Wno-missing-noreturn +endif + +%/obj.g.$(OBJEXT) : %.cc + @echo =====debug========= $< + @echo Compiling > $*/status + @$(CXX) $(flags) -c $< -o $@ + +%/obj.$(OBJEXT) : %.cc + @echo =====optimized===== $< + @echo Compiling > $*/status + @$(CXX) $(CXXFLAGS.o) -c $< -o $@ + +###################################################################### +# Don't put $(libraries) into this line since it is already in $^ +###################################################################### +%/exe : %/obj.$(OBJEXT) + @echo =====linking======= $@ + @echo Linking > $*/status + @$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS) + + +############################################################ +# After all these general rules, here is the target to be +# executed by make: for each entry in the list $(tests) +# perform a check. +############################################################ +run-tests: $(tests:%=%/output) + +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 \ + > $@ + + + + +include Makefile.depend +include Makefile.tests diff --git a/tests/benchmarks/dof_handler_size.cc b/tests/benchmarks/dof_handler_size.cc new file mode 100644 index 0000000000..e40e3bbf84 --- /dev/null +++ b/tests/benchmarks/dof_handler_size.cc @@ -0,0 +1,71 @@ +//---------------------------------------------------------------------- +// $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. +// +//---------------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include + +using namespace dealii; + + +template +void check () +{ + deallog << "Dimension " << dim << std::endl; + Triangulation tr; + GridGenerator::hyper_cube(tr); + tr.refine_global(18/dim); + + deallog << "Cells " << tr.n_cells() + << " active " << tr.n_active_cells() + << " memory " << tr.memory_consumption() + << std::endl; + + FE_Q q1(1); + FE_Q q3(3); + FESystem sys1(q3, 1); + FESystem sys2(q3, 10); + DoFHandler dof(tr); + + dof.distribute_dofs(q1); + deallog << "Dofs Q1 " << dof.n_dofs() + << " memory " << dof.memory_consumption() + << std::endl; + + dof.distribute_dofs(q3); + deallog << "Dofs Q3 " << dof.n_dofs() + << " memory " << dof.memory_consumption() + << std::endl; + + dof.distribute_dofs(sys1); + deallog << "Dofs Sys1 " << dof.n_dofs() + << " memory " << dof.memory_consumption() + << std::endl; + + dof.distribute_dofs(sys2); + deallog << "Dofs Sys2 " << dof.n_dofs() + << " memory " << dof.memory_consumption() + << std::endl; +} + +int main() +{ + deallog.log_execution_time(true); + check<2>(); + check<3>(); +} +