ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
CudaHostAllocator< T > Struct Template Reference

Allocator that uses CUDA to allocate CPU memory. More...

#include <CudaHostAllocator.hpp>

Public Types

using value_type = T
 
using pointer = T *
 
using reference = T &
 
using const_reference = std::add_const_t< reference >
 

Public Member Functions

 CudaHostAllocator () noexcept=default
 
template<class U >
 CudaHostAllocator (const CudaHostAllocator< U > &)
 
template<class U >
bool operator== (const CudaHostAllocator< U > &) const
 
template<class U >
bool operator!= (const CudaHostAllocator< U > &) const
 
T * allocate (const std::size_t n) const
 
void deallocate (T *const p, std::size_t) const noexcept
 

Detailed Description

template<class T>
struct CudaHostAllocator< T >

Allocator that uses CUDA to allocate CPU memory.

Using the CUDA allocator can have performance benefits, because it returns pinned memory that is suitable for DMA.

Template Parameters
TType to allocate memory for.

Definition at line 38 of file CudaHostAllocator.hpp.

Member Typedef Documentation

◆ const_reference

template<class T >
using CudaHostAllocator< T >::const_reference = std::add_const_t<reference>

Definition at line 42 of file CudaHostAllocator.hpp.

◆ pointer

template<class T >
using CudaHostAllocator< T >::pointer = T *

Definition at line 40 of file CudaHostAllocator.hpp.

◆ reference

template<class T >
using CudaHostAllocator< T >::reference = T &

Definition at line 41 of file CudaHostAllocator.hpp.

◆ value_type

template<class T >
using CudaHostAllocator< T >::value_type = T

Definition at line 39 of file CudaHostAllocator.hpp.

Constructor & Destructor Documentation

◆ CudaHostAllocator() [1/2]

template<class T >
CudaHostAllocator< T >::CudaHostAllocator ( )
defaultnoexcept

◆ CudaHostAllocator() [2/2]

template<class T >
template<class U >
CudaHostAllocator< T >::CudaHostAllocator ( const CudaHostAllocator< U > &  )
inlineexplicit

Definition at line 45 of file CudaHostAllocator.hpp.

Member Function Documentation

◆ allocate()

template<class T >
T * CudaHostAllocator< T >::allocate ( const std::size_t  n) const
inline

Definition at line 53 of file CudaHostAllocator.hpp.

References cuda_malloc_host().

◆ deallocate()

template<class T >
void CudaHostAllocator< T >::deallocate ( T *const  p,
std::size_t   
) const
inlinenoexcept

Definition at line 61 of file CudaHostAllocator.hpp.

References cuda_free_host().

◆ operator!=()

template<class T >
template<class U >
bool CudaHostAllocator< T >::operator!= ( const CudaHostAllocator< U > &  ) const
inline

Definition at line 49 of file CudaHostAllocator.hpp.

◆ operator==()

template<class T >
template<class U >
bool CudaHostAllocator< T >::operator== ( const CudaHostAllocator< U > &  ) const
inline

Definition at line 46 of file CudaHostAllocator.hpp.


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