1.3. Data Declaration

Parallaxis differentiates between scalar and vector variables in data declarations as well as in procedure parameters and results. Scalar data is placed on the control processor, while vectors are distributed component-wise among the virtual PEs (see Figure 5, here configurations are not connected). Since a program may contain several PE configurations with different numbers of PEs, the name of a configuration is used for specifying the vector type of a variable.
VAR  a: INTEGER;       (* scalar *)
     b: grid OF REAL;  (* vector *)
     c: tree OF CHAR;  (* vector *)

Figure 5 Allocation of scalar and vector data

Unfortunately, this declaration semantics has some unpleasant effect for procedure arguments. Imagine, e.g. writing a function factorial, for computing the factorial value for an argument of type INTEGER. Now, a factorial function would have to be declared for scalar arguments, and for every configuration defined in a program. Since there is no way of knowing them in advance, it would be impossible to write general library routines. To remedy this situation, parameters and variable declarations inside such a procedure may use the keyword VECTOR instead of a particular configuration name. This indicates that a parameter will be used in a parallel computation, without specifying a particular configuration (this results in a generic procedure). All parameters declared as generic vectors or variables in such a procedure have to belong to the same configuration. Since no particular configuration has been specified, no data exchange may be performed in such a procedure.

PROCEDURE s_factorial(a: INTEGER): INTEGER; 
VAR b: INTEGER;                    (* scalar *) 
	... 
END s_factorial;
PROCEDURE v_factorial(a: VECTOR OF INTEGER): VECTOR OF INTEGER; 
VAR b: VECTOR OF INTEGER;          (* any vector *) 
	... 
END v_factorial;


[ Previous Page | Table of Contents | Next Page ]