vecmem 1.18.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-2025 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
35
38 void* do_allocate(std::size_t nbytes, std::size_t alignment) override;
39
42 void do_deallocate(void* ptr, std::size_t nbytes,
43 std::size_t alignment) override;
44
47 bool do_is_equal(const memory_resource& other) const noexcept override;
48
50
52 const int m_device;
53
54}; // class device_memory_resource
55
56} // namespace vecmem::hip
An allocator class that wraps a memory resource.
Definition allocator.hpp:37
Memory resource for a specific HIP device.
Definition device_memory_resource.hpp:19
VECMEM_HIP_EXPORT void * do_allocate(std::size_t nbytes, std::size_t alignment) override
Function performing the memory allocation.
Definition device_memory_resource.cpp:30
VECMEM_HIP_EXPORT ~device_memory_resource() noexcept override
Destructor.
VECMEM_HIP_EXPORT void do_deallocate(void *ptr, std::size_t nbytes, std::size_t alignment) override
Function performing the memory de-allocation.
Definition device_memory_resource.cpp:46
static constexpr int INVALID_DEVICE
Invalid/default device identifier.
Definition device_memory_resource.hpp:23
VECMEM_HIP_EXPORT bool do_is_equal(const memory_resource &other) const noexcept override
Function comparing two memory resource instances.
Definition device_memory_resource.cpp:61
Namespace holding types that work on/with ROCm/HIP.
Definition hip_device_atomic_ref.hpp:25