ATLAS Offline Software
Public Member Functions | Protected Member Functions | List of all members
CaloGPUCUDAInitialization Class Reference

Base class to provide some basic common infrastructure for initializing CUDA only at the right place to work fine with multiprocessing... More...

#include <CaloGPUCUDAInitialization.h>

Inheritance diagram for CaloGPUCUDAInitialization:
Collaboration diagram for CaloGPUCUDAInitialization:

Public Member Functions

void handle (const Incident &incident) override
 
virtual ~CaloGPUCUDAInitialization ()=default
 

Protected Member Functions

virtual StatusCode initialize_non_CUDA ()
 Initialization that does not invoke CUDA functions. More...
 
virtual StatusCode initialize_CUDA ()
 Initialization that invokes CUDA functions. More...
 
virtual StatusCode initialize ()
 

Detailed Description

Base class to provide some basic common infrastructure for initializing CUDA only at the right place to work fine with multiprocessing...

Author
Nuno Fernandes nuno..nosp@m.dos..nosp@m.santo.nosp@m.s.fe.nosp@m.rnand.nosp@m.es@c.nosp@m.ern.c.nosp@m.h
Date
15 March 2024

Definition at line 27 of file CaloGPUCUDAInitialization.h.

Constructor & Destructor Documentation

◆ ~CaloGPUCUDAInitialization()

virtual CaloGPUCUDAInitialization::~CaloGPUCUDAInitialization ( )
virtualdefault

Member Function Documentation

◆ handle()

void CaloGPUCUDAInitialization::handle ( const Incident &  incident)
inlineoverride

Definition at line 66 of file CaloGPUCUDAInitialization.h.

67  {
68  const bool is_multiprocess = (Gaudi::Concurrency::ConcurrencyFlags::numProcs() > 0);
69  if (is_multiprocess && incident.type() == AthenaInterprocess::UpdateAfterFork::type())
70  {
71  if (!this->initialize_CUDA().isSuccess())
72  {
73  throw GaudiException("Failed to perform the CUDA initialization!",
74  "CaloGPUCUDAInitialization::handle",
75  StatusCode::FAILURE);
76  }
77  }
78  }

◆ initialize()

virtual StatusCode CaloGPUCUDAInitialization::initialize ( )
inlineprotectedvirtual

Reimplemented in GPUKernelSizeOptimizerSvc, CaloGPUHybridClusterProcessor, TopoAutomatonClustering, BasicGPUClusterInfoCalculator, GPUClusterInfoAndMomentsCalculator, and TopoAutomatonSplitting.

Definition at line 44 of file CaloGPUCUDAInitialization.h.

45  {
47 
48  const bool is_multiprocess = (Gaudi::Concurrency::ConcurrencyFlags::numProcs() > 0);
49 
50  if (is_multiprocess)
51  {
52  ServiceHandle<IIncidentSvc> incidentSvc("IncidentSvc","CaloGPUCUDAInitialization");
53 
54  incidentSvc->addListener(this, AthenaInterprocess::UpdateAfterFork::type());
55  }
56  else
57  {
58  ATH_CHECK(this->initialize_CUDA());
59  }
60 
61  return StatusCode::SUCCESS;
62  }

◆ initialize_CUDA()

virtual StatusCode CaloGPUCUDAInitialization::initialize_CUDA ( )
inlineprotectedvirtual

Initialization that invokes CUDA functions.

Reimplemented in GPUKernelSizeOptimizerSvc, CaloGPUHybridClusterProcessor, TopoAutomatonClustering, BasicGPUClusterInfoCalculator, GPUClusterInfoAndMomentsCalculator, and TopoAutomatonSplitting.

Definition at line 39 of file CaloGPUCUDAInitialization.h.

40  {
41  return StatusCode::SUCCESS;
42  }

◆ initialize_non_CUDA()

virtual StatusCode CaloGPUCUDAInitialization::initialize_non_CUDA ( )
inlineprotectedvirtual

Initialization that does not invoke CUDA functions.

Reimplemented in CaloGPUHybridClusterProcessor, TopoAutomatonClustering, BasicGPUClusterInfoCalculator, GPUClusterInfoAndMomentsCalculator, and TopoAutomatonSplitting.

Definition at line 33 of file CaloGPUCUDAInitialization.h.

34  {
35  return StatusCode::SUCCESS;
36  }

The documentation for this class was generated from the following file:
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloGPUCUDAInitialization::initialize_non_CUDA
virtual StatusCode initialize_non_CUDA()
Initialization that does not invoke CUDA functions.
Definition: CaloGPUCUDAInitialization.h:33
AthenaInterprocess::UpdateAfterFork::type
static const std::string & type()
Incident type.
Definition: Incidents.h:49
CaloGPUCUDAInitialization::initialize_CUDA
virtual StatusCode initialize_CUDA()
Initialization that invokes CUDA functions.
Definition: CaloGPUCUDAInitialization.h:39
ServiceHandle< IIncidentSvc >