1.2. Multiple Configurations and Generic Connections

In addition to the constructs shown so far, the definition of multiple topologies in a program is possible. These may be defined independently of each other on separate groups of PEs - in which case the topologies may have different vector data structures. Or the topologies can be defined as `different views' of the same set of PEs with identical data structure. Furthermore, local topologies may be defined in procedures, thus allowing semi-dynamic connection structures.

Different configuration definitions denote different sets of PEs. For example, the following definition defines two distinct sets of PEs:

CONFIGURATION grid [1..200],[1..50]; 
... 
CONFIGURATION tree [1..10000];
On the other hand, configurations defined within the same declaration structure denote different views of the same set of PEs. In this case, the numbers of PEs have to be identical.
CONFIGURATION	grid [1..200],[1..50];
		tree [1..10000]; 
Connections may be specified between multiple configurations, whether they belong to the same or distinct sets of PEs:
CONFIGURATION	grid [0..199],[0..49];
		tree [1..10000]; 
CONNECTION mix:   grid[i,j] ->   tree[i*50 + j];
However, configurations only come to life, when they are used for the declaration of a vector variable, which is later used in a computation. A vector variable based on a configuration with multiple views can make use of all connection structures defined for any of the views. Such a variable is also assignment compatible to a variable of the same type but of a different view.

An extension to the definition of connections is the use of generic connection functions, as exemplified by the following alternative definition for a hypercube network of arbitrary size (the exponentiation function is denoted by `**', n is a constant):

CONFIGURATION hyper [0..2**n-1]; 
CONNECTION FOR k := 0 TO n-1 DO 
dir[k]: hyper[i] <->     {EVEN(i DIV 2**k)} 
                                hyper[i + 2**k] :dir[k]; 
			END;
If n equals 10, there are 1,024 PEs defined together with ten bi-directional connections. Expression EVEN(i DIV 2**k) tests, whether the k-th bit of i equals 0.

A large program may be split into several modules, which are compiled separately. So, e.g. for a module containing library functions, it may be desirable not to specify the size of a configuration. When writing routines for image processing, the size of the grid structure should be left unspecified and will be defined later by the module importing these routines. An open configuration is indicated by using an asterisk `*' instead of a value range. The configuration size may be determined dynamically at run time, e.g. by passing a parameter that is subsequently used as a bound in the configuration declaration.

CONFIGURATION open_grid [*],[*]; 
...
CONFIGURATION small_grid = open_grid [1..100],[1..100]; 
... 
PROCEDURE grid_proc (n: INTEGER); 
	CONFIGURATION my_grid = open_grid [1..n],[1..n]; 
	...
END grid_proc;


[ Previous Page | Table of Contents | Next Page ]