STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
Functions
Distribution Specifications

A collection of functions that create view-based specifications of common data distributions. More...

+ Collaboration diagram for Distribution Specifications:

Functions

distribution_spec stapl::block (unsigned long int n, unsigned long int block_size, level lvl=current_level)
 Construct the specification of a blocked distribution. More...
 
distribution_spec stapl::block (unsigned long int n, unsigned long int block_size, std::vector< location_type > const &locs)
 Construct the specification of a blocked distribution that will span a specific set of locations. More...
 
distribution_spec stapl::cyclic (unsigned long int n, level lvl=current_level)
 Construct the specification of a cyclic distribution. More...
 
distribution_spec stapl::cyclic (unsigned long int n, std::vector< location_type > const &locs)
 Construct the specification of a cyclic distribution that will span a specific set of locations. More...
 
distribution_spec stapl::block_cyclic (unsigned long int n, unsigned long int block_size, level lvl=current_level)
 Construct the specification of a block-cyclic distribution. More...
 
distribution_spec stapl::block_cyclic (unsigned long int n, unsigned long int block_size, std::vector< location_type > const &locs)
 Construct the specification of a block-cyclic distribution that will span a specific set of locations. More...
 
distribution_spec stapl::balance (unsigned long int n, level lvl=current_level)
 Construct the specification of a balanced distribution. More...
 
distribution_spec stapl::balance (unsigned long int n, std::vector< location_type > const &locs)
 Construct the specification of a balanced distribution that will span a specific set of locations. More...
 
template<typename GIDMapFunc , typename PIDMapFunc >
distribution_spec stapl::arbitrary (unsigned long int n, unsigned long int nparts, GIDMapFunc const &gid_to_pid, PIDMapFunc const &pid_to_lid, level lvl=current_level)
 Construct the specification of an arbitrary distribution. More...
 
template<typename Dom , typename GIDMapFunc , typename PIDMapFunc , typename >
distribution_spec< Dom > stapl::arbitrary (Dom const &dom, unsigned long int nparts, GIDMapFunc const &gid_to_pid, PIDMapFunc const &pid_to_lid, level lvl=current_level)
 Construct the specification of an arbitrary distribution. More...
 
template<typename GIDMapFunc , typename PIDMapFunc >
distribution_spec stapl::arbitrary (unsigned long int n, unsigned long int nparts, GIDMapFunc const &gid_to_pid, PIDMapFunc const &pid_to_lid, std::vector< location_type > const &locs)
 Construct the specification of an arbitrary distribution that will span a specific set of locations. More...
 
template<typename View >
distribution_spec stapl::arbitrary (View const &part_view, level lvl=current_level)
 Construct the specification of an arbitrary distribution. More...
 
template<typename View >
distribution_spec stapl::arbitrary (View const &part_view, std::vector< location_type > const &locs)
 Construct the specification of an arbitrary distribution that will span a specific set of locations. More...
 

Detailed Description

A collection of functions that create view-based specifications of common data distributions.

Function Documentation

◆ block() [1/2]

distribution_spec stapl::block ( unsigned long int  n,
unsigned long int  block_size,
level  lvl = current_level 
)

Construct the specification of a blocked distribution.

The GIDs will be blocked into partitions, and the partition ids are balanced across the locations.

Parameters
nNumber of elements in the data to be distributed
block_sizeNumber of elements in each partition
lvlTag indicating the level of the system hierarchy across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in a blocked distribution of GIDs.

◆ block() [2/2]

distribution_spec stapl::block ( unsigned long int  n,
unsigned long int  block_size,
std::vector< location_type > const &  locs 
)

Construct the specification of a blocked distribution that will span a specific set of locations.

The GIDs will be blocked into partitions, and the partition ids are balanced across the locations in the new communication group constructed over the locations specified from the parent communication group.

Parameters
nNumber of elements in the data to be distributed
block_sizeNumber of elements in each partition
locsExplicit specification of the locations across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in a blocked distribution of GIDs.

◆ cyclic() [1/2]

distribution_spec stapl::cyclic ( unsigned long int  n,
level  lvl = current_level 
)

Construct the specification of a cyclic distribution.

The GIDs will not be blocked. Each single-element partition will be mapped to a location in a round-robin manner beginning with location 0.

Parameters
nNumber of elements in the data to be distributed
lvlTag indicating the level of the system hierarchy across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in a cyclic distribution of GIDs.

◆ cyclic() [2/2]

distribution_spec stapl::cyclic ( unsigned long int  n,
std::vector< location_type > const &  locs 
)

Construct the specification of a cyclic distribution that will span a specific set of locations.

The GIDs will not be blocked. Each single-element partition will be mapped to a location in a round-robin manner beginning with location 0 in the new communication group constructed over the locations specified from the parent communication group.

Parameters
nNumber of elements in the data to be distributed
locsExplicit specification of the locations across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in a cyclic distribution of GIDs.

◆ block_cyclic() [1/2]

distribution_spec stapl::block_cyclic ( unsigned long int  n,
unsigned long int  block_size,
level  lvl = current_level 
)

Construct the specification of a block-cyclic distribution.

The GIDs will be mapped into partitions of size block_size. Each partition will be mapped to a location in a round-robin manner beginning with location 0.

Parameters
nNumber of elements in the data to be distributed
block_sizeNumber of elements in each partition
lvlTag indicating the level of the system hierarchy across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in a block-cyclic distribution of GIDs.

◆ block_cyclic() [2/2]

distribution_spec stapl::block_cyclic ( unsigned long int  n,
unsigned long int  block_size,
std::vector< location_type > const &  locs 
)

Construct the specification of a block-cyclic distribution that will span a specific set of locations.

The GIDs will be mapped into partitions of size block_size. Each partition will be mapped to a location in a round-robin manner beginning with location 0 in the new communication group constructed over the locations specified from the parent communication group.

Parameters
nNumber of elements in the data to be distributed
block_sizeNumber of elements in each partition
locsExplicit specification of the locations across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in a block-cyclic distribution of GIDs.

◆ balance() [1/2]

distribution_spec stapl::balance ( unsigned long int  n,
level  lvl = current_level 
)

Construct the specification of a balanced distribution.

The GIDs will be mapped into partitions of near even size. Each of the num_locs partitions will be mapped to a unique location beginning with location 0.

Parameters
nNumber of elements in the data to be distributed
lvlTag indicating the level of the system hierarchy across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in a balanced distribution of GIDs.

◆ balance() [2/2]

distribution_spec stapl::balance ( unsigned long int  n,
std::vector< location_type > const &  locs 
)

Construct the specification of a balanced distribution that will span a specific set of locations.

The GIDs will be mapped into partitions of near even size. Each of the num_locs partitions will be mapped to a unique location beginning with location 0 in the new communication group constructed over the locations specified from the parent communication group.

Parameters
nNumber of elements in the data to be distributed
locsExplicit specification of the locations across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in a balanced distribution of GIDs.

◆ arbitrary() [1/5]

template<typename GIDMapFunc , typename PIDMapFunc >
distribution_spec stapl::arbitrary ( unsigned long int  n,
unsigned long int  nparts,
GIDMapFunc const &  gid_to_pid,
PIDMapFunc const &  pid_to_lid,
level  lvl = current_level 
)

Construct the specification of an arbitrary distribution.

The mapping functions to map an element GID to a partition id and a partition id to a location id are function objects that have the appropriately defined function operators. Given a functor to map GIDS to partition ids of type GIDMap and a functor to map partition ids to location ids of type PIDMap the interfaces required are:

/// unsigned long int GIDMap::operator()(unsigned long int) const;
/// stapl::location_type PIDMap::operator()(unsigned long int) const;
/// 
Parameters
nNumber of elements in the data to be distributed
npartsNumber of partitions the elements are mapped to as part of the distribution process.
gid_to_pidFunctor mapping element GIDs to partition ids
pid_to_lidFunctor mapping partition ids to location ids
lvlTag indicating the level of the system hierarchy across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in the arbitrary distribution of GIDS specified by the mapping functions provided.

◆ arbitrary() [2/5]

template<typename Dom , typename GIDMapFunc , typename PIDMapFunc , typename >
distribution_spec< Dom > stapl::arbitrary ( Dom const &  dom,
unsigned long int  nparts,
GIDMapFunc const &  gid_to_pid,
PIDMapFunc const &  pid_to_lid,
level  lvl = current_level 
)

Construct the specification of an arbitrary distribution.

The mapping functions to map an element GID to a partition id and a partition id to a location id are function objects that have the appropriately defined function operators. Given a functor to map GIDS to partition ids of type GIDMap and a functor to map partition ids to location ids of type PIDMap the interfaces required are:

/// unsigned long int GIDMap::operator()(gid_type) const;
/// stapl::location_type PIDMap::operator()(unsigned long int) const;
/// 
Parameters
domThe domain used for the container.
npartsNumber of partitions the elements are mapped to as part of the distribution process.
gid_to_pidFunctor mapping element GIDs to partition ids
pid_to_lidFunctor mapping partition ids to location ids
lvlTag indicating the level of the system hierarchy across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in the arbitrary distribution of GIDS specified by the mapping functions provided.
Note
The enable_if is here to help the compiler differentiate with the arbitrary(unsigned long int n, unsigned long int nparts, ...) function

◆ arbitrary() [3/5]

template<typename GIDMapFunc , typename PIDMapFunc >
distribution_spec stapl::arbitrary ( unsigned long int  n,
unsigned long int  nparts,
GIDMapFunc const &  gid_to_pid,
PIDMapFunc const &  pid_to_lid,
std::vector< location_type > const &  locs 
)

Construct the specification of an arbitrary distribution that will span a specific set of locations.

The mapping functions to map an element GID to a partition id and a partition id to a location id are function objects that have the appropriately defined function operators. Given a functor to map GIDS to partition ids of type GIDMap and a functor to map partition ids to location ids of type PIDMap the interfaces required are:

/// unsigned long int GIDMap::operator()(unsigned long int) const;
/// stapl::location_type PIDMap::operator()(unsigned long int) const;
/// 

The locations to which the partitions will be mapped begin with location 0 in the new communication group constructed over the locations specified from the parent communication group.

Parameters
nNumber of elements in the data to be distributed
npartsNumber of partitions the elements are mapped to as part of the distribution process.
gid_to_pidFunctor mapping element GIDs to partition ids
pid_to_lidFunctor mapping partition ids to location ids
locsExplicit specification of the locations across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in the arbitrary distribution of GIDS specified by the mapping functions provided.

◆ arbitrary() [4/5]

template<typename View >
distribution_spec stapl::arbitrary ( View const &  part_view,
level  lvl = current_level 
)

Construct the specification of an arbitrary distribution.

Parameters
part_viewA view whose elements define the partitions of the distribution and the location to which each one is mapped.
lvlTag indicating the level of the system hierarchy across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in the arbitrary distribution of GIDs specified by the partition information provided.

Each element of the view can be an instance of arbitrary_partition_info. If another type is used the interface it must provide is: std::pair<unsigned long int, unsigned long int> domain(void) const; unsigned int location(void) const;

These methods provide the information needed to construct each partition in the container whose distribution is being specified. The partition id isn't explicitly provided. Instead the index of the element in the container is used as an implicit partition id.

◆ arbitrary() [5/5]

template<typename View >
distribution_spec stapl::arbitrary ( View const &  part_view,
std::vector< location_type > const &  locs 
)

Construct the specification of an arbitrary distribution that will span a specific set of locations.

Parameters
part_viewA view whose elements define the partitions of the distribution and the location to which each one is mapped.
locsExplicit specification of the locations across which the data will be distributed.
Returns
A read-only view with the domains and mapping functions that result in the arbitrary distribution of GIDs specified by the partition information provided.

Each element of the view can be an instance of arbitrary_partition_info. If another type is used the interface it must provide is: std::pair<unsigned long int, unsigned long int> domain(void) const; unsigned int location(void) const;

These methods provide the information needed to construct each partition in the container whose distribution is being specified. The partition id isn't explicitly provided. Instead the index of the element in the container is used as an implicit partition id.

The locations to which the partitions will be mapped begin with location 0 in the new communication group constructed over the locations specified from the parent communication group.