PSTL Distributed Container Classes

Distributed containers are data structures whose elements are distributed across several contexts. There are seven distributed containers in the PSTL. These mirror the containers in the basic STL. Three of the containers are sequence containers, which store elements in a sequential order. The other four are associative containers. Elements are ordered by a key, which can also be used to retrieve elements from the container.

As described in the section on parallel iterators, each container provides a local and global view through iterators which access local and global elements. Iterators for the sequence containers traverse elements in sequence while associative container iterators traverse in the order of the element keys.

The PSTL containers use irregular block distribution across contexts. Each context is assigned a unique ID and contexts are ordered by these IDs when determining placement of element blocks. The elements in a particular context form a contiguous segment of the container's element iteration space.

The distribution itself is specified using a ContainerRatio object, which may be modified during execution. This object contains information about the proportion of the total elements to be assigned to each context. If no ratio object is specified for a container, block distribution is used -- elements are divided evenly among the contexts, with any extra elements assigned to the last context. The creation of a distributed container and the manipulation of its ratio object are collective operations. The ratio object must be identical in each context.

The PSTL containers are dynamic -- the size will vary as elements are inserted and/or deleted. For this reason, the distribution of elements in a container is only guaranteed to comply with its ratio object after either container construction or invocation of the redistribute method on the container or its ratio object. This compliance remains in effect until the first operation which modifies the size of the container or until the ratio object itself is changed or replaced.

Containers may share a ratio object. Invoking redistribute on the ratio object redistributes all containers which share that object. Invoking redistribute on the container itself only redistributes that container's elements; the other containers which share the ratio object remain unchanged. Note also that the containers need not be of the same type in order to share a ratio object. A distributed_vector, for example, may share a ratio object with a distributed_list.

Last modified: Thu Feb 4 17:05:37 EST 1999