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

Tool providing an asynchronous vecmem::copy object for CUDA devices. More...

#include <AsyncCopyTool.h>

Inheritance diagram for AthCUDA::AsyncCopyTool:
Collaboration diagram for AthCUDA::AsyncCopyTool:

Classes

struct  Stream
 Helper structure for managing a CUDA stream in memory. More...

Public Member Functions

Function(s) inherited from @c AthAlgTool
virtual StatusCode initialize () override
 Initialize the tool.
Function(s) inherited from @c ICopyTool
virtual std::shared_ptr< const vecmem::copy > copy (const EventContext &ctx) const override
 Get the provided vecmem::copy object.

Private Attributes

std::unique_ptr< const SG::SlotSpecificObj< Stream > > m_streams
 Slot specific CUDA stream.

Detailed Description

Tool providing an asynchronous vecmem::copy object for CUDA devices.

Definition at line 20 of file AsyncCopyTool.h.

Member Function Documentation

◆ copy()

std::shared_ptr< const vecmem::copy > AthCUDA::AsyncCopyTool::copy ( const EventContext & ctx) const
overridevirtual

Get the provided vecmem::copy object.

Definition at line 47 of file AsyncCopyTool.cxx.

48 {
49
50 // Create an asynchronous copy object, specific to this slot's CUDA stream.
51 cudaStream_t stream = m_streams->get(ctx)->m_stream;
52 assert(stream != nullptr);
53 return std::make_shared<const vecmem::cuda::async_copy>(stream);
54}
std::unique_ptr< const SG::SlotSpecificObj< Stream > > m_streams
Slot specific CUDA stream.

◆ initialize()

StatusCode AthCUDA::AsyncCopyTool::initialize ( )
overridevirtual

Initialize the tool.

Definition at line 38 of file AsyncCopyTool.cxx.

38 {
39
40 // Create the slot specific stream.
41 m_streams = std::make_unique<const SG::SlotSpecificObj<Stream>>();
42
43 // Return gracefully.
44 return StatusCode::SUCCESS;
45}

Member Data Documentation

◆ m_streams

std::unique_ptr<const SG::SlotSpecificObj<Stream> > AthCUDA::AsyncCopyTool::m_streams
private

Slot specific CUDA stream.

Definition at line 55 of file AsyncCopyTool.h.


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