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

Tool providing a separate (single) CUDA stream to the component using it. More...

#include <PerComponentStreamTool.h>

Inheritance diagram for AthCUDA::PerComponentStreamTool:
Collaboration diagram for AthCUDA::PerComponentStreamTool:

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 Details::Streamm_stream
 Single CUDA stream.

Detailed Description

Tool providing a separate (single) CUDA stream to the component using it.

This means that in algorithms using this tool, operations from different events would end up being executed in a single stream. But operations from different components/algorithms could be executed in parallel.

Definition at line 27 of file PerComponentStreamTool.h.

Member Function Documentation

◆ initialize()

StatusCode AthCUDA::PerComponentStreamTool::initialize ( )
overridevirtual

Initialize the tool.

Definition at line 14 of file PerComponentStreamTool.cxx.

14 {
15
16 // Create the stream object.
17 m_stream = std::make_unique<const Details::Stream>();
18
19 // Tell the user what happened.
20 ATH_MSG_DEBUG("Initialized CUDA stream on device: " << m_stream->name());
21
22 // Return gracefully.
23 return StatusCode::SUCCESS;
24}
#define ATH_MSG_DEBUG(x)
std::unique_ptr< const Details::Stream > m_stream
Single CUDA stream.

◆ stream()

cudaStream_t AthCUDA::PerComponentStreamTool::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 26 of file PerComponentStreamTool.cxx.

26 {
27
28 // Get the stream corresponding to the current slot.
29 assert(m_stream);
30 assert(m_stream->stream());
31 return m_stream->stream();
32}

Member Data Documentation

◆ m_stream

std::unique_ptr<const Details::Stream> AthCUDA::PerComponentStreamTool::m_stream
private

Single CUDA stream.

Definition at line 55 of file PerComponentStreamTool.h.


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