TRIQS/nda 1.3.0
Multi-dimensional array library for C++
|
Generic versions (w.r.t. the different address spaces) of memory managing functions as well as other tools related to memory management.
Concepts | |
concept | nda::mem::Allocator |
Check if a given type satisfies the allocator concept. | |
concept | nda::mem::Handle |
Check if a given type satisfies the memory handle concept. | |
concept | nda::mem::OwningHandle |
Check if a given type satisfies the owning memory handle concept. |
Classes | |
struct | nda::mem::aligner< T, Al > |
Wraps an arbitrary type to have a specified alignment. More... | |
struct | nda::mem::do_not_initialize_t |
Tag used in constructors to indicate that the memory should not be initialized. More... | |
struct | nda::mem::init_zero_t |
Tag used in constructors to indicate that the memory should be initialized to zero. More... |
Macros | |
#define | device_error_check(ARG1, ARG2) |
Trigger a compilation error every time the nda::device_error_check function is called. |
Functions | |
template<bool flag = false> | |
void | nda::compile_error_no_gpu () |
Trigger a compilation error in case GPU specific functionality is used without configuring the project with GPU support. | |
template<AddressSpace AdrSp> | |
void | nda::mem::free (void *p) |
Call the correct free function based on the given address space. | |
template<AddressSpace AdrSp> | |
void * | nda::mem::malloc (size_t size) |
Call the correct malloc function based on the given address space. | |
template<AddressSpace DestAdrSp, AddressSpace SrcAdrSp> | |
void | nda::mem::memcpy (void *dest, void const *src, size_t count) |
Call the correct memcpy function based on the given address spaces. | |
template<AddressSpace DestAdrSp, AddressSpace SrcAdrSp> | |
void | nda::mem::memcpy2D (void *dest, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height) |
Call CUDA's cudaMemcpy2D function or simulate its behavior on the Host based on the given address spaces. | |
template<AddressSpace AdrSp> | |
void | nda::mem::memset (void *p, int value, size_t count) |
Call the correct memset function based on the given address space. | |
template<AddressSpace AdrSp> | |
void | nda::mem::memset2D (void *ptr, size_t pitch, int value, size_t width, size_t height) |
Call CUDA's cudaMemset2D function or simulate its behavior on the Host based on the given address space. |
Variables | |
static constexpr do_not_initialize_t | nda::mem::do_not_initialize {} |
Instance of nda::mem::do_not_initialize_t. | |
static constexpr bool | nda::have_cuda = false |
Constexpr variable that is true if the project is configured with CUDA support. | |
static constexpr bool | nda::have_device = false |
Constexpr variable that is true if the project is configured with GPU support. | |
static constexpr bool | nda::mem::init_dcmplx = true |
Should we initialize memory for complex double types to zero. | |
static constexpr init_zero_t | nda::mem::init_zero {} |
Instance of nda::mem::init_zero_t. |
void nda::mem::free | ( | void * | p | ) |
#include <nda/mem/malloc.hpp>
Call the correct free function based on the given address space.
It makes the following function calls depending on the address space:
AdrSp | nda::mem::AddressSpace. |
p | Pointer to the memory to be freed. |
Definition at line 75 of file malloc.hpp.
void * nda::mem::malloc | ( | size_t | size | ) |
#include <nda/mem/malloc.hpp>
Call the correct malloc function based on the given address space.
It makes the following function calls depending on the address space:
AdrSp | nda::mem::AddressSpace. |
size | Size in bytes to be allocated. |
Definition at line 49 of file malloc.hpp.
void nda::mem::memcpy | ( | void * | dest, |
void const * | src, | ||
size_t | count ) |
#include <nda/mem/memcpy.hpp>
Call the correct memcpy function based on the given address spaces.
It makes the following function calls depending on the address spaces:
DestAdrSp | nda::mem::AddressSpace of the destination. |
SrcAdrSp | nda::mem::AddressSpace of the source. |
dest | Pointer to the destination memory. |
src | Pointer to the source memory. |
count | Size in bytes to copy. |
Definition at line 51 of file memcpy.hpp.
void nda::mem::memcpy2D | ( | void * | dest, |
size_t | dpitch, | ||
const void * | src, | ||
size_t | spitch, | ||
size_t | width, | ||
size_t | height ) |
#include <nda/mem/memcpy.hpp>
Call CUDA's cudaMemcpy2D function or simulate its behavior on the Host based on the given address spaces.
Copies a matrix (height rows of width bytes each) from the memory area pointed to by src to the memory area pointed to by dest. dpitch and spitch are the widths in memory in bytes of the 2D arrays pointed to by dest and src, including any padding added to the end of each row. The memory areas may not overlap. width must not exceed either dpitch or spitch.
If both address spaces are Host, it simulates the behavior of CUDA's cudaMemcpy2D function by making multiple calls to std::memcpy.
DestAdrSp | nda::mem::AddressSpace of the destination. |
SrcAdrSp | nda::mem::AddressSpace of the source. |
dest | Pointer to the destination memory. |
dpitch | Pitch of destination memory |
src | Pointer to the source memory. |
spitch | Pitch of source memory. |
width | Width of matrix transfer (columns in bytes). |
height | Height of matrix transfer (rows). |
Definition at line 84 of file memcpy.hpp.
void nda::mem::memset | ( | void * | p, |
int | value, | ||
size_t | count ) |
#include <nda/mem/memset.hpp>
Call the correct memset function based on the given address space.
It makes the following function calls depending on the address spaces:
AdrSp | nda::mem::AddressSpace. |
p | Pointer to the memory to be set. |
value | Value to set for each byte of specified memory. |
count | Size in bytes to be set. |
Definition at line 49 of file memset.hpp.
void nda::mem::memset2D | ( | void * | ptr, |
size_t | pitch, | ||
int | value, | ||
size_t | width, | ||
size_t | height ) |
#include <nda/mem/memset.hpp>
Call CUDA's cudaMemset2D function or simulate its behavior on the Host based on the given address space.
Sets each byte of a matrix (height rows of width bytes each) pointed to by dest to a specified value. pitch is the width in memory in bytes of the 2D array pointed to by dest, including any padding added to the end of each row.
If the address space is Host, it simulates the behavior of CUDA's cudaMemset2D function by making multiple calls to std::memset.
AdrSp | nda::mem::AddressSpace. |
ptr | Pointer to the memory to be set. |
pitch | Pitch in bytes of the memory (unused if height is 1). |
value | Value to set for each byte of specified memory |
width | Width of matrix to set (columns in bytes). |
height | Height of matrix to set (rows). |
Definition at line 78 of file memset.hpp.