vecmem 1.14.0
Loading...
Searching...
No Matches
device_memory_resource.hpp
1/*
2 * VecMem project, part of the ACTS project (R&D line)
3 *
4 * (c) 2021-2023 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
16namespace vecmem::hip {
17
19class device_memory_resource final : public memory_resource {
20
21public:
23 static constexpr int INVALID_DEVICE = -1;
24
31
32private:
35
38 virtual void* do_allocate(std::size_t nbytes,
39 std::size_t alignment) override final;
40
43 virtual void do_deallocate(void* ptr, std::size_t nbytes,
44 std::size_t alignment) override final;
45
48 virtual bool do_is_equal(
49 const memory_resource& other) const noexcept override final;
50
52
54 const int m_device;
55
56}; // class device_memory_resource
57
58} // namespace vecmem::hip
Memory resource for a specific HIP device.
Definition device_memory_resource.hpp:19
VECMEM_HIP_EXPORT ~device_memory_resource()
Destructor.
virtual VECMEM_HIP_EXPORT void do_deallocate(void *ptr, std::size_t nbytes, std::size_t alignment) override final
Function performing the memory de-allocation.
Definition device_memory_resource.cpp:46
virtual VECMEM_HIP_EXPORT bool do_is_equal(const memory_resource &other) const noexcept override final
Function comparing two memory resource instances.
Definition device_memory_resource.cpp:61
static constexpr int INVALID_DEVICE
Invalid/default device identifier.
Definition device_memory_resource.hpp:23
virtual VECMEM_HIP_EXPORT void * do_allocate(std::size_t nbytes, std::size_t alignment) override final
Function performing the memory allocation.
Definition device_memory_resource.cpp:30
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