cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
cuda::is_valid_kernel_argument< T > Struct Template Reference

A trait characterizing those types which can be used as kernel parameters. More...

#include <kernel_launch.hpp>

Inheritance diagram for cuda::is_valid_kernel_argument< T >:
Collaboration diagram for cuda::is_valid_kernel_argument< T >:

Detailed Description

template<typename T>
struct cuda::is_valid_kernel_argument< T >

A trait characterizing those types which can be used as kernel parameters.

When passing arguments to a kernel function, their representation is copied from the host to the GPU device; so their type must allow for a construction by means of such copying; this is essentially the std::is_trivially_copy_constructible trait. which serves to identify types that can be safely passed to CUDA kernels.

Template Parameters
TThe prospective kernel parameter type
Note
This trait is used internally in the CUDA API wrappers to enforce the constraints on kernel arguments at compile time.
The trait is based on the CUDA C++ Programming Guide's requirements from kernel parameter types, mostly (see https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#global-function-argument-processing ); There is also a requirement for supporting destructor calls before the kernel execution is actually concluded - which is all but impossible to check via a trait; so it is up to users of the library to either exercise care, or otherwise specialize the trait for known-to-be-problematic types, precluding their use.

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