| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

CPUCruncher.h
Go to the documentation of this file.
1
2 #include "GaudiKernel/AlgFactory.h"
3 #include "GaudiKernel/IRndmGenSvc.h"
4 #include "GaudiKernel/RndmGenerators.h"
5 #include "GaudiAlg/GaudiAlgorithm.h"
6 #include "GaudiKernel/RegistryEntry.h"
7
8 #include <tbb/concurrent_hash_map.h>
9
10 //------------------------------------------------------------------------------
11
19 class CPUCruncher : public GaudiAlgorithm
20 {
21
22 public:
23
24 typedef tbb::concurrent_hash_map<std::string,unsigned int> CHM;
25
27 virtual StatusCode execute () ; // the execution of the algorithm
29 virtual StatusCode initialize();
31 virtual StatusCode finalize () ; // the finalization of the algorithm
32
33 double get_runtime() const { return m_avg_runtime; };
34
35 CPUCruncher
36 ( const std::string& name , // the algorithm instance name
37 ISvcLocator* pSvc ); // the Service Locator
38
40 virtual ~CPUCruncher(); // virtual & protected desctrustor
41
42 private:
43
45 CPUCruncher () ; // no default constructor
47 CPUCruncher ( const CPUCruncher& ) ; // no copy constructor
49 CPUCruncher& operator= ( const CPUCruncher& ) ; // no assignement
51 void findPrimes (const unsigned long int ) ;
52
54 void calibrate();
55 long unsigned int getNCaliIters(double);
56
57 double m_avg_runtime ; //Avg Runtime
58 double m_var_runtime ; //Variance of Runtime
59 bool m_local_rndm_gen; //Decide what random number generation to use
60 bool m_shortCalib;
61
62 // To calib only once
63 static std::vector<unsigned int>m_niters_vect;
64 static std::vector<double> m_times_vect;
65
66 // For the concurrency
67
68 const uint MAX_INPUTS = 40;
69 const uint MAX_OUTPUTS = 10;
70
71 std::vector<DataObjectHandle<DataObject> *> m_inputHandles;
72 std::vector<DataObjectHandle<DataObject> *> m_outputHandles;
73
74 std::vector<std::string> m_inpKeys, m_outKeys;
75
76 unsigned int m_rwRepetitions;
77
78 static CHM m_name_ncopies_map;
79
80 // Sleep during execution instead of real CPU crunching
81 bool m_sleepyExecution;
82
83 };
84
CPUCruncher::m_sleepyExecution
bool m_sleepyExecution
Definition: CPUCruncher.h:81
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
CPUCruncher::initialize
virtual StatusCode initialize()
Its initialization.
Definition: CPUCruncher.cpp:63
CPUCruncher::m_shortCalib
bool m_shortCalib
Definition: CPUCruncher.h:60
CPUCruncher::MAX_OUTPUTS
const uint MAX_OUTPUTS
Definition: CPUCruncher.h:69
CPUCruncher::~CPUCruncher
virtual ~CPUCruncher()
virtual & protected desctrustor
Definition: CPUCruncher.cpp:52
GaudiAlgorithm.h
CPUCruncher::findPrimes
void findPrimes(const unsigned long int)
The CPU intensive function.
Definition: CPUCruncher.cpp:191
CPUCruncher::m_avg_runtime
double m_avg_runtime
Definition: CPUCruncher.h:57
CPUCruncher::get_runtime
double get_runtime() const
Definition: CPUCruncher.h:33
CPUCruncher::operator=
CPUCruncher & operator=(const CPUCruncher &)
the assignement operator is disabled
CPUCruncher::calibrate
void calibrate()
Calibrate.
Definition: CPUCruncher.cpp:97
CPUCruncher::execute
virtual StatusCode execute()
the execution of the algorithm
Definition: CPUCruncher.cpp:248
CPUCruncher::getNCaliIters
long unsigned int getNCaliIters(double)
Definition: CPUCruncher.cpp:156
std::string
STL class.
Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
CPUCruncher::finalize
virtual StatusCode finalize()
the finalization of the algorithm
Definition: CPUCruncher.cpp:369
CPUCruncher::m_niters_vect
static std::vector< unsigned int > m_niters_vect
Definition: CPUCruncher.h:63
CPUCruncher::m_name_ncopies_map
static CHM m_name_ncopies_map
Definition: CPUCruncher.h:78
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
GaudiAlgorithm
The useful base class for data processing algorithms.
Definition: GaudiAlgorithm.h:93
RndmGenerators.h
CPUCruncher::m_times_vect
static std::vector< double > m_times_vect
Definition: CPUCruncher.h:64
RegistryEntry.h
CPUCruncher::m_inputHandles
std::vector< DataObjectHandle< DataObject > * > m_inputHandles
Definition: CPUCruncher.h:71
std::vector< unsigned int >
IRndmGenSvc.h
CPUCruncher::CPUCruncher
CPUCruncher()
the default constructor is disabled
CPUCruncher::m_outKeys
std::vector< std::string > m_outKeys
Definition: CPUCruncher.h:74
AlgFactory.h
CPUCruncher::m_rwRepetitions
unsigned int m_rwRepetitions
Definition: CPUCruncher.h:76
CPUCruncher::MAX_INPUTS
const uint MAX_INPUTS
Definition: CPUCruncher.h:68
CPUCruncher::m_inpKeys
std::vector< std::string > m_inpKeys
Definition: CPUCruncher.h:74
CPUCruncher::m_outputHandles
std::vector< DataObjectHandle< DataObject > * > m_outputHandles
Definition: CPUCruncher.h:72
CPUCruncher::m_local_rndm_gen
bool m_local_rndm_gen
Definition: CPUCruncher.h:59
CPUCruncher::m_var_runtime
double m_var_runtime
Definition: CPUCruncher.h:58
CPUCruncher::CHM
tbb::concurrent_hash_map< std::string, unsigned int > CHM
Definition: CPUCruncher.h:24
CPUCruncher
Definition: CPUCruncher.py:1