PAStime: Progress-aware Scheduling for Mixed-criticality Computing - Artifact

A Guideline to Run PAStime

The artifact zip file is available for download here.
We have installed the LITMUSRT kernel on Ubuntu 16.04.

All our code are assumed to be kept at a location /home/common_shared/.

The directory structure is the following:

  /home/common_shared/litmus/litmus-rt
  /home/common_shared/litmus/liblitmus
  /home/common_shared/PAStime/PMU/pmu-tools
  /home/common_shared/PAStime/pastime
  /home/common_shared/PAStime/darknet
  /home/common_shared/PAStime/video
  

In case this location is not accessible in your machine, then grep for common_shared and change those locations accordingly, because we had to use the absolute paths at some points in the code.

Steps:

  1. Installing LITMUSRT with modifications for AMC and AMC-PAStime
  2. Building liblitmus
  3. Installing PMU tools
  4. Building PAStime userspace library
  5. Building Darknet
  6. Placing dataset in Darknet
  7. Building the video decoder
  8. Running experiments for AMC-PAStime
    1. Profiling phase
    2. Execution phase
    3. Running the AMC scheduler
    4. Generating results and graphs

Installing LITMUSRT with modifications for AMC and AMC-PAStime:

  1. mkdir litmus
  2. cd litmus
  3. git clone https://github.com/sohamm17/litmus-rt-amc-pastime
  4. mv litmus-rt-amc-pastime litmus-rt
  5. We have already included our Linux kernel installation configuration in the .config file.
  6. Then, follow instructions at the LITMUSRT webpage to compile and install the kernel: https://www.litmus-rt.org/installation.html#compilingthelitmusrtkernel

Issues: The mouse and keyboard may not work in the newly installed kernel. Therefore, it is better to have an ethernet connection to machine and connect over ssh.

Building liblitmus:

  1. In the litmus directory, git clone https://github.com/sohamm17/liblitmus-amc-pastime (i.e after cd litmus)
  2. mv liblitmus-amc-pastime liblitmus
  3. Then follow the LITMUSRT webpage to build liblitmus: https://www.litmus-rt.org/installation.html#buildingliblitmus

Installing PMU tools:

  1. cd PAStime
  2. mkdir PMU && cd PMU
  3. git clone https://github.com/andikleen/pmu-tools.git
  4. cd pmu-tools
  5. cd jevents
  6. make
  7. sudo make install

Building PAStime userspace library:

  1. cd PAStime
  2. git clone https://github.com/sohamm17/pastime
  3. cd pastime
  4. make

Building Darknet:

  1. cd PAStime
  2. git clone [email protected]:sohamm17/darknet-master.git
  3. cd darknet-master
  4. make

Wherever you can, change it (/home/common_shared/) with the full path that you are using. You have to change it in line number 635, 662 of the darknet/examples/classifier.c to get the experiments to run. Otherwise, segmentation fault will happen.

Placing dataset in darknet:

  1. Get the coco_dataset.zip from our provided zip file.
  2. Unzip the coco_dataset.zip in PAStime/darknet/data/coco/
  3. There should be a few directories in the coco/ directory like converted, converted1, etc.

Building the video decoder:

The benchmarking video of big buck bunny can be downloaded from: http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4
It should be renamed to bunny_1080p_60fps.mp4
The video file md5sum: 7a7bc8ae38ccbd700e07977a9deb8cb7
There are some package dependencies for this video decoder to be compiled. Please install the following packages on Ubuntu:

    sudo apt-get install ffmpeg libavcodec-dev libavformat-dev libswscale-ffmpeg3 libswscale-dev
    

  1. Decompress the artifact file.
  2. cd PAStime
  3. mkdir video
  4. cd video
  5. unzip [location_of_the_file]/video_app.zip
  6. cd app
  7. wget http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4
  8. mv bbb_sunflower_1080p_60fps_normal.mp4 bunny_1080p_60fps.mp4
  9. make

Running experiments for AMC-PAStime:

As per our paper, experiments have two phases in PAStime: Profiling phase and Execution phase. First, we will note the time to reach a checkpoint in the Profiling phase. Then we will use the data from the Profiling phase in the Execution phase.

Profiling phase:

This phase does not need the LITMUSRT kernel at all. By default, the darknet application which is considered to be a high-criticality application, is set up for the Profiling phase. A checkpoint is placed at 0.4x location in the src/network.c file and forward_network function. To get a checkpoint timing, we run the code on multiple inputs and get an average of the checkpoint timing. From our provided artifact zip file, go inside the scripts folder and run the profiler.sh file inside PAStime/darknet directory. Run the following commands:

  1. cd PAStime/darknet
  2. sudo ./profiler.sh

You will file a file called timeinfo.h. This file notes the checkpoint timing for different individual image inputs which the darknet application classify.
You can use our script the following way to get a median of the checkpoint timing. Our script can be run the following way:

  python profile.py -timefile timeinfo.h

The file mean_timeinfo.h will contain the resultant average checkpoint timing. We will use this data in Execution phase.

Execution Phase:

For the Execution phase, we need to edit two files in darknet.
src/network.c: Here, we need to comment the writeTime function call because it is for the Profiling phase. The call is made at line number 231. We need to uncomment the ANNOUNCE_TIME macro at line number 232. In addition, we need to get the checkpoint timing from the Profiling phase (the average value that we just got above), and place it at line number 200, where the line current has something like: #define CP_1_11 <some number>. This should be changed to the profiling data that we got above.

Basically, the CP_1_11 macro is saying that it is a checkpoint at some function 1 and at some position identified by 11, which are random. In our automated LLVM compiler, these function numbers, and exact point where the macro call is made, is decided by the LLVM compiler infrastructure. As we are doing this manually, we can choose our own function call number, etc. We just need to be consistent with the Profiling phase and Execution phase.

examples/classifier.c: Here we need to uncomment the profiling bookkeeping code and enable the litmus-rt code. Go to line number 724. You will find comments there which tells which part of the code is for the Profiling phase and which part is for the Execution phase. You need to comment the Profiling phase code and uncomment the Execution phase code. This part of the code is between 724 and 822 line numbers. After this, recompile darknet with make.

We have automated the Execution phase with a script named amc_8_tasks_60_util.sh . The script runs 4 HC tasks of darknet and 4 LC tasks of the video decoder, totalling a 60% utilization. Look at the Results and Graphs section to know how to run the Execution phase in details.

Running the AMC scheduler:
To run only with AMC scheduling and not AMC-PAStime, you need to comment out the ANNOUNCE_TIME macro in the src/network.c file. Our kernel changes incorporate PAStime on top of AMC. Therefore, if we do not announce any time, then the vanilla AMC scheduler runs by default.

Generating results and graphs:

Download all our scripts by git clone [email protected]:sohamm17/pastime_scripts.git and keep them in /home/common_shared/PAStime/

Results of different runs are taken with LITMUSRT feather-trace-tools. We use the st-jobs-stats tool to collect how much utilization was achieved for the HC and LC tasks.
We have modified the feather-trace-tools to show the average utilization of a run for a particular task. It can be downloaded by: git clone [email protected]:sohamm17/feather-trace-tools.git You should clone it at /home/common_shared/litmus/

How to run the Execution phase:

  1. In one terminal window (T1), go to the darknet directory (/home/common_shared/PAStime/darknet/).
  2. In another terminal window (T2), go to the /home/common_shared/litmus/feather-trace-tools
  3. In T1, run: st-trace-schedule my-trace
  4. In T2, run our execution script, for example: ./amc_8_tasks_60_util.sh <LEN> or ./amc.sh <LEN>
    Here, (LEN*8) is the number of seconds that the experiments will run (except two tasks).
    Typically, for 2 tasks, LEN should be 25, to run the experiments for 180 seconds. For 8 tasks, try with 15, the length of the run is around 90-120 seconds.
  5. After the script finishes in T2, press <enter> in T1 to finish tracing schedule by LITMUSRT.
  6. Execution phase is done and schedule is recorded at a file in /home/common_shared/litmus/feather-trace-tools/. It should be named something like schedule_host=<your_computer_name>_scheduler=P-FP-Dyn_trace=my-trace_cpu=0.bin
  7. We run all the code in a single core (AMC and AMC-PAStime are uniprocessor scheduling algorithm) which is the number 1 core. Therefore, our schedule is at cpu=1.bin in the formerly mentioned scheduling trace file.

How to get the utilization: You need to run the following script (which we have modified in our modified feather-trace-tools repo):

        st-job-stats schedule_host=<YOUR_COMPUTER_NAME>_scheduler=P-FP-Dyn_trace=my-trace_cpu=*.bin
      

The above script will give the utilization of each tasks which were run with the execution script. We need to take these numbers and place in a text file to be parsed by some python scripts to generate the graph. Instructions to generate graphs are given below.

How to generate graphs: From our script folder, the below scripts can be used to generate graphs. The data CSV files are also included in the scripts repository:

  1. To generate the base case of two tasks (one HC task and one LC task) running over 180 seconds: python avg_util_two_amc.py
  2. To generate the average LC tasks utilizations with AMC and AMC-PAStime against different initial LO-mode utilization (for 8 tasks): python util_amc_avg_lc_util.py
  3. To generate the average LC tasks utilizations with AMC and AMC-PAStime against different number of tasks (for 60% initial LO-mode utilization): python task_amc_avg_util.py

Contact: For any help, please contact Soham at soham1 <at> bu DOT edu