All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Public Member Functions | Static Public Member Functions | Friends | List of all members
rmm::mr::pinned_host_memory_resource Class Reference

Memory resource class for allocating pinned host memory. More...

#include <pinned_host_memory_resource.hpp>

Public Member Functions

bool operator== (const pinned_host_memory_resource &) const
 true if the specified resource is the same type as this resource. More...
 
bool operator!= (const pinned_host_memory_resource &) const
 true if the specified resource is not the same type as this resource, otherwise false. More...
 

Static Public Member Functions

static void * allocate (std::size_t bytes, [[maybe_unused]] std::size_t alignment=rmm::RMM_DEFAULT_HOST_ALIGNMENT)
 Allocates pinned host memory of size at least bytes bytes. More...
 
static void deallocate (void *ptr, std::size_t bytes, std::size_t alignment=rmm::RMM_DEFAULT_HOST_ALIGNMENT) noexcept
 Deallocate memory pointed to by ptr of size bytes bytes. More...
 
static void * allocate_async (std::size_t bytes, [[maybe_unused]] cuda::stream_ref stream)
 Allocates pinned host memory of size at least bytes bytes. More...
 
static void * allocate_async (std::size_t bytes, std::size_t alignment, [[maybe_unused]] cuda::stream_ref stream)
 Allocates pinned host memory of size at least bytes bytes and alignment alignment. More...
 
static void deallocate_async (void *ptr, std::size_t bytes, [[maybe_unused]] cuda::stream_ref stream) noexcept
 Deallocate memory pointed to by ptr of size bytes bytes. More...
 
static void deallocate_async (void *ptr, std::size_t bytes, std::size_t alignment, [[maybe_unused]] cuda::stream_ref stream) noexcept
 Deallocate memory pointed to by ptr of size bytes bytes and alignment alignment bytes. More...
 

Friends

void get_property (pinned_host_memory_resource const &, cuda::mr::device_accessible) noexcept
 Enables the cuda::mr::device_accessible property. More...
 
void get_property (pinned_host_memory_resource const &, cuda::mr::host_accessible) noexcept
 Enables the cuda::mr::host_accessible property. More...
 

Detailed Description

Memory resource class for allocating pinned host memory.

This class uses CUDA's cudaHostAlloc to allocate pinned host memory. It implements the cuda::mr::memory_resource and cuda::mr::device_memory_resource concepts, and the cuda::mr::host_accessible and cuda::mr::device_accessible properties.

Member Function Documentation

◆ allocate()

static void* rmm::mr::pinned_host_memory_resource::allocate ( std::size_t  bytes,
[[maybe_unused] ] std::size_t  alignment = rmm::RMM_DEFAULT_HOST_ALIGNMENT 
)
inlinestatic

Allocates pinned host memory of size at least bytes bytes.

Exceptions
rmm::out_of_memoryif the requested allocation could not be fulfilled due to to a CUDA out of memory error.
rmm::bad_allocif the requested allocation could not be fulfilled due to any other reason.
Parameters
bytesThe size, in bytes, of the allocation.
alignmentAlignment in bytes. Default alignment is used if unspecified.
Returns
Pointer to the newly allocated memory.

◆ allocate_async() [1/2]

static void* rmm::mr::pinned_host_memory_resource::allocate_async ( std::size_t  bytes,
[[maybe_unused] ] cuda::stream_ref  stream 
)
inlinestatic

Allocates pinned host memory of size at least bytes bytes.

Note
Stream argument is ignored and behavior is identical to allocate.
Exceptions
rmm::out_of_memoryif the requested allocation could not be fulfilled due to to a CUDA out of memory error.
rmm::bad_allocif the requested allocation could not be fulfilled due to any other error.
Parameters
bytesThe size, in bytes, of the allocation.
streamCUDA stream on which to perform the allocation (ignored).
Returns
Pointer to the newly allocated memory.

◆ allocate_async() [2/2]

static void* rmm::mr::pinned_host_memory_resource::allocate_async ( std::size_t  bytes,
std::size_t  alignment,
[[maybe_unused] ] cuda::stream_ref  stream 
)
inlinestatic

Allocates pinned host memory of size at least bytes bytes and alignment alignment.

Note
Stream argument is ignored and behavior is identical to allocate.
Exceptions
rmm::out_of_memoryif the requested allocation could not be fulfilled due to to a CUDA out of memory error.
rmm::bad_allocif the requested allocation could not be fulfilled due to any other error.
Parameters
bytesThe size, in bytes, of the allocation.
alignmentAlignment in bytes.
streamCUDA stream on which to perform the allocation (ignored).
Returns
Pointer to the newly allocated memory.

◆ deallocate()

static void rmm::mr::pinned_host_memory_resource::deallocate ( void *  ptr,
std::size_t  bytes,
std::size_t  alignment = rmm::RMM_DEFAULT_HOST_ALIGNMENT 
)
inlinestaticnoexcept

Deallocate memory pointed to by ptr of size bytes bytes.

Parameters
ptrPointer to be deallocated.
bytesSize of the allocation.
alignmentAlignment in bytes. Default alignment is used if unspecified.

◆ deallocate_async() [1/2]

static void rmm::mr::pinned_host_memory_resource::deallocate_async ( void *  ptr,
std::size_t  bytes,
[[maybe_unused] ] cuda::stream_ref  stream 
)
inlinestaticnoexcept

Deallocate memory pointed to by ptr of size bytes bytes.

Note
Stream argument is ignored and behavior is identical to deallocate.
Parameters
ptrPointer to be deallocated.
bytesSize of the allocation.
streamCUDA stream on which to perform the deallocation (ignored).

◆ deallocate_async() [2/2]

static void rmm::mr::pinned_host_memory_resource::deallocate_async ( void *  ptr,
std::size_t  bytes,
std::size_t  alignment,
[[maybe_unused] ] cuda::stream_ref  stream 
)
inlinestaticnoexcept

Deallocate memory pointed to by ptr of size bytes bytes and alignment alignment bytes.

Note
Stream argument is ignored and behavior is identical to deallocate.
Parameters
ptrPointer to be deallocated.
bytesSize of the allocation.
alignmentAlignment in bytes.
streamCUDA stream on which to perform the deallocation (ignored).

◆ operator!=()

bool rmm::mr::pinned_host_memory_resource::operator!= ( const pinned_host_memory_resource ) const
inline

true if the specified resource is not the same type as this resource, otherwise false.

Returns
true if the specified resource is not the same type as this resource, otherwise false.

◆ operator==()

bool rmm::mr::pinned_host_memory_resource::operator== ( const pinned_host_memory_resource ) const
inline

true if the specified resource is the same type as this resource.

Returns
true if the specified resource is the same type as this resource.

Friends And Related Function Documentation

◆ get_property [1/2]

void get_property ( pinned_host_memory_resource const &  ,
cuda::mr::device_accessible   
)
friend

Enables the cuda::mr::device_accessible property.

This property declares that a pinned_host_memory_resource provides device accessible memory

◆ get_property [2/2]

void get_property ( pinned_host_memory_resource const &  ,
cuda::mr::host_accessible   
)
friend

Enables the cuda::mr::host_accessible property.

This property declares that a pinned_host_memory_resource provides host accessible memory


The documentation for this class was generated from the following file: