/home/runner/work/HiCR/HiCR/include/hicr/backends/hwloc/memoryManager.hpp Source File
HiCR
|
memoryManager.hpp
Go to the documentation of this file.
58 void setRequestedBindingType(const LocalMemorySlot::binding_type type) { _hwlocBindingRequested = type; }
65 [[nodiscard]] LocalMemorySlot::binding_type getRequestedBindingType() const { return _hwlocBindingRequested; }
90 LocalMemorySlot::binding_type _hwlocBindingRequested = LocalMemorySlot::binding_type::relaxed_binding;
97 __INLINE__ std::shared_ptr<HiCR::LocalMemorySlot> allocateLocalMemorySlotImpl(std::shared_ptr<HiCR::MemorySpace> memorySpace, const size_t size) override
103 if (m == nullptr) HICR_THROW_LOGIC("The passed memory space is not supported by this memory manager\n");
112 if (_hwlocBindingRequested == LocalMemorySlot::binding_type::strict_binding) bindingTypeToUse = LocalMemorySlot::binding_type::strict_binding;
113 if (_hwlocBindingRequested == LocalMemorySlot::binding_type::relaxed_binding && supportedBindingType == LocalMemorySlot::binding_type::strict_binding)
115 if (_hwlocBindingRequested == LocalMemorySlot::binding_type::relaxed_binding && supportedBindingType == LocalMemorySlot::binding_type::strict_non_binding)
117 if (_hwlocBindingRequested == LocalMemorySlot::binding_type::strict_non_binding) bindingTypeToUse = LocalMemorySlot::binding_type::strict_non_binding;
122 "Requesting an allocation binding support level (%u) not supported by the operating system (HWLoc max support: %u)", _hwlocBindingRequested, supportedBindingType);
130 ptr = hwloc_alloc_membind(*_topology, size, hwlocObj->nodeset, HWLOC_MEMBIND_DEFAULT, HWLOC_MEMBIND_BYNODESET | HWLOC_MEMBIND_STRICT);
134 if (ptr == nullptr) HICR_THROW_RUNTIME("Could not allocate memory (size %lu) in the requested memory space", size);
137 auto memorySlot = std::make_shared<LocalMemorySlot>(supportedBindingType, ptr, size, memorySpace);
143 __INLINE__ std::shared_ptr<HiCR::LocalMemorySlot> registerLocalMemorySlotImpl(std::shared_ptr<HiCR::MemorySpace> memorySpace, void *const ptr, const size_t size) override
146 auto memorySlot = std::make_shared<LocalMemorySlot>(LocalMemorySlot::binding_type::strict_non_binding, ptr, size, memorySpace);
152 __INLINE__ void deregisterLocalMemorySlotImpl(std::shared_ptr<HiCR::LocalMemorySlot> memorySlot) override
157 __INLINE__ void freeLocalMemorySlotImpl(std::shared_ptr<HiCR::LocalMemorySlot> memorySlot) override
163 if (m == nullptr) HICR_THROW_LOGIC("The passed memory slot is not supported by this backend\n");
181 if (memorySlotBindingType == LocalMemorySlot::binding_type::strict_non_binding) { free(memorySlotPointer); }
Provides a definition for the local memory slot class for the HWLoc-based backend.
This file implements the memory space class for the HWLoc-based backend.
Definition memoryManager.hpp:51
@ strict_binding
Definition localMemorySlot.hpp:48
@ relaxed_binding
Definition localMemorySlot.hpp:58
@ strict_non_binding
Definition localMemorySlot.hpp:53
Definition memoryManager.hpp:39
LocalMemorySlot::binding_type getRequestedBindingType() const
Definition memoryManager.hpp:65
MemoryManager(const hwloc_topology_t *topology)
Definition memoryManager.hpp:47
~MemoryManager() override=default
void setRequestedBindingType(const LocalMemorySlot::binding_type type)
Definition memoryManager.hpp:58
static __INLINE__ std::unique_ptr< HiCR::MemoryManager > createDefault()
Definition memoryManager.hpp:72
Provides a definition for the base backend's memory manager class.
Generated by