cuda-api-wrappers
Thin C++-flavored wrappers for the CUDA Runtime API
cuda::memory::copy_parameters_t< NumDimensions > Struct Template Reference

A builder-ish subclass template around the basic 2D or 3D copy parameters which CUDA's complex copying API actually takes. More...

#include <copy_parameters.hpp>

Inheritance diagram for cuda::memory::copy_parameters_t< NumDimensions >:
Collaboration diagram for cuda::memory::copy_parameters_t< NumDimensions >:

Public Types

using parent = detail_::base_copy_params_t< NumDimensions >
 
using this_type = copy_parameters_t< NumDimensions >
 
using intra_context_type = typename detail_::base_copy_params< NumDimensions >::intra_context_type
 A Raw CUDA Driver API type punning the general copy parameters, which is used for copy operations within the same context.
 
using dimensions_type = array::dimensions_t< NumDimensions >
 
using dimension_type = array::dimension_t
 

Public Member Functions

bool is_intra_context () const noexcept
 
this_typeset_context (endpoint_t endpoint, const context_t &context) noexcept
 Set the context for one end of the copy operation.
 
this_typeset_single_context (const context_t &context) noexcept
 Set the same context for both endpoints of the copy operation.
 
template<typename T >
this_typeset_endpoint (endpoint_t endpoint, const cuda::array_t< T, NumDimensions > &array) noexcept
 Set one of the copy endpoints to a CUDA array. More...
 
this_typeset_endpoint_untyped (endpoint_t endpoint, context::handle_t context_handle, void *ptr, dimensions_type dimensions)
 Set one of the copy endpoints to a multi-dimensional elements, with dimensions specified in bytes rather than actual elements, starting somewhere in memory (in any CUDA memory space) More...
 
template<typename T >
this_typeset_endpoint (endpoint_t endpoint, span< T > span) noexcept
 Set one of the copy endpoints to a multi-dimensional elements, starting at the beginning of a span of memory (in any CUDA memory space) More...
 
template<typename T >
this_typeset_source (const cuda::array_t< T, NumDimensions > &array) noexcept
 Set the source endpoint of the copy operation to be a CUDA array. More...
 
this_typeset_source_untyped (context::handle_t context_handle, void *ptr, dimensions_type dimensions)
 Set the source of the copy operation to be a sequence of multi-dimensional elements, with dimensions specified in bytes rather than actual elements, starting somewhere in memory (in any CUDA memory space) More...
 
template<typename T >
this_typeset_source (span< T > span) noexcept
 Set one of the copy endpoints to a multi-dimensional elements, starting at the beginning of a span of memory (in any CUDA memory space) More...
 
template<typename T >
this_typeset_destination (const cuda::array_t< T, NumDimensions > &array) noexcept
 Set the source endpoint of the copy operation to be a CUDA array. More...
 
void set_destination_untyped (context::handle_t context_handle, void *ptr, dimensions_type dimensions) noexcept
 Set the destination of the copy operation to be a sequence of multi-dimensional elements, with dimensions specified in bytes rather than actual elements, starting somewhere in memory (in any CUDA memory space) More...
 
template<typename T >
this_typeset_destination (span< T > span) noexcept
 Set the desintation of the copy operation to a range of multi-dimensional elements, starting at the beginning of a span of memory (in any CUDA memory space) More...
 
this_typeset_bytes_offset (endpoint_t endpoint, dimensions_type offset) noexcept
 Set the (multi-dimensional) offset, in bytes, into multidimensional range of elements at one of the endpoints of the copy operation.
 
template<typename T >
this_typeset_offset (endpoint_t endpoint, dimensions_type offset) noexcept
 Set the (multi-dimensional) offset, in elements, into multidimensional range of elements at one of the endpoints of the copy operation.
 
this_typeclear_offset (endpoint_t endpoint) noexcept
 Set the copy operation to use the multi-dimensional region of the specified endpoint without skipping any offset-elements into it.
 
this_typeclear_offsets () noexcept
 Clear the offsets into both the source and the destination endpoint regions.
 
this_typeset_bytes_pitch (endpoint_t endpoint, dimension_type pitch_in_bytes) noexcept
 Set the difference, in bytes, between the beginning of sequences of the minor-most dimension, for consecutive coordinates in the second minor-most dimension - within the multi-dimensional regions of one of the copy operation endpoints.
 
template<typename T >
this_typeset_pitch (endpoint_t endpoint, dimension_type pitch_in_elements) noexcept
 Set the difference, in elements, between the beginning of sequences of the minor-most dimension, for consecutive coordinates in the second minor-most dimension - within the multi-dimensional regions of one of the copy operation endpoints.
 
template<typename T >
this_typeset_pitches (dimension_type uniform_pitch_in_elements) noexcept
 Set the difference, in elements, between the beginning of sequences of the minor-most dimension, for consecutive coordinates in the second minor-most dimension - within the multi-dimensional regions of both of the copy operation endpoints.
 
this_typeset_default_pitch (endpoint_t endpoint) noexcept
 
this_typeset_default_pitches () noexcept
 
this_typeset_bytes_extent (dimensions_type extent_in_bytes) noexcept
 Set how much is to be copied in each dimension - in bytes. More...
 
template<typename T >
this_typeset_extent (dimensions_type extent_in_elements) noexcept
 Set how much is to be copied in each dimension - in elements. More...
 
dimensions_type bytes_extent () const noexcept
 
template<typename T >
dimensions_type extent () const noexcept
 
this_typeset_pitches (dimension_type uniform_pitch_in_bytes) noexcept
 
this_typeclear_rest () noexcept
 
template<>
copy_parameters_t< 2 > & set_endpoint_untyped (endpoint_t endpoint, context::handle_t, void *ptr, array::dimensions_t< 2 > dimensions)
 
template<>
copy_parameters_t< 3 > & set_endpoint_untyped (endpoint_t endpoint, context::handle_t, void *ptr, array::dimensions_t< 3 > dimensions)
 
template<>
copy_parameters_t< 2 > & set_endpoint (endpoint_t endpoint, context::handle_t context_handle, T *ptr, array::dimensions_t< 2 > dimensions) noexcept
 
template<>
copy_parameters_t< 2 > & set_endpoint (endpoint_t endpoint, T *ptr, array::dimensions_t< 2 > dimensions)
 
template<>
copy_parameters_t< 2 > & set_endpoint (endpoint_t endpoint, const cuda::array_t< T, 2 > &array) noexcept
 
template<>
copy_parameters_t< 3 > & set_endpoint (endpoint_t endpoint, const cuda::array_t< T, 3 > &array) noexcept
 
template<>
copy_parameters_t< 2 > & set_context (endpoint_t endpoint, const context_t &context) noexcept=delete
 
template<>
copy_parameters_t< 3 > & set_context (endpoint_t endpoint, const context_t &context) noexcept
 
template<>
copy_parameters_t< 3 > & set_endpoint (endpoint_t endpoint, context::handle_t context_handle, T *ptr, array::dimensions_t< 3 > dimensions) noexcept
 
template<>
copy_parameters_t< 3 > & set_endpoint (endpoint_t endpoint, T *ptr, array::dimensions_t< 3 > dimensions)
 
template<>
copy_parameters_t< 2 > & clear_rest () noexcept
 
template<>
copy_parameters_t< 3 > & clear_rest () noexcept
 
template<>
copy_parameters_t< 2 > & set_extent (dimensions_type extent_in_elements) noexcept
 
template<>
copy_parameters_t< 2 > & set_bytes_extent (dimensions_type extent_in_elements) noexcept
 
template<>
copy_parameters_t< 3 > & set_bytes_extent (dimensions_type extent_in_elements) noexcept
 
template<>
copy_parameters_t< 2 >::dimensions_type bytes_extent () const noexcept
 
template<>
copy_parameters_t< 3 >::dimensions_type bytes_extent () const noexcept
 
template<>
copy_parameters_t< 2 > & set_endpoint_untyped (endpoint_t endpoint, context::handle_t, void *ptr, array::dimensions_t< 2 > dimensions)
 
template<>
copy_parameters_t< 3 > & set_endpoint_untyped (endpoint_t endpoint, context::handle_t context_handle, void *ptr, array::dimensions_t< 3 > dimensions)
 
template<>
copy_parameters_t< 3 > & set_extent (dimensions_type extent_in_elements) noexcept
 
template<>
copy_parameters_t< 3 > & set_bytes_offset (endpoint_t endpoint, dimensions_type offset) noexcept
 
template<>
copy_parameters_t< 2 > & set_bytes_offset (endpoint_t endpoint, dimensions_type offset) noexcept
 
template<>
copy_parameters_t< 3 > & set_offset (endpoint_t endpoint, dimensions_type offset) noexcept
 
template<>
copy_parameters_t< 2 > & set_offset (endpoint_t endpoint, dimensions_type offset) noexcept
 
template<typename T >
this_typeset_endpoint (endpoint_t endpoint, T *ptr, dimensions_type dimensions)
 Set one of the copy endpoints to a multi-dimensional elements, starting somewhere in memory (in any CUDA memory space) More...
 
template<typename T >
this_typeset_endpoint (endpoint_t endpoint, context::handle_t context_handle, T *ptr, dimensions_type dimensions) noexcept
 
template<typename T >
this_typeset_source (T *ptr, dimensions_type dimensions) noexcept
 Set one of the copy endpoints to a multi-dimensional elements, starting somewhere in memory (in any CUDA memory space) More...
 
template<typename T >
this_typeset_source (context::handle_t context_handle, T *ptr, dimensions_type dimensions) noexcept
 
template<typename T >
this_typeset_destination (T *ptr, dimensions_type dimensions) noexcept
 Set one of the copy endpoints to a multi-dimensional elements, starting somewhere in memory (in any CUDA memory space) More...
 
template<typename T >
this_typeset_destination (context::handle_t context_handle, T *ptr, dimensions_type dimensions) noexcept
 

Detailed Description

template<dimensionality_t NumDimensions>
struct cuda::memory::copy_parameters_t< NumDimensions >

A builder-ish subclass template around the basic 2D or 3D copy parameters which CUDA's complex copying API actually takes.

{

Note
This class is not "safe", in the sense that there is currently no checks to ensure you've actively set all fields properly before passing it on to the CUDA driver.}

{

Note
this class cannot hold reference units to any contexts or allocated memory, so one must ensure every resource relevant to the source and the destination remains alive until the copy operation is both scheduled and executed.}

Member Function Documentation

◆ bytes_extent()

template<dimensionality_t NumDimensions>
dimensions_type cuda::memory::copy_parameters_t< NumDimensions >::bytes_extent ( ) const
noexcept
Returns
How much is to be copied by the memory operation, in each dimension - in bytes
Note
This differs from the dimensions of the source and destination regions overall.

◆ extent()

template<dimensionality_t NumDimensions>
template<typename T >
dimensions_type cuda::memory::copy_parameters_t< NumDimensions >::extent ( ) const
inlinenoexcept
Returns
how much is to be copied in each dimension - in elements
Note
This differs from the dimensions of the source and destination regions overall.

◆ is_intra_context()

template<dimensionality_t NumDimensions>
bool cuda::memory::copy_parameters_t< NumDimensions >::is_intra_context ( ) const
inlinenoexcept
Returns
true if this structure indicates that the copy operation is to occur between endpoints in the same CUDA context

◆ set_bytes_extent()

template<dimensionality_t NumDimensions>
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_bytes_extent ( dimensions_type  extent_in_bytes)
noexcept

Set how much is to be copied in each dimension - in bytes.

Note
This differs from the dimensions of the source and destination regions overall.

◆ set_destination() [1/3]

template<dimensionality_t NumDimensions>
template<typename T >
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_destination ( const cuda::array_t< T, NumDimensions > &  array)
inlinenoexcept

Set the source endpoint of the copy operation to be a CUDA array.

Note
: This assumes default pitch.

◆ set_destination() [2/3]

template<dimensionality_t NumDimensions>
template<typename T >
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_destination ( T *  ptr,
dimensions_type  dimensions 
)
inlinenoexcept

Set one of the copy endpoints to a multi-dimensional elements, starting somewhere in memory (in any CUDA memory space)

Note
: This assumes default pitch.

◆ set_destination() [3/3]

template<dimensionality_t NumDimensions>
template<typename T >
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_destination ( span< T >  span)
inlinenoexcept

Set the desintation of the copy operation to a range of multi-dimensional elements, starting at the beginning of a span of memory (in any CUDA memory space)

Note
: This assumes default pitch.

◆ set_destination_untyped()

template<dimensionality_t NumDimensions>
void cuda::memory::copy_parameters_t< NumDimensions >::set_destination_untyped ( context::handle_t  context_handle,
void *  ptr,
dimensions_type  dimensions 
)
inlinenoexcept

Set the destination of the copy operation to be a sequence of multi-dimensional elements, with dimensions specified in bytes rather than actual elements, starting somewhere in memory (in any CUDA memory space)

Note
: This assumes default pitch.

◆ set_endpoint() [1/3]

template<dimensionality_t NumDimensions>
template<typename T >
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_endpoint ( endpoint_t  endpoint,
const cuda::array_t< T, NumDimensions > &  array 
)
noexcept

Set one of the copy endpoints to a CUDA array.

Note
: This assumes default pitch.

◆ set_endpoint() [2/3]

template<dimensionality_t NumDimensions>
template<typename T >
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_endpoint ( endpoint_t  endpoint,
T *  ptr,
dimensions_type  dimensions 
)

Set one of the copy endpoints to a multi-dimensional elements, starting somewhere in memory (in any CUDA memory space)

Note
: This assumes default pitch.

◆ set_endpoint() [3/3]

template<dimensionality_t NumDimensions>
template<typename T >
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_endpoint ( endpoint_t  endpoint,
span< T >  span 
)
inlinenoexcept

Set one of the copy endpoints to a multi-dimensional elements, starting at the beginning of a span of memory (in any CUDA memory space)

Note
: This assumes default pitch.

◆ set_endpoint_untyped()

template<dimensionality_t NumDimensions>
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_endpoint_untyped ( endpoint_t  endpoint,
context::handle_t  context_handle,
void *  ptr,
dimensions_type  dimensions 
)

Set one of the copy endpoints to a multi-dimensional elements, with dimensions specified in bytes rather than actual elements, starting somewhere in memory (in any CUDA memory space)

Note
: This assumes default pitch.

◆ set_extent()

template<dimensionality_t NumDimensions>
template<typename T >
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_extent ( dimensions_type  extent_in_elements)
noexcept

Set how much is to be copied in each dimension - in elements.

Note
This differs from the dimensions of the source and destination regions overall.

◆ set_source() [1/3]

template<dimensionality_t NumDimensions>
template<typename T >
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_source ( const cuda::array_t< T, NumDimensions > &  array)
inlinenoexcept

Set the source endpoint of the copy operation to be a CUDA array.

Note
: This assumes default pitch.

◆ set_source() [2/3]

template<dimensionality_t NumDimensions>
template<typename T >
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_source ( T *  ptr,
dimensions_type  dimensions 
)
inlinenoexcept

Set one of the copy endpoints to a multi-dimensional elements, starting somewhere in memory (in any CUDA memory space)

Note
: This assumes default pitch.

◆ set_source() [3/3]

template<dimensionality_t NumDimensions>
template<typename T >
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_source ( span< T >  span)
inlinenoexcept

Set one of the copy endpoints to a multi-dimensional elements, starting at the beginning of a span of memory (in any CUDA memory space)

Note
: This assumes default pitch.

◆ set_source_untyped()

template<dimensionality_t NumDimensions>
this_type& cuda::memory::copy_parameters_t< NumDimensions >::set_source_untyped ( context::handle_t  context_handle,
void *  ptr,
dimensions_type  dimensions 
)
inline

Set the source of the copy operation to be a sequence of multi-dimensional elements, with dimensions specified in bytes rather than actual elements, starting somewhere in memory (in any CUDA memory space)

Note
: This assumes default pitch.

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