.\" @(#)demoRecur1	1.1	12/10/92
.NA demoRecur1
.SD
Demonstration of the quasi-static scheduler for a graph with a "recursion" construct.
.DE
.SV 1.1 2/6/92
.AL "S. Ha"
.LO "~ptolemy/src/domains/cg-ddf/demo"
.LD
.Ir "recursion construct"
.Ir "quasi-static scheduler"
This demo displays a schedule result applying a quasi-static
scheduling technique to a program graph with a \fIrecursion\fR construct.
A \fIrecursion\fR construct, which resides in a CGWormhole, contains two
.c Self
.Sr Self
stars, which will be expanded as the same recursion construct if executed.
The control input to the 
.c Case
star decides whether to execute 
.c Self
stars. If the
.c Self
stars are not executed, the recursion construct at that level is
terminated.  The recursion body resides in the CGDDF wormholes,
5 and 6. Since there are two Self stars, the number of execution of
the recursion body grows exponentially as the depth of the recursion. 
Therefore, the recursion construct is highly parallelizable.
.pp
By setting the target parameter of the CG-DDF domain inside
the CGWormhole (green block at the top level), we indicate that 
it is a \fIrecursion\fR construct (
.c constructType
= recur ) and the depth of recursion is distributed
uniformly (
.c paramType
= uniform ) from 1 to 4 (
.c paramMin
= 1,
.c paramMax
= 4 ).  By regarding the depth of recursion as the parameter for
the distribution of the run-time behavior, we approximate the
situation that all recursion branches are identically distributed, or
all synchronized (have the same termination condition).
Since the
.c fixedNum
state is 0, we let the scheduler decide the number of processors to
assign to the recursion construct.
.pp
The CG-DDF galaxy contains  wormholes of CG domain that share
the same child targets as the outside CG domain by setting
.c inheritProcessors
target parameter "YES". The quasi-static scheduling
idea is that we fix the assignment and the execution order of stars in
the CG domains at the compile time.  At the top level, the "recursion"
construct is regarded as an atomic block. The blocks inside the
CGDDF wormholes of CG domain are also scheduled (assigned and ordered)
at compile-time. At run time, 
we determine which wormholes to execute depending on the control
value fed to the
.c Case 
star.
.pp
The core of the scheduling technique is to determine the assumed
execution profile of the \fIrecursion\fR construct at compile-time,
based on the distribution of the depth of recursion.
In the displayed Gantt chart, we can find out what is the
.Ir "profile, CG-DDF"
estimated profile of the construct. The construct is assigned to four
processors among 5 processors.  
Each recursion body is executed in a single processor, and four
recursion branches are parallelized. Once all four recursion branches
are parallelized, the corresponding recursion constructs are 
executed sequentially.
Note that we pipeline the program graph by inserting delays on a cutset
manually to increase the possibility of parallelism.
In this release we do not make code generation working properly yet.
.ES

