Next: Explicit repetition specification
Up: To repeat an algorithm
Previous: To repeat an algorithm
  Contents
In most cases, to repeat an algorithm definition, you should use the
implicit repetition specification. Create a reference
to a definition such that the number of elements of the type of each
input is an exact divisor (submultiple) of the number of elements of
the type of the corresponding output it is connected to, and
similarly, the number of elements of the type of each ouput is a
sub-multiple of the number of elements of the type of the
corresponding input it is connected to. The ratio between the number
of elements of each input (resp. output) and the number of elements
of the output (resp. input) it is connected to, gives the number of
repetitions; we call this situation a Fork-Join. WARNING: all the
ratios of the repeated definition must be the same, otherwise it is
not consistent. However, some inputs may have ratio one, whereas the
common ratio is greater than one, in this case the input is replicated
as much time as the common ratio; we call this situation Diffuse.
Similarly, some outputs may have ratio one, whereas the common ratio
is greater than one, in this case the output of the repetition i
becomes the input of the repetition i+1, and the definition must
have a corresponding input/output port, which SynDEx will use to
connect the successive repetitions; we call this situation Iterate.
The output of the last repetition is the output of the
repeated definition. Input/output port must be initialized.
Hence, the number of repetition applied to the definition is implicit,
it is calculated by SynDEx which will automatically repeat the
algorithm definition and create the corresponding expanded graph. The
repetition factor is displayed next to the name of the reference. It
is the expanded graph which will be taken into account during the
adequation and the code generation. The expansion will introduce new
vertices called explode and implode. The explode
vertex extracts for each repetition of a definition each element of
the data it receives, whereas the implode vertex builds the data
it sends by concatenating each separated element produced by each
repetition of the definition.
Suppose that you want to specify the
multiplication of a vector V by a scalar S giving a vector
W as result. You can specify it using the multiplication between
two scalars instead of defining a new multiplication between a vector
and a scalar. By the way, this allows you to specify more parallelism.
For example if the dimension of the vector is three, you may specify
the repetition by three multiplications between two reals giving a
real as a result, by referencing this definition and connecting one of
the two inputs to an output which is a vector of three real (V),
and the other input to an output of one real (S), and connecting
its output to an input which is a vector of three reals (W). The
common ratio is three, and one input has a ratio one that is to say
the real is replicated three times in order to be multiplicated by one
of the three elements of the vector.
Next: Explicit repetition specification
Up: To repeat an algorithm
Previous: To repeat an algorithm
  Contents
Julien Forget
2003-03-21