legate::experimental::stl::logical_store#
-
template<typename ElementType, std::int32_t Dim>
class logical_store# A multi-dimensional data container.
logical_store
is a multi-dimensional data container for fixed-size elements. Stores are internally partitioned and distributed across the system, but users need not specify the partitioning and distribution directly. Instead, Legate.STL automatically partitions and distributes stores based on how thelogical_store
object is used.logical_store
objects are value-like and are move-only. They are not immediately associated with a physical allocation. To access the data directly, users must ask for a view into the logical store. This will trigger the allocation of a physical store and the population of the physical memory, which is a blocking operation.- Template Parameters:
ElementType – The type of the elements of the store. The element type must be fixed size, and it must be one of the allowable Legate element types.
Dim – The number of dimensions in the logical store
Public Functions
-
template<std::size_t Rank>
inline explicit logical_store( - const std::size_t (&extents)[Rank]
Create a logical store of a given shape.
logical_store<int, 3> data{{ 10, 20, 30 }};
- Template Parameters:
Rank – The number of dimensions in the store.
- Parameters:
extents – The extents of the store.
- inline explicit logical_store(
- ::cuda::std::span<const std::size_t, Dim> extents
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
template<std::size_t Rank>
inline explicit logical_store( - const std::size_t (&extents)[Rank],
- ElementType value
Create a logical store of a given shape and fills it with a given value.
logical_store<int, 3> data{{ 10, 20, 30 }, 42};
- Template Parameters:
Rank – The number of dimensions in the store.
- Parameters:
extents – The extents of the store.
value – The value to fill the store with.
- inline explicit logical_store(
- ::cuda::std::span<const std::size_t, Dim> extents,
- ElementType value
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
inline logical_store(std::in_place_t, init_list_t il)#
Create a logical store from a
std::initializer_list
.For stores with two or more dimensions,
logical_store
objects can be initialized from aninitializer_list
as follows:logical_store<int, 2> data = { {1, 2, 3}, {4, 5, 6} };
For 1-dimensional stores, however, this syntax can get confused with the constructor that takes the shape of the store as a list of integers. So for 1-D stores, the first argument must be
std::in_place
as shown below:logical_store<int, 1> data{std::in_place, {1, 2, 3, 4, 5, 6}};
- Example:
stl::logical_store<int, 2> store = {{1, 2, 3}, {4, 5, 6}}; // store contains: // [[1 2 3] // [4 5 6]]
- Parameters:
il – The initializer list to create the store from. The type of
il
is a nestedstd::initializer_list
of the store’s element type.- Pre:
The initializer list must have the same dimensionality (as determined by list nesting depth) as the store.
-
logical_store(init_list_t il)#
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Note
This constructor is only available when the dimensionality of the store is greater than 1.
-
logical_store(logical_store&&) = default#
logical_store
is a move-only type.
Public Static Functions
-
static inline std::int32_t dim() noexcept#
Get the dimensionality of the store.
- Returns:
std::int32_t
- The number of dimensions in the store.