aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/btl/generic_bench/utils
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-07-09 14:04:48 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-07-09 14:04:48 +0000
commit28539e7597c643dbc2b8d4f49dd16bd86fb7251f (patch)
tree3bfb96ae898f0afc943a388edcc83c27d28d5b3a /bench/btl/generic_bench/utils
parent5f55ab524cf0aad34dd6884bcae09eaa6c43c247 (diff)
imported a reworked version of BTL (Benchmark for Templated Libraries).
the modifications to initial code follow: * changed build system from plain makefiles to cmake * added eigen2 (4 versions: vec/novec and fixed/dynamic), GMM++, MTL4 interfaces * added "transposed matrix * vector" product action * updated blitz interface to use condensed products instead of hand coded loops * removed some deprecated interfaces * changed default storage order to column major for all libraries * new generic bench timer strategy which is supposed to be more accurate * various code clean-up
Diffstat (limited to 'bench/btl/generic_bench/utils')
-rw-r--r--bench/btl/generic_bench/utils/dump_file_x_y.hh47
-rw-r--r--bench/btl/generic_bench/utils/size_lin_log.hh70
-rw-r--r--bench/btl/generic_bench/utils/size_log.hh54
-rw-r--r--bench/btl/generic_bench/utils/utilities.h90
4 files changed, 261 insertions, 0 deletions
diff --git a/bench/btl/generic_bench/utils/dump_file_x_y.hh b/bench/btl/generic_bench/utils/dump_file_x_y.hh
new file mode 100644
index 000000000..6b99dcb10
--- /dev/null
+++ b/bench/btl/generic_bench/utils/dump_file_x_y.hh
@@ -0,0 +1,47 @@
+//=====================================================
+// File : dump_file_x_y.hh
+// Author : L. Plagne <laurent.plagne@edf.fr)>
+// Copyright (C) EDF R&D, lun sep 30 14:23:20 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
+// 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 DUMP_FILE_X_Y_HH
+#define DUMP_FILE_X_Y_HH
+#include <fstream>
+#include <string>
+
+// The Vector class must satisfy the following part of STL vector concept :
+// resize() method
+// [] operator for seting element
+// the vector element must have the << operator define
+
+using namespace std;
+
+template<class Vector_A, class Vector_B>
+void dump_file_x_y(const Vector_A & X, const Vector_B & Y, const std::string & filename){
+
+ ofstream outfile (filename.c_str(),ios::out) ;
+ int size=X.size();
+
+ for (int i=0;i<size;i++){
+
+ outfile << X[i] << " " << Y[i] << endl ;
+
+ }
+
+ outfile.close();
+}
+
+#endif
diff --git a/bench/btl/generic_bench/utils/size_lin_log.hh b/bench/btl/generic_bench/utils/size_lin_log.hh
new file mode 100644
index 000000000..bca3932ae
--- /dev/null
+++ b/bench/btl/generic_bench/utils/size_lin_log.hh
@@ -0,0 +1,70 @@
+//=====================================================
+// File : size_lin_log.hh
+// Author : L. Plagne <laurent.plagne@edf.fr)>
+// Copyright (C) EDF R&D, mar déc 3 18:59:37 CET 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
+// 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 SIZE_LIN_LOG
+#define SIZE_LIN_LOG
+
+#include "size_log.hh"
+
+template<class Vector>
+void size_lin_log(const int nb_point, const int size_min, const int size_max, Vector & X)
+{
+ int ten=10;
+ int nine=9;
+
+ X.resize(nb_point);
+
+ if (nb_point>ten){
+
+ for (int i=0;i<nine;i++){
+
+ X[i]=i+1;
+
+ }
+
+ Vector log_size;
+ size_log(nb_point-nine,ten,size_max,log_size);
+
+ for (int i=0;i<nb_point-nine;i++){
+
+ X[i+nine]=log_size[i];
+
+ }
+ }
+ else{
+
+ for (int i=0;i<nb_point;i++){
+
+ X[i]=i+1;
+
+ }
+ }
+
+ // for (int i=0;i<nb_point;i++){
+
+// INFOS("computed sizes : X["<<i<<"]="<<X[i]);
+
+// }
+
+}
+
+#endif
+
+
+
diff --git a/bench/btl/generic_bench/utils/size_log.hh b/bench/btl/generic_bench/utils/size_log.hh
new file mode 100644
index 000000000..13a3da7a8
--- /dev/null
+++ b/bench/btl/generic_bench/utils/size_log.hh
@@ -0,0 +1,54 @@
+//=====================================================
+// File : size_log.hh
+// Author : L. Plagne <laurent.plagne@edf.fr)>
+// Copyright (C) EDF R&D, lun sep 30 14:23:17 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
+// 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 SIZE_LOG
+#define SIZE_LOG
+
+#include "math.h"
+// The Vector class must satisfy the following part of STL vector concept :
+// resize() method
+// [] operator for seting element
+// the vector element are int compatible.
+template<class Vector>
+void size_log(const int nb_point, const int size_min, const int size_max, Vector & X)
+{
+ X.resize(nb_point);
+
+ float ls_min=log(float(size_min));
+ float ls_max=log(float(size_max));
+
+ float ls=0.0;
+
+ float delta_ls=(ls_max-ls_min)/(float(nb_point-1));
+
+ int size=0;
+
+ for (int i=0;i<nb_point;i++){
+
+ ls = ls_min + float(i)*delta_ls ;
+
+ size=int(exp(ls));
+
+ X[i]=size;
+ }
+
+}
+
+
+#endif
diff --git a/bench/btl/generic_bench/utils/utilities.h b/bench/btl/generic_bench/utils/utilities.h
new file mode 100644
index 000000000..3c2acfb02
--- /dev/null
+++ b/bench/btl/generic_bench/utils/utilities.h
@@ -0,0 +1,90 @@
+//=============================================================================
+// File : utilities.h
+// Created : mar jun 19 13:18:14 CEST 2001
+// Author : Antoine YESSAYAN, Paul RASCLE, EDF
+// Project : SALOME
+// Copyright : EDF 2001
+// $Header$
+//=============================================================================
+
+/* --- Definition macros file to print informations if _DEBUG_ is defined --- */
+
+# ifndef UTILITIES_H
+# define UTILITIES_H
+
+# include <stdlib.h>
+//# include <iostream> ok for gcc3.01
+# include <iostream>
+
+/* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
+
+# define HEREWEARE cout<<flush ; cerr << __FILE__ << " [" << __LINE__ << "] : " << flush ;
+# define INFOS(chain) {HEREWEARE ; cerr << chain << endl ;}
+# define PYSCRIPT(chain) {cout<<flush ; cerr << "---PYSCRIPT--- " << chain << endl ;}
+
+/* --- To print date and time of compilation of current source on stdout --- */
+
+# if defined ( __GNUC__ )
+# define COMPILER "g++" ;
+# elif defined ( __sun )
+# define COMPILER "CC" ;
+# elif defined ( __KCC )
+# define COMPILER "KCC" ;
+# elif defined ( __PGI )
+# define COMPILER "pgCC" ;
+# else
+# define COMPILER "undefined" ;
+# endif
+
+# ifdef INFOS_COMPILATION
+# error INFOS_COMPILATION already defined
+# endif
+# define INFOS_COMPILATION {\
+ cerr << flush;\
+ cout << __FILE__ ;\
+ cout << " [" << __LINE__ << "] : " ;\
+ cout << "COMPILED with " << COMPILER ;\
+ cout << ", " << __DATE__ ; \
+ cout << " at " << __TIME__ << endl ;\
+ cout << "\n\n" ;\
+ cout << flush ;\
+ }
+
+# ifdef _DEBUG_
+
+/* --- the following MACROS are useful at debug time --- */
+
+# define HERE cout<<flush ; cerr << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " << flush ;
+# define SCRUTE(var) HERE ; cerr << #var << "=" << var << endl ;
+# define MESSAGE(chain) {HERE ; cerr << chain << endl ;}
+# define INTERRUPTION(code) HERE ; cerr << "INTERRUPTION return code= " << code << endl ; exit(code) ;
+
+# ifndef ASSERT
+# define ASSERT(condition) if (!(condition)){ HERE ; cerr << "CONDITION " << #condition << " NOT VERIFIED"<< endl ; INTERRUPTION(1) ;}
+# endif /* ASSERT */
+
+#define REPERE cout<<flush ; cerr << " --------------" << endl << flush ;
+#define BEGIN_OF(chain) {REPERE ; HERE ; cerr << "Begin of: " << chain << endl ; REPERE ; }
+#define END_OF(chain) {REPERE ; HERE ; cerr << "Normal end of: " << chain << endl ; REPERE ; }
+
+
+
+# else /* ifdef _DEBUG_*/
+
+# define HERE
+# define SCRUTE(var)
+# define MESSAGE(chain)
+# define INTERRUPTION(code)
+
+# ifndef ASSERT
+# define ASSERT(condition)
+# endif /* ASSERT */
+
+#define REPERE
+#define BEGIN_OF(chain)
+#define END_OF(chain)
+
+
+# endif /* ifdef _DEBUG_*/
+
+# endif /* ifndef UTILITIES_H */