ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthDevice
AthDeviceComps
src
PoolMemoryResourceSvc.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 ATHDEVICECOMPS_POOLMEMORYRESOURCESVC_H
5
#define ATHDEVICECOMPS_POOLMEMORYRESOURCESVC_H
6
7
// Framework include(s).
8
#include "
AthenaBaseComps/AthService.h
"
9
#include "GaudiKernel/ToolHandle.h"
10
11
// AthDevice include(s).
12
#include "
AthDeviceInterfaces/IMemoryResourceSvc.h
"
13
#include "
AthDeviceInterfaces/IMemoryResourceTool.h
"
14
15
// VecMem include(s).
16
#include <vecmem/memory/pool_memory_resource.hpp>
17
18
namespace
AthDevice
{
19
24
class
PoolMemoryResourceSvc
:
public
extends<AthService, IMemoryResourceSvc> {
25
26
public
:
27
// Inherit the base class's constructor(s).
28
using
extends::extends;
29
32
34
virtual
StatusCode
initialize
()
override
;
35
37
40
42
virtual
std::pmr::memory_resource&
mr
()
const override
;
43
45
virtual
std::string_view
deviceName
()
const override
;
46
48
49
private
:
51
ToolHandle<IMemoryResourceTool>
m_mrTool
{
52
this
,
"MRTool"
,
""
,
"Tool providing the memory resource to be cached"
};
53
54
std::unique_ptr<std::pmr::memory_resource>
m_cachedMR
;
56
std::unique_ptr<std::pmr::memory_resource>
m_syncedMR
;
57
60
62
vecmem::pool_memory_resource::options
m_opts
;
63
64
Gaudi::Property<std::size_t>
m_minBlocksPerChunk
{
65
this
,
"MinBlocksPerChunk"
,
m_opts
.min_blocks_per_chunk,
66
[
this
](Gaudi::Details::PropertyBase&) {
67
m_opts
.min_blocks_per_chunk =
m_minBlocksPerChunk
;
68
}};
69
Gaudi::Property<std::size_t>
m_maxBlocksPerChunk
{
70
this
,
"MaxBlocksPerChunk"
,
m_opts
.max_blocks_per_chunk,
71
[
this
](Gaudi::Details::PropertyBase&) {
72
m_opts
.max_blocks_per_chunk =
m_maxBlocksPerChunk
;
73
}};
74
Gaudi::Property<std::size_t>
m_minBytesPerChunk
{
75
this
,
"MinBytesPerChunk"
,
m_opts
.min_bytes_per_chunk,
76
[
this
](Gaudi::Details::PropertyBase&) {
77
m_opts
.min_bytes_per_chunk =
m_minBytesPerChunk
;
78
}};
79
Gaudi::Property<std::size_t>
m_maxBytesPerChunk
{
80
this
,
"MaxBytesPerChunk"
,
m_opts
.max_bytes_per_chunk,
81
[
this
](Gaudi::Details::PropertyBase&) {
82
m_opts
.max_bytes_per_chunk =
m_maxBytesPerChunk
;
83
}};
84
85
Gaudi::Property<std::size_t>
m_smallestBlockSize
{
86
this
,
"SmallestBlockSize"
,
m_opts
.smallest_block_size,
87
[
this
](Gaudi::Details::PropertyBase&) {
88
m_opts
.smallest_block_size =
m_smallestBlockSize
;
89
}};
90
Gaudi::Property<std::size_t>
m_largestBlockSize
{
91
this
,
"LargestBlockSize"
,
m_opts
.largest_block_size,
92
[
this
](Gaudi::Details::PropertyBase&) {
93
m_opts
.largest_block_size =
m_largestBlockSize
;
94
}};
95
96
Gaudi::Property<std::size_t>
m_alignment
{
97
this
,
"Alignment"
,
m_opts
.alignment,
98
[
this
](Gaudi::Details::PropertyBase&) {
99
m_opts
.alignment =
m_alignment
;
100
}};
101
102
Gaudi::Property<bool>
m_cacheOversized
{
103
this
,
"CacheOversized"
,
m_opts
.cache_oversized,
104
[
this
](Gaudi::Details::PropertyBase&) {
105
m_opts
.cache_oversized =
m_cacheOversized
;
106
}};
107
Gaudi::Property<std::size_t>
m_cachedSizeCutoffFactor
{
108
this
,
"CachedSizeCutoffFactor"
,
m_opts
.cached_size_cutoff_factor,
109
[
this
](Gaudi::Details::PropertyBase&) {
110
m_opts
.cached_size_cutoff_factor =
m_cachedSizeCutoffFactor
;
111
}};
112
Gaudi::Property<std::size_t>
m_cachedAlignmentCutoffFactor
{
113
this
,
"CachedAlignmentCutoffFactor"
,
114
m_opts
.cached_alignment_cutoff_factor,
115
[
this
](Gaudi::Details::PropertyBase&) {
116
m_opts
.cached_alignment_cutoff_factor =
m_cachedAlignmentCutoffFactor
;
117
}};
118
120
121
};
// class PoolMemoryResourceSvc
122
123
}
// namespace AthDevice
124
125
#endif
// ATHDEVICECOMPS_POOLMEMORYRESOURCESVC_H
AthService.h
IMemoryResourceSvc.h
IMemoryResourceTool.h
AthDevice::PoolMemoryResourceSvc
Service implementing "pooled" caching on top of another memory resource.
Definition
PoolMemoryResourceSvc.h:24
AthDevice::PoolMemoryResourceSvc::m_minBytesPerChunk
Gaudi::Property< std::size_t > m_minBytesPerChunk
Definition
PoolMemoryResourceSvc.h:74
AthDevice::PoolMemoryResourceSvc::m_alignment
Gaudi::Property< std::size_t > m_alignment
Definition
PoolMemoryResourceSvc.h:96
AthDevice::PoolMemoryResourceSvc::m_largestBlockSize
Gaudi::Property< std::size_t > m_largestBlockSize
Definition
PoolMemoryResourceSvc.h:90
AthDevice::PoolMemoryResourceSvc::m_smallestBlockSize
Gaudi::Property< std::size_t > m_smallestBlockSize
Definition
PoolMemoryResourceSvc.h:85
AthDevice::PoolMemoryResourceSvc::m_cacheOversized
Gaudi::Property< bool > m_cacheOversized
Definition
PoolMemoryResourceSvc.h:102
AthDevice::PoolMemoryResourceSvc::initialize
virtual StatusCode initialize() override
Initialize the service.
Definition
PoolMemoryResourceSvc.cxx:17
AthDevice::PoolMemoryResourceSvc::m_cachedAlignmentCutoffFactor
Gaudi::Property< std::size_t > m_cachedAlignmentCutoffFactor
Definition
PoolMemoryResourceSvc.h:112
AthDevice::PoolMemoryResourceSvc::m_maxBlocksPerChunk
Gaudi::Property< std::size_t > m_maxBlocksPerChunk
Definition
PoolMemoryResourceSvc.h:69
AthDevice::PoolMemoryResourceSvc::m_cachedMR
std::unique_ptr< std::pmr::memory_resource > m_cachedMR
The memory resource that this tool uses for caching.
Definition
PoolMemoryResourceSvc.h:54
AthDevice::PoolMemoryResourceSvc::deviceName
virtual std::string_view deviceName() const override
The name of the device for which the memory resource is provided.
Definition
PoolMemoryResourceSvc.cxx:40
AthDevice::PoolMemoryResourceSvc::m_maxBytesPerChunk
Gaudi::Property< std::size_t > m_maxBytesPerChunk
Definition
PoolMemoryResourceSvc.h:79
AthDevice::PoolMemoryResourceSvc::m_opts
vecmem::pool_memory_resource::options m_opts
Options object for the underlying pool memory resource.
Definition
PoolMemoryResourceSvc.h:62
AthDevice::PoolMemoryResourceSvc::m_cachedSizeCutoffFactor
Gaudi::Property< std::size_t > m_cachedSizeCutoffFactor
Definition
PoolMemoryResourceSvc.h:107
AthDevice::PoolMemoryResourceSvc::mr
virtual std::pmr::memory_resource & mr() const override
Get the provided std::pmr::memory_resource object.
Definition
PoolMemoryResourceSvc.cxx:33
AthDevice::PoolMemoryResourceSvc::m_mrTool
ToolHandle< IMemoryResourceTool > m_mrTool
Handle to the tool providing the underlying memory resource.
Definition
PoolMemoryResourceSvc.h:51
AthDevice::PoolMemoryResourceSvc::m_syncedMR
std::unique_ptr< std::pmr::memory_resource > m_syncedMR
The memory resource that this tool uses for synchronization.
Definition
PoolMemoryResourceSvc.h:56
AthDevice::PoolMemoryResourceSvc::m_minBlocksPerChunk
Gaudi::Property< std::size_t > m_minBlocksPerChunk
Definition
PoolMemoryResourceSvc.h:64
AthDevice
Definition
BinaryPageMemoryResourceSvc.cxx:15
Generated on
for ATLAS Offline Software by
1.17.0