ATLAS Offline Software
Loading...
Searching...
No Matches
AthCUDA::PerEventAndComponentStreamTool Class Reference

Tool providing a separate, per-event CUDA streams to the component using it. More...

#include <PerEventAndComponentStreamTool.h>

Inheritance diagram for AthCUDA::PerEventAndComponentStreamTool:
Collaboration diagram for AthCUDA::PerEventAndComponentStreamTool:

Public Member Functions

Function(s) inherited from @c AthAlgTool
virtual StatusCode initialize () override
 Initialize the tool.
Function(s) inherited from @c IStreamTool
virtual cudaStream_t stream (const EventContext &ctx) const override
 Get the CUDA stream to use.

Private Attributes

std::unique_ptr< const SG::SlotSpecificObj< Details::Stream, SG::InvalidSlot::Enabled > > m_streams
 Slot specific CUDA stream(s).

Detailed Description

Tool providing a separate, per-event CUDA streams to the component using it.

So that all components would use separate streams, and separate in all events as well. Creating/using a large number of streams as a result.

Definition at line 27 of file PerEventAndComponentStreamTool.h.

Member Function Documentation

◆ initialize()

StatusCode AthCUDA::PerEventAndComponentStreamTool::initialize ( )
overridevirtual

Initialize the tool.

Definition at line 14 of file PerEventAndComponentStreamTool.cxx.

14 {
15
16 // Create the stream object.
17 m_streams = std::make_unique<
18 const SG::SlotSpecificObj<Details::Stream, SG::InvalidSlot::Enabled>>();
19
20 // Tell the user what happened.
21 ATH_MSG_DEBUG("Initialized "
22 << std::distance(m_streams->begin(), m_streams->end())
23 << " CUDA stream(s):");
24 for (const auto& stream : *m_streams) {
25 ATH_MSG_DEBUG(" - " << stream.name());
26 }
27
28 // Return gracefully.
29 return StatusCode::SUCCESS;
30}
#define ATH_MSG_DEBUG(x)
std::unique_ptr< const SG::SlotSpecificObj< Details::Stream, SG::InvalidSlot::Enabled > > m_streams
Slot specific CUDA stream(s).
virtual cudaStream_t stream(const EventContext &ctx) const override
Get the CUDA stream to use.

◆ stream()

cudaStream_t AthCUDA::PerEventAndComponentStreamTool::stream ( const EventContext & ctx) const
overridevirtual

Get the CUDA stream to use.

Parameters
ctxThe event context for which the stream is requested
Returns
The CUDA stream to use for the current event context

Definition at line 32 of file PerEventAndComponentStreamTool.cxx.

33 {
34
35 // Get the stream corresponding to the current slot.
36 assert(m_streams);
37 return m_streams->get(ctx)->stream();
38}

Member Data Documentation

◆ m_streams

std::unique_ptr< const SG::SlotSpecificObj<Details::Stream, SG::InvalidSlot::Enabled> > AthCUDA::PerEventAndComponentStreamTool::m_streams
private

Slot specific CUDA stream(s).

Definition at line 57 of file PerEventAndComponentStreamTool.h.


The documentation for this class was generated from the following files: