Thread environment classes provide a simple, portable mechanism for a limited form of parallelism. However, a more important abstraction is based on a structure called a concurrent aggregate, or collection.
The motivation is to describe a structure that defines a set of objects of some given type that can be distributed over the memory modules of a parallel system.
The way in which elements of a collection are distributed over processors is determined by a two-step mechanism similar to HPFF Fortran. In the first step, collection elements are mapped to a logical coordinate system. This first mapping is called an alignment and it is defined by an Align class object. A Distribution class object defines the logical coordinate system and the way in which it is mapped to Processors object threads.
The declaration of a collection is specified by a collection type name followed by a type name of the element objects enclosed in angle brackets. The arguments for the three constructors define these collections in terms of alignment and distribution objects.
collection-name < element-name > object( constructor arguments )For example, suppose we want to create a matrix, A, and two vectors, X and Y, of complex numbers and want to distribute them over processors of a parallel machine. Given a C++ class for complex numbers, Complex, we can build distributed matrix and vector collections by using the pC++ library collection classes DistributedMatrix and DistributedVector as follows:
DistributedMatrix<Complex> A(...constructor arguments ...); DistributedVector<Complex> X(...constructor arguments ...); DistributedVector<Complex> Y(...constructor arguments ...);