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

A host_memory_resource that uses cudaMallocHost to allocate pinned/page-locked host memory. More...

#include <pinned_memory_resource.hpp>

Inheritance diagram for rmm::mr::pinned_memory_resource:
Inheritance graph
[legend]
Collaboration diagram for rmm::mr::pinned_memory_resource:
Collaboration graph
[legend]

Public Member Functions

 pinned_memory_resource (pinned_memory_resource const &)=default
 Default copy constructor.
 
 pinned_memory_resource (pinned_memory_resource &&)=default
 Default move constructor.
 
pinned_memory_resourceoperator= (pinned_memory_resource const &)=default
 Default copy assignment operator. More...
 
pinned_memory_resourceoperator= (pinned_memory_resource &&)=default
 Default move assignment operator. More...
 
void * allocate_async (std::size_t bytes, std::size_t alignment, cuda_stream_view)
 Pretend to support the allocate_async interface, falling back to stream 0. More...
 
void * allocate_async (std::size_t bytes, cuda_stream_view)
 Pretend to support the allocate_async interface, falling back to stream 0. More...
 
void deallocate_async (void *ptr, std::size_t bytes, std::size_t alignment, cuda_stream_view)
 Pretend to support the deallocate_async interface, falling back to stream 0. More...
 
- Public Member Functions inherited from rmm::mr::host_memory_resource
 host_memory_resource (host_memory_resource const &)=default
 Default copy constructor.
 
 host_memory_resource (host_memory_resource &&) noexcept=default
 Default move constructor.
 
host_memory_resourceoperator= (host_memory_resource const &)=default
 Default copy assignment operator. More...
 
host_memory_resourceoperator= (host_memory_resource &&) noexcept=default
 Default move assignment operator. More...
 
void * allocate (std::size_t bytes, std::size_t alignment=alignof(std::max_align_t))
 Allocates memory on the host of size at least bytes bytes. More...
 
void deallocate (void *ptr, std::size_t bytes, std::size_t alignment=alignof(std::max_align_t))
 Deallocate memory pointed to by ptr. More...
 
bool is_equal (host_memory_resource const &other) const noexcept
 Compare this resource to another. More...
 
bool operator== (host_memory_resource const &other) const noexcept
 Comparison operator with another host_memory_resource. More...
 
bool operator!= (host_memory_resource const &other) const noexcept
 Comparison operator with another host_memory_resource. More...
 

Friends

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

Detailed Description

A host_memory_resource that uses cudaMallocHost to allocate pinned/page-locked host memory.

See https://devblogs.nvidia.com/how-optimize-data-transfers-cuda-cc/

Member Function Documentation

◆ allocate_async() [1/2]

void* rmm::mr::pinned_memory_resource::allocate_async ( std::size_t  bytes,
cuda_stream_view   
)
inline

Pretend to support the allocate_async interface, falling back to stream 0.

Exceptions
rmm::bad_allocWhen the requested bytes cannot be allocated on the specified stream.
Parameters
bytesThe size of the allocation
Returns
void* Pointer to the newly allocated memory

◆ allocate_async() [2/2]

void* rmm::mr::pinned_memory_resource::allocate_async ( std::size_t  bytes,
std::size_t  alignment,
cuda_stream_view   
)
inline

Pretend to support the allocate_async interface, falling back to stream 0.

Exceptions
rmm::bad_allocWhen the requested bytes cannot be allocated on the specified stream.
Parameters
bytesThe size of the allocation
alignmentThe expected alignment of the allocation
Returns
void* Pointer to the newly allocated memory

◆ deallocate_async()

void rmm::mr::pinned_memory_resource::deallocate_async ( void *  ptr,
std::size_t  bytes,
std::size_t  alignment,
cuda_stream_view   
)
inline

Pretend to support the deallocate_async interface, falling back to stream 0.

Parameters
ptrPointer to be deallocated
bytesThe size in bytes of the allocation. This must be equal to the value of bytes that was passed to the allocate call that returned p.
alignmentThe alignment that was passed to the allocate call that returned p

◆ operator=() [1/2]

pinned_memory_resource& rmm::mr::pinned_memory_resource::operator= ( pinned_memory_resource &&  )
default

Default move assignment operator.

Returns
pinned_memory_resource& Reference to the assigned object

◆ operator=() [2/2]

pinned_memory_resource& rmm::mr::pinned_memory_resource::operator= ( pinned_memory_resource const &  )
default

Default copy assignment operator.

Returns
pinned_memory_resource& Reference to the assigned object

Friends And Related Function Documentation

◆ get_property

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

Enables the cuda::mr::device_accessible property.

This property declares that a pinned_memory_resource provides device accessible memory


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