static_size_generator.hh
Go to the documentation of this file.
00001 //=====================================================
00002 // File   :  static_size_generator.hh
00003 // Author :  L. Plagne <laurent.plagne@edf.fr)>        
00004 // Copyright (C) EDF R&D,  mar déc 3 18:59:36 CET 2002
00005 //=====================================================
00006 // 
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 // 
00012 // This program is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 // You should have received a copy of the GNU General Public License
00017 // along with this program; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019 // 
00020 #ifndef _STATIC_SIZE_GENERATOR_HH
00021 #define _STATIC_SIZE_GENERATOR_HH
00022 #include <vector>
00023 
00024 using namespace std;
00025 
00026 //recursive generation of statically defined matrix and vector sizes
00027 
00028 template <int SIZE,template<class> class Perf_Analyzer, template<class> class Action, template<class,int> class Interface> 
00029 struct static_size_generator{
00030   static void go(vector<double> & tab_sizes, vector<double> & tab_mflops)
00031   {
00032     tab_sizes.push_back(SIZE);
00033     std::cout << tab_sizes.back() << " \t" << std::flush;
00034     Perf_Analyzer<Action<Interface<REAL_TYPE,SIZE> > > perf_action;
00035     tab_mflops.push_back(perf_action.eval_mflops(SIZE));
00036     std::cout << tab_mflops.back() << " MFlops" << std::endl;
00037     static_size_generator<SIZE-1,Perf_Analyzer,Action,Interface>::go(tab_sizes,tab_mflops);
00038   };
00039 };
00040 
00041 //recursion end
00042 
00043 template <template<class> class Perf_Analyzer, template<class> class Action, template<class,int> class Interface> 
00044 struct static_size_generator<1,Perf_Analyzer,Action,Interface>{  
00045   static  void go(vector<double> & tab_sizes, vector<double> & tab_mflops)
00046   {
00047     tab_sizes.push_back(1);
00048     Perf_Analyzer<Action<Interface<REAL_TYPE,1> > > perf_action;
00049     tab_mflops.push_back(perf_action.eval_mflops(1));
00050   };
00051 };
00052 
00053 #endif
00054   
00055   
00056   
00057   


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:32:59