The Gaudi Framework  master (37c0b60a)
GPUCruncher.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 
17 #include <tbb/concurrent_hash_map.h>
18 
19 //------------------------------------------------------------------------------
20 
26 
27 public:
28  using CHM = tbb::concurrent_hash_map<std::string, unsigned int>;
29 
30  bool isClonable() const override { return true; }
31 
33  StatusCode execute( const EventContext& ctx ) const override;
35  StatusCode initialize() override;
37  StatusCode finalize() override;
38 
39  double get_runtime() const { return m_avg_runtime; }
40 
41  GPUCruncher( const std::string& name, // the algorithm instance name
42  ISvcLocator* pSvc ); // the Service Locator
43 
45  virtual ~GPUCruncher(); // virtual & protected destructor
46 
47 private:
49  GPUCruncher(); // no default constructor
51  GPUCruncher( const GPUCruncher& ); // no copy constructor
53  GPUCruncher& operator=( const GPUCruncher& ); // no assignement
56 
59 
60  Gaudi::Property<double> m_avg_runtime{ this, "avgRuntime", 1., "Average runtime of the module." };
61  Gaudi::Property<double> m_var_runtime{ this, "varRuntime", 0.01, "Variance of the runtime of the module." };
62 
63  // For the concurrency
64  const uint MAX_INPUTS = 40;
65  const uint MAX_OUTPUTS = 10;
66 
69 
71 };
GPUCruncher::m_inpKeys
Gaudi::Property< std::vector< std::string > > m_inpKeys
Definition: GPUCruncher.h:57
std::string
STL class.
GPUCruncher::finalize
StatusCode finalize() override
the finalization of the algorithm
Definition: GPUCruncher.cpp:197
GPUCruncher::isClonable
bool isClonable() const override
Definition: GPUCruncher.h:30
RndmGenerators.h
GPUCruncher::m_outputHandles
std::vector< DataObjectHandle< DataObject > * > m_outputHandles
Definition: GPUCruncher.h:68
GPUCruncher::MAX_INPUTS
const uint MAX_INPUTS
Definition: GPUCruncher.h:64
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition: Algorithm.cpp:526
std::vector< double >
GPUCruncher::m_var_runtime
Gaudi::Property< double > m_var_runtime
Definition: GPUCruncher.h:61
ISvcLocator
Definition: ISvcLocator.h:46
IRndmGenSvc.h
GPUCruncher::execute
StatusCode execute(const EventContext &ctx) const override
the execution of the algorithm
Definition: GPUCruncher.cpp:80
GPUCruncher::~GPUCruncher
virtual ~GPUCruncher()
virtual & protected desctrustor
Definition: GPUCruncher.cpp:43
GPUCruncher::MAX_OUTPUTS
const uint MAX_OUTPUTS
Definition: GPUCruncher.h:65
RegistryEntry.h
GPUCruncher::operator=
GPUCruncher & operator=(const GPUCruncher &)
the assignement operator is disabled
GPUCruncher::initialize
StatusCode initialize() override
Its initialization.
Definition: GPUCruncher.cpp:49
AsynchronousAlgorithm.h
GPUCruncher::m_inputHandles
std::vector< DataObjectHandle< DataObject > * > m_inputHandles
Definition: GPUCruncher.h:67
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
StatusCode
Definition: StatusCode.h:65
Gaudi::AsynchronousAlgorithm
Base class for asynchronous algorithms.
Definition: AsynchronousAlgorithm.h:34
GPUCruncher::gpuExecute
StatusCode gpuExecute(const std::vector< double > &in, std::vector< double > &out) const
The GPU intensive function.
GPUCruncher::GPUCruncher
GPUCruncher()
the default constructor is disabled
GPUCruncher::GPUCruncher
GPUCruncher(const GPUCruncher &)
the copy constructor is disabled
EventContext
Definition: EventContext.h:34
GPUCruncher::CHM
tbb::concurrent_hash_map< std::string, unsigned int > CHM
Definition: GPUCruncher.h:28
GPUCruncher::m_outKeys
Gaudi::Property< std::vector< std::string > > m_outKeys
Definition: GPUCruncher.h:58
GPUCruncher::m_name_ncopies_map
static CHM m_name_ncopies_map
Definition: GPUCruncher.h:70
GPUCruncher::get_runtime
double get_runtime() const
Definition: GPUCruncher.h:39
GPUCruncher::m_avg_runtime
Gaudi::Property< double > m_avg_runtime
Definition: GPUCruncher.h:60
GPUCruncher
Definition: GPUCruncher.h:25
DataObjectHandle.h
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:37
PrepareBase.out
out
Definition: PrepareBase.py:20