diff options
Diffstat (limited to 'btl/generic_bench/utils')
-rw-r--r-- | btl/generic_bench/utils/LinearCongruential.hh | 66 | ||||
-rw-r--r-- | btl/generic_bench/utils/size_lin_log.hh | 70 | ||||
-rw-r--r-- | btl/generic_bench/utils/size_log.hh | 54 | ||||
-rw-r--r-- | btl/generic_bench/utils/utilities.h | 90 | ||||
-rw-r--r-- | btl/generic_bench/utils/xy_file.hh | 75 |
5 files changed, 0 insertions, 355 deletions
diff --git a/btl/generic_bench/utils/LinearCongruential.hh b/btl/generic_bench/utils/LinearCongruential.hh deleted file mode 100644 index 2ab21ae..0000000 --- a/btl/generic_bench/utils/LinearCongruential.hh +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef LINEARCONGRUENTIAL_HH_ -#define LINEARCONGRUENTIAL_HH_ - -#include <vector> - -class LinearCongruential -{ - typedef std::vector<unsigned> buffer_t; - typedef unsigned int_t; - -public: - LinearCongruential(const int_t& seed) : - a_(1664525u), c_(1013904223u), m_(getM()), i_(0) - { - buffer_.resize(4096/sizeof(unsigned)); - fillBuffer(seed); - } - - int_t a() const { return a_; } - int_t c() const { return c_; } - int_t m() const { return m_; } - - int_t get_int() { - if (i_ >= buffer_.size()) { - fillBuffer(); - i_ = 0; - } - return buffer_.at(i_++); - } - - double get_01() { - return static_cast<double>(get_int())/static_cast<double>(m_); - } - -private: - buffer_t buffer_; - const int_t a_, c_, m_; - std::size_t i_; - - void fillBuffer(const int_t& seed) - { - buffer_.front() = (seed*a_+c_) & m_; - for ( - typename buffer_t::iterator i = buffer_.begin()+1, end = buffer_.end(); - i != end; ++i) - *i = (*(i-1)*a_ + c_) & m_; - } - - void fillBuffer() - { - const int_t seed = buffer_.back(); - fillBuffer(seed); - } - - static int_t getM() - { - int_t _m = 1; - for (int i = 1; i < 32; ++i) { - _m <<= 1; - _m += 1; - } - return _m; - } -}; - -#endif /* LINEARCONGRUENTIAL_HH_ */ diff --git a/btl/generic_bench/utils/size_lin_log.hh b/btl/generic_bench/utils/size_lin_log.hh deleted file mode 100644 index bca3932..0000000 --- a/btl/generic_bench/utils/size_lin_log.hh +++ /dev/null @@ -1,70 +0,0 @@ -//===================================================== -// 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/btl/generic_bench/utils/size_log.hh b/btl/generic_bench/utils/size_log.hh deleted file mode 100644 index 13a3da7..0000000 --- a/btl/generic_bench/utils/size_log.hh +++ /dev/null @@ -1,54 +0,0 @@ -//===================================================== -// 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/btl/generic_bench/utils/utilities.h b/btl/generic_bench/utils/utilities.h deleted file mode 100644 index d2330d0..0000000 --- a/btl/generic_bench/utils/utilities.h +++ /dev/null @@ -1,90 +0,0 @@ -//============================================================================= -// 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 information 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 */ diff --git a/btl/generic_bench/utils/xy_file.hh b/btl/generic_bench/utils/xy_file.hh deleted file mode 100644 index 4571bed..0000000 --- a/btl/generic_bench/utils/xy_file.hh +++ /dev/null @@ -1,75 +0,0 @@ -//===================================================== -// 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 XY_FILE_HH -#define XY_FILE_HH -#include <fstream> -#include <iostream> -#include <string> -#include <vector> -using namespace std; - -bool read_xy_file(const std::string & filename, std::vector<int> & tab_sizes, - std::vector<double> & tab_mflops, bool quiet = false) -{ - - std::ifstream input_file (filename.c_str(),std::ios::in); - - if (!input_file){ - if (!quiet) { - INFOS("!!! Error opening "<<filename); - } - return false; - } - - int nb_point=0; - int size=0; - double mflops=0; - - while (input_file >> size >> mflops ){ - nb_point++; - tab_sizes.push_back(size); - tab_mflops.push_back(mflops); - } - SCRUTE(nb_point); - - input_file.close(); - return true; -} - -// 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_xy_file(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 |