Next: Thread Parallelism Up: Parallelism with Collection: Previous: Parallelism with Collection:

Method of Element Parallelism

Let E be a class as shown below.

class E{
     float a, b, c;
     void f(int);
     float g(float h);
Let C be a collection where these same fields declared as virtual members in the collection.

Collection C: ... {
     virtual float a, b, c;
     virtual void f(int);
     virtual float g(float h);

In the case of MethodOfElement fields, the keyword ``virtual'' means that these will be supplied by the element class. We apologize for the slight twist of the usual C++ meaning. Note: In version 1.0 the declaration of these fields as virtual in the MethodOfElement section of the collection is required. However, this will not be required in version 2.0.

Suppose one has a collection defined in terms of these components and a pointer to a collection of the same type as shown below.

    C < E >  X( .... );
    C < E >  *p = X;

The simplest form of parallelism is to invoke a member function on each element of the collection as in in the expressions below.

These operations may be called from the main thread of computation or from the Processors object threads provided that each processors object representative makes the same call.

Parallel operations on element fields are also allowed as long as the operation is well defined on the elements. For example

   X.a =  X.b + X.c - X.g(32.1)
The general rule is that if X is a collection of type C with distribution d and alignment a and if y is a member field of type T, then the expression X is of type C < T > with the same distribution and alignment.

NOTE: There is a bug in version 1.0. The expression X.g(X.a) is valid and means that the a field of the element is passed to the instance of the invocation of g(). However, the compiler currently rejects this construct. This will be fixed as soon as possible.

Member functions can be applied to vector subsets of a collection as shown below.

   p[ i : j : k].f();
   p[ i : j : k].a  = p[r : s : t].b + p[u: v: w].g(33.3);
Observe that a pointer to a collection is necessary to parse the expression. also, note that the extent and bounds of the operation are determined by the [...] operation on the left hand side of the assignment.

In version 1.0 it is not possible to have more than 1 dimensional vector sub-ranges. This problem will be addressed in version 2.0.

Next: Thread Parallelism Up: Parallelism with Collection: Previous: Parallelism with Collection:
Mon Nov 21 09:49:54 EST 1994