The utility application will then extract useful information of the task graph and generate the UPPAAL models. The Windows executable file tgff3 1.exe is bundled ...
1
Tutorial for the UPPAAL Model Generater Zonghua Gu, Mingxuan Yuan and Xiuqiang He Department of Computer Science and Engineering Hong Kong University of Science and Technology
I. I NTRODUCTION In the technical report [1],we addressed two problems of static offline task scheduling on FPGA: finding optimal static schedule for a task graph with the optimization objective of minimizing the total schedule length, and finding a feasible static schedule for a set of periodic tasks within a hyper-period with the objective of meeting all deadlines. We developed two small utility applications that allow the user to specify a set of parameters to generate the UPPAAL models and corresponding query files. The generated models can be verified to generate the schedule trace. II. S OFTWARE E NVIRONMENT The list of required software tools are: • UPPAAL. Downloadable from [2]. • TGFF (Task Graphs for Free) is a random task graph generator downloadable from [3]. Our utility application for task graph scheduling generates the scripts as input file for TGFF according to the parameters specified by the user, and invoke the TGFF generate the random task graphs. The utility application will then extract useful information of the task graph and generate the UPPAAL models. The Windows executable file tgff3 1.exe is bundled in the software download. • Memtime. A utility program developed by the UPPAAL group to measure time and memory usage, downloadable from [2]. • Microsoft .NET Framework. Downloadable from [4]. • UPPAAL Model Generator. The utility application for generating UPPAAL models and corresponding query files. The zip file contains several executable files, e.g., Configure.exe, Deconfigure.exe, GeneratorForPeriodTaskSet.exe, GenerateorForTaskGraph.exe, tgff3 1.exe, and two text files PatternTG.txt and PatternPT.txt. tgff3 1.exe is the Windows executable file for TGFF. Configure.exe setup the necessary environment Variables, and Deconfigure.exe will undo the setting. Configure.exe must be executed before running the GeneratorForTaskGraph.exe and GeneratorForPeriodTaskSet.exe. GeneratorForTaskGraph.exe can generate random task graphs and corresponding UPPAAL models and qurey files according to the parameters specified, while GeneratorForPeriodTaskSet.exe can generate random period task sets and corresponding UPPAAL models and query files. III. S TATIC S CHEDULING FOR TASK G RAPHS In this section, we explain how to use the utility application GeneratorForTaskGraph.exe to generate random task graphs and their corresponding UPPAAL models and query files. Moreover, the user can write a user-defined file which describe a task graph, and GeneratorForTaskGraph can generate UPPAAL model and query file for the task graph based on the file. A. Random Task Graphs Run Configure.exe to setup the necessary Environment Variables, and GeneratorForTaskGraph.exe to invoke the user interface, as illustrated in Fig. 1. Lots of parameters should be specified for generating random task graph and its UPPAAL model and query files, most of them are required by TGFF. Here are the explanations for these parameters: • Seed. The seed for the pseudo-random number generator for TGFF. TGFF can be used to genearate a family of closely related outputs by changing the random number seed and leaving the other parameters constant. This value can be any real number.
2
•
•
• •
Task Num. The parameter task cnt of TGFF, which sets the minimal number of tasks in the generated task graph. Ave of Task Num is the average value and Multiplier specifies the +/- range by which it can vary. StartNodes. The parameter start node of TGFF. This parameters sets the number of the start nodes for graphs with multiple start nodes. (Ave-Multiplier, Ave+Multiplier) defines the value range. start node takes effect when the graph has multiple start nodes. Probability of Multiple Start Nodes. The probability that a graph has more than one start nodes. This parameter can be set to 100% if the user always wants multiple start nodes in the generated graphs. Execution Time. The range of task execution in the generated graphs, which is a random integer value in (Ave-Multiplier,Ave+Multiplier).
Fig. 1.
User interface of the random task graph generator.
Width: Sets the range of the number of columns On FPGA that the tasks in graphs can occupy, i.e., the range is (Ave-Multiplier, Ave+Multiplier). • Max Degree: Corresponds to the task degree in TGFF, which sets the maximum number of parent (in) and child (out) tasks for each task. • FPGA Width: Sets the total number of columns of FPGA. • Reconfiguration Ratio: The reconfiguration time required for a task is proportional to the number of the columns it will occupy, i.e. the width of the task. Reconf iguration T ime = bReconfiguration Ratio × task widthc. After specifying the above parameters, click the button Generate Task Graph to generate a random task graph, and then the button Generate UPPAAL Model to generate the UPPAAL model and query files. Click the button Generate Task Graph to generate a random task graph. Four related files will be generated in the same package: TGFFConfig.tgffopt, TGFFConfig.tgff, TGFFConfig.eps and TGFFConfig.vcg. The utility application first creates a file TGFFConfig.tgffopt based on the parameters specified by the user, and invoke TGFF to take this file as input and generate the other three files. TGFFConfig.eps and TGFFConfig.vcg are two visual graphs, and the EPS files should be readable by any postscript viewing program. Fig. 2 illustrated visual graph in eps format. TGFFConfig.tgff is another expression of the task graph from which the useful information, such as the precedence relationship, execution time and width of tasks, can be easily extracted. The format of the file will be analyzed detailed later. Click the button Generate UPPAAL Model to generate the UPPAAL model and query files with TGFFConfig.tgff as the input file. Click the button Generate UPPAAL Model to generate the UPPAAL model and query file. Two •
3
Fig. 2.
A task graph generated by TGFF.
files named TaskGraph1.xml and TaskGraph1.xml.q are generated, where TaskGraph1.xml is the UPPAAL model, and TaskGraph1.xml.q is the query file shown in Fig. 2. B. User-Defined Task Graphs The user can also generate UPPAAL model from a user-defined task graph. As mentioned before, TGFFConfig.tgff is used as the input file to extract useful information of the task graph and generate the final UPPAAL model. If task graph is specified in TGFFConfig.tgff, the UPPAAL model can be generated by clicking the button Generate UPPAAL Model. Here is one example of TGFFConfig.tgff: @TASK_GRAPH 0 { APERIODIC TASK t0_0 TYPE 0 execTime 13 taskWidth 5 TASK t0_1 TYPE 0 execTime 8 taskWidth 9 TASK t0_2 TYPE 0 execTime 14 taskWidth 6 ..................................... ARC a0_0 FROM t0_0 TO t0_1 TYPE 0 ARC a0_1 FROM t0_0 TO t0_2 TYPE 0 ARC a0_2 FROM t0_2 TO t0_3 TYPE 0 ..................................... }
Each line starting with Task describes the parameters, e.g., execution time and width, for a task in the graph. Each line starting with ARC denotes a precedence relationship between two tasks in the task graph. For example, the line ARC a0 0 FROM t0 0 TO t0 1 TYPE 0 means that task 0 precedes task 1. We can rewrite the file TGFFConfig.tgff and specify a user-defined task graph. Click the button Generate UPPAAL Model to generate the UPPAAL model and query files after the modified TGFFConfig.tgff is ready. Note that The TGFFConfig.tgff must reside in the same folder with the utility applications. C. Model Checking with UPPAAL UPPAAL provides a graphical user interface and command line interface.
4
1) Graphical Interface: • Click File→Open System to open the generated UPPAAL model, e.g., TaskGraph1.xml. • Click File→Open Queries.. to open the query file, e.g., TaskGraph.xml. Afterwards, click on the tab Verifier and the query sentence should exist as an item in the Overview. • Click Options→Diagnostic Trace, and check Fastest. The fastest trace is the trace with the least time delay among all the traces that satisfy the query condition specified by the query file, and it is also the optimal schedule for a task graph. Click on the button Check on the Verifier to start the verification process. Running time of the model-checker depends on many factors, including number of tasks, task graph shape, task computation time and size, etc. When model-checking is done successfully, a dialog box is invoked to ask the user whether the old trace in the simulator should be destroyed. Click Yes to load the new trace in Simulator. Property is satisfied is shown below on the Status panel.
Fig. 3.
Find the maximum value of global clock in the execution trace.
Click on the tab Simulator to analyze the optimal schedule for task graph. We can get the minimal-length schedule for the task graph by analyzing the simulation trace. The maximum value of the global variable globalclk is the total schedule length, shown in Fig. 3. 2) Command Line: The UPPAAL model generated by our utility application can also be checked in Command Line form. This is necessary when the user wants to use memtime to measure the peak memory usage and verification time. The Linux version of verifyta is in the bin-Linux package, and the Windows version verifyta.exe is in the bin-Win32 package. The command should be used as below: •
verifyta -t2 -f tracefile model.xml query.q where the option -t2 instructs UPPAAL to find the shortest simulation trace to the target state defined in query.q and the option -f dumps out the trace into the file specified by tracefile upon successful completion of the modelchecking precedure. Memtime is a utility program developed by the UPPAAL group to record the peak memory usage and the running time. Only the Linux version of memtime is available. To measure cost of verifying the model generated by our utility application, the following command can be used: memtime verifyta -t2 -f tracefile model.xml query.q Fig. 4 illustrates the result of executing Memtime to measure the cost of the verification in UPPAAL. This verification takes 52.12s, and the peak memory usage is 146848 KB. IV. S TATIC S CHEDULING FOR P ERIODIC TASKSETS In this section, we explain how to use the utility application to generate a periodic task set, and subsequently its UPPAAL model and query. The utility supports both the generation of a random and user-defined periodic task set. Fig. 5 shows the user interface.
5
Fig. 4.
Memory Usage and Running Time Measurement
Fig. 5.
Generator for Periodic Task Set
A. Random Periodic Tasksets The options shown in Fig. 5 are explained as follows: • Task Num: Total number of tasks in the set. • Execution Time: (Min, Max) defines the range within which the execution time of each task in the set can vary. • Width:(Min, Max) defines the range within which the area size of each task in the set can vary. • Period:(Min,Max) defines the range of integer values that can be assigned to each task as its period. The value of Period of a task is initialized to be greater than its execution time. • Reconfiguration Ratio: explained in Section III-A. • FPGA Width: explained in Section III-A. If the user clicks the button Task Set Generate, the randomly generated periodic task set is shown in a new window, as shown in Fig. 6. The the user can also modify the parameters of the generated taskset, e.g., adding or removing tasks. A hyper-period of the taskset is calculated and shown on the top left of the window. The taskset shown in left panel can be saved by clicking the button Save, and it can reloaded by clicking button Load. Clicking the buttonOK conforms the modification and returns to the previous window. Select the proper value for FPGA Width, and Click the button Uppaal Generate to instruct the utility application create the UPPAAL model and query file for the task graph. The user are required to specify the name and routine for the generated UPPAAL model and query file.
6
Fig. 6.
User Interface to View or Modify the Randomly Generated TaskSet
B. User-Defined Periodic Tasksets The user can define a set of periodic tasks by using the user interface shown in Fig. 6. The user can remove all the tasks shown in the left panel by selecting one item per time and clicking the button Remove, and then add new tasks to create a new taskset. The user can also click the button Load in the user interface shown in Fig. 5 to load a file describing a periodic task set. The file Example In Paper TaskSet.txt is the example task set in our paper, which are found in the same download package with the utility application. The user can load the file and generate the UPPAAL model and query files to generate the example traces shown in [1]. C. Model-Checking with UPPAAL The model-checking procedure is similar to that for task graphs in Sections III-C.1 and III-C.2, except for these two points: • Graphical Interface. Since need to find one feasible schedule where all tasks meet their deadlines instead of the optimal schedule with minimum schedule length as in task graph scheduling, the user should click Options→Diagnostic Trace, and check the option Some. • Command Line: The command line is: verifyta -t0 -f tracefile model.xml qeury.q and the command using memtime to measure memory usage and running time of the model-checking session is: memtime verifyta -t0 -f tracefile model.xml query.q where t0 means some trace, corresponding to the option Some in the graphical interface. R EFERENCES [1] Z. Gu, M. Yuan, and X. He, “Real-Time Task Scheduling Analysis on Partially Runtime Reconfigurable FPGAs using Model-Checking,” in Technical report, available online at [5]. [2] The UPPAAL Model-Checker. [Online]. Available: http://www.uppaal.com [3] Task Graph For Free. [Online]. Available: http://ziyang.ece.northwestern.edu/tgff/ [4] Microsoft .Net. [Online]. Available: http://www.microsoft.com/net/ [5] “FPGA Scheduling Project at HKUST,” http://www.cse.ust.hk/∼zgu/FPGA/.