Parallel array container.Parallel sequence container with fixed size. By default, its GID type is a std::size_t, which represents the position of values in the array. More...
Public Member Functions | |
std::enable_if<(is_distribution_view< DistSpecView >::value||detail::has_is_composed_dist_spec< DistSpecView >::value) &&is_view_based< partition_type >::value &&is_view_based< mapper_type >::value >::type | redistribute (DistSpecView const &dist_view) |
Redistribute the data stored in the container to match the distribution specified by the distribution view provided. More... | |
std::enable_if<(is_distribution_view< DistSpecView >::value||detail::has_is_composed_dist_spec< DistSpecView >::value) &&is_view_based< partition_type >::value &&is_view_based< mapper_type >::value >::type | redistribute (DistSpecView const *dist_view) |
Redistribute the data stored in the container to match the distribution specified by the distribution view provided. More... | |
void | destroy (void) |
Used as a target method for rmis implementing one-sided destruction, as a pointer to member variable referring to the destructor cannot be initialized, per the standard. Used when container is an element of another container. | |
size_t | get_num_locations (void) const |
location_type | get_location_id (void) const |
boost::shared_ptr< array< T, OptionalParams... > > | shared_from_this () |
Constructors | |
array (void) | |
Create an array with size 0. Initially places the array in an unusable state. Should be used in conjunction with array::resize. | |
array (size_type n) | |
Create an array with a given size and default construct all elements. More... | |
array (size_type n, value_type const &default_value) | |
Create an array with a given size and construct all elements with a default value. More... | |
array (size_type n, mapper_type const &mapper) | |
Create an array with a given size and instance of mapper. More... | |
array (partition_type const &ps) | |
Create an array with a given instance of partition. More... | |
array (partition_type const &ps, value_type const &default_value) | |
Create an array with a given instance of partition and construct all elements with a default value. More... | |
array (partition_type const &partitioner, mapper_type const &mapper) | |
Create an array with a given partitioner and a mapper. More... | |
template<typename DistSpecView > | |
array (DistSpecView const &dist_view, typename std::enable_if< is_distribution_view< DistSpecView >::value &&!detail::has_is_composed_dist_spec< DistSpecView >::value >::type *=0) | |
Create an array with a distribution that is specified by the dist_view provided. More... | |
template<typename DistSpecView > | |
array (DistSpecView const &dist_view, value_type const &default_value, typename std::enable_if< is_distribution_view< DistSpecView >::value &&!detail::has_is_composed_dist_spec< DistSpecView >::value >::type *=0) | |
Create an array with a distribution that is specified by the dist_view provided, and initialize all elements to default_value . More... | |
template<typename PartitionContainer > | |
array (PartitionContainer const &part_cont, typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type *=0) | |
Create an array with an arbitrary distribution that is specified by the elements of the part_cont provided, which are instances of arbitrary_partition_info. More... | |
template<typename PartitionContainer > | |
array (PartitionContainer const &part_cont, value_type const &default_value, typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type *=0) | |
Create an array with an arbitrary distribution that is specified by the elements of the part_cont provided, which are instances of arbitrary_partition_info. All elements are initialized to default_value . More... | |
template<typename DP > | |
array (size_type n, value_type const &default_value, DP const &dis_policy) | |
Create an array with a given size and default value where the value type of the container is itself a parallel container. More... | |
template<typename X , typename Y > | |
array (boost::tuples::cons< X, Y > dims) | |
Create an array of arrays with given n-dimensional size. More... | |
template<typename X , typename Y , typename DP > | |
array (boost::tuples::cons< X, Y > dims, DP const &dis_policy) | |
Create an array of arrays with given n-dimensional size. More... | |
template<typename SizesView > | |
array (SizesView const &sizes_view, typename std::enable_if< std::is_same< size_type, typename SizesView::size_type >::value &&!is_distribution_view< SizesView >::value &&!std::is_same< typename SizesView::value_type, arbitrary_partition_info >::value &&!detail::has_is_composed_dist_spec< SizesView >::value >::type *=0) | |
Constructor for composed containers. For an m level composed container, sizes_view is an m-1 level composed view representing the sizes of the nested containers. | |
template<typename ComposedSpec > | |
array (ComposedSpec const &comp_spec, typename std::enable_if< detail::has_is_composed_dist_spec< ComposedSpec >::value >::type *=0) | |
Constructor for composed containers. For an m level composed container, comp_spec contains specifications of the distributions of the current container and each of its elements. More... | |
template<typename DistSpecView > | |
array (std::vector< DistSpecView > const &dist_specs, typename std::enable_if< is_distribution_view< DistSpecView >::value &&!detail::has_is_composed_dist_spec< DistSpecView >::value >::type *=0) | |
Constructor for composed containers. For an m level composed container, dist_specs contains specifications of the distributions to be used at each level of the composed container. More... | |
Element Manipulation | |
reference | operator[] (index_type idx) |
Construct a reference to a specific index of the array. More... | |
const_reference | operator[] (index_type idx) const |
Construct a const_reference to a specific index of the array. More... | |
reference | front () |
Construct a reference to the first element of the array. More... | |
const_reference | front () const |
Construct a const_reference to the first element of the array. More... | |
reference | back () |
Construct a reference to the last element of the array. More... | |
const_reference | back () const |
Construct a const_reference to the last element of the array. More... | |
reference | make_reference (index_type const &idx) |
Construct a reference to a specific index of the array. More... | |
const_reference | make_reference (index_type const &idx) const |
Construct a const_reference to a specific index of the array. More... | |
iterator | make_iterator (gid_type const &gid) |
Construct an iterator to a specific index of the array. More... | |
const_iterator | make_const_iterator (gid_type const &gid) const |
Construct a const_iterator to a specific index of the array. More... | |
iterator | begin (void) |
Construct an iterator to the beginning of the array. More... | |
const_iterator | begin (void) const |
Construct a const_iterator to the beginning of the array. More... | |
const_iterator | cbegin (void) const |
Construct a const_iterator to the beginning of the array. More... | |
iterator | end (void) |
Construct an iterator to one past the end of the array. More... | |
const_iterator | end (void) const |
Construct a const_iterator to one past the end of the array. More... | |
const_iterator | cend (void) const |
Construct a const_iterator to one past the end of the array. More... | |
Memory and Domain Management | |
domain_type | domain (void) const |
void | resize (size_type n) |
Destroy the distribution of the container (including all of its elements) and recreate the container with a different size. More... | |
Element Manipulation | |
void | set_element (index_type const &idx, value_type const &val) |
Sets the element specified by the index to the provided value. More... | |
void | set_elements (index_type const &idx, View &&vals) |
Sets a range of elements starting with a given index to a sequence of provided values. More... | |
value_type | get_element (index_type const &idx) const |
Returns the value of the element specified by the index. More... | |
future< value_type > | get_element_split (index_type const &idx) |
Returns a stapl::future holding the value of the element specified by the index. More... | |
void | apply_set (gid_type const &gid, F const &f) |
Applies a function f to the element specified by the GID. More... | |
F::result_type | apply_get (gid_type const &gid, F const &f) |
Applies a function f to the element specified by the GID, and returns the result. More... | |
F::result_type | apply_get (gid_type const &gid, F const &f) const |
Applies a function f to the element specified by the GID, and returns the result. More... | |
Public Types | |
typedef T | value_type |
typedef index_type | gid_type |
typedef metadata::static_container_extractor< distribution_type > | loc_dist_metadata |
Metadata extractor type used for coarsening. | |
typedef mapper_type::domain_type | map_dom_t |
Domain used by the mapper. | |
typedef partition_type::value_type | part_dom_t |
Type of the subdomains produced by the partition. | |
typedef container_traits< array< T, OptionalParams... > >::template construct_distribution< array< T, OptionalParams... > >::type | distribution_type |
typedef size_t | size_type |
Protected Attributes | |
domain_type | m_domain |
Domain of the array. | |
Memory and Domain Management | |
void | migrate (gid_type const &gid, location_type destination) |
Migrates the element specified by the gid to the destination location. More... | |
size_type | size (void) const |
Return the number of elements in the container. More... | |
bool | empty (void) const |
distribution_type & | distribution (void) |
distribution_type const & | distribution (void) const |
distribution_type * | get_distribution (void) |
locality_info | locality (gid_type gid) |
Return locality information about the element specified by the gid. More... | |
bool | is_local (Indices const &... i) const |
Returns true if the element specified by the GID formed from the index components provided is stored on this location, or false otherwise. | |
rmi_handle::reference | get_rmi_handle_reference (void) |
std::shared_ptr< DistSpecView > | get_spec (DistSpecView const &dist_view, typename std::enable_if< !detail::has_is_composed_dist_spec< DistSpecView >::value >::type *=0) |
Return a shared_ptr to the distribution specification for this container instance. More... | |
std::shared_ptr< typename ComposedSpec::distribution_spec > | get_spec (ComposedSpec const &dist_view, typename std::enable_if< detail::has_is_composed_dist_spec< ComposedSpec >::value >::type *=0) |
Return a shared_ptr to the distribution specification for this container instance that is part of a composed container instantiation. More... | |
Parallel array container.
Parallel sequence container with fixed size. By default, its GID type is a std::size_t, which represents the position of values in the array.
T | Type of the stored elements in the container. T must be default assignable, copyable and assignable. |
PS | Partition strategy that defines how to partition the original domain into subdomains. The default partition is balanced_partition. |
M | Mapper that defines how to map the subdomains produced by the partition to locations. The default mapper is mapper. |
Traits | A traits class that defines customizable components of array, such as the domain type and base container type. The default traits class is array_traits. |
stapl::array< T, OptionalParams >::array | ( | size_type | n | ) |
Create an array with a given size and default construct all elements.
n | The size of the array |
stapl::array< T, OptionalParams >::array | ( | size_type | n, |
value_type const & | default_value | ||
) |
Create an array with a given size and construct all elements with a default value.
n | The size of the array |
default_value | The initial value of the elements in the container |
stapl::array< T, OptionalParams >::array | ( | size_type | n, |
mapper_type const & | mapper | ||
) |
Create an array with a given size and instance of mapper.
n | The size of the array |
mapper | An instance of a mapper to use for distribution |
stapl::array< T, OptionalParams >::array | ( | partition_type const & | ps | ) |
Create an array with a given instance of partition.
ps | An instance of a partition to use for distribution |
stapl::array< T, OptionalParams >::array | ( | partition_type const & | ps, |
value_type const & | default_value | ||
) |
Create an array with a given instance of partition and construct all elements with a default value.
ps | An instance of a partition to use for distribution |
default_value | The initial value of the elements in the container |
stapl::array< T, OptionalParams >::array | ( | partition_type const & | partitioner, |
mapper_type const & | mapper | ||
) |
Create an array with a given partitioner and a mapper.
partitioner | An instance of the partitioner to use for the distribution. |
mapper | An instance of the mapper to use for the distribution. |
stapl::array< T, OptionalParams >::array | ( | DistSpecView const & | dist_view, |
typename std::enable_if< is_distribution_view< DistSpecView >::value &&!detail::has_is_composed_dist_spec< DistSpecView >::value >::type * | = 0 |
||
) |
Create an array with a distribution that is specified by the dist_view
provided.
dist_view | view that specifies the mapping of container GIDs to partition ids, and partition ids to location ids. |
Distribution Specifications contains a set of functions to create views for common data distributions.
stapl::array< T, OptionalParams >::array | ( | DistSpecView const & | dist_view, |
value_type const & | default_value, | ||
typename std::enable_if< is_distribution_view< DistSpecView >::value &&!detail::has_is_composed_dist_spec< DistSpecView >::value >::type * | = 0 |
||
) |
Create an array with a distribution that is specified by the dist_view
provided, and initialize all elements to default_value
.
dist_view | view that specifies the mapping of container GIDs to partition ids, and partition ids to location ids. |
default_value | value to assign to each element in the container. |
Distribution Specifications contains a set of functions to create views for common data distributions.
stapl::array< T, OptionalParams >::array | ( | PartitionContainer const & | part_cont, |
typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type * | = 0 |
||
) |
Create an array with an arbitrary distribution that is specified by the elements of the part_cont
provided, which are instances of arbitrary_partition_info.
part_cont | container of elements that specify the arbitrary mapping of gids to partition ids and location ids. |
stapl::array< T, OptionalParams >::array | ( | PartitionContainer const & | part_cont, |
value_type const & | default_value, | ||
typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type * | = 0 |
||
) |
Create an array with an arbitrary distribution that is specified by the elements of the part_cont
provided, which are instances of arbitrary_partition_info. All elements are initialized to default_value
.
part_cont | container of elements that specify the arbitrary mapping of gids to partition ids and location ids. |
default_value | value to assign to each element in the container. |
stapl::array< T, OptionalParams >::array | ( | size_type | n, |
value_type const & | default_value, | ||
DP const & | dis_policy | ||
) |
Create an array with a given size and default value where the value type of the container is itself a parallel container.
n | The size of the array |
default_value | The initial value of the elements in the container |
dis_policy | A distribution policy that specifies how to distribute the nested containers, in the context of containers of containers. |
stapl::array< T, OptionalParams >::array | ( | boost::tuples::cons< X, Y > | dims | ) |
Create an array of arrays with given n-dimensional size.
dims | A cons list specifying the dimensions of the containers. |
stapl::array< T, OptionalParams >::array | ( | boost::tuples::cons< X, Y > | dims, |
DP const & | dis_policy | ||
) |
Create an array of arrays with given n-dimensional size.
dims | A cons list specifying the dimensions of the containers. |
dis_policy | A distribution policy that specifies how to distribute the nested containers. |
stapl::array< T, OptionalParams >::array | ( | ComposedSpec const & | comp_spec, |
typename std::enable_if< detail::has_is_composed_dist_spec< ComposedSpec >::value >::type * | = 0 |
||
) |
Constructor for composed containers. For an m level composed container, comp_spec
contains specifications of the distributions of the current container and each of its elements.
The specification of the current container's distribution is accessed by calling the spec()
method, while the distribution specification of an element is accessed via operator
[].
comp_spec | Instance of composed_dist_spec representing the distribution specifications for each nested container. |
stapl::array< T, OptionalParams >::array | ( | std::vector< DistSpecView > const & | dist_specs, |
typename std::enable_if< is_distribution_view< DistSpecView >::value &&!detail::has_is_composed_dist_spec< DistSpecView >::value >::type * | = 0 |
||
) |
Constructor for composed containers. For an m level composed container, dist_specs
contains specifications of the distributions to be used at each level of the composed container.
The first element of the vector specifies the distribution of the outer container, the second the distribution of the containers at the first level of composition, etc. The number of elements in dist_specs
must be at least the same as the number of levels of container composition.
The result of the constructor is a container composition where the size and distribution of the container elements at a given level of the composition are the same.
dist_specs | distribution specifications that are used to construct the nested containers at a given level of the composition. |
reference stapl::array< T, OptionalParams >::operator[] | ( | index_type | idx | ) |
Construct a reference to a specific index of the array.
idx | The index for which to create the reference |
const_reference stapl::array< T, OptionalParams >::operator[] | ( | index_type | idx | ) | const |
Construct a const_reference to a specific index of the array.
idx | The index for which to create the reference |
reference stapl::array< T, OptionalParams >::front | ( | ) |
Construct a reference to the first element of the array.
const_reference stapl::array< T, OptionalParams >::front | ( | ) | const |
Construct a const_reference to the first element of the array.
reference stapl::array< T, OptionalParams >::back | ( | ) |
Construct a reference to the last element of the array.
const_reference stapl::array< T, OptionalParams >::back | ( | ) | const |
Construct a const_reference to the last element of the array.
reference stapl::array< T, OptionalParams >::make_reference | ( | index_type const & | idx | ) |
Construct a reference to a specific index of the array.
idx | The index for which to create the reference |
const_reference stapl::array< T, OptionalParams >::make_reference | ( | index_type const & | idx | ) | const |
Construct a const_reference to a specific index of the array.
idx | The index for which to create the reference |
iterator stapl::array< T, OptionalParams >::make_iterator | ( | gid_type const & | gid | ) |
Construct an iterator to a specific index of the array.
gid | The index for which to create the iterator |
const_iterator stapl::array< T, OptionalParams >::make_const_iterator | ( | gid_type const & | gid | ) | const |
Construct a const_iterator to a specific index of the array.
gid | The index for which to create the const_iterator |
iterator stapl::array< T, OptionalParams >::begin | ( | void | ) |
Construct an iterator to the beginning of the array.
const_iterator stapl::array< T, OptionalParams >::begin | ( | void | ) | const |
Construct a const_iterator to the beginning of the array.
const_iterator stapl::array< T, OptionalParams >::cbegin | ( | void | ) | const |
Construct a const_iterator to the beginning of the array.
iterator stapl::array< T, OptionalParams >::end | ( | void | ) |
Construct an iterator to one past the end of the array.
const_iterator stapl::array< T, OptionalParams >::end | ( | void | ) | const |
Construct a const_iterator to one past the end of the array.
const_iterator stapl::array< T, OptionalParams >::cend | ( | void | ) | const |
Construct a const_iterator to one past the end of the array.
void stapl::array< T, OptionalParams >::resize | ( | size_type | n | ) |
Destroy the distribution of the container (including all of its elements) and recreate the container with a different size.
n | The new size of the array. |
|
inherited |
Redistribute the data stored in the container to match the distribution specified by the distribution view provided.
dist_view | View-based specification of the desired distribution. |
|
inherited |
Redistribute the data stored in the container to match the distribution specified by the distribution view provided.
dist_view | View-based specification of the desired distribution. |
This function is invoked from the proxy when nested containers are being redistributed.
|
inherited |
Sets the element specified by the index to the provided value.
idx | GID of the element to be set. |
val | The new value of the element. |
|
inherited |
Sets a range of elements starting with a given index to a sequence of provided values.
idx | GID of start of element range to be set. |
vals | The new values to be assigned to the element range. |
|
inherited |
Returns the value of the element specified by the index.
idx | GID of the element to be retrieved. |
|
inherited |
Returns a stapl::future holding the value of the element specified by the index.
idx | GID of the element to be set. |
|
inherited |
Applies a function f to the element specified by the GID.
gid | The GID of the element. |
f | The Functor to apply on the element. |
|
inherited |
Applies a function f to the element specified by the GID, and returns the result.
gid | The GID of the element. |
f | The Functor to apply on the element. |
|
inherited |
Applies a function f to the element specified by the GID, and returns the result.
gid | The GID of the element. |
f | The Functor to apply on the element. |
|
inherited |
Migrates the element specified by the gid to the destination location.
gid | GID of the element to be migrated. |
destination | Id of the location where the element is to be migrated. |
|
inherited |
Return the number of elements in the container.
This method is one-sided, If other locations may be concurrently performing operations that change their local size and the effects are desired to be observed in a deterministic way, then appropriate synchronization, e.g. a fence, may be required before or after the call to size, to enforce appropriate ordering.
|
inherited |
Return locality information about the element specified by the gid.
|
protectedinherited |
Return a shared_ptr to the distribution specification for this container instance.
This function is called by redistribute when the distribution specification provided is for a single container instance instead of a collection of composed container instance.
dist_view | Instantiation of distribution_spec that describes the target distribution for redistribute |
|
protectedinherited |
Return a shared_ptr to the distribution specification for this container instance that is part of a composed container instantiation.
This function is called by redistribute when the distribution specification provided is for all container instances of a composed container.
dist_view | Instantiation of composed_dist_spec that describes the target distributions for redistribute for all container instances in a composed container |