DIPLODOCUS Help: Script for Design Space Exploration





Scripting: What's for?

Using TTool's graphical interface, it is quite easy to perform the simulation of a DIPLODODOCUS model. But whenever several - if not many - simulation are involved, and for which you wish to study and gather results (e.g., average bus load over 10000 simulations), scripting is the most efficient way to do. This page summarizes the structure of a design space exploration script.

How to use a script?

  1. You first need to make a description of the system to analyze in text format. From the graphical interface, select the mapping you wish to work on, check the syntax, and then generate the TML code (specific icon). The code will be generated in the configured directory, e.g. ttool/tmlcode , in three different files: the task model (spec.tml), the architecture (spec.tarchi) and the mapping (spec.tmap).

  2. Second, you need to write a script explaining what you wish to do on that model: simulations, explorations, which results you wish to gather, etc. The syntax of such a script is explained hereafter.

  3. Third, you need to execute the script. To do so, run the following command, assuming your script is located in ~/ttool/tmlcode/myscript.dse:
  4. $ java -jar ~/ttool/bin/RunDSE.jar ~/ttool/tmlcode/myscript.dse
    

  5. Last, you can consult results generated by the script execution, see below for more information on how to generate results from script execution, and performing computations on those results.

How to make a script?

A script is made out of several types of commands:
  • Commands to set parameters

  • Commands to execute simulations

  • Commands to compute simulation results

Example

# My first DSE script
# Commands are not case sensitive
# To execute this script: java -jar RunDSE.jar <-debug> this_script.dse


#Model
ModelPath = /homes/foo/TTool/tmlcode/
MappingFile = smartcard.tmap

#Path
PathToSimulator = /homes/foo/TTool/tmlcode/simulators/c++2/
PathToResults = /homes/foo/TTool/tmlcode/simulators/results/

#Simulation

#Use -1 value to unset
SimulationMaxCycle = -1

SimulationOutputVCD = true
SimulationOutputHTML = true
SimulationOutputTXT = true
SimulationOutputXML = true
RecordResults = true
SimulationCompilationCommand = make -j9 -C
SimulationExecutionCommand = run.x

SimulationExplorationMinimumCommand = 5
SimulationExplorationMinimumBranch = 5

ShowSimulatorRawOutput = false

NbOfSimulationThreads = 128

#Starting simulation
#runSimulation = 1000

runParallelSimulation = 10000
#runexplo

#To print in a file all simulation results
saveAllResults

#To print in a file a summary of simulation results
saveResultsSummary

#To reset results
resetResults

#Automatic DSE
TaskModelFile = smartcard.tml
MinNbOfCPUs = 1
MaxNbOfCPUs = 3
#The two next functions are not yet supported
MinNbOfCoresPerCPU = 1
MaxNbOfCoresPerCPU = 3
NbOfSimulationsPerMapping = 10
setTap = minSimulationDuration 10
setTap = averageSimulationDuration 0
setTap = maxSimulationDuration 0
setTap = architectureComplexity 1
setTap = averageCPUUsage -10
runDSE
#runParallelDSE
saveAllResults
saveResultsSummary

#End of script

#End of script

Comments can be put after a "#" at the beginning of a line. Also, commands are not case sensitive.

Setting parameters

Model directory

  • Setting the model directory path:
#ModelPath = <directory>
  • Selecting a mapping:
#MappingFile = <file name>
  • Selecting a task model:
#TaskModelFile = <file name>

Paths and commands of the simulator

  • Path to the simulator:
#PathToSimulator = <directory>
  • Setting of the simulator compilation command:
#SimulationCompilationCommand = <command>
  • Setting of the simulator execution command:
#SimulationExecutionCommand = <command>
  • Setting the number of threads that will be use to start simulations in parallel:
#NbOfSimulationThreads = <stricly positive integer value>

Traces and results of the simulation

  • Path to where you wish to store simulation and DSE results:
#PathToResults = <directory>
  • Activate / deactivate the recording of results, i.e., CPU load, bus load, contentions on buses:
#RecordResults = <true / false>
  • Show / hide outputs produced by the simulator in its standard output:
#ShowSimulatorRawOutput = <true / false>
  • Activating / deactivating simulation output in VCD format:
#SimulationOutputVCD = <true / false>
  • Activating / deactivating simulation output in TXT format:
  • #SimulationOutputTXT = <true / false>
    
    • Activating / deactivating simulation output in HTML format:
    #SimulationOutputHTML = <true / false>
    
    • Activating / deactivating simulation output in XML format:
    #SimulationOutputXML = <true / false>
    
    • Maximum number of simulated cycles per simulation (use -1 to go until the simulated system terminated):
    #SimulationMaxCycles = <integer value>
    

    Commands specific to the exploration mode of the simulator

    • In exploration mode, minimum number of commands that will be explored, i.e. the exploration stops when this minimum has been reached, or when the simulated system terminates:
    #SimulationExplorationMinimumCommand = <integer value (percentage)>
    
    • In exploration mode, minimum number of possible branches that will be explored, i.e. the exploration stops when this minimum has been reached, or when the simulated system terminates:
    #SimulationExplorationMinimumBranch = <integer value (percentage)>
    

    Commands specific to the automatic DSE mode

    • In automatic DSE mode, number of simulation performed for each mappin:
    #NbOfSimulationsPerMapping <integer value >0>
    
      • In automatic DSE mode, taps of parameters for computing a grade for each mapping:
      #setTap = < tap > <integer value >0> 
      
      with tap equal to one of the following element: minSimulationDuration, averageSimulationDuration, maxSimulationDuration, architectureComplexity, minCPUUsage, averageCPUUsage, maxCPUUsage, minBusUsage, averageBusUsage, maxBusUsage, minBusContention, averageBusContention, maxBusContention

        Executing simulations

        Regular simulation

        • Running x simulations in a raw.
        #runSimulation = <integer value>
        

        Parallel simulation

        • Running x simulations in a raw, and in parallel i.e. several simulation threads are started at the same time.
        #runParallelSimulation = <integer value>
        

        Exploration

        • Running an exploration of the system. Generated reachability graphs are stored in the result directory, in tree.aut and tree.dot.
        #runExplo
        

        Executing automatic DSE

        TaskModelFile must be set first. Then, the number of CPUs must be set as well.
        • Running an automatic Design Space Exploration.
        #runDSE
        

        Computing simulation and DSE results

        • Printing in a file all simulation results.
        #saveAllResults
        
        • Printing in a file a summary of simulation results.
        #saveResultsSummary
        
        • Resting simulation results, i.e., all results obtained from previous simulations are erased from the script engine memory.
        #resetResults