4#ifndef ATHDEVICECOMPS_POOLMEMORYRESOURCESVC_H
5#define ATHDEVICECOMPS_POOLMEMORYRESOURCESVC_H
9#include "GaudiKernel/ToolHandle.h"
16#include <vecmem/memory/pool_memory_resource.hpp>
28 using extends::extends;
42 virtual std::pmr::memory_resource&
mr()
const override;
49 this,
"MRTool",
"",
"Tool providing the memory resource to be cached"};
59 vecmem::pool_memory_resource::options
m_opts;
62 this,
"MinBlocksPerChunk",
m_opts.min_blocks_per_chunk,
63 [
this](Gaudi::Details::PropertyBase&) {
67 this,
"MaxBlocksPerChunk",
m_opts.max_blocks_per_chunk,
68 [
this](Gaudi::Details::PropertyBase&) {
72 this,
"MinBytesPerChunk",
m_opts.min_bytes_per_chunk,
73 [
this](Gaudi::Details::PropertyBase&) {
77 this,
"MaxBytesPerChunk",
m_opts.max_bytes_per_chunk,
78 [
this](Gaudi::Details::PropertyBase&) {
83 this,
"SmallestBlockSize",
m_opts.smallest_block_size,
84 [
this](Gaudi::Details::PropertyBase&) {
88 this,
"LargestBlockSize",
m_opts.largest_block_size,
89 [
this](Gaudi::Details::PropertyBase&) {
94 this,
"Alignment",
m_opts.alignment,
95 [
this](Gaudi::Details::PropertyBase&) {
100 this,
"CacheOversized",
m_opts.cache_oversized,
101 [
this](Gaudi::Details::PropertyBase&) {
105 this,
"CachedSizeCutoffFactor",
m_opts.cached_size_cutoff_factor,
106 [
this](Gaudi::Details::PropertyBase&) {
110 this,
"CachedAlignmentCutoffFactor",
111 m_opts.cached_alignment_cutoff_factor,
112 [
this](Gaudi::Details::PropertyBase&) {
Service implementing "pooled" caching on top of another memory resource.
Gaudi::Property< std::size_t > m_minBytesPerChunk
Gaudi::Property< std::size_t > m_alignment
Gaudi::Property< std::size_t > m_largestBlockSize
Gaudi::Property< std::size_t > m_smallestBlockSize
Gaudi::Property< bool > m_cacheOversized
virtual StatusCode initialize() override
Initialize the tool.
Gaudi::Property< std::size_t > m_cachedAlignmentCutoffFactor
Gaudi::Property< std::size_t > m_maxBlocksPerChunk
std::unique_ptr< std::pmr::memory_resource > m_cachedMR
The memory resource that this tool uses for caching.
Gaudi::Property< std::size_t > m_maxBytesPerChunk
vecmem::pool_memory_resource::options m_opts
Options object for the underlying pool memory resource.
Gaudi::Property< std::size_t > m_cachedSizeCutoffFactor
virtual std::pmr::memory_resource & mr() const override
Get the provided std::pmr::memory_resource object.
ToolHandle< IMemoryResourceTool > m_mrTool
Handle to the tool providing the underlying memory resource.
std::unique_ptr< std::pmr::memory_resource > m_syncedMR
The memory resource that this tool uses for synchronization.
Gaudi::Property< std::size_t > m_minBlocksPerChunk