CPUCruncher.h
Go to the documentation of this file.
1 
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 
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
61 
62  // To calib only once
65 
66  // For the concurrency
67 
68  const uint MAX_INPUTS = 40;
69  const uint MAX_OUTPUTS = 10;
70 
73 
75 
76  unsigned int m_rwRepetitions;
77 
78  static CHM m_name_ncopies_map;
79 
80  // Sleep during execution instead of real CPU crunching
82 
83  };
84 
bool m_sleepyExecution
Definition: CPUCruncher.h:81
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
virtual StatusCode initialize()
Its initialization.
Definition: CPUCruncher.cpp:63
bool m_shortCalib
Definition: CPUCruncher.h:60
const uint MAX_OUTPUTS
Definition: CPUCruncher.h:69
virtual ~CPUCruncher()
virtual & protected desctrustor
Definition: CPUCruncher.cpp:52
void findPrimes(const unsigned long int)
The CPU intensive function.
double m_avg_runtime
Definition: CPUCruncher.h:57
double get_runtime() const
Definition: CPUCruncher.h:33
CPUCruncher & operator=(const CPUCruncher &)
the assignement operator is disabled
void calibrate()
Calibrate.
Definition: CPUCruncher.cpp:97
virtual StatusCode execute()
the execution of the algorithm
long unsigned int getNCaliIters(double)
STL class.
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:820
virtual StatusCode finalize()
the finalization of the algorithm
static std::vector< unsigned int > m_niters_vect
Definition: CPUCruncher.h:63
static CHM m_name_ncopies_map
Definition: CPUCruncher.h:78
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
The useful base class for data processing algorithms.
static std::vector< double > m_times_vect
Definition: CPUCruncher.h:64
std::vector< DataObjectHandle< DataObject > * > m_inputHandles
Definition: CPUCruncher.h:71
CPUCruncher()
the default constructor is disabled
std::vector< std::string > m_outKeys
Definition: CPUCruncher.h:74
unsigned int m_rwRepetitions
Definition: CPUCruncher.h:76
const uint MAX_INPUTS
Definition: CPUCruncher.h:68
std::vector< std::string > m_inpKeys
Definition: CPUCruncher.h:74
std::vector< DataObjectHandle< DataObject > * > m_outputHandles
Definition: CPUCruncher.h:72
bool m_local_rndm_gen
Definition: CPUCruncher.h:59
double m_var_runtime
Definition: CPUCruncher.h:58
tbb::concurrent_hash_map< std::string, unsigned int > CHM
Definition: CPUCruncher.h:24