48 template <AddressSpace AdrSp>
49 void memset(
void *p,
int value,
size_t count) {
53 if constexpr (AdrSp == Host) {
54 std::memset(p, value, count);
77 template <AddressSpace AdrSp>
78 void memset2D(
void *ptr,
size_t pitch,
int value,
size_t width,
size_t height) {
82 if constexpr (AdrSp == Host) {
83 auto *ptri =
static_cast<unsigned char *
>(ptr);
84 for (
size_t i = 0; i < height; ++i, ptri += pitch) std::memset(ptri, value, width);
Provides definitions and type traits involving the different memory address spaces supported by nda.
Provides GPU and non-GPU specific functionality.
static const auto check_adr_sp_valid
Check validity of a set of nda::mem::AddressSpace values.
static constexpr bool have_cuda
Constexpr variable that is true if the project is configured with CUDA support.
void 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 spa...
#define device_error_check(ARG1, ARG2)
Trigger a compilation error every time the nda::device_error_check function is called.
static constexpr bool have_device
Constexpr variable that is true if the project is configured with GPU support.
void memset(void *p, int value, size_t count)
Call the correct memset function based on the given address space.