Reference documentation for deal.II version 9.3.3
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Classes | Functions
Utilities::CUDA Namespace Reference

Classes

struct  Handle
 

Functions

template<typename T >
void malloc (T *&pointer, const unsigned int n_elements)
 
template<typename T >
void free (T *&pointer)
 
template<typename Number >
Number * allocate_device_data (const std::size_t size)
 
template<typename Number >
void delete_device_data (Number *device_ptr) noexcept
 
template<typename T >
void copy_to_host (const ArrayView< const T, MemorySpace::CUDA > &in, ArrayView< T, MemorySpace::Host > &out)
 
template<typename T >
void copy_to_dev (const ArrayView< const T, MemorySpace::Host > &in, ArrayView< T, MemorySpace::CUDA > &out)
 
template<typename T >
void copy_to_host (const T *pointer_dev, std::vector< T > &vector_host)
 
template<typename T >
void copy_to_dev (const std::vector< T > &vector_host, T *pointer_dev)
 

Detailed Description

A namespace for utility structures for CUDA.

Function Documentation

◆ malloc()

template<typename T >
void Utilities::CUDA::malloc ( T *&  pointer,
const unsigned int  n_elements 
)
inline

Allocate n_elements on the device.

Definition at line 85 of file cuda.h.

◆ free()

template<typename T >
void Utilities::CUDA::free ( T *&  pointer)
inline

Free memory on the device.

Definition at line 97 of file cuda.h.

◆ allocate_device_data()

template<typename Number >
Number * Utilities::CUDA::allocate_device_data ( const std::size_t  size)

Allocator to be used for std::unique_ptr pointing to device memory.

Definition at line 109 of file cuda.h.

◆ delete_device_data()

template<typename Number >
void Utilities::CUDA::delete_device_data ( Number *  device_ptr)
noexcept

Deleter to be used for std::unique_ptr pointing to device memory.

Definition at line 121 of file cuda.h.

◆ copy_to_host() [1/2]

template<typename T >
void Utilities::CUDA::copy_to_host ( const ArrayView< const T, MemorySpace::CUDA > &  in,
ArrayView< T, MemorySpace::Host > &  out 
)
inline

Copy the device ArrayView in to the host ArrayView out.

Definition at line 132 of file cuda.h.

◆ copy_to_dev() [1/2]

template<typename T >
void Utilities::CUDA::copy_to_dev ( const ArrayView< const T, MemorySpace::Host > &  in,
ArrayView< T, MemorySpace::CUDA > &  out 
)
inline

Copy the host ArrayView in to the device ArrayView out.

Definition at line 148 of file cuda.h.

◆ copy_to_host() [2/2]

template<typename T >
void Utilities::CUDA::copy_to_host ( const T *  pointer_dev,
std::vector< T > &  vector_host 
)
inline

Copy the elements in pointer_dev to the host in vector_host.

Definition at line 164 of file cuda.h.

◆ copy_to_dev() [2/2]

template<typename T >
void Utilities::CUDA::copy_to_dev ( const std::vector< T > &  vector_host,
T *  pointer_dev 
)
inline

Copy the elements in vector_host to the device in pointer_dev. The memory needs to be allocate on the device before this function is called.

Definition at line 177 of file cuda.h.