The Gaudi Framework  master (9f3f8895)
Loading...
Searching...
No Matches
ConcurrencyFlags.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2026 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
13#include <cstddef>
14
16#include <GaudiKernel/Kernel.h>
17
18class AthMpEvtLoopMgr;
19
20namespace SG {
21 class HiveMgrSvc;
22}
23
33
34namespace Gaudi {
35
36 namespace Concurrency {
37
38 class ConcurrencyManager;
39
41
42 friend class ConcurrencyManager;
43 friend class SG::HiveMgrSvc; // ATLAS
44 friend class ::AthMpEvtLoopMgr; // ATLAS
45
46 public:
49 static GAUDI_API std::size_t numThreads() { return n_threads; }
50
53 static GAUDI_API std::size_t numConcurrentEvents() { return n_concEvts; }
54
57 static GAUDI_API std::size_t numProcs() { return n_procs; }
58
61 static GAUDI_API bool concurrent() { return ( n_threads || n_concEvts || n_procs ); }
62
63 private:
64 static GAUDI_API void setNumThreads( const std::size_t& nT ) { n_threads = nT; }
65 static GAUDI_API void setNumConcEvents( const std::size_t& nE ) { n_concEvts = nE; }
66 static GAUDI_API void setNumProcs( const std::size_t& nP ) { n_procs = nP; }
67
68 private:
69 static std::size_t n_threads; // worker threads for MT
70 static std::size_t n_concEvts; // concurrent events for MT
71 static std::size_t n_procs; // child processes for MP
72 };
73
83 class GAUDI_API ConcurrencyManager : virtual public IInterface {
84 public:
87
88 protected:
90 static void setNumThreads( const std::size_t& nT ) { ConcurrencyFlags::setNumThreads( nT ); }
91
93 static void setNumConcEvents( const std::size_t& nE ) { ConcurrencyFlags::setNumConcEvents( nE ); }
94
96 static void setNumProcs( const std::size_t& nP ) { ConcurrencyFlags::setNumProcs( nP ); }
97 };
98
99 } // namespace Concurrency
100} // namespace Gaudi
#define GAUDI_API
Definition Kernel.h:49
static GAUDI_API std::size_t numConcurrentEvents()
number of Concurrent Events (for MT)
static GAUDI_API void setNumConcEvents(const std::size_t &nE)
static GAUDI_API void setNumThreads(const std::size_t &nT)
static GAUDI_API bool concurrent()
serial operation, or some form of concurrency
static GAUDI_API void setNumProcs(const std::size_t &nP)
static GAUDI_API std::size_t numThreads()
number of Worker Threads (for MT)
static GAUDI_API std::size_t numProcs()
number of forked child processes (for MP)
Interface implemented by components that are allowed to set the concurrency flags of the running job.
DeclareInterfaceID(ConcurrencyManager, 1, 0)
InterfaceID.
static void setNumConcEvents(const std::size_t &nE)
Set the number of concurrent events (for MT).
static void setNumThreads(const std::size_t &nT)
Set the number of worker threads (for MT).
static void setNumProcs(const std::size_t &nP)
Set the number of forked child processes (for MP).
Definition of the basic interface.
Definition IInterface.h:225
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1