Reactive systems are computer systems that react continuously to their environment, at a speed determined by the latter. Synchronous languages have been designed to facilitate the programming of reactive systems. The main synchronous languages are Esterel, Lustre, Argos, and Signal.
One thing that cannot be easily taken into account in
synchronous languages is long duration tasks. In
Esterel, the only possibility is to use the asynchronous task
mechanism (with the exec
and return
signals). For Lustre, we propose a different approach, which
uses the automatic distribution tool ocrep. The
principle is to write the Lustre program such that the long
duration task is cadenced on a slow clock. The period of this
clock must be at least as great as the duration of the task. Then, the
distribution specifications needed by ocrep must be written
such that all the slow inputs and outputs are assigned to one
computing site, while all the remaining inputs and outputs (i.e., the
fast ones) are assigned to another computing site. Finally,
ocrep must be run with the -r
option, in order to
desynchronise the slow computing site and the fast one. We call this
approach clock driven distribution.
The ludivin tool is a graphical user interface that allows the user to automatise the distribution process with ocrep, be it a manual distribution or a clock driven one.
Ludivin is a graphical user interface written in Tcl/Tk. It is an acronym for LUstre DIstribution Visual INterface. As said above, ludivin uses the ocrep automatic distribution tool. Without going into details, ocrep takes as input:
foo.oc
, andfoo.rep
.The distribution specifications consist in a partition of the set of inputs and outputs of the program into as many sub-sets as there are computing sites. This assigns a unique computing site to each input/output. Finer specifications can be given by also assigning a computing site to local variables. Concretely, the distribution specification file contains a table of sites, with the same overall syntax as the other OC tables:
site_part : /* empty */ | 'sites:' number_of_sites site_table 'end:' ; number_of_sites : integer ; site_table : site_table site_definition ; site_definition : site_num ':' identifier '(' signal_list ')' | site_num ':' identifier '(' signal_list ')' '[' clock ']' ; site_num : integer ;
Here, signal_list
is a list of names of
input and output signals of the OC program (they are the same
as the inputs and outputs of the main Lustre node). The
clock
indication is optional. Its purpose is to indicate
that the related computing location must run at the speed of this
clock. The clock true
is by convention the base
clock of the program, that is, the sequence of its reactions.
FInally, the communications take place through a
fully-connected network of FIFO channels. Two communication primitives
are used: a sending instruction put
and a receiving
instruction get
which blocks when the queue is empty.
Ludivin is run by invoking the command:
ludivin.tcl
which creates and opens the following window:
The File
menu has three commands:
Load
command opens a dialog box for choosing a
Lustre file to open.Close
command closes the currently openned
file.Quit
command quits the interfaces.The Ocrep
menu has three commands:
Version
command gives you the current version of
ocrep.Help
command prints the available options of
ocrep.Options
command allows you to choose among these
options by popping a sub-menu.Finally, the Help
menu has two commands:
About
command gives you the current version of
ludivin.User manual (HTML)
command launches the man page
inside an html
browser.The dialog box openned by the Load
command is the
following:
Once you have selected a Lustre file, ludivin prompts you for the corresponding main node and OC file, by opening the following window:
By default, the name of the OC file is the
basename of your Lustre file with the .oc
suffix. If you have clicked in the Compilation
checkbox,
ou if you do not provide the OC file, ludivin will
compile your Lustre file. Once this is done, ludivin
will parse your Lustre file to compute the tree of all the
clocks used in the main node. The root of this tree is always the base
clock of the program, which is called true
. The clock
tree will also be decorated with the inputs and outputs of the main
Lustre node, such that each appears next to its respective
clock. It will be displayed in the following window:
For instance, here the clock tree contains the root
true
(with CK
and RES
attached
to it) and a single leaf CK
(with IN
and
OUT
attached to it). This window allows you to choose the
number of desired computing sites and among two distribution
methods:
In the clock driven
method, clocks
are attached to computing sites. This will allow you to desynchronise
the computing sites and therefore to handle long duration
tasks.
In the manual
method, only inputs
and outputs are attached to computing sites, which will remain
synchronised.
If you click the open *.rep
button,
ludivin will ask you to choose an already existing ditribution
specification file:
If you do so, you will directly go to the final
window. But let us proceed one thing at a time. If you choose the
clock driven distribution, type the number of desired computing sites,
and click the ok
button, you will then have to choose a
clock for each site:
To do this, click on the button left to the site,
then click on one of the clock from the clock tree above. Do this for
all the sites and procced by clicking the >>>
button. You
will then have to assign each input and output to a unique site:
The clock of a site determines the maximal frequency
at which this site will run. Therefore, you can only assign to a site
inputs and outputs that are at least as slow as its designated
clock. For instance, here you can assign IN
and
OUT
to either the site 0
or 1
,
but CK
and RES
can only be assigned to the
site 0
. Clicking on a clock in the clock tree will
automatically select all the remaining inputs/outputs (this is a short
cup). Clicking on an input/output will select or unselect it. Clicking
on one of the clear
buttons will unselect all the
inpust/outputs of the corresponding site. Clicking on the
reset
button will reset all the distribution (after a
warning). Finally, clicking on the save *.rep
button will
allow you to save the current state of the distribution in a chosen
.rep
file. This distribution does not need to be
complete; that is some inputs or outputs can be left unselected at
this stage.
Note that the above window reminds you that you have chosen the clock driven distribution method. In the manual distribution case, you will have the following window:
Execpt for the fact that sites have no clock, the
method for assigning inputs and outputs to sites is that same as
above. In both cases, once you are done, you can clik on the
Start distribution
button. Ludivin will then check
that each input and output is assigned to exactly one computing site,
and that in the clock driven case, none of the inputs and outputs
assigned to it are faster that its clock. If everything is correct,
ludivin will invoke ocrep with the chosen options and
will print the result in a window:
The files produced by ocrep will be left in the directory containing the source Lustre file.
The ludivin tool is available for Unix architectures:
This distribution of ludivin contains four directories:
src
contains all the Tcl/Tk
sources, including the main file ludivin.tcl
.bin
containts the lus2clk
and rep2tcl
executables. These are needed by
ludivin, respectively for parsing the main Lustre node
to extract the clock tree, and for parsing .rep
files.man
contains the user manual.demo
contains the Filter
demo.You also need the ocrep executable (available here) and the Lustre to OC translator (available here). Enjoy!