diff options
-rw-r--r-- | bench/btl/CMakeLists.txt | 11 | ||||
-rw-r--r-- | bench/btl/data/CMakeLists.txt | 2 | ||||
-rw-r--r-- | bench/btl/data/atv.hh | 108 | ||||
-rwxr-xr-x | bench/btl/data/go_mean | 1 | ||||
-rw-r--r-- | bench/btl/generic_bench/bench.hh | 9 | ||||
-rw-r--r-- | bench/btl/generic_bench/bench_parameter.hh | 2 | ||||
-rw-r--r-- | bench/btl/generic_bench/btl.hh | 186 | ||||
-rw-r--r-- | bench/btl/generic_bench/static/bench_static.hh | 5 | ||||
-rw-r--r-- | bench/btl/libs/C/main.cpp | 2 | ||||
-rw-r--r-- | bench/btl/libs/C_BLAS/main.cpp | 19 | ||||
-rw-r--r-- | bench/btl/libs/STL/main.cpp | 2 | ||||
-rw-r--r-- | bench/btl/libs/STL_algo/main.cpp | 2 | ||||
-rw-r--r-- | bench/btl/libs/blitz/main.cpp | 2 | ||||
-rw-r--r-- | bench/btl/libs/eigen2/eigen2_interface.hh | 2 | ||||
-rw-r--r-- | bench/btl/libs/eigen2/main.cpp | 15 | ||||
-rw-r--r-- | bench/btl/libs/f77/main.cpp | 17 | ||||
-rw-r--r-- | bench/btl/libs/gmm/main.cpp | 2 | ||||
-rw-r--r-- | bench/btl/libs/mtl4/main.cpp | 2 | ||||
-rw-r--r-- | bench/btl/libs/tiny_blitz/main.cpp | 10 | ||||
-rw-r--r-- | bench/btl/libs/tvmet/CMakeLists.txt | 5 | ||||
-rw-r--r-- | bench/btl/libs/tvmet/main.cpp | 12 | ||||
-rw-r--r-- | bench/btl/libs/tvmet/tvmet_interface.hh | 115 | ||||
-rw-r--r-- | bench/btl/libs/ublas/main.cpp | 2 |
23 files changed, 413 insertions, 120 deletions
diff --git a/bench/btl/CMakeLists.txt b/bench/btl/CMakeLists.txt index adcb62a52..636129b03 100644 --- a/bench/btl/CMakeLists.txt +++ b/bench/btl/CMakeLists.txt @@ -11,8 +11,10 @@ SET(CMAKE_INCLUDE_CURRENT_DIR ON) IF(CMAKE_COMPILER_IS_GNUCXX) SET(CMAKE_CXX_FLAGS "-g0 -O3 -DNDEBUG") + SET(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG") IF(NOT BTL_NOVEC) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") + SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -msse2") ELSE(NOT BTL_NOVEC) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE") ENDIF(NOT BTL_NOVEC) @@ -36,6 +38,7 @@ ENABLE_TESTING() find_package(Eigen2) if (EIGEN2_FOUND) macro_optional_add_subdirectory(libs/eigen2 ON) + macro_optional_add_subdirectory(libs/tiny_eigen2 OFF) endif (EIGEN2_FOUND) # GMM++ @@ -55,9 +58,15 @@ endif (Boost_FOUND) find_package(Blitz) if (BLITZ_FOUND) macro_optional_add_subdirectory(libs/blitz ON) - macro_optional_add_subdirectory(libs/tiny_blitz ON) + macro_optional_add_subdirectory(libs/tiny_blitz OFF) endif (BLITZ_FOUND) +# tvmet +find_package(Tvmet) +if (TVMET_FOUND) + macro_optional_add_subdirectory(libs/tvmet OFF) +endif (TVMET_FOUND) + # cblas find_package(CBLAS) if (CBLAS_FOUND) diff --git a/bench/btl/data/CMakeLists.txt b/bench/btl/data/CMakeLists.txt index 365652ca9..0057614da 100644 --- a/bench/btl/data/CMakeLists.txt +++ b/bench/btl/data/CMakeLists.txt @@ -1,7 +1,7 @@ ADD_CUSTOM_TARGET(copy_scripts) -SET(script_files go_mean aat.hh ata.hh axpy.hh order_lib mk_mean_script.sh mk_new_gnuplot.sh mk_gnuplot_script.sh matrix_matrix.hh matrix_vector.hh) +SET(script_files go_mean aat.hh ata.hh axpy.hh order_lib mk_mean_script.sh mk_new_gnuplot.sh mk_gnuplot_script.sh matrix_matrix.hh matrix_vector.hh atv.hh) FOREACH(script_file ${script_files}) ADD_CUSTOM_COMMAND( diff --git a/bench/btl/data/atv.hh b/bench/btl/data/atv.hh new file mode 100644 index 000000000..45327f532 --- /dev/null +++ b/bench/btl/data/atv.hh @@ -0,0 +1,108 @@ +#!/usr/bin/gnuplot -persist +# +# +# G N U P L O T +# Linux version 3.7 +# patchlevel 0 +# last modified Thu Jan 14 19:34:53 BST 1999 +# +# Copyright(C) 1986 - 1993, 1998, 1999 +# Thomas Williams, Colin Kelley and many others +# +# Type `help` to access the on-line reference manual +# The gnuplot FAQ is available from +# <http://www.uni-karlsruhe.de/~ig25/gnuplot-faq/> +# +# Send comments and requests for help to <info-gnuplot@dartmouth.edu> +# Send bugs, suggestions and mods to <bug-gnuplot@dartmouth.edu> +# +# set terminal postscript landscape noenhanced monochrome dashed defaultplex "Helvetica" 14 +# set output 'bench_gcc.ps' +set noclip points +set clip one +set noclip two +set bar 1.000000 +set border 31 lt -1 lw 1.000 +set xdata +set ydata +set zdata +set x2data +set y2data +set boxwidth +set dummy x,y +set format x "%g" +set format y "%g" +set format x2 "%g" +set format y2 "%g" +set format z "%g" +set angles radians +set nogrid +set key title "" +set key right top Right noreverse box linetype -2 linewidth 1.000 samplen 4 spacing 1 width 0 +set nolabel +set noarrow +set nolinestyle +set nologscale +set logscale x 10 +set offsets 0, 0, 0, 0 +set pointsize 1 +set encoding default +set nopolar +set noparametric +set view 60, 30, 1, 1 +set samples 100, 100 +set isosamples 10, 10 +set surface +set nocontour +set clabel '%8.3g' +set mapping cartesian +set nohidden3d +set cntrparam order 4 +set cntrparam linear +set cntrparam levels auto 5 +set cntrparam points 5 +set size ratio 0 1,1 +set origin 0,0 +set data style linespoints +set function style lines +set xzeroaxis lt -2 lw 1.000 +set x2zeroaxis lt -2 lw 1.000 +set yzeroaxis lt -2 lw 1.000 +set y2zeroaxis lt -2 lw 1.000 +set tics in +set ticslevel 0.5 +set ticscale 1 0.5 +set mxtics default +set mytics default +set mx2tics default +set my2tics default +set xtics border mirror norotate autofreq +set ytics border mirror norotate autofreq +set ztics border nomirror norotate autofreq +set nox2tics +set noy2tics +set title "transposed-matrix vector product " 0.000000,0.000000 "" +set timestamp "" bottom norotate 0.000000,0.000000 "" +set rrange [ * : * ] noreverse nowriteback # (currently [-0:10] ) +set trange [ * : * ] noreverse nowriteback # (currently [-5:5] ) +set urange [ * : * ] noreverse nowriteback # (currently [-5:5] ) +set vrange [ * : * ] noreverse nowriteback # (currently [-5:5] ) +set xlabel "matrix size" 0.000000,0.000000 "" +set x2label "" 0.000000,0.000000 "" +set timefmt "%d/%m/%y\n%H:%M" +set xrange [ 10 : 1000 ] noreverse nowriteback +set x2range [ * : * ] noreverse nowriteback # (currently [-10:10] ) +set ylabel "MFLOPS" 0.000000,0.000000 "" +set y2label "" 0.000000,0.000000 "" +set yrange [ * : * ] noreverse nowriteback # (currently [-10:10] ) +set y2range [ * : * ] noreverse nowriteback # (currently [-10:10] ) +set zlabel "" 0.000000,0.000000 "" +set zrange [ * : * ] noreverse nowriteback # (currently [-10:10] ) +set zero 1e-08 +set lmargin -1 +set bmargin -1 +set rmargin -1 +set tmargin -1 +set locale "C" +set xrange [1:1000] +##set yrange [0:400] diff --git a/bench/btl/data/go_mean b/bench/btl/data/go_mean index 80203afc4..36942bd09 100755 --- a/bench/btl/data/go_mean +++ b/bench/btl/data/go_mean @@ -3,6 +3,7 @@ mkdir $1 source mk_mean_script.sh axpy $1 11 2500 100000 250000 > $1/axpy.html source mk_mean_script.sh matrix_vector $1 11 50 300 500 > $1/matrix_vector.html +source mk_mean_script.sh atv $1 11 50 300 500 > $1/atv.html source mk_mean_script.sh matrix_matrix $1 11 100 300 500 > $1/matrix_matrix.html source mk_mean_script.sh aat $1 11 100 300 1000 > $1/aat.html source mk_mean_script.sh ata $1 11 100 300 1000 > $1/ata.html diff --git a/bench/btl/generic_bench/bench.hh b/bench/btl/generic_bench/bench.hh index f46965c2f..484b526e3 100644 --- a/bench/btl/generic_bench/bench.hh +++ b/bench/btl/generic_bench/bench.hh @@ -19,6 +19,8 @@ // #ifndef BENCH_HH #define BENCH_HH + +#include "btl.hh" #include "bench_parameter.hh" #include <iostream> #include "utilities.h" @@ -34,9 +36,10 @@ using namespace std; template <template<class> class Perf_Analyzer, class Action> -void bench( int size_min, int size_max, int nb_point ){ - - // bench name +void bench( int size_min, int size_max, int nb_point ) +{ + if (BtlConfig::skipAction(Action::name())) + return; string filename="bench_"+Action::name()+".dat"; diff --git a/bench/btl/generic_bench/bench_parameter.hh b/bench/btl/generic_bench/bench_parameter.hh index e2db997fd..e4e145ea0 100644 --- a/bench/btl/generic_bench/bench_parameter.hh +++ b/bench/btl/generic_bench/bench_parameter.hh @@ -48,6 +48,6 @@ #define DEFAULT_NB_SAMPLE 1000 // how many times we run a single bench (keep the best perf) -#define NB_TRIES 3 +#define NB_TRIES 4 #endif diff --git a/bench/btl/generic_bench/btl.hh b/bench/btl/generic_bench/btl.hh new file mode 100644 index 000000000..97b0dec7c --- /dev/null +++ b/bench/btl/generic_bench/btl.hh @@ -0,0 +1,186 @@ +//===================================================== +// File : btl.hh +// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr> +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program 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 program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BTL_HH +#define BTL_HH +#include "bench_parameter.hh" +#include <iostream> +#include <vector> +#include <string> +#include "utilities.h" + +/** Enhanced std::string +*/ +class BtlString : public std::string +{ +public: + BtlString() : std::string() {} + BtlString(const BtlString& str) : std::string(static_cast<const std::string&>(str)) {} + BtlString(const std::string& str) : std::string(str) {} + BtlString(const char* str) : std::string(str) {} + + operator const char* () const { return c_str(); } + + void trim( bool left = true, bool right = true ) + { + int lspaces, rspaces, len = length(), i; + lspaces = rspaces = 0; + + if ( left ) + for (i=0; i<len && (at(i)==' '||at(i)=='\t'||at(i)=='\r'||at(i)=='\n'); ++lspaces,++i); + + if ( right && lspaces < len ) + for(i=len-1; i>=0 && (at(i)==' '||at(i)=='\t'||at(i)=='\r'||at(i)=='\n'); rspaces++,i--); + + *this = substr(lspaces, len-lspaces-rspaces); + } + + std::vector<BtlString> split( const BtlString& delims = "\t\n ") const + { + std::vector<BtlString> ret; + unsigned int numSplits = 0; + size_t start, pos; + start = 0; + do + { + pos = find_first_of(delims, start); + if (pos == start) + { + ret.push_back(""); + start = pos + 1; + } + else if (pos == npos) + ret.push_back( substr(start) ); + else + { + ret.push_back( substr(start, pos - start) ); + start = pos + 1; + } + //start = find_first_not_of(delims, start); + ++numSplits; + } while (pos != npos); + return ret; + } + + bool endsWith(const BtlString& str) const + { + if(str.size()>this->size()) + return false; + return this->substr(this->size()-str.size(),str.size()) == str; + } + bool contains(const BtlString& str) const + { + return this->find(str)<this->size(); + } + bool beginsWith(const BtlString& str) const + { + if(str.size()>this->size()) + return false; + return this->substr(0,str.size()) == str; + } + + BtlString toLowerCase( void ) + { + std::transform(begin(), end(), begin(), static_cast<int(*)(int)>(::tolower) ); + return *this; + } + BtlString toUpperCase( void ) + { + std::transform(begin(), end(), begin(), static_cast<int(*)(int)>(::toupper) ); + return *this; + } + + /** Case insensitive comparison. + */ + bool isEquiv(const BtlString& str) const + { + BtlString str0 = *this; + str0.toLowerCase(); + BtlString str1 = str; + str1.toLowerCase(); + return str0 == str1; + } + + /** Decompose the current string as a path and a file. + For instance: "dir1/dir2/file.ext" leads to path="dir1/dir2/" and filename="file.ext" + */ + void decomposePathAndFile(BtlString& path, BtlString& filename) const + { + std::vector<BtlString> elements = this->split("/\\"); + path = ""; + filename = elements.back(); + elements.pop_back(); + if (this->at(0)=='/') + path = "/"; + for (unsigned int i=0 ; i<elements.size() ; ++i) + path += elements[i] + "/"; + } +}; + +class BtlConfig +{ +public: + BtlConfig() + : m_runSingleAction(false) + { + char * _config; + _config = getenv ("BTL_CONFIG"); + if (_config!=NULL) + { + std::vector<BtlString> config = BtlString(_config).split(" \t\n"); + for (int i = 0; i<config.size(); i++) + { + if (config[i].beginsWith("-a")) + { + if (i+1==config.size()) + { + std::cerr << "error processing option: " << config[i] << "\n"; + exit(2); + } + Instance.m_runSingleAction = true; + Instance.m_singleActionName = config[i+1]; + + i += 1; + } + } + } + } + + static bool skipAction(const std::string& name) + { + if (Instance.m_runSingleAction) + { + std::cout << "Instance.m_singleActionName = " << Instance.m_singleActionName << "\n"; + return !BtlString(name).contains(Instance.m_singleActionName); + } + + return false; + } + + +protected: + bool m_runSingleAction; + BtlString m_singleActionName; + + static BtlConfig Instance; +}; + +#define BTL_MAIN \ + BtlConfig BtlConfig::Instance + +#endif // BTL_HH diff --git a/bench/btl/generic_bench/static/bench_static.hh b/bench/btl/generic_bench/static/bench_static.hh index 5ae23c1b8..0bc0d441e 100644 --- a/bench/btl/generic_bench/static/bench_static.hh +++ b/bench/btl/generic_bench/static/bench_static.hh @@ -19,6 +19,8 @@ // #ifndef BENCH_STATIC_HH #define BENCH_STATIC_HH + +#include "btl.hh" #include "bench_parameter.hh" #include <iostream> #include "utilities.h" @@ -34,6 +36,9 @@ using namespace std; template <template<class> class Perf_Analyzer, template<class> class Action, template<class,int> class Interface> void bench_static(void) { + if (BtlConfig::skipAction(Action<Interface<REAL_TYPE,10> >::name())) + return; + string filename = "bench_" + Action<Interface<REAL_TYPE,10> >::name() + ".dat"; INFOS("starting " << filename); diff --git a/bench/btl/libs/C/main.cpp b/bench/btl/libs/C/main.cpp index b15b7d9d5..60ff2b4d6 100644 --- a/bench/btl/libs/C/main.cpp +++ b/bench/btl/libs/C/main.cpp @@ -28,6 +28,8 @@ //#include "action_lu_solve.hh" #include "timers/mixed_perf_analyzer.hh" +BTL_MAIN; + int main() { diff --git a/bench/btl/libs/C_BLAS/main.cpp b/bench/btl/libs/C_BLAS/main.cpp index d88effa29..97a0c6ca1 100644 --- a/bench/btl/libs/C_BLAS/main.cpp +++ b/bench/btl/libs/C_BLAS/main.cpp @@ -1,14 +1,14 @@ //===================================================== // File : main.cpp -// Author : L. Plagne <laurent.plagne@edf.fr)> +// Author : L. Plagne <laurent.plagne@edf.fr)> // Copyright (C) EDF R&D, lun sep 30 14:23:28 CEST 2002 //===================================================== -// +// // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -// +// // This program 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 @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// +// #include "utilities.h" #include "C_BLAS_interface.hh" #include "bench.hh" @@ -27,22 +27,23 @@ #include "action_ata_product.hh" #include "action_aat_product.hh" +BTL_MAIN; int main() { - bench<Action_axpy<C_BLAS_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench<Action_axpy<C_BLAS_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT); - bench<Action_matrix_vector_product<C_BLAS_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT); + bench<Action_matrix_vector_product<C_BLAS_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT); - bench<Action_matrix_matrix_product<C_BLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); + bench<Action_matrix_matrix_product<C_BLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); bench<Action_ata_product<C_BLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); - + bench<Action_aat_product<C_BLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); //bench<Action_lu_solve<C_BLAS_LU_solve_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT); - + return 0; } diff --git a/bench/btl/libs/STL/main.cpp b/bench/btl/libs/STL/main.cpp index dc2044320..4cb846633 100644 --- a/bench/btl/libs/STL/main.cpp +++ b/bench/btl/libs/STL/main.cpp @@ -28,6 +28,8 @@ #include "action_aat_product.hh" #include "action_atv_product.hh" +BTL_MAIN; + int main() { bench<Action_axpy<STL_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT); diff --git a/bench/btl/libs/STL_algo/main.cpp b/bench/btl/libs/STL_algo/main.cpp index 8c8b60781..9ce2d947e 100644 --- a/bench/btl/libs/STL_algo/main.cpp +++ b/bench/btl/libs/STL_algo/main.cpp @@ -23,6 +23,8 @@ #include "action_atv_product.hh" #include "action_axpy.hh" +BTL_MAIN; + int main() { diff --git a/bench/btl/libs/blitz/main.cpp b/bench/btl/libs/blitz/main.cpp index 65fbb6b11..16d2b5951 100644 --- a/bench/btl/libs/blitz/main.cpp +++ b/bench/btl/libs/blitz/main.cpp @@ -29,6 +29,8 @@ #include "action_aat_product.hh" #include "action_atv_product.hh" +BTL_MAIN; + int main() { diff --git a/bench/btl/libs/eigen2/eigen2_interface.hh b/bench/btl/libs/eigen2/eigen2_interface.hh index 5d8ad9466..8c4270e8c 100644 --- a/bench/btl/libs/eigen2/eigen2_interface.hh +++ b/bench/btl/libs/eigen2/eigen2_interface.hh @@ -108,7 +108,7 @@ public : } static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ - X = (A*B).lazy(); + X = (A.transpose()*B).lazy(); } static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){ diff --git a/bench/btl/libs/eigen2/main.cpp b/bench/btl/libs/eigen2/main.cpp index d73a80768..dbd6a1764 100644 --- a/bench/btl/libs/eigen2/main.cpp +++ b/bench/btl/libs/eigen2/main.cpp @@ -18,7 +18,6 @@ #include "utilities.h" #include "eigen2_interface.hh" #include "bench.hh" -#include "static/bench_static.hh" #include "action_matrix_vector_product.hh" #include "action_matrix_matrix_product.hh" #include "action_axpy.hh" @@ -27,22 +26,20 @@ #include "action_aat_product.hh" #include "action_atv_product.hh" +BTL_MAIN; + int main() { bench<Action_matrix_vector_product<eigen2_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT); bench<Action_atv_product<eigen2_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT); - bench<Action_axpy<eigen2_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT); - bench<Action_matrix_matrix_product<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); - bench<Action_ata_product<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); - bench<Action_aat_product<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); +// bench<Action_axpy<eigen2_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT); +// bench<Action_matrix_matrix_product<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); +// bench<Action_ata_product<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); +// bench<Action_aat_product<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); //bench<Action_lu_solve<blitz_LU_solve_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT); - bench_static<Action_axpy,eigen2_interface>(); - bench_static<Action_matrix_matrix_product,eigen2_interface>(); - bench_static<Action_matrix_vector_product,eigen2_interface>(); - return 0; } diff --git a/bench/btl/libs/f77/main.cpp b/bench/btl/libs/f77/main.cpp index 17934fb25..a4b67b487 100644 --- a/bench/btl/libs/f77/main.cpp +++ b/bench/btl/libs/f77/main.cpp @@ -1,14 +1,14 @@ //===================================================== // File : main.cpp -// Author : L. Plagne <laurent.plagne@edf.fr)> +// Author : L. Plagne <laurent.plagne@edf.fr)> // Copyright (C) EDF R&D, lun sep 30 14:23:25 CEST 2002 //===================================================== -// +// // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -// +// // This program 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 @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// +// #include "utilities.h" #include "f77_interface.hh" #include "bench.hh" @@ -27,17 +27,18 @@ #include "action_ata_product.hh" #include "action_aat_product.hh" +BTL_MAIN; int main() { - bench<Action_axpy<f77_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench<Action_axpy<f77_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT); - bench<Action_matrix_vector_product<f77_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT); + bench<Action_matrix_vector_product<f77_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT); - bench<Action_matrix_matrix_product<f77_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); + bench<Action_matrix_matrix_product<f77_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); bench<Action_ata_product<f77_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); - + bench<Action_aat_product<f77_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT); return 0; diff --git a/bench/btl/libs/gmm/main.cpp b/bench/btl/libs/gmm/main.cpp index 27afeedbb..a05fd1b46 100644 --- a/bench/btl/libs/gmm/main.cpp +++ b/bench/btl/libs/gmm/main.cpp @@ -26,6 +26,8 @@ #include "action_aat_product.hh" #include "action_atv_product.hh" +BTL_MAIN; + int main() { diff --git a/bench/btl/libs/mtl4/main.cpp b/bench/btl/libs/mtl4/main.cpp index 219570d28..17b200a90 100644 --- a/bench/btl/libs/mtl4/main.cpp +++ b/bench/btl/libs/mtl4/main.cpp @@ -26,6 +26,8 @@ #include "action_aat_product.hh" #include "action_atv_product.hh" +BTL_MAIN; + int main() { diff --git a/bench/btl/libs/tiny_blitz/main.cpp b/bench/btl/libs/tiny_blitz/main.cpp index 6675d3d1a..eff3c1881 100644 --- a/bench/btl/libs/tiny_blitz/main.cpp +++ b/bench/btl/libs/tiny_blitz/main.cpp @@ -1,14 +1,14 @@ //===================================================== // File : main.cpp -// Author : L. Plagne <laurent.plagne@edf.fr)> +// Author : L. Plagne <laurent.plagne@edf.fr)> // Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 //===================================================== -// +// // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -// +// // This program 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 @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// +// #include "utilities.h" #include "tiny_blitz_interface.hh" #include "static/bench_static.hh" @@ -25,6 +25,8 @@ #include "action_axpy.hh" #include "timers/x86_perf_analyzer.hh" +BTL_MAIN; + int main() { bench_static<Action_axpy,tiny_blitz_interface>(); diff --git a/bench/btl/libs/tvmet/CMakeLists.txt b/bench/btl/libs/tvmet/CMakeLists.txt index e047b4e08..3e965069b 100644 --- a/bench/btl/libs/tvmet/CMakeLists.txt +++ b/bench/btl/libs/tvmet/CMakeLists.txt @@ -1,4 +1,3 @@ -include_directories(${BLITZ_INCLUDES}) -add_executable(btl_blitz main.cpp) -target_link_libraries(btl_blitz ${BLITZ_LIBRARIES}) +include_directories(${TVMET_INCLUDE_DIR}) +add_executable(btl_tvmet main.cpp) diff --git a/bench/btl/libs/tvmet/main.cpp b/bench/btl/libs/tvmet/main.cpp index 448c1a980..633215c43 100644 --- a/bench/btl/libs/tvmet/main.cpp +++ b/bench/btl/libs/tvmet/main.cpp @@ -1,14 +1,14 @@ //===================================================== // File : main.cpp -// Author : L. Plagne <laurent.plagne@edf.fr)> +// Author : L. Plagne <laurent.plagne@edf.fr)> // Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 //===================================================== -// +// // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -// +// // This program 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 @@ -16,19 +16,23 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// +// #include "utilities.h" #include "tvmet_interface.hh" #include "static/bench_static.hh" #include "action_matrix_vector_product.hh" #include "action_matrix_matrix_product.hh" +#include "action_atv_product.hh" #include "action_axpy.hh" +BTL_MAIN; + int main() { bench_static<Action_axpy,tvmet_interface>(); bench_static<Action_matrix_matrix_product,tvmet_interface>(); bench_static<Action_matrix_vector_product,tvmet_interface>(); + bench_static<Action_atv_product,tvmet_interface>(); return 0; } diff --git a/bench/btl/libs/tvmet/tvmet_interface.hh b/bench/btl/libs/tvmet/tvmet_interface.hh index dfbfa20aa..28aa35300 100644 --- a/bench/btl/libs/tvmet/tvmet_interface.hh +++ b/bench/btl/libs/tvmet/tvmet_interface.hh @@ -1,14 +1,14 @@ //===================================================== // File : tvmet_interface.hh -// Author : L. Plagne <laurent.plagne@edf.fr)> +// Author : L. Plagne <laurent.plagne@edf.fr)> // Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 //===================================================== -// +// // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. -// +// // This program 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 @@ -16,10 +16,11 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// +// #ifndef TVMET_INTERFACE_HH #define TVMET_INTERFACE_HH +#include <tvmet/tvmet.h> #include <tvmet/Vector.h> #include <tvmet/Matrix.h> @@ -29,113 +30,75 @@ using namespace tvmet; template<class real, int SIZE> class tvmet_interface{ - + public : - + typedef real real_type ; typedef std::vector<real> stl_vector; typedef std::vector<stl_vector > stl_matrix; - + typedef Vector<real,SIZE> gene_vector; typedef Matrix<real,SIZE,SIZE> gene_matrix; - static inline std::string name( void ) - { - return "tvmet"; - } - - - static void free_matrix(gene_matrix & A, int N){ - - return ; - } - - static void free_vector(gene_vector & B){ - - return ; - - } - + static inline std::string name() { return "tvmet"; } + + static void free_matrix(gene_matrix & A, int N){} + + static void free_vector(gene_vector & B){} + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ - - for (int i=0; i<A_stl.size() ; i++){ - for (int j=0; j<A_stl[i].size() ; j++){ - A(i,j)=A_stl[i][j]; - } - - } + for (int j=0; j<A_stl.size() ; j++) + for (int i=0; i<A_stl[j].size() ; i++) + A(i,j) = A_stl[j][i]; } - + static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){ - - for (int i=0; i<B_stl.size() ; i++){ + for (int i=0; i<B_stl.size() ; i++) B[i]=B_stl[i]; - } } - + static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){ - for (int i=0; i<B_stl.size() ; i++){ B_stl[i]=B[i]; } } static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){ - - int N=A_stl.size(); - - for (int i=0;i<N;i++){ - A_stl[i].resize(N); - for (int j=0;j<N;j++){ - A_stl[i][j]=A(i,j); - } + int N = A_stl.size(); + for (int j=0;j<N;j++){ + A_stl[j].resize(N); + for (int i=0;i<N;i++) + A_stl[j][i] = A(i,j); } - } - static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N) - { - - for (int i=0;i<N;i++){ - for (int j=0;j<N;j++){ - cible(i,j)=source(i,j); - } - } - + static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){ + cible = source; } - static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N) - { - - for (int i=0;i<N;i++){ - cible[i]=source[i]; - } - + static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){ + cible = source; } - - - - static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N) - { - X=product(A,B); + + static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){ + X = prod(A,B); } + static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + X = prod(A,B); + } - static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N) - { - X=product(A,B); - + static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + X = prod(trans(A),B); } - static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N) - { + static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){ Y+=coef*X; } - }; - + #endif diff --git a/bench/btl/libs/ublas/main.cpp b/bench/btl/libs/ublas/main.cpp index 768010406..acc59364f 100644 --- a/bench/btl/libs/ublas/main.cpp +++ b/bench/btl/libs/ublas/main.cpp @@ -27,6 +27,8 @@ #include "action_aat_product.hh" #include "action_atv_product.hh" +BTL_MAIN; + int main() { bench<Action_axpy<ublas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT); |