vecmem 1.14.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
vecmem::cuda::async_copy Class Reference

Specialisation of vecmem::copy for CUDA. More...

#include <vecmem/utils/cuda/async_copy.hpp>

Inheritance diagram for vecmem::cuda::async_copy:
vecmem::copy

Public Types

using event_type = std::unique_ptr< abstract_event >
 Event type used by the copy class.
 

Public Member Functions

VECMEM_CUDA_EXPORT async_copy (const stream_wrapper &stream)
 Constructor with the stream to operate on.
 
VECMEM_CUDA_EXPORT ~async_copy ()
 Destructor.
 
template<typename TYPE >
copy::event_type setup (data::vector_view< TYPE > data) const
 
template<typename TYPE >
copy::event_type setup (data::jagged_vector_view< TYPE > data) const
 
template<typename SCHEMA >
copy::event_type setup (edm::view< SCHEMA > data) const
 
template<typename TYPE >
copy::event_type memset (data::vector_view< TYPE > data, int value) const
 
template<typename TYPE >
copy::event_type memset (data::jagged_vector_view< TYPE > data, int value) const
 
template<typename... VARTYPES>
copy::event_type memset (edm::view< edm::schema< VARTYPES... > > data, int value) const
 
template<typename TYPE >
copy::event_type operator() (const data::vector_view< std::add_const_t< TYPE > > &from_view, data::vector_view< TYPE > to_view, type::copy_type cptype) const
 
template<typename TYPE , typename ALLOC >
copy::event_type operator() (const data::vector_view< std::add_const_t< TYPE > > &from_view, std::vector< TYPE, ALLOC > &to_vec, type::copy_type cptype) const
 
template<typename TYPE >
copy::event_type operator() (const data::jagged_vector_view< std::add_const_t< TYPE > > &from_view, data::jagged_vector_view< TYPE > to_view, type::copy_type cptype) const
 
template<typename TYPE , typename ALLOC1 , typename ALLOC2 >
copy::event_type operator() (const data::jagged_vector_view< std::add_const_t< TYPE > > &from_view, std::vector< std::vector< TYPE, ALLOC2 >, ALLOC1 > &to_vec, type::copy_type cptype) const
 
template<typename... VARTYPES>
copy::event_type operator() (const edm::view< edm::details::add_const_t< edm::schema< VARTYPES... > > > &from_view, edm::view< edm::schema< VARTYPES... > > to_view, type::copy_type cptype) const
 
template<typename... VARTYPES, template< typename > class INTERFACE>
copy::event_type operator() (const edm::view< edm::details::add_const_t< edm::schema< VARTYPES... > > > &from_view, edm::host< edm::schema< VARTYPES... >, INTERFACE > &to_vec, type::copy_type cptype) const
 
template<typename TYPE >
copy::event_type set_sizes (const std::vector< typename data::vector_view< TYPE >::size_type > &sizes, data::jagged_vector_view< TYPE > data) const
 
1-dimensional vector data handling functions
template<typename TYPE >
VECMEM_NODISCARD event_type setup (data::vector_view< TYPE > data) const
 Set up the internal state of a vector buffer correctly on a device.
 
template<typename TYPE >
VECMEM_NODISCARD event_type memset (data::vector_view< TYPE > data, int value) const
 Set all bytes of the vector to some value.
 
template<typename TYPE >
data::vector_buffer< std::remove_cv_t< TYPE > > to (const data::vector_view< TYPE > &data, memory_resource &resource, type::copy_type cptype=type::unknown) const
 Copy a 1-dimensional vector to the specified memory resource.
 
template<typename TYPE >
VECMEM_NODISCARD event_type operator() (const data::vector_view< std::add_const_t< TYPE > > &from, data::vector_view< TYPE > to, type::copy_type cptype=type::unknown) const
 Copy a 1-dimensional vector's data between two existing memory blocks.
 
template<typename TYPE , typename ALLOC >
VECMEM_NODISCARD event_type operator() (const data::vector_view< std::add_const_t< TYPE > > &from, std::vector< TYPE, ALLOC > &to, type::copy_type cptype=type::unknown) const
 Copy a 1-dimensional vector's data into a vector object.
 
template<typename TYPE >
data::vector_view< TYPE >::size_type get_size (const data::vector_view< TYPE > &data) const
 Helper function for getting the size of a resizable 1D buffer.
 
Jagged vector data handling functions
template<typename TYPE >
VECMEM_NODISCARD event_type setup (data::jagged_vector_view< TYPE > data) const
 Copy the internal state of a jagged vector buffer to the target device.
 
template<typename TYPE >
VECMEM_NODISCARD event_type memset (data::jagged_vector_view< TYPE > data, int value) const
 Set all bytes of the jagged vector to some value.
 
template<typename TYPE >
data::jagged_vector_buffer< std::remove_cv_t< TYPE > > to (const data::jagged_vector_view< TYPE > &data, memory_resource &resource, memory_resource *host_access_resource=nullptr, type::copy_type cptype=type::unknown) const
 Copy a jagged vector to the specified memory resource.
 
template<typename TYPE >
VECMEM_NODISCARD event_type operator() (const data::jagged_vector_view< std::add_const_t< TYPE > > &from, data::jagged_vector_view< TYPE > to, type::copy_type cptype=type::unknown) const
 Copy a jagged vector's data between two existing allocations.
 
template<typename TYPE , typename ALLOC1 , typename ALLOC2 >
VECMEM_NODISCARD event_type operator() (const data::jagged_vector_view< std::add_const_t< TYPE > > &from, std::vector< std::vector< TYPE, ALLOC2 >, ALLOC1 > &to, type::copy_type cptype=type::unknown) const
 Copy a jagged vector's data into a vector object.
 
template<typename TYPE >
std::vector< typename data::vector_view< TYPE >::size_type > get_sizes (const data::jagged_vector_view< TYPE > &data) const
 Helper function for getting the sizes of a resizable jagged vector.
 
template<typename TYPE >
VECMEM_NODISCARD event_type set_sizes (const std::vector< typename data::vector_view< TYPE >::size_type > &sizes, data::jagged_vector_view< TYPE > data) const
 Helper function for setting the sizes of a resizable jagged vector.
 
SoA container handling functions
template<typename SCHEMA >
VECMEM_NODISCARD event_type setup (edm::view< SCHEMA > data) const
 Set up the internal state of a buffer correctly on a device.
 
template<typename... VARTYPES>
VECMEM_NODISCARD event_type memset (edm::view< edm::schema< VARTYPES... > > data, int value) const
 Set all bytes of the container to some value.
 
template<typename... VARTYPES>
VECMEM_NODISCARD event_type operator() (const edm::view< edm::details::add_const_t< edm::schema< VARTYPES... > > > &from, edm::view< edm::schema< VARTYPES... > > to, type::copy_type cptype=type::unknown) const
 Copy between two views.
 
template<typename... VARTYPES, template< typename > class INTERFACE>
VECMEM_NODISCARD event_type operator() (const edm::view< edm::details::add_const_t< edm::schema< VARTYPES... > > > &from, edm::host< edm::schema< VARTYPES... >, INTERFACE > &to, type::copy_type cptype=type::unknown) const
 Copy from a view, into a host container.
 
template<typename... VARTYPES>
edm::view< edm::schema< VARTYPES... > >::size_type get_size (const edm::view< edm::schema< VARTYPES... > > &data) const
 Get the (outer) size of a resizable SoA container.
 

Protected Member Functions

virtual VECMEM_CUDA_EXPORT void do_copy (std::size_t size, const void *from, void *to, type::copy_type cptype) const override final
 Perform an asynchronous memory copy using CUDA.
 
virtual VECMEM_CUDA_EXPORT void do_memset (std::size_t size, void *ptr, int value) const override final
 Fill a memory area using CUDA asynchronously.
 
virtual VECMEM_CUDA_EXPORT event_type create_event () const override final
 Create an event for synchronization.
 
virtual void do_copy (std::size_t size, const void *from, void *to, type::copy_type cptype) const
 Perform a "low level" memory copy.
 

Detailed Description

Specialisation of vecmem::copy for CUDA.

This specialisation of vecmem::copy, unlike vecmem::cuda::copy, performs all of its operations asynchronously. Using the CUDA stream that is given to its constructor.

It is up to the user to ensure that copy operations are performed in the right order, and they would finish before an operation that needs them is executed.

Member Function Documentation

◆ create_event()

async_copy::event_type vecmem::cuda::async_copy::create_event ( ) const
finaloverrideprotectedvirtual

Create an event for synchronization.

Reimplemented from vecmem::copy.

◆ do_memset()

void vecmem::cuda::async_copy::do_memset ( std::size_t  size,
void ptr,
int  value 
) const
finaloverrideprotectedvirtual

Fill a memory area using CUDA asynchronously.

Reimplemented from vecmem::copy.


The documentation for this class was generated from the following files: