ATLAS Offline Software
Loading...
Searching...
No Matches
AsyncCopyTool.h
Go to the documentation of this file.
1//
2// Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3//
4#ifndef ATHCUDASERVICES_ASYNCCOPYTOOL_H
5#define ATHCUDASERVICES_ASYNCCOPYTOOL_H
6
7// Framework include(s).
10
11// AthDevice include(s).
13
14// CUDA include(s).
15#include <cuda_runtime.h>
16
17namespace AthCUDA {
18
20class AsyncCopyTool : public extends<AthAlgTool, AthDevice::ICopyTool> {
21
22 public:
23 // Inherit the base class's constructor(s).
24 using extends::extends;
25
28
30 virtual StatusCode initialize() override;
31
33
36
38 virtual std::shared_ptr<const vecmem::copy> copy(
39 const EventContext& ctx) const override;
40
42
43 private:
45 struct Stream {
47 Stream();
49 ~Stream();
51 cudaStream_t m_stream{nullptr};
52 }; // struct Stream
53
55 std::unique_ptr<const SG::SlotSpecificObj<Stream>> m_streams;
56
57}; // class AsyncCopyTool
58
59} // namespace AthCUDA
60
61#endif // ATHCUDASERVICES_ASYNCCOPYTOOL_H
Maintain a set of objects, one per slot.
Tool providing an asynchronous vecmem::copy object for CUDA devices.
virtual std::shared_ptr< const vecmem::copy > copy(const EventContext &ctx) const override
Get the provided vecmem::copy object.
virtual StatusCode initialize() override
Initialize the tool.
std::unique_ptr< const SG::SlotSpecificObj< Stream > > m_streams
Slot specific CUDA stream.
Definition Info.h:14
Stream()
Constructor, creating the CUDA stream.
cudaStream_t m_stream
The CUDA stream to use for asynchronous copies.
~Stream()
Destructor, destroying the CUDA stream.