stdgpu/memory.h Source File#
stdgpu Latest
Efficient STL-like Data Structures on the GPU
|
memory.h
Go to the documentation of this file.
674 allocate_filled(ExecutionPolicy&& policy, Allocator& a, index_type n, const value_type& default_value);
const T * operator->() const
Returns a pointer to the managed object.
device_unique_object(Args &&... args)
Creates an object on the GPU (device)
device_unique_object(ExecutionPolicy &&policy, Args &&... args)
Creates an object on the GPU (device)
const T & operator*() const
Returns a reference to the managed object.
A resource wrapper for managing device objects with automatic scope-based object destruction.
Definition: memory.h:290
device_unique_object(null_object_t)
Creates an empty unique object.
T * createManagedArray(const stdgpu::index64_t count, const T default_value=T(), const Initialization initialize_on=Initialization::DEVICE)
Creates a new managed array and initializes (fills) it with the given default value.
index64_t get_deallocation_count(dynamic_memory_type memory_type)
Returns the total number of registered deallocations of a specific memory type.
T * createDeviceArray(const stdgpu::index64_t count, const T default_value=T())
Creates a new device array and initializes (fills) it with the given default value.
STDGPU_HOST_DEVICE T * construct_at(T *p, Args &&... args)
Destroys the value at the given pointer.
T * copyCreateHost2HostArray(const T *host_array, const stdgpu::index64_t count, const MemoryCopy check_safety=MemoryCopy::RANGE_CHECK)
Creates and copies the given host array to the host.
index64_t size_bytes(T *array)
Finds the size (in bytes) of the given dynamically allocated array.
@ NO_CHECK
@ RANGE_CHECK
OutputIt uninitialized_copy_n(ExecutionPolicy &&policy, InputIt begin, Size n, OutputIt output_begin)
Copies all elements of the input range to the output range using the copy constructor.
index64_t get_allocation_count(dynamic_memory_type memory_type)
Returns the total number of registered allocations of a specific memory type.
void uninitialized_fill(ExecutionPolicy &&policy, Iterator begin, Iterator end, const T &value)
Writes the given value to into the given range using the copy constructor.
T * createHostArray(const stdgpu::index64_t count, const T default_value=T())
Creates a new host array and initializes (fills) it with the given default value.
T * copyCreateHost2DeviceArray(const T *host_array, const stdgpu::index64_t count, const MemoryCopy check_safety=MemoryCopy::RANGE_CHECK)
Creates and copies the given host array to the device.
void deregister_memory(T *p, index64_t n, dynamic_memory_type memory_type)
Deregisters the given memory block into the internal memory size manger.
void register_memory(T *p, index64_t n, dynamic_memory_type memory_type)
Registers the given memory block into the internal memory size manger.
void destroy(ExecutionPolicy &&policy, Iterator first, Iterator last)
Destroys the range of values.
Iterator uninitialized_fill_n(ExecutionPolicy &&policy, Iterator begin, Size n, const T &value)
Writes the given value to into the given range using the copy constructor.
void copyHost2HostArray(const T *source_host_array, const stdgpu::index64_t count, T *destination_host_array, const MemoryCopy check_safety=MemoryCopy::RANGE_CHECK)
Copies the given host array to the host.
@ HOST
@ DEVICE
Iterator destroy_n(ExecutionPolicy &&policy, Iterator first, Size n)
Destroys the range of values.
OutputIt uninitialized_copy(ExecutionPolicy &&policy, InputIt begin, InputIt end, OutputIt output_begin)
Copies all elements of the input range to the output range using the copy constructor.
dynamic_memory_type get_dynamic_memory_type(T *array)
Determines the dynamic memory type of the given array.
void copyDevice2DeviceArray(const T *source_device_array, const stdgpu::index64_t count, T *destination_device_array, const MemoryCopy check_safety=MemoryCopy::RANGE_CHECK)
Copies the given device array to the device.
dynamic_memory_type
The types of a dynamically allocated array.
Definition: memory.h:360
@ managed
@ invalid
T * copyCreateDevice2DeviceArray(const T *device_array, const stdgpu::index64_t count, const MemoryCopy check_safety=MemoryCopy::RANGE_CHECK)
Creates and copies the given device array to the device.
STDGPU_HOST_DEVICE T * to_address(T *p) noexcept
Converts a potential fancy pointer to a raw pointer.
void copyHost2DeviceArray(const T *source_host_array, const stdgpu::index64_t count, T *destination_device_array, const MemoryCopy check_safety=MemoryCopy::RANGE_CHECK)
Copies the given host array to the device.
void copyDevice2HostArray(const T *source_device_array, const stdgpu::index64_t count, T *destination_host_array, const MemoryCopy check_safety=MemoryCopy::RANGE_CHECK)
Copies the given device array to the host.
T * copyCreateDevice2HostArray(const T *device_array, const stdgpu::index64_t count, const MemoryCopy check_safety=MemoryCopy::RANGE_CHECK)
Creates and copies the given device array to the host.
constexpr null_object_t null_object
A constant to indicate an uninitialized unique object.
Definition: memory.h:281
#define STDGPU_HOST_DEVICE
Platform-independent host device function annotation.
Definition: platform.h:77
typename Allocator::value_type value_type
Definition: memory.h:612
static pointer allocate(Allocator &a, index_type n, const_void_pointer hint)
Allocates a memory block of the given size.
std::false_type propagate_on_container_copy_assignment
Definition: memory.h:624
static pointer allocate(Allocator &a, index_type n)
Allocates a memory block of the given size.
std::is_empty< Allocator > is_always_equal
Definition: memory.h:627
typename std::pointer_traits< pointer >::template rebind< const value_type > const_pointer
Definition: memory.h:615
typename std::pointer_traits< pointer >::template rebind< const void > const_void_pointer
Definition: memory.h:619
static Allocator select_on_container_copy_construction(const Allocator &a)
Returns a copy of the allocator.
static void deallocate(Allocator &a, pointer p, index_type n)
Deallocates the given memory block.
typename std::allocator_traits< Allocator >::template rebind_alloc< T > rebind_alloc
Definition: memory.h:630
static STDGPU_HOST_DEVICE index_type max_size(const Allocator &a) noexcept
Returns the maximum size that could be theoretically allocated.
static STDGPU_HOST_DEVICE void destroy(Allocator &a, T *p)
Destroys the object value at the given pointer.
static void deallocate_filled(ExecutionPolicy &&policy, Allocator &a, pointer p, index_type n)
Deallocates the given filled memory block.
std::false_type propagate_on_container_swap
Definition: memory.h:626
std::false_type propagate_on_container_move_assignment
Definition: memory.h:625
static STDGPU_HOST_DEVICE void construct(Allocator &a, T *p, Args &&... args)
Constructs an object value at the given pointer.
static pointer allocate_filled(ExecutionPolicy &&policy, Allocator &a, index_type n, const value_type &default_value)
Allocates and fills a memory block of the given size.
typename std::pointer_traits< pointer >::difference_type difference_type
Definition: memory.h:622
typename std::pointer_traits< pointer >::template rebind< void > void_pointer
Definition: memory.h:617
void deallocate(T *p, index64_t n)
Deallocates the given memory block.
T * allocate(index64_t n)
Allocates a memory block of the given size.
static constexpr dynamic_memory_type memory_type
Dynamic memory type of allocations.
Definition: memory.h:391
safe_device_allocator() noexcept=default
Default constructor.
safe_host_allocator() noexcept=default
Default constructor.
safe_managed_allocator() noexcept=default
Default constructor.
Generated by 1.9.6