
https://svn.lrde.epita.fr/svn/oln/trunk/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Add room in sandbox. * sandbox/duhamel: New. * sandbox/levillain: New. * sandbox/nivault: New. * sandbox/jardonnet: New. * sandbox/geraud: New. * sandbox/garrigues: New. * sandbox/cxxcompilation: Rename as... * sandbox/ballas: ...this. compilation_unit.rb | 56 -------------------- methods | 104 -------------------------------------- test.cc | 69 ------------------------- vaucanson_bench | 141 ---------------------------------------------------- 4 files changed, 370 deletions(-) Index: sandbox/cxxcompilation/compilation_unit.rb --- sandbox/cxxcompilation/compilation_unit.rb (revision 1066) +++ sandbox/cxxcompilation/compilation_unit.rb (working copy) @@ -1,56 +0,0 @@ -#! /usr/bin/ruby - -#Create a compilation unit file from a .cc file - -#USAGE: ./compilation_unit.rb file.cc - - -class CompilationUnit - attr_reader :sourceFileName, :name, :namespaceName - - public - def initialize(sourceFileName) - - - @sourceFileName = sourceFileName - @name = sourceFileName.gsub(/.cc\z/, ".unit.cc") - @namespaceName = "__instanciator_code" - - if not File.exist?(@name) then - self.createCompilationUnitFile - end - end - - def update - createCompilationUnitFile - end - - #Create UnitCompilationfile from source - def createCompilationUnitFile - sourceFile = File.new("#{@sourceFileName}", "r") - destinationFile = File.new("#{@name}", "w") - - # Copy usefull include files into cache file. - sourceFile.each_line do |line| - destinationFile.puts(line) if line =~ /#include/ - end - - # trash namespace - destinationFile.puts("namespace #{@namespaceName} {") - - # puts code line into trash namespace - sourceFile.close - sourceFile = File.new("#{@sourceFileName}", "r") - sourceFile.each_line do |line| - destinationFile.puts(line) if not (line =~ /#include/) - end - - # end of namespace - destinationFile.puts("}") - - sourceFile.close - destinationFile.close - end -end - -unit = CompilationUnit.new(ARGV[0]) Index: sandbox/cxxcompilation/test.cc --- sandbox/cxxcompilation/test.cc (revision 1066) +++ sandbox/cxxcompilation/test.cc (working copy) @@ -1,69 +0,0 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory -// -// This file is part of the Olena Library. This library is free -// software; you can redistribute it and/or modify it under the terms -// of the GNU General Public License version 2 as published by the -// Free Software Foundation. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to -// the Free Software Foundation, 51 Franklin Street, Fifth Floor, -// Boston, MA 02111-1307, USA. -// -// As a special exception, you may use this file as part of a free -// software library without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to -// produce an executable, this file does not by itself cause the -// resulting executable to be covered by the GNU General Public -// License. This exception does not however invalidate any other -// reasons why the executable file might be covered by the GNU General -// Public License. - -#include <oln/core/2d/image2d.hh> -#include <oln/core/3d/image3d.hh> -#include <oln/core/1d/image1d.hh> -#include <oln/level/fill.hh> - - -using namespace oln; - -int main(void) -{ - image1d<char> ima1d1(5); - image1d<int> ima1d2(5); - image1d<float> ima1d3(5); - image1d<double> ima1d4(5); - - level::fill(inplace(ima1d1), 5); - level::fill(inplace(ima1d2), 5); - level::fill(inplace(ima1d3), 5); - level::fill(inplace(ima1d4), 5); - - image2d<char> ima2d1(5, 5); - image2d<int> ima2d2(5, 5); - image2d<float> ima2d3(5, 5); - image2d<double> ima2d4(5, 5); - - level::fill(inplace(ima2d1), 5); - level::fill(inplace(ima2d2), 5); - level::fill(inplace(ima2d3), 5); - level::fill(inplace(ima2d4), 5); - - image3d<char> ima3d1(5, 5, 5); - image3d<int> ima3d2(5, 5, 5); - image3d<float> ima3d3(5, 5, 5); - image3d<double> ima3d4(5, 5, 5); - - level::fill(inplace(ima3d1), 5); - level::fill(inplace(ima3d2), 5); - level::fill(inplace(ima3d3), 5); - level::fill(inplace(ima3d4), 5); - - return 0; -} Index: sandbox/cxxcompilation/methods --- sandbox/cxxcompilation/methods (revision 1066) +++ sandbox/cxxcompilation/methods (working copy) @@ -1,104 +0,0 @@ - -*- Outline -*- - -* without optimization flags - -** Benchmark - -compilation: 2.131 -execution: 18.538 -total: 22.670 - - -* O1 - -** Benchmark -compilation: 3.616 -execution: 4.893 -total: 8.509 - -* O2 -** Benchmark -compilation: 4.610 -execution: 3.781 -total: 8.391 - -* 03 -compilation: 5.071 -execution: 1.567 -total: 6.638 - - - - -The next part introduces different method to speed up C++ compilation time. - -Test are made with union_find.cc file. - -* precompiled header (without optimization option) - -** Description - -Generate precompiled header (.gch) which can parsed in a faster way by g++. - - -How to automize header precompilation, just make a precompilation of usefull header ? - -** Benchmark - -compilation: 3.733 -execution: 18.119 -total: 21.852 - -* ccache (without optimization option) - -** Description - -"ccache is a compiler cache. It acts as a caching pre-processor to C/C++ compilers, using the -E compiler switch and a hash to detect when a compilation can be satisfied from cache. This often results in a 5 to 10 times speedup in common compilations." http://cache.samba.org - -** Benchmark - -* Vacauson Way (without optimization option) - -** Description - -cf: http://www.lrde.epita.fr/cgi-bin/twiki/view/Know/SpeedUpCxxCompilation - - -*** total recompilation protocol of source.cc: ---> (1) compile source.cc to "ref".o (cache used for function addresse reference) ---> (2) source.cc -> source.o with -DINTERFACE_ONLY (real program) ---> (3) links source.o to "ref".o - -*** Protocole: ---> do (1) ---> do (2) and (3) as long as there is no linkage error, else redo (1) - - -*** Problems: - -You must recompile the cache when you use an new algorithm/data type in your program. ---> solution: ask developper to write usefull algorithm/data types/includes at the start of the programm and uses template instantiation - - -Automatization?? ---> how deals with several files ---> how deals with missing .hh files ---> differenciate link error from other error - -***Others things: - -wrapper script or Makefile??? ---> script used by Makefile - -** Benchmark - -*** first compilation or total recompilation is longer than a normal compilation - -you need to compile program two times - - -*** next time when cache recompilation is not needed - -compilation: 0.200 -execution: 17.875 -toto: 18.075 Index: sandbox/cxxcompilation/vaucanson_bench --- sandbox/cxxcompilation/vaucanson_bench (revision 1066) +++ sandbox/cxxcompilation/vaucanson_bench (working copy) @@ -1,141 +0,0 @@ - -*- Outline -*- - -* Summary: - - This files present c++ compilation benchmark with Vaucanson method. - -* Vaucanson method: - -** Files used: -*** source.cc -client code - -*** source.unit.cc -This files contains instantiations of templated data and algorithms used by the client code. - -A Compilation unit copies #include directives used by source.cc -Furthermore, it copies client source code into a trash name's (in order to instantiated templates). - -But other method exists to create compilation unit(cf .hcc). - - -** Compilation process: - -*** total recompilation - ---> (1) compile source.unit.cc to an object file (source.unit.o) (cache used to find function address reference). - ---> (2) compile source.cc to source.o with -DINTERFACE_ONLY (or INCLUDE_ONLY, we want to compile just the interface the objects). - ---> (3) link source.o with source.unit.o - -*** Protocol: ---> do (1) ---> do (2) and (3) as long as there are no linkage errors, else redo (1) - - - - -* Benchmark: - -** With Olena: - -compile command: -g++ -W -Wall -Werror -ansi -pedantic -Ipath/metalic -Ipath/olena -Ipath/extended - -dimension of image used for test: 512 * 512. -Note: We can add optimization flag to speed up execution time. - - -******************************************************************************* -** File: oln/morpho/Rd/union_find.cc - -*** normal compilation: -compilation time: 4.110 -execution time: 42.893 -total time: 47.003 - -*** With Vaucanson method: - -**** total recompilation: - -compilation time: 6.749 ---> (1) : 4.062 ---> (2) : 2.524 ---> (3) : 0.163 - -execution time: 42.058 -total time: 48.807 - -~= 2 second slower than a normal compilation - -**** Usual recompilation - -compilation time: 2.702 ---> (2) : 2.542 ---> (3) : 0.160 - -execution time:42.060 -total time: 44.762 - -******************************************************************************* -** oln/morpho/Rd/queue_based.cc - -*** normal compilation: -compilation time: 4.296 -execution time: 35.836 -total time: 40.132 - -*** With Vaucanson method: - -**** total recompilation: - -compilation time: 7.187 ---> (1) : 4.378 ---> (2) : 2.636 ---> (3) : 0.173 - -execution time: 35.836 -total time: 43.023 - -**** Usual recompilation - -compilation time: 2.809 ---> (2) : 2.636 ---> (3) : 0.173 - -******************************************************************************* -** test.cc - -(declare and fill 12 differents image types) - -*** normal compilation: -compilation time: 25.585 -execution time: 0.006 -total time: 25.596 - -*** With Vaucanson method: - -**** total recompilation: - -compilation time: 45.087 ---> (1) : 25.378 ---> (2) : 19.318 ---> (3) : 0.391 - -execution time: 0.006 -total time: 45.093 - -**** Usual recompilation - -compilation time: 19.664 ---> (2) : 19.259 ---> (3) : 0.405 - -** with morpher - -FIXME - -*** With Milena - -FIXME
participants (1)
-
Thierry Geraud