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

Tool providing memory resource for device memory. More...

#include <DeviceMemoryResourceTool.h>

Inheritance diagram for AthCUDA::DeviceMemoryResourceTool:
Collaboration diagram for AthCUDA::DeviceMemoryResourceTool:

Public Member Functions

Function(s) inherited from @c AthAlgTool
virtual StatusCode initialize () override
 Initialize the tool.
Function(s) inherited from @c AthDevice::IMemoryResourceTool
virtual std::pmr::memory_resource & mr () const override

Private Attributes

std::unique_ptr< std::pmr::memory_resource > m_mr
 The memory resource that this tool uses.
Tool properties
Gaudi::Property< int > m_deviceID
 Device to allocate memory on.

Detailed Description

Tool providing memory resource for device memory.

Making use of vecmem::cuda::device_memory_resource.

Definition at line 22 of file DeviceMemoryResourceTool.h.

Member Function Documentation

◆ initialize()

StatusCode AthCUDA::DeviceMemoryResourceTool::initialize ( )
overridevirtual

Initialize the tool.

Definition at line 13 of file DeviceMemoryResourceTool.cxx.

13 {
14
15 // Construct the appropriate memory resource.
16 m_mr = std::make_unique<vecmem::cuda::device_memory_resource>(m_deviceID);
17
18 // Return gracefully.
19 return StatusCode::SUCCESS;
20}
std::unique_ptr< std::pmr::memory_resource > m_mr
The memory resource that this tool uses.
Gaudi::Property< int > m_deviceID
Device to allocate memory on.

◆ mr()

std::pmr::memory_resource & AthCUDA::DeviceMemoryResourceTool::mr ( ) const
overridevirtual

Definition at line 22 of file DeviceMemoryResourceTool.cxx.

22 {
23
24 assert(m_mr);
25 return *m_mr;
26}

Member Data Documentation

◆ m_deviceID

Gaudi::Property<int> AthCUDA::DeviceMemoryResourceTool::m_deviceID
private
Initial value:
{
this, "DeviceID", vecmem::cuda::device_memory_resource::INVALID_DEVICE,
"ID of the device to allocate memory on (-1 to use the default device)"}

Device to allocate memory on.

Definition at line 52 of file DeviceMemoryResourceTool.h.

52 {
53 this, "DeviceID", vecmem::cuda::device_memory_resource::INVALID_DEVICE,
54 "ID of the device to allocate memory on (-1 to use the default device)"};

◆ m_mr

std::unique_ptr<std::pmr::memory_resource> AthCUDA::DeviceMemoryResourceTool::m_mr
private

The memory resource that this tool uses.

Definition at line 46 of file DeviceMemoryResourceTool.h.


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