Download CuPit-2 | A Parallel Language for Neural Algorithms: Language

Transcript
13.3 Subscription and parallel variables
77
This macro is invoked in denition 106.
Selections pick an element of a structure type object (node, connection, network, or record) by name.
The selected element can be a data element (of a network, node, connection, or record), a node group or
node array (of a network), or an interface element (of a node).
13.3 Subscription and parallel variables
Data Object Access[111] f
111
Object:
Object '[' Expression ']' /
Object '[' ']'.
g
This macro is dened in denitions 109, 110, 111, and 112.
This macro is invoked in denition 106.
Subscriptions pick one or several elements of an array or group by position. To pick a single element, the
expression must have integral type. If the value of the expression is n, e.g. ME.nodes[n], the subscription
refers to the element of the array or group that has index n. The rst object of an array or group has index
0. To pick several elements at once, the expression must have Interval type, e.g. ME.nodes[3...5].
The object that is referred to by such a subscription is called a slice of the group or array and consists of
all elements whose index is contained in the interval. There is a special slice, called the all-slice containing
all objects of an array or group that is denoted by just using selection brackets without any expression
at all, e.g. ME.nodes[]. Slice subscriptions that contain indices of objects that are not existing in the
sliced object are automatically clipped to only the existing objects without producing an error.
As we have seen in the description of the object procedure calls, all parallelism in CuPit-2 is created by
operating on a multitude of objects. To describe this, the notion of a parallel variable is used: a parallel
variable is a multiple object that can induce parallelism; parallel variables are either multiple replicates
of a network, multiple nodes of a node array or group, or multiple connections attached to a connection
interface of a node.
Slice subscription is used to create parallel variables. In order to do this, connection interfaces and explicit
network variables are implicitly treated as groups . Given a network variable called net, a node group
(or array) called nodes and a connection interface called cons, we nd the following cases: In a global
subroutine, net[] and net[1...3] are parallel variables while net and net[3] are ordinary variables.
In a network subroutine ME.nodes[] and ME.nodes[3...5] are parallel variables while ME.nodes and
ME.nodes[3] are ordinary variables. In a node subroutine, ME.con[] is a parallel variable while ME.con
is an ordinary variable; actual subscription is not allowed for connection interfaces.
Parallel variables can be used for calls to object procedures (but not object functions, since that would
return a multitude of values). Further subscription is not allowed on parallel variables. Further selection
from a parallel variable creates a parallel variable selection . Such an object can be used only in REDUCTION
and WTA statements and in CONNECT and DISCONNECT statements. E.g. given a Real data element called
r in cons, in REDUCTION ME.cons[].r:sum INTO x the term ME.cons[] denotes a parallel variable of
connection type and ME.cons[].r is a parallel variable selection of Real type.
13.4 Connection addressing
Data Object Access[112] f
Object:
'{' Object '-->' Object '}'.
g
This macro is dened in denitions 109, 110, 111, and 112.
112