Reference documentation for deal.II version 9.2.0
\(\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 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 84 of file cuda.h.

◆ free()

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

Free memory on the device.

Definition at line 96 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 108 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 120 of file cuda.h.

◆ copy_to_host()

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 131 of file cuda.h.

◆ copy_to_dev()

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 146 of file cuda.h.