All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
CPUCruncher.h
Go to the documentation of this file.
1 
7 
8 #include <tbb/concurrent_hash_map.h>
9 
10 //------------------------------------------------------------------------------
11 
20 {
21 
22 public:
23  typedef tbb::concurrent_hash_map<std::string, unsigned int> CHM;
24 
26  StatusCode execute() override;
28  StatusCode initialize() override;
30  StatusCode finalize() override;
31 
32  double get_runtime() const { return m_avg_runtime; }
33 
34  CPUCruncher( const std::string& name, // the algorithm instance name
35  ISvcLocator* pSvc ); // the Service Locator
36 
38  virtual ~CPUCruncher(); // virtual & protected desctrustor
39 
40 private:
42  CPUCruncher(); // no default constructor
44  CPUCruncher( const CPUCruncher& ); // no copy constructor
46  CPUCruncher& operator=( const CPUCruncher& ); // no assignement
48  void findPrimes( const unsigned long int );
49 
51  void calibrate();
52  long unsigned int getNCaliIters( double );
53 
56 
57  Gaudi::Property<double> m_avg_runtime{this, "avgRuntime", 1., "Average runtime of the module."};
58  Gaudi::Property<double> m_var_runtime{this, "varRuntime", 0.01, "Variance of the runtime of the module."};
59  Gaudi::Property<bool> m_local_rndm_gen{this, "localRndm", true, "Decide if the local random generator is to be used"};
60  Gaudi::Property<bool> m_shortCalib{this, "shortCalib", false, "Enable coarse grained calibration"};
61  Gaudi::Property<unsigned int> m_rwRepetitions{this, "RwRepetitions", 1, "Increase access to the WB"};
63  this, "SleepFraction", 0.0f,
64  "Fraction of time, between 0 and 1, when an algorithm is actually sleeping instead of crunching"};
65 
66  // To calib only once
69 
70  // For the concurrency
71  const uint MAX_INPUTS = 40;
72  const uint MAX_OUTPUTS = 10;
73 
76 
77  static CHM m_name_ncopies_map;
78 };
StatusCode execute() override
the execution of the algorithm
Gaudi::Property< float > m_sleepFraction
Definition: CPUCruncher.h:62
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:725
A class that implements a search for prime numbers.
Definition: CPUCruncher.h:19
Implementation of property with value of concrete type.
Definition: Property.h:313
const uint MAX_OUTPUTS
Definition: CPUCruncher.h:72
virtual ~CPUCruncher()
virtual & protected desctrustor
Definition: CPUCruncher.cpp:39
Header file for class GaudiAlgorithm.
void findPrimes(const unsigned long int)
The CPU intensive function.
Gaudi::Property< unsigned int > m_rwRepetitions
Definition: CPUCruncher.h:61
double get_runtime() const
Definition: CPUCruncher.h:32
std::vector< DataObjectHandle< DataObject > * > m_outputHandles
Definition: CPUCruncher.h:75
CPUCruncher & operator=(const CPUCruncher &)
the assignement operator is disabled
void calibrate()
Calibrate.
Definition: CPUCruncher.cpp:85
long unsigned int getNCaliIters(double)
STL class.
tbb::concurrent_hash_map< std::string, unsigned int > CHM
Definition: CPUCruncher.h:23
static std::vector< unsigned int > m_niters_vect
Definition: CPUCruncher.h:67
static CHM m_name_ncopies_map
Definition: CPUCruncher.h:77
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
The useful base class for data processing algorithms.
std::vector< DataObjectHandle< DataObject > * > m_inputHandles
Definition: CPUCruncher.h:74
static std::vector< double > m_times_vect
Definition: CPUCruncher.h:68
Gaudi::Property< bool > m_shortCalib
Definition: CPUCruncher.h:60
Gaudi::Property< double > m_avg_runtime
Definition: CPUCruncher.h:57
StatusCode initialize() override
Its initialization.
Definition: CPUCruncher.cpp:46
CPUCruncher()
the default constructor is disabled
Gaudi::Property< std::vector< std::string > > m_outKeys
Definition: CPUCruncher.h:55
Gaudi::Property< std::vector< std::string > > m_inpKeys
Definition: CPUCruncher.h:54
const uint MAX_INPUTS
Definition: CPUCruncher.h:71
StatusCode finalize() override
the finalization of the algorithm
Gaudi::Property< bool > m_local_rndm_gen
Definition: CPUCruncher.h:59
Gaudi::Property< double > m_var_runtime
Definition: CPUCruncher.h:58