vecmem 1.14.0
|
Main namespace for the vecmem classes/functions. More...
Namespaces | |
namespace | cuda |
Namespace holding types that work on/with CUDA. | |
namespace | data |
Namespace holding "data types". | |
namespace | details |
Namespace for types that should not be used directly by clients. | |
namespace | edm |
Namespace for the types implementing Struct-of-Array container support. | |
namespace | hip |
Namespace holding types that work on/with ROCm/HIP. | |
namespace | sycl |
Namespace holding types that work on/with oneAPI/SYCL. | |
Classes | |
struct | abstract_event |
Interface that language specific "events" need to implement. More... | |
class | allocator |
An allocator class that wraps a memory resource. More... | |
class | arena_memory_resource |
Memory resource implementing an arena allocation scheme. More... | |
class | array |
Array with a fixed size, chosen during runtime. More... | |
class | atomic |
Class providing atomic operations for the VecMem code. More... | |
class | binary_page_memory_resource |
A memory manager using power-of-two pages that can be split to deal with allocation requests of various sizes. More... | |
class | choice_memory_resource |
This memory resource conditionally allocates memory. More... | |
class | coalescing_memory_resource |
This memory resource tries to allocate with several upstream resources and returns the first succesful one. More... | |
class | conditional_memory_resource |
This memory resource conditionally allocates memory. More... | |
class | contiguous_memory_resource |
Downstream allocator that ensures that allocations are contiguous. More... | |
class | copy |
Class implementing (synchronous) host <-> device memory copies. More... | |
class | debug_memory_resource |
This memory resource forwards allocation and deallocation requests to the upstream resource, but alerts the user of potential problems. More... | |
class | device_array |
Class mimicking a host-filled std::array in "device code". More... | |
class | device_vector |
Class mimicking an std::vector in "device code". More... | |
class | dummy_device_atomic_ref |
Dummy / No-op atomic reference for unsupported devices / compilers. More... | |
class | host_memory_resource |
Memory resource which wraps standard library memory allocation calls. More... | |
class | identity_memory_resource |
This memory resource forwards allocation and deallocation requests to the upstream resource. More... | |
class | instrumenting_memory_resource |
This memory resource forwards allocation and deallocation requests to the upstream resource while recording useful statistics and information about these events. More... | |
class | jagged_device_vector |
A view for jagged vectors. More... | |
class | memory_monitor |
Class collecting some basic set of memory allocation statistics. More... | |
class | pool_memory_resource |
Memory resource pooling allocations of various sizes. More... | |
class | posix_device_atomic_ref |
Custom implementation for atomic operations using "POSIX" built-ins. More... | |
struct | static_array |
Simple statically-sized array-like class designed for use in device code. More... | |
class | static_vector |
Class mimicking std::vector on top of a fixed sized array. More... | |
class | synchronized_memory_resource |
A memory resource that synchronizes the operations of an upstream resource. More... | |
class | terminal_memory_resource |
This memory resource does nothing, but it does nothing for a purpose. More... | |
struct | tuple |
Default tuple type. More... | |
struct | tuple< T, Ts... > |
Simple tuple implementation for the vecmem EDM classes. More... | |
struct | tuple_element |
Default/empty implementation for vecmem::tuple_element . More... | |
struct | tuple_element< I, tuple< Ts... > > |
Get the type of the I-th element of a tuple. More... | |
Typedefs | |
template<typename T > | |
using | jagged_vector = vector< vector< T > > |
Alias type for jagged vectors with our polymorphic allocator. | |
template<typename T > | |
using | vector = std::vector< T, vecmem::polymorphic_allocator< T > > |
Alias type for vectors with our polymorphic allocator. | |
template<typename T , device_address_space address = device_address_space::global> | |
using | device_atomic_ref = dummy_device_atomic_ref< T, address > |
Use vecmem::dummy_device_atomic_ref as a fallback. | |
template<typename T > | |
using | unique_obj_ptr = std::unique_ptr< T, details::unique_obj_deleter< T > > |
A unique pointer type for non-trivial objects. | |
template<typename T > | |
using | unique_alloc_ptr = std::unique_ptr< T, details::unique_alloc_deleter< T > > |
A unique pointer type for trivial types. | |
Enumerations | |
enum class | device_address_space { global = 0 , local = 1 } |
Custom definition for the device memory adress space. | |
enum class | memory_order { relaxed = 0 , consume = 1 , acquire = 2 , release = 3 , acq_rel = 4 , seq_cst = 5 } |
Custom (dummy) definition for the memory order. | |
Functions | |
template<typename T , std::size_t N> | |
VECMEM_HOST data::vector_view< T > | get_data (array< T, N > &a) |
Helper function creating a vecmem::data::vector_view object. | |
template<typename T , std::size_t N> | |
VECMEM_HOST data::vector_view< const T > | get_data (const array< T, N > &a) |
Helper function creating a vecmem::data::vector_view object. | |
template<typename TYPE > | |
data::jagged_vector_view< TYPE > & | get_data (data::jagged_vector_buffer< TYPE > &data) |
Helper function creating a vecmem::data::jagged_vector_view object. | |
template<typename TYPE > | |
const data::jagged_vector_view< TYPE > & | get_data (const data::jagged_vector_buffer< TYPE > &data) |
Helper function creating a vecmem::data::jagged_vector_view object. | |
template<typename TYPE > | |
data::jagged_vector_view< TYPE > & | get_data (data::jagged_vector_data< TYPE > &data) |
Helper function creating a vecmem::data::jagged_vector_view object. | |
template<typename TYPE > | |
const data::jagged_vector_view< TYPE > & | get_data (const data::jagged_vector_data< TYPE > &data) |
Helper function creating a vecmem::data::jagged_vector_view object. | |
template<typename TYPE > | |
data::vector_view< TYPE > & | get_data (data::vector_buffer< TYPE > &data) |
Helper function creating a vecmem::data::vector_view object. | |
template<typename TYPE > | |
const data::vector_view< TYPE > & | get_data (const data::vector_buffer< TYPE > &data) |
Helper function creating a vecmem::data::vector_view object. | |
template<typename TYPE > | |
data::jagged_vector_data< TYPE > | get_data (jagged_vector< TYPE > &vec, memory_resource *resource) |
Helper function creating a vecmem::data::jagged_vector_data object. | |
template<typename TYPE , typename ALLOC1 , typename ALLOC2 > | |
data::jagged_vector_data< TYPE > | get_data (std::vector< std::vector< TYPE, ALLOC1 >, ALLOC2 > &vec, memory_resource *resource) |
Helper function creating a vecmem::data::jagged_vector_data object. | |
template<typename TYPE > | |
data::jagged_vector_data< const TYPE > | get_data (const jagged_vector< TYPE > &vec, memory_resource *resource) |
Helper function creating a vecmem::data::jagged_vector_data object. | |
template<typename TYPE , typename ALLOC1 , typename ALLOC2 > | |
data::jagged_vector_data< const TYPE > | get_data (const std::vector< std::vector< TYPE, ALLOC1 >, ALLOC2 > &vec, memory_resource *resource) |
Helper function creating a vecmem::data::jagged_vector_data object. | |
template<typename T , std::size_t N> | |
VECMEM_HOST_AND_DEVICE bool | operator== (const static_array< T, N > &lhs, const static_array< T, N > &rhs) |
Equality check on two arrays. | |
template<typename T , std::size_t N> | |
VECMEM_HOST_AND_DEVICE bool | operator!= (const static_array< T, N > &lhs, const static_array< T, N > &rhs) |
Non-equality check on two arrays. | |
template<typename TYPE , typename ALLOC > | |
VECMEM_HOST data::vector_view< TYPE > | get_data (std::vector< TYPE, ALLOC > &vec) |
Helper function creating a vecmem::data::vector_view object. | |
template<typename TYPE , typename ALLOC > | |
VECMEM_HOST data::vector_view< const TYPE > | get_data (const std::vector< TYPE, ALLOC > &vec) |
Helper function creating a vecmem::data::vector_view object. | |
template<typename TYPE > | |
VECMEM_HOST data::jagged_vector_data< TYPE > | get_data (jagged_vector< TYPE > &vec, memory_resource *resource=nullptr) |
Helper function creating a vecmem::data::jagged_vector_data object. | |
template<typename TYPE , typename ALLOC1 , typename ALLOC2 > | |
VECMEM_HOST data::jagged_vector_data< TYPE > | get_data (std::vector< std::vector< TYPE, ALLOC1 >, ALLOC2 > &vec, memory_resource *resource) |
Helper function creating a vecmem::data::jagged_vector_data object. | |
template<typename TYPE > | |
VECMEM_HOST data::jagged_vector_data< const TYPE > | get_data (const jagged_vector< TYPE > &vec, memory_resource *resource=nullptr) |
Helper function creating a vecmem::data::jagged_vector_data object. | |
template<typename TYPE , typename ALLOC1 , typename ALLOC2 > | |
VECMEM_HOST data::jagged_vector_data< const TYPE > | get_data (const std::vector< std::vector< TYPE, ALLOC1 >, ALLOC2 > &vec, memory_resource *resource) |
Helper function creating a vecmem::data::jagged_vector_data object. | |
template<typename... VARTYPES> | |
VECMEM_HOST edm::view< edm::schema< VARTYPES... > > | get_data (edm::buffer< edm::schema< VARTYPES... > > &buffer) |
Helper function for getting a (possibly non-const) view for a buffer. | |
template<typename... VARTYPES> | |
VECMEM_HOST edm::view< edm::details::add_const_t< edm::schema< VARTYPES... > > > | get_data (const edm::buffer< edm::schema< VARTYPES... > > &buffer) |
Helper function for getting a (const) view for a buffer. | |
template<typename... VARTYPES> | |
VECMEM_HOST edm::view< edm::schema< VARTYPES... > > & | get_data (edm::data< edm::schema< VARTYPES... > > &data) |
Helper function for getting a (possibly non-const) view of a data object. | |
template<typename... VARTYPES> | |
VECMEM_HOST edm::view< edm::details::add_const_t< edm::schema< VARTYPES... > > > | get_data (const edm::data< edm::schema< VARTYPES... > > &data) |
Helper function for getting a (const) view of a data object. | |
template<typename... VARTYPES, template< typename > class INTERFACE> | |
VECMEM_HOST edm::data< edm::schema< VARTYPES... > > | get_data (edm::host< edm::schema< VARTYPES... >, INTERFACE > &host, memory_resource *resource=nullptr) |
Helper function for getting a (non-const) data object for a host container. | |
template<typename... VARTYPES, template< typename > class INTERFACE> | |
VECMEM_HOST edm::data< edm::details::add_const_t< edm::schema< VARTYPES... > > > | get_data (const edm::host< edm::schema< VARTYPES... >, INTERFACE > &host, memory_resource *resource=nullptr) |
Helper function for getting a (const) data object for a host container. | |
template<typename... VARTYPES, template< typename > class INTERFACE> | |
VECMEM_HOST void | get_data_impl (edm::host< edm::schema< VARTYPES... >, INTERFACE > &, edm::data< edm::schema< VARTYPES... > > &, memory_resource &, std::index_sequence<>) |
Helper function terminal node. | |
template<typename... VARTYPES, template< typename > class INTERFACE, std::size_t I, std::size_t... Is> | |
VECMEM_HOST void | get_data_impl (edm::host< edm::schema< VARTYPES... >, INTERFACE > &host, edm::data< edm::schema< VARTYPES... > > &data, memory_resource &mr, std::index_sequence< I, Is... >) |
Helper function recursive node. | |
template<typename... VARTYPES, template< typename > class INTERFACE> | |
VECMEM_HOST void | get_data_impl (const edm::host< edm::schema< VARTYPES... >, INTERFACE > &, edm::data< edm::details::add_const_t< edm::schema< VARTYPES... > > > &, memory_resource &, std::index_sequence<>) |
Helper function terminal node. | |
template<typename... VARTYPES, template< typename > class INTERFACE, std::size_t I, std::size_t... Is> | |
VECMEM_HOST void | get_data_impl (const edm::host< edm::schema< VARTYPES... >, INTERFACE > &host, edm::data< edm::details::add_const_t< edm::schema< VARTYPES... > > > &data, memory_resource &mr, std::index_sequence< I, Is... >) |
Helper function recursive node. | |
template<typename T , typename... Args> | |
std::enable_if_t<!std::is_array_v< T >, unique_obj_ptr< T > > | make_unique_obj (memory_resource &m, Args &&... a) |
Create a unique object pointer to a newly constructed object. | |
template<typename T > | |
std::enable_if_t< std::is_array_v< T > &&std::extent_v< T >==0, unique_obj_ptr< T > > | make_unique_obj (memory_resource &m, std::size_t n) |
Create a unique object pointer to an array of default-constructed objects. | |
template<typename T > | |
unique_alloc_ptr< T > | make_unique_alloc (memory_resource &m) |
Create a unique allocation pointer to a type. | |
template<typename T > | |
unique_alloc_ptr< T > | make_unique_alloc (memory_resource &m, std::size_t n) |
Create a unique allocation pointer to an array type. | |
template<typename T , typename C > | |
unique_alloc_ptr< T > | make_unique_alloc (memory_resource &m, const T *f, const C &c) |
Create a unique allocation pointer to a type, copying some existing data to it. | |
template<typename T , typename C > | |
unique_alloc_ptr< T > | make_unique_alloc (memory_resource &m, std::size_t n, const std::remove_extent_t< T > *f, const C &c) |
Create a unique allocation pointer to an array type, copying some existing data to it. | |
Variables | |
template<std::size_t I> | |
reference | |
template<std::size_t I> | |
const_reference | |
Utility functions for @c vecmem::tuple | |
template<std::size_t I, class T > | |
using | tuple_element_t = typename tuple_element< I, T >::type |
Convenience accessor for the I-th element of a tuple. | |
template<std::size_t I, typename... Ts> | |
VECMEM_HOST_AND_DEVICE constexpr const auto & | get (const tuple< Ts... > &t) noexcept |
Get a constant element out of a tuple. | |
template<std::size_t I, typename... Ts> | |
VECMEM_HOST_AND_DEVICE constexpr auto & | get (tuple< Ts... > &t) noexcept |
Get a non-constant element out of a tuple. | |
template<typename... Ts> | |
VECMEM_HOST_AND_DEVICE constexpr tuple< Ts &... > | tie (Ts &... args) |
Tie references to existing objects, into a tuple. | |
template<class... Ts> | |
VECMEM_HOST_AND_DEVICE constexpr tuple< typename std::decay< Ts >::type... > | make_tuple (Ts &&... args) |
Make a tuple with automatic type deduction. | |
Main namespace for the vecmem classes/functions.
Helpers for explicit calls to the SYCL atomic functions.
Namespace for the types serving as base classes for an SoA event data model.
Public classes and functions that are not language/backend specific, are generally placed in this namespace.
vecmem::data
Alias type for jagged vectors with our polymorphic allocator.
This type serves as an alias for a common type pattern, namely a host-accessible vector of vectors with a memory resource which is not known at compile time, which could be host memory or shared memory.
using vecmem::tuple_element_t = typedef typename tuple_element<I, T>::type |
Convenience accessor for the I-th element of a tuple.
T | The type of the tuple to investigate |
I | Index of the element to get the type of |
using vecmem::unique_alloc_ptr = typedef std::unique_ptr<T, details::unique_alloc_deleter<T> > |
A unique pointer type for trivial types.
This type alias serves as a unique pointer to some trivial object(s). When the pointer goes out of scope, the pointee is automatically deallocated, but NOT deleted.
T | The type of the object stored. |
using vecmem::unique_obj_ptr = typedef std::unique_ptr<T, details::unique_obj_deleter<T> > |
A unique pointer type for non-trivial objects.
This type alias serves as a unique pointer to some non-trivial object(s). When the pointer goes out of scope, the pointee is automatically deallocated and deleted.
T | The type of the object stored. |
using vecmem::vector = typedef std::vector<T, vecmem::polymorphic_allocator<T> > |
Alias type for vectors with our polymorphic allocator.
This type serves as an alias for a common type pattern, namely a host-accessible vector with a memory resource which is not known at compile time, which could be host memory or shared memory.
|
inlineconstexprnoexcept |
Get a constant element out of a tuple.
I | The index of the element to get |
...Ts | The types held by the tuple |
t | The tuple to get the element from |
|
inlineconstexprnoexcept |
Get a non-constant element out of a tuple.
I | The index of the element to get |
...Ts | The types held by the tuple |
t | The tuple to get the element from |
VECMEM_HOST edm::view< edm::details::add_const_t< edm::schema< VARTYPES... > > > vecmem::get_data | ( | const edm::buffer< edm::schema< VARTYPES... > > & | buffer | ) |
Helper function for getting a (const) view for a buffer.
...VARTYPES | The variable types describing the container |
buffer | The buffer to get a view for |
VECMEM_HOST edm::view< edm::details::add_const_t< edm::schema< VARTYPES... > > > vecmem::get_data | ( | const edm::data< edm::schema< VARTYPES... > > & | data | ) |
Helper function for getting a (const) view of a data object.
...VARTYPES | The variable types describing the container |
data | The data object to get a view for |
VECMEM_HOST edm::data< edm::details::add_const_t< edm::schema< VARTYPES... > > > vecmem::get_data | ( | const edm::host< edm::schema< VARTYPES... >, INTERFACE > & | host, |
memory_resource * | resource = nullptr |
||
) |
Helper function for getting a (const) data object for a host container.
...VARTYPES | The variable types describing the container |
host | The host container to get a data object for |
resource | The memory resource to use for any allocation(s) |
VECMEM_HOST edm::view< edm::schema< VARTYPES... > > vecmem::get_data | ( | edm::buffer< edm::schema< VARTYPES... > > & | buffer | ) |
Helper function for getting a (possibly non-const) view for a buffer.
...VARTYPES | The variable types describing the container |
buffer | The buffer to get a view for |
VECMEM_HOST edm::view< edm::schema< VARTYPES... > > & vecmem::get_data | ( | edm::data< edm::schema< VARTYPES... > > & | data | ) |
Helper function for getting a (possibly non-const) view of a data object.
...VARTYPES | The variable types describing the container |
data | The data object to get a view for |
VECMEM_HOST edm::data< edm::schema< VARTYPES... > > vecmem::get_data | ( | edm::host< edm::schema< VARTYPES... >, INTERFACE > & | host, |
memory_resource * | resource = nullptr |
||
) |
Helper function for getting a (non-const) data object for a host container.
...VARTYPES | The variable types describing the container |
host | The host container to get a data object for |
resource | The memory resource to use for any allocation(s) |
|
inlineconstexpr |
Make a tuple with automatic type deduction.
...Ts | Types deduced for the resulting tuple |
args | Values to make a tuple out of |
unique_alloc_ptr< T > vecmem::make_unique_alloc | ( | memory_resource & | m | ) |
Create a unique allocation pointer to a type.
This function creates a unique allocation pointer to an allocation, which means that the memory is only deallocated, not deconstructed, when it goes out of scope.
T | The type to allocate. |
m | The memory resource to use. |
Create a unique allocation pointer to a type, copying some existing data to it.
This function creates a unique allocation pointer to an allocation, which means that the memory is only deallocated, not deconstructed, when it goes out of scope.
Also, this method copies data from a host-accessible pointer to the allocated memory via some copy helper.
T | The type to allocate. |
C | The copy helper, which must have a method with the signature of void operator()(T* dst, T* src, std::size_t bytes) . |
m | The memory resource to use. |
f | The host-accessible pointer to copy from. |
c | The copy helper callable object. |
unique_alloc_ptr< T > vecmem::make_unique_alloc | ( | memory_resource & | m, |
std::size_t | n | ||
) |
Create a unique allocation pointer to an array type.
This function creates a unique allocation pointer to an allocation of an array type of trivial objects, which is deallocated but not deleted when the pointer goes out of scope.
T | The type to allocate. |
m | The memory resource to use. |
n | The number of elements to allocate. |
unique_alloc_ptr< T > vecmem::make_unique_alloc | ( | memory_resource & | m, |
std::size_t | n, | ||
const std::remove_extent_t< T > * | f, | ||
const C & | c | ||
) |
Create a unique allocation pointer to an array type, copying some existing data to it.
This function creates a unique allocation pointer to an allocation of an array type of trivial objects, which is deallocated but not deleted when the pointer goes out of scope.
Also, this method copies data from a host-accessible pointer to the allocated memory via some copy helper.
T | The type to allocate. |
C | The copy helper, which must have a method with the signature of void operator()(T* dst, T* src, std::size_t bytes) . |
m | The memory resource to use. |
n | The number of elements to allocate. |
f | The host-accessible pointer to copy from. |
c | The copy helper callable object. |
std::enable_if_t<!std::is_array_v< T >, unique_obj_ptr< T > > vecmem::make_unique_obj | ( | memory_resource & | m, |
Args &&... | a | ||
) |
Create a unique object pointer to a newly constructed object.
This is the vecmem analogue to std::make_unique<T>(Args...). That is to say, it allocates memory for, and then constructs, a single object. The construction uses the arguments passed to this function.
T | The type to allocate. |
Args | The argument types to pass to the constructor. |
m | The memory resource to use. |
a | The arguments to pass to the constructor. |
std::enable_if_t< std::is_array_v< T > &&std::extent_v< T >==0, unique_obj_ptr< T > > vecmem::make_unique_obj | ( | memory_resource & | m, |
std::size_t | n | ||
) |
Create a unique object pointer to an array of default-constructed objects.
This is the vecmem analogue of std::make_unique<T>(std::size_t). That is to say, it allocates an array of compile-time-unknown bounds, where the size is given by the argument. The objects are all default-constructed.
T | The type to allocate. |
m | The memory resource to use. |
n | The number of elements to allocate. |
|
inlineconstexpr |
Tie references to existing objects, into a tuple.
...Ts | Types to refer to with the resulting tuple |
...args | References to the objects that the tuple should point to |
vecmem::const_reference |
vecmem::reference |