The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
GPUCruncher.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 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#pragma once
12
18#include <tbb/concurrent_hash_map.h>
19
20//------------------------------------------------------------------------------
21
27
28public:
29 using CHM = tbb::concurrent_hash_map<std::string, unsigned int>;
30
31 bool isClonable() const override { return true; }
32
34 StatusCode execute( const EventContext& ctx ) const override;
36 StatusCode initialize() override;
38 StatusCode finalize() override;
39
40 double get_runtime() const { return m_avg_runtime; }
41
42 GPUCruncher( const std::string& name, // the algorithm instance name
43 ISvcLocator* pSvc ); // the Service Locator
44
46 virtual ~GPUCruncher(); // virtual & protected destructor
47
48private:
50 GPUCruncher(); // no default constructor
52 GPUCruncher( const GPUCruncher& ); // no copy constructor
54 GPUCruncher& operator=( const GPUCruncher& ); // no assignement
56 StatusCode gpuExecute( const std::vector<double>& in, std::vector<double>& out ) const;
57
60
61 Gaudi::Property<double> m_avg_runtime{ this, "avgRuntime", 1., "Average runtime of the module." };
62 Gaudi::Property<double> m_var_runtime{ this, "varRuntime", 0.01, "Variance of the runtime of the module." };
63
64 // For the concurrency
65 const uint MAX_INPUTS = 40;
66 const uint MAX_OUTPUTS = 10;
67
68 std::vector<DataObjectHandle<DataObject>*> m_inputHandles;
69 std::vector<DataObjectHandle<DataObject>*> m_outputHandles;
70
72};
This class represents an entry point to all the event specific data.
bool isClonable() const override
Definition GPUCruncher.h:31
GPUCruncher()
the default constructor is disabled
StatusCode finalize() override
the finalization of the algorithm
StatusCode gpuExecute(const std::vector< double > &in, std::vector< double > &out) const
The GPU intensive function.
GPUCruncher(const GPUCruncher &)
the copy constructor is disabled
std::vector< DataObjectHandle< DataObject > * > m_inputHandles
Definition GPUCruncher.h:68
static CHM m_name_ncopies_map
Definition GPUCruncher.h:71
GPUCruncher(const std::string &name, ISvcLocator *pSvc)
Gaudi::Property< double > m_var_runtime
Definition GPUCruncher.h:62
Gaudi::Property< double > m_avg_runtime
Definition GPUCruncher.h:61
GPUCruncher & operator=(const GPUCruncher &)
the assignement operator is disabled
tbb::concurrent_hash_map< std::string, unsigned int > CHM
Definition GPUCruncher.h:29
virtual ~GPUCruncher()
virtual & protected desctrustor
StatusCode execute(const EventContext &ctx) const override
the execution of the algorithm
Gaudi::Property< std::vector< std::string > > m_inpKeys
Definition GPUCruncher.h:58
const uint MAX_OUTPUTS
Definition GPUCruncher.h:66
double get_runtime() const
Definition GPUCruncher.h:40
const uint MAX_INPUTS
Definition GPUCruncher.h:65
std::vector< DataObjectHandle< DataObject > * > m_outputHandles
Definition GPUCruncher.h:69
StatusCode initialize() override
Its initialization.
Gaudi::Property< std::vector< std::string > > m_outKeys
Definition GPUCruncher.h:59
const std::string & name() const override
The identifying name of the algorithm object.
Base class for asynchronous algorithms.
Implementation of property with value of concrete type.
Definition PropertyFwd.h:27
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition ISvcLocator.h:42
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64