vecmem 1.14.0
Loading...
Searching...
No Matches
managed_memory_resource.hpp
1/*
2 * VecMem project, part of the ACTS project (R&D line)
3 *
4 * (c) 2024 CERN for the benefit of the ACTS project
5 *
6 * Mozilla Public License Version 2.0
7 */
8
9#pragma once
10
11// Local include(s).
12#include "vecmem/memory/memory_resource.hpp"
13#include "vecmem/vecmem_hip_export.hpp"
14
15namespace vecmem::hip {
16
23class managed_memory_resource final : public memory_resource {
24
25public:
32
33private:
36
39 virtual void* do_allocate(std::size_t, std::size_t) override final;
42 virtual void do_deallocate(void* p, std::size_t,
43 std::size_t) override final;
46 virtual bool do_is_equal(
47 const memory_resource& other) const noexcept override final;
48
50
51}; // class managed_memory_resource
52
53} // namespace vecmem::hip
Memory resource that wraps managed HIP allocation.
Definition managed_memory_resource.hpp:23
VECMEM_HIP_EXPORT managed_memory_resource()
Default constructor.
virtual VECMEM_HIP_EXPORT void do_deallocate(void *p, std::size_t, std::size_t) override final
De-allocate a previously allocated managed memory block.
Definition managed_memory_resource.cpp:41
VECMEM_HIP_EXPORT ~managed_memory_resource()
Destructor.
virtual VECMEM_HIP_EXPORT bool do_is_equal(const memory_resource &other) const noexcept override final
Compares *this for equality with other.
Definition managed_memory_resource.cpp:54
virtual VECMEM_HIP_EXPORT void * do_allocate(std::size_t, std::size_t) override final
Allocate HIP managed memory.
Definition managed_memory_resource.cpp:28
Namespace holding types that work on/with ROCm/HIP.
Definition hip_device_atomic_ref.hpp:25
std::vector< T, vecmem::polymorphic_allocator< T > > vector
Alias type for vectors with our polymorphic allocator.
Definition vector.hpp:35