vecmem 1.14.0
|
Class implementing (synchronous) host <-> device memory copies. More...
#include <vecmem/utils/copy.hpp>
Classes | |
struct | type |
Wrapper struct around the copy_type enumeration. More... | |
Public Types | |
using | event_type = std::unique_ptr< abstract_event > |
Event type used by the copy class. | |
Public Member Functions | |
template<typename TYPE > | |
copy::event_type | setup (data::vector_view< TYPE > data) const |
template<typename TYPE > | |
copy::event_type | memset (data::vector_view< TYPE > 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 | setup (data::jagged_vector_view< TYPE > data) const |
template<typename TYPE > | |
copy::event_type | memset (data::jagged_vector_view< TYPE > data, int value) 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 TYPE > | |
copy::event_type | set_sizes (const std::vector< typename data::vector_view< TYPE >::size_type > &sizes, data::jagged_vector_view< TYPE > data) const |
template<typename SCHEMA > | |
copy::event_type | setup (edm::view< SCHEMA > data) const |
template<typename... VARTYPES> | |
copy::event_type | memset (edm::view< edm::schema< VARTYPES... > > data, int value) 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 |
1-dimensional vector data handling functions | |
virtual | ~copy () |
Virtual destructor. | |
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 void | do_copy (std::size_t size, const void *from, void *to, type::copy_type cptype) const |
Perform a "low level" memory copy. | |
virtual void | do_memset (std::size_t size, void *ptr, int value) const |
Perform a "low level" memory filling operation. | |
virtual VECMEM_NODISCARD event_type | create_event () const |
Create an event for synchronization. | |
Class implementing (synchronous) host <-> device memory copies.
Since most of the logic of explicitly copying the payload of vecmem containers between the host and device is independent of the exact GPU language used, this common base class is used for implementing most of that logic.
Language specific copy
classes should only need to re-implement the do_copy
function, everything else should be provided by this class.
|
inlinevirtual |
Virtual destructor.
Reimplemented in vecmem::sycl::copy.
|
protectedvirtual |
Create an event for synchronization.
Reimplemented in vecmem::cuda::async_copy, and vecmem::sycl::async_copy.
Perform a "low level" memory filling operation.
Reimplemented in vecmem::cuda::async_copy, vecmem::cuda::copy, vecmem::hip::copy, vecmem::sycl::async_copy, and vecmem::sycl::copy.