From 0da35d673e1c1717821f724d8fb00379477b65be Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Thu, 21 Oct 2021 19:20:36 -0400 Subject: dag case study scripts --- Makefile | 25 +- SD-VBS/dag_binaries/disparity_qcif_pair | Bin 0 -> 131576 bytes SD-VBS/dag_binaries/disparity_qcif_single | Bin 0 -> 126312 bytes SD-VBS/dag_binaries/localization_qcif_pair | Bin 0 -> 140232 bytes SD-VBS/dag_binaries/localization_qcif_single | Bin 0 -> 130872 bytes SD-VBS/dag_binaries/mser_qcif_pair | Bin 0 -> 126912 bytes SD-VBS/dag_binaries/mser_qcif_single | Bin 0 -> 125736 bytes SD-VBS/dag_binaries/multi_ncut_qcif_pair | Bin 0 -> 131216 bytes SD-VBS/dag_binaries/multi_ncut_qcif_single | Bin 0 -> 125952 bytes SD-VBS/dag_binaries/sift_qcif_pair | Bin 0 -> 140328 bytes SD-VBS/dag_binaries/sift_qcif_single | Bin 0 -> 135056 bytes SD-VBS/dag_binaries/stitch_qcif_pair | Bin 0 -> 135600 bytes SD-VBS/dag_binaries/stitch_qcif_single | Bin 0 -> 130336 bytes SD-VBS/dag_binaries/svm_qcif_pair | Bin 0 -> 135584 bytes SD-VBS/dag_binaries/svm_qcif_single | Bin 0 -> 130320 bytes SD-VBS/dag_binaries/texture_synthesis_qcif_pair | Bin 0 -> 136296 bytes SD-VBS/dag_binaries/texture_synthesis_qcif_single | Bin 0 -> 131032 bytes SD-VBS/dag_binaries/tracking_qcif_pair | Bin 0 -> 135536 bytes SD-VBS/dag_binaries/tracking_qcif_single | Bin 0 -> 130272 bytes dag_example | 4 + deadline_misses | 23 ++ extra.h | 17 +- run_all_sd-vbs.sh | 14 +- run_case_study_dag.py | 319 ++++++++-------------- 24 files changed, 180 insertions(+), 222 deletions(-) create mode 100755 SD-VBS/dag_binaries/disparity_qcif_pair create mode 100755 SD-VBS/dag_binaries/disparity_qcif_single create mode 100755 SD-VBS/dag_binaries/localization_qcif_pair create mode 100755 SD-VBS/dag_binaries/localization_qcif_single create mode 100755 SD-VBS/dag_binaries/mser_qcif_pair create mode 100755 SD-VBS/dag_binaries/mser_qcif_single create mode 100755 SD-VBS/dag_binaries/multi_ncut_qcif_pair create mode 100755 SD-VBS/dag_binaries/multi_ncut_qcif_single create mode 100755 SD-VBS/dag_binaries/sift_qcif_pair create mode 100755 SD-VBS/dag_binaries/sift_qcif_single create mode 100755 SD-VBS/dag_binaries/stitch_qcif_pair create mode 100755 SD-VBS/dag_binaries/stitch_qcif_single create mode 100755 SD-VBS/dag_binaries/svm_qcif_pair create mode 100755 SD-VBS/dag_binaries/svm_qcif_single create mode 100755 SD-VBS/dag_binaries/texture_synthesis_qcif_pair create mode 100755 SD-VBS/dag_binaries/texture_synthesis_qcif_single create mode 100755 SD-VBS/dag_binaries/tracking_qcif_pair create mode 100755 SD-VBS/dag_binaries/tracking_qcif_single create mode 100644 dag_example create mode 100644 deadline_misses diff --git a/Makefile b/Makefile index a473a20..9205e0b 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,26 @@ case-study: benchmarks: sed -i "s/LITMUS 1/LITMUS 0/g" extra.h - $(MAKE) -C baseline all - $(MAKE) -C all_pairs all - $(MAKE) -C dis pairs + #$(MAKE) -C baseline all + #$(MAKE) -C all_pairs all + #$(MAKE) -C dis pairs + $(MAKE) -C SD-VBS/benchmarks CFLAGS=-DPAIRED compile + + +benches := svm mser sift texture_synthesis tracking disparity localization multi_ncut stitch +bench_path := SD-VBS/benchmarks +dag_path := SD-VBS/dag_binaries +single_suffix := _qcif_single +pair_suffix := _qcif_pair +dag-case-study: + sed -i "s/LITMUS 0/LITMUS 1/g" extra.h + $(MAKE) -C SD-VBS/benchmarks compile + @for v in $(benches) ; do \ + # echo "$(dag_path)/$$v""$(single_suffix)"; \ + sudo cp $(bench_path)/$$v/data/qcif/$$v "$(dag_path)/$$v""$(single_suffix)"; \ + done $(MAKE) -C SD-VBS/benchmarks CFLAGS=-DPAIRED compile + @for v in $(benches) ; do \ + # echo "$(dag_path)/$$v""$(pair_suffix)"; \ + sudo cp $(bench_path)/$$v/data/qcif/$$v "$(dag_path)/$$v""$(pair_suffix)"; \ + done diff --git a/SD-VBS/dag_binaries/disparity_qcif_pair b/SD-VBS/dag_binaries/disparity_qcif_pair new file mode 100755 index 0000000..85641f7 Binary files /dev/null and b/SD-VBS/dag_binaries/disparity_qcif_pair differ diff --git a/SD-VBS/dag_binaries/disparity_qcif_single b/SD-VBS/dag_binaries/disparity_qcif_single new file mode 100755 index 0000000..84037c5 Binary files /dev/null and b/SD-VBS/dag_binaries/disparity_qcif_single differ diff --git a/SD-VBS/dag_binaries/localization_qcif_pair b/SD-VBS/dag_binaries/localization_qcif_pair new file mode 100755 index 0000000..695375c Binary files /dev/null and b/SD-VBS/dag_binaries/localization_qcif_pair differ diff --git a/SD-VBS/dag_binaries/localization_qcif_single b/SD-VBS/dag_binaries/localization_qcif_single new file mode 100755 index 0000000..7755bbe Binary files /dev/null and b/SD-VBS/dag_binaries/localization_qcif_single differ diff --git a/SD-VBS/dag_binaries/mser_qcif_pair b/SD-VBS/dag_binaries/mser_qcif_pair new file mode 100755 index 0000000..cbb5562 Binary files /dev/null and b/SD-VBS/dag_binaries/mser_qcif_pair differ diff --git a/SD-VBS/dag_binaries/mser_qcif_single b/SD-VBS/dag_binaries/mser_qcif_single new file mode 100755 index 0000000..96e2338 Binary files /dev/null and b/SD-VBS/dag_binaries/mser_qcif_single differ diff --git a/SD-VBS/dag_binaries/multi_ncut_qcif_pair b/SD-VBS/dag_binaries/multi_ncut_qcif_pair new file mode 100755 index 0000000..eb10fa7 Binary files /dev/null and b/SD-VBS/dag_binaries/multi_ncut_qcif_pair differ diff --git a/SD-VBS/dag_binaries/multi_ncut_qcif_single b/SD-VBS/dag_binaries/multi_ncut_qcif_single new file mode 100755 index 0000000..b7188c8 Binary files /dev/null and b/SD-VBS/dag_binaries/multi_ncut_qcif_single differ diff --git a/SD-VBS/dag_binaries/sift_qcif_pair b/SD-VBS/dag_binaries/sift_qcif_pair new file mode 100755 index 0000000..fac7559 Binary files /dev/null and b/SD-VBS/dag_binaries/sift_qcif_pair differ diff --git a/SD-VBS/dag_binaries/sift_qcif_single b/SD-VBS/dag_binaries/sift_qcif_single new file mode 100755 index 0000000..9f4d486 Binary files /dev/null and b/SD-VBS/dag_binaries/sift_qcif_single differ diff --git a/SD-VBS/dag_binaries/stitch_qcif_pair b/SD-VBS/dag_binaries/stitch_qcif_pair new file mode 100755 index 0000000..e16e2b7 Binary files /dev/null and b/SD-VBS/dag_binaries/stitch_qcif_pair differ diff --git a/SD-VBS/dag_binaries/stitch_qcif_single b/SD-VBS/dag_binaries/stitch_qcif_single new file mode 100755 index 0000000..cf88cb1 Binary files /dev/null and b/SD-VBS/dag_binaries/stitch_qcif_single differ diff --git a/SD-VBS/dag_binaries/svm_qcif_pair b/SD-VBS/dag_binaries/svm_qcif_pair new file mode 100755 index 0000000..2443f6b Binary files /dev/null and b/SD-VBS/dag_binaries/svm_qcif_pair differ diff --git a/SD-VBS/dag_binaries/svm_qcif_single b/SD-VBS/dag_binaries/svm_qcif_single new file mode 100755 index 0000000..24246a1 Binary files /dev/null and b/SD-VBS/dag_binaries/svm_qcif_single differ diff --git a/SD-VBS/dag_binaries/texture_synthesis_qcif_pair b/SD-VBS/dag_binaries/texture_synthesis_qcif_pair new file mode 100755 index 0000000..5703d2e Binary files /dev/null and b/SD-VBS/dag_binaries/texture_synthesis_qcif_pair differ diff --git a/SD-VBS/dag_binaries/texture_synthesis_qcif_single b/SD-VBS/dag_binaries/texture_synthesis_qcif_single new file mode 100755 index 0000000..1ed3ee7 Binary files /dev/null and b/SD-VBS/dag_binaries/texture_synthesis_qcif_single differ diff --git a/SD-VBS/dag_binaries/tracking_qcif_pair b/SD-VBS/dag_binaries/tracking_qcif_pair new file mode 100755 index 0000000..4132b01 Binary files /dev/null and b/SD-VBS/dag_binaries/tracking_qcif_pair differ diff --git a/SD-VBS/dag_binaries/tracking_qcif_single b/SD-VBS/dag_binaries/tracking_qcif_single new file mode 100755 index 0000000..cbb0c10 Binary files /dev/null and b/SD-VBS/dag_binaries/tracking_qcif_single differ diff --git a/dag_example b/dag_example new file mode 100644 index 0000000..f52ff5c --- /dev/null +++ b/dag_example @@ -0,0 +1,4 @@ +1, mser_qcif, mser001, 5, 0, 1, 1, 100, 1, 7, sift_qcif, sift001 +0, mser_qcif, mser002, 3, 1, 2, 1, 10, 1, 13 +1, svm_qcif, svm001, 6, 0, 3, 1, 50, 1, 11, localization_qcif, localization001 +0, tracking_qcif, tracking001, 3, 2, 4, 1, 9, 1, 37 \ No newline at end of file diff --git a/deadline_misses b/deadline_misses new file mode 100644 index 0000000..b9d3aa1 --- /dev/null +++ b/deadline_misses @@ -0,0 +1,23 @@ +(tracking001/497952:2) HAZARDOUS: Level-B tardy 2594240 ns, relative tardiness 0.288249 +(tracking001/497952:3) HAZARDOUS: Level-B tardy 1489684 ns, relative tardiness 0.165520 +(tracking001/497952:4) HAZARDOUS: Level-B tardy 341547 ns, relative tardiness 0.037950 +(svm001/497937:2) HAZARDOUS: Level-B tardy 92756505 ns, relative tardiness 1.855130 +(mser001/497910:2) HAZARDOUS: Level-B tardy 47794140 ns, relative tardiness 0.477941 +(svm001/497937:3) HAZARDOUS: Level-B tardy 109956550 ns, relative tardiness 2.199131 +(localization001/497941:3) HAZARDOUS: Level-B tardy 111499419 ns, relative tardiness 2.229988 +(svm001/497937:4) HAZARDOUS: Level-B tardy 127490228 ns, relative tardiness 2.549805 +(localization001/497941:4) HAZARDOUS: Level-B tardy 129233193 ns, relative tardiness 2.584664 +(mser001/497910:3) HAZARDOUS: Level-B tardy 90713709 ns, relative tardiness 0.907137 +(sift001/497913:3) HAZARDOUS: Level-B tardy 123545859 ns, relative tardiness 1.235459 +(svm001/497937:5) HAZARDOUS: Level-B tardy 166669051 ns, relative tardiness 3.333381 +(localization001/497941:5) HAZARDOUS: Level-B tardy 167447784 ns, relative tardiness 3.348956 +(localization001/497941:6) HAZARDOUS: Level-B tardy 165639831 ns, relative tardiness 3.312797 +(svm001/497937:6) HAZARDOUS: Level-B tardy 168822509 ns, relative tardiness 3.376450 +(mser001/497910:4) HAZARDOUS: Level-B tardy 128636187 ns, relative tardiness 1.286362 +(sift001/497913:4) HAZARDOUS: Level-B tardy 154725906 ns, relative tardiness 1.547259 +(svm001/497937:7) HAZARDOUS: Level-B tardy 188427477 ns, relative tardiness 3.768550 +(localization001/497941:7) HAZARDOUS: Level-B tardy 189059124 ns, relative tardiness 3.781182 +(mser001/497910:5) HAZARDOUS: Level-B tardy 137590008 ns, relative tardiness 1.375900 +(sift001/497913:5) HAZARDOUS: Level-B tardy 174780618 ns, relative tardiness 1.747806 +(mser001/497910:6) HAZARDOUS: Level-B tardy 82683605 ns, relative tardiness 0.826836 +(sift001/497913:6) HAZARDOUS: Level-B tardy 128132417 ns, relative tardiness 1.281324 diff --git a/extra.h b/extra.h index ceaee92..f2ec84e 100644 --- a/extra.h +++ b/extra.h @@ -30,7 +30,7 @@ extern int sched_getcpu(); #endif // This is a proxy for "case study mode" now -#define LITMUS 0 +#define LITMUS 1 #define MMDC_PROF 0 #if LITMUS @@ -106,7 +106,7 @@ static void _rt_load_params_itrl(int argc, char **argv) { #if LITMUS fprintf(stderr, " in ms\n"); fprintf(stderr, " 0 for Level-A, 1 for Level-B, 2 for Level-C\n"); - fprintf(stderr, " in ms\n"); + fprintf(stderr, " in ms\n"); #endif /* LITMUS */ exit(1); } @@ -209,6 +209,7 @@ static void _rt_load_params_itrl(int argc, char **argv) { _rt_period = ms2ns(strtoul(argv[end], NULL, 10)); _rt_crit = atoi(argv[end+1]); _rt_phase = ms2ns(strtoul(argv[end+2], NULL, 10)); + // _rt_phase = 0; unsigned int wait = 1; if (be_migrate_to_domain(_rt_core) < 0) { perror("Unable to migrate to specified CPU"); @@ -221,7 +222,8 @@ static void _rt_load_params_itrl(int argc, char **argv) { rt_param.period = _rt_period; rt_param.relative_deadline = 0; rt_param.phase = _rt_phase; - rt_param.priority = LITMUS_LOWEST_PRIORITY; + // rt_param.priority = LITMUS_LOWEST_PRIORITY; + rt_param.priority = ns2ms(_rt_phase); rt_param.cls = _rt_crit; rt_param.budget_policy = NO_ENFORCEMENT; rt_param.cpu = _rt_core; @@ -435,10 +437,11 @@ static void _rt_start_loop() { } if (last == 0) { last = now; - } else if (now > last + 60ull * _BILLION && _rt_crit >= 2) { - last = now; - fprintf(stderr, "(%s/%d:%lu) Ping\n", _rt_our_prog_name, gettid(), _rt_cp->job_index); - } + } + // else if (now > last + 60ull * _BILLION && _rt_crit >= 2) { + // last = now; + // fprintf(stderr, "(%s/%d:%lu) Ping\n", _rt_our_prog_name, gettid(), _rt_cp->job_index); + // } if (sleep_next_period() != 0) { perror("Unable to sleep for next period"); } diff --git a/run_all_sd-vbs.sh b/run_all_sd-vbs.sh index 97fc4f1..2db51f2 100755 --- a/run_all_sd-vbs.sh +++ b/run_all_sd-vbs.sh @@ -30,18 +30,18 @@ cd .. echo "Done. Running experiments..." # Full L3, full L2 - xi is the baseline for the pairs baseXI=SD-VBS/$(date +"%b%d-%H")-c-xi-$runID.txt -echo "" | ../run_bench.sh -m base -p $coreCPU -l $maxJobs -b sd-vbsNames.txt -B -I xi $runID +echo "" | ../run_bench.sh -m base -p $coreCPU -l $maxJobs -b sd-vbsNames.txt -I xi $runID # Half L3, full L2 - i3 sees effect of half L3 baseI3=SD-VBS/$(date +"%b%d-%H")-c-i3-$runID.txt -echo "" | ../run_bench.sh -m base -p $coreCPU -l $maxJobs -b sd-vbsNames.txt -B -I i3 $runID +echo "" | ../run_bench.sh -m base -p $coreCPU -l $maxJobs -b sd-vbsNames.txt -I i3 $runID # Half L3, half L2 - additional effect of half L2 baseI=SD-VBS/$(date +"%b%d-%H")-c-i-$runID.txt -echo "" | ../run_bench.sh -m base -p $coreCPU -l $maxJobs -b sd-vbsNames.txt -B -I i $runID +echo "" | ../run_bench.sh -m base -p $coreCPU -l $maxJobs -b sd-vbsNames.txt -I i $runID date # Run the Level-C pairs pairC=SD-VBS/$(date +"%b%d-%H")-c-xi-async-$runID.txt -echo "" | ../run_bench.sh -m pair -p $coreCPU -P $threadCPU -l $maxJobs -b sd-vbsNames.txt -B -I xi -A $runID +echo "" | ../run_bench.sh -m pair -p $coreCPU -P $threadCPU -l $maxJobs -b sd-vbsNames.txt -I xi -A $runID date # Run the Level-A/-B pairs @@ -52,13 +52,13 @@ cd .. echo "Done. Continuing experiments..." # No cache isolation pairXI=SD-VBS/$(date +"%b%d-%H")-c-xi-$runID"-A.txt and -B.txt" -echo "" | ../run_bench.sh -m pair -p $coreCPU -P $threadCPU -l $maxJobs -b sd-vbsNames.txt -B -I xi $runID +echo "" | ../run_bench.sh -m pair -p $coreCPU -P $threadCPU -l $maxJobs -b sd-vbsNames.txt -I xi $runID # Shared L2, split L3 pairI3=SD-VBS/$(date +"%b%d-%H")-c-i3-$runID"-A.txt and -B.txt" -echo "" | ../run_bench.sh -m pair -p $coreCPU -P $threadCPU -l $maxJobs -b sd-vbsNames.txt -B -I i3 $runID +echo "" | ../run_bench.sh -m pair -p $coreCPU -P $threadCPU -l $maxJobs -b sd-vbsNames.txt -I i3 $runID # Split L2, split L3 pairI=SD-VBS/$(date +"%b%d-%H")-c-i-$runID"-A.txt and -B.txt" -echo "" | ../run_bench.sh -m pair -p $coreCPU -P $threadCPU -l $maxJobs -b sd-vbsNames.txt -B -I i $runID +echo "" | ../run_bench.sh -m pair -p $coreCPU -P $threadCPU -l $maxJobs -b sd-vbsNames.txt -I i $runID date echo "==== DONE ====" diff --git a/run_case_study_dag.py b/run_case_study_dag.py index 0b2f61c..f098e9e 100755 --- a/run_case_study_dag.py +++ b/run_case_study_dag.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#/usr/bin/python3 # Make sure to run this as root!!!!! import os import sys @@ -7,22 +7,30 @@ import csv import time import subprocess -A_SUITE = 1 -A_BIN = 2 -A_CRIT = 3 -A_PERIOD = 5 -P_CORE = 0 -P_CRIT = 1 -P_T1_ID = 2 -P_T2_ID = 5 +# Single tasks: +# 0, binary_name, task_name, iterations, my_core, runID, save?, period, criticality, phase +# Paired tasks: +# 1, binary_name, task_name, iterations, my_core, runID, save?, period, criticality, phase, other_binary_name, other_task_name -T_ID = 0 -T_BIN = 1 -T_PERIOD = 2 -T_CCX = 3 -CRIT_LEVEL_C = 2 +binary_path = "./SD-VBS/dag_binaries/" +stderr_file = open("./deadline_misses", 'w+') + +BINARY_NAME = 1 +TASK_NAME = 2 +NUM_ITERS = 3 +CORE_NUM = 4 +RUN_ID = 5 +SAVE_RESULT = 6 +PERIOD = 7 +CRT_LEVEL = 8 +PHASE= 9 + +OTHER_BINARY_NAME = 10 +OTHER_TASK_NAME = 11 +# OTHER_CORE_NUM = 12 +# PAIR_ID = 12 all_pids=[] def run(command): @@ -56,215 +64,116 @@ def main(pathName): # Each list represents the parameters for a task as: # [id, suite, binary name, criticality level (0-base), pet us (unused), period ms, wss (unused)] all_tasks = [] - # List of lists - # Each list represents the parameters for a pairing as: - # [core, criticality level (0-base), task 1 ID, task 1 name (unused), task 1 period, task 2 ID, task 2 name, task 2 period] - # if task 1 ID = task 2 ID, it's not actually a pair at all - levelAB = [] - levelC = [] - levelC_s = [] + input_cmd = {} # Load input command for each binary - with open("baseline/tacleNames.txt") as f: - for benchName in f: - # TACLeBench doesn't need inputs - input_cmd[benchName.strip()] = "echo ' '" + with open("SD-VBS/sd-vbsNames.txt") as f: for line in f: name, cmd = line.split(maxsplit=1) input_cmd[name.replace("./", "")] = cmd.replace("./", "./SD-VBS/").strip() - with open("dis/dis2MbInNames.txt") as f: - for line in f: - name, cmd = line.split(maxsplit=1) - input_cmd[name.replace("./", "")] = cmd.replace("./", "./dis/").strip() + # for k in input_cmd: + # print(k, input_cmd[k]) + # return 1 + task_launches = [] + max_core = 0 # Load task specifications - with open(pathName+"/all_tasks.csv", "r") as csv_file: - csv_reader = csv.reader(csv_file, delimiter = ',') - line = 0 - for row in csv_reader: - if line > 0: - all_tasks.append(row) - line += 1 - with open(pathName+"/levelAB_pairs.csv", "r") as csv_file: - csv_reader = csv.reader(csv_file, delimiter = ',') - line = 0 - for row in csv_reader: - if line > 0: - levelAB.append(row) - line += 1 - with open(pathName+"/levelC_threads.csv", "r") as csv_file: - csv_reader = csv.reader(csv_file, delimiter = ',') - line = 0 - ccx = "0" - threaded = True - for row in csv_reader: - if(len(row) < 3): - continue - # Start of a cluster - read definition - if(row[0] == "threaded" or row[0] == "solo"): - threaded = row[0] == "threaded" - if(row[1] == "4"): - ccx = "1" - else: - ccx = "0" - continue - # Start of a thread speficication - if(row[0] != "task id" and row[0] != ""): - row.append(ccx) - if(threaded): - row.append("t") - else: - row.append("s") - levelC.append(row) - line += 1 + with open(pathName, "r") as file: + for line in file: + parameters = line.split(",") + task_launches.append(parameters) + core_num = int(parameters[CORE_NUM]) % 16 + if max_core < core_num: + max_core = core_num + # if parameters[0] == '1': + # other_core_num = int(parameters[OTHER_CORE_NUM]) % 16 + # if other_core_num > max_core: + # max_core = other_core_num + + core_count = max_core+1 + # print(parameters) + ### Allocate Cache Ways ### - run('mount -t resctrl resctrl /sys/fs/resctrl') + run('mount -t resctrl resctrl /sys/fs/resctrl') # run('echo "L3:0=0000,1=0000,2=0000,3=0000" > /sys/fs/resctrl/schemata') - with open(pathName+"/l3alloc.csv", "r") as csv_file: - csv_reader = csv.reader(csv_file, delimiter = ',') - line = 0 - ccx = 0 - for row in csv_reader: - if line > 0: - core = int(row[0]) - way_AB = int(row[1]) - way_C = int(row[3]) - # Level C allocation - if(core == 1): - run("mkdir -p /sys/fs/resctrl/level-c-ccx-0") - run('echo "L3:0=' + ("%0.4x" % (int("1"*way_C, 2))) + ';1=0000;2=0000;3=0000" > /sys/fs/resctrl/level-c-ccx-0/schemata') - - if(core == 4): - run("mkdir -p /sys/fs/resctrl/level-c-ccx-1") - run('echo "L3:0=0000;1=' + ("%0.4x" % (int("1"*way_C, 2))) + ';2=0000;3=0000" > /sys/fs/resctrl/level-c-ccx-1/schemata') - run('mkdir -p /sys/fs/resctrl/level-ab-core-' + str(core)) - if(core < 4): - run('echo "L3:0=' + ("%0.4x" % (int("1"*way_AB + "0"*(16-way_AB), 2))) + ';1=0000;2=0000;3=0000" > /sys/fs/resctrl/level-ab-core-' + str(core) + '/schemata') - else: - run('echo "L3:0=0000;1=' + ("%0.4x" % (int("1"*way_AB + "0"*(16-way_AB), 2))) + ';2=0000;3=0000" > /sys/fs/resctrl/level-ab-core-' + str(core) + '/schemata') - line += 1 - ### Cleanup Old State ### + # for core in range(16): + # run("mkdir -p /sys/fs/resctrl/core-{}".format(core)) + # ccx = core // 4 + # in_ccx = core % 4 + # mask = "0000" + # mask = mask[:in_ccx] +'f'+ mask[in_ccx+1:] + # if ccx == 0: + # run('echo "L3:0=' + mask + ';1=0000;2=0000;3=0000" > /sys/fs/resctrl/core-{}/schemata'.format(core)) + # if ccx == 1: + # run('echo "L3:0=0000;1=' + mask + ';2=0000;3=0000" > /sys/fs/resctrl/core-{}/schemata'.format(core)) + # if ccx == 2: + # run('echo "L3:0=0000;1=0000;2='+ mask +';3=0000" > /sys/fs/resctrl/core-{}/schemata'.format(core)) + # if ccx == 3: + # run('echo "L3:0=0000;1=0000;2=0000;3=' + mask + '" > /sys/fs/resctrl/core-{}/schemata'.format(core)) + + # return 1 run("rm -rf /dev/shm/*") - pairID = 0 - ### Dispatch all the Level-A and -B paired and unpaired tasks ### - for pairing in levelAB: - task1 = int(pairing[P_T1_ID]) - task2 = int(pairing[P_T2_ID]) - # Lookup periods and binary location - name1 = all_tasks[task1][A_BIN] - name2 = all_tasks[task2][A_BIN] - period1 = all_tasks[task1][A_PERIOD] - period2 = all_tasks[task2][A_PERIOD] - suite1 = all_tasks[task1][A_SUITE] - suite2 = all_tasks[task2][A_SUITE] - core = pairing[P_CORE] - criticality = pairing[P_CRIT] - binary = "" - binary1 = "" - binary2 = "" - arg = "" - # If the IDs match, this isn't a pair at all - if task1 == task2: - if suite1 == "TACLe": - binary = "./baseline/bin/" + name1 - elif suite1 == "SD-VBS": - binary = "./SD-VBS/" + name1 + "_qcif" - elif suite1 == "DIS": - binary = "./dis/" + name1 - else: - print("Invalid suite name " + suite1 + " in Level-A/-B tasks! Exiting...") - return 1 - lookupID = name1 + str(task1) - if ID2PID(lookupID): - print("ERROR: Task ID {} is already running! Did you end the previous case study?".format(lookupID)) - return 1 - # Arg format: - arg = " " + lookupID + " -1 " + core + " NULL 0 " + period1 + " " + criticality - bench_tsk = subprocess.Popen(input_cmd[name1] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash') - pid_str = ID2PID(lookupID) + + pairID = 0 + ### Dispatch tasks + for launch in task_launches: + binary_name = launch[BINARY_NAME].strip() + task_name = launch[TASK_NAME].strip() + num_iters = launch[NUM_ITERS].strip() + core_num =launch[CORE_NUM].strip() + run_id = launch[RUN_ID].strip() + save_result = launch[SAVE_RESULT].strip() + period = launch[PERIOD].strip() + crt_level = launch[CRT_LEVEL].strip() + phase = launch[PHASE].strip() + + + phys_core = int(core_num) % 16 + if ID2PID(task_name): + print("ERROR: Task Name {} is already running! Did you end the previous case study?".format(task_name)) + return 1 + # single tasks + if launch[0] == '0': + binary = binary_path + binary_name + "_single" + # Arg format: + arg = " " + task_name + " " + num_iters +" " + core_num +" " + run_id +" " + save_result+" " + period +" " + crt_level + " "+ phase + # print(input_cmd[binary_name] + " | numactl --interleave=all " + binary + arg) + bench_tsk = subprocess.Popen(input_cmd[binary_name] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash', stderr=stderr_file) + pid_str = ID2PID(task_name) if not pid_str: - print("Unable to launch {} as a solo task! Exiting...".format(name1)) + print("Unable to launch {} as a solo task! Exiting...".format(task_name)) return 1 - # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms) - run("echo " + pid_str + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") - addpid(pid_str) + # run("echo " + pid_str + " > /sys/fs/resctrl/core-" + str(phys_core) + "/tasks") else: - if suite1 == "TACLe": - binary1 = "./baseline/bin/" + name1 - binary2 = "./baseline/bin/" + name2 - elif suite1 == "SD-VBS": - binary1 = "./SD-VBS/" + name1 + "_qcif_all" - binary2 = "./SD-VBS/" + name2 + "_qcif_all" - elif suite1 == "DIS": - binary1 = "./dis/" + name1 + "_all" - binary2 = "./dis/" + name2 + "_all" - else: - print("Invalid suite name " + suite1 + " in Level-A/-B tasks! Exiting...") - return 1 - - pairID += 1 # Used for sem/shm identification in the pair task - thread = str(int(core) + 16) # How Linux numbers SMT threads on the 3950X - lookupID1 = name1 + str(task1) - lookupID2 = name2 + str(task2) - if ID2PID(lookupID1) or ID2PID(lookupID2): - print("ERROR: Part of the pair containing task IDs {} and {} is already running! Did you end the previous case study?".format(lookupID1, lookupID2)) + # Paried tasks + other_binary_name = launch[OTHER_BINARY_NAME].strip() + other_task_name = launch[OTHER_TASK_NAME].strip() + other_core_num = str(int(core_num)+16) + + #Check if SMT-paired correctly + # assert(abs(int(core_num)-int(other_core_num)) == 16) + if ID2PID(other_task_name): + print("ERROR: Task Name {} is already running! Did you end the previous case study?".format(other_task_name)) return 1 - # Arg format: <0 other core> - # XXX XXX XXX: FIXME when LITMUS is fixed - arg1 = " " + lookupID1 + " -1 " + core + " NULL 0 " + period1 + " " + criticality - arg2 = " " + lookupID2 + " -1 " + thread + " NULL 0 " + period2 + " " + criticality - bench_tsk1 = subprocess.Popen(input_cmd[name1] + " | numactl --membind=0 " + binary1 + arg1, shell=True, executable='/bin/bash') - bench_tsk2 = subprocess.Popen(input_cmd[name2] + " | numactl --membind=1 " + binary2 + arg2, shell=True, executable='/bin/bash') - # Find benchmark PID (avoid getting shell or numactl PID) - pid1_str = ID2PID(lookupID1) - pid2_str = ID2PID(lookupID2) + binary = binary_path + binary_name + "_pair" + other_binary = binary_path + other_binary_name + "_pair" + # Arg format: <0 other core> + arg1 = " " + task_name + " " + num_iters +" " + core_num +" " + other_core_num+" "+ other_task_name+" "+ run_id +" " + save_result+" " +str(pairID) +" "+ period +" " + crt_level +" "+phase + arg2 = " " + other_task_name + " " + num_iters +" " + other_core_num +" " + core_num+" "+ task_name+" "+ run_id +" " + save_result+" " +str(pairID) +" "+ period +" " + crt_level+" " +phase + # print(input_cmd[binary_name] + " | numactl --membind=0 " + binary + arg1) + # print(input_cmd[other_binary_name] + " | numactl --membind=1 " + other_binary + arg2) + bench_tsk1 = subprocess.Popen(input_cmd[binary_name] + " | numactl --membind=0 " + binary + arg1, shell=True, executable='/bin/bash', stderr=stderr_file) + bench_tsk2 = subprocess.Popen(input_cmd[other_binary_name] + " | numactl --membind=1 " + other_binary + arg2, shell=True, executable='/bin/bash', stderr=stderr_file) + pid1_str = ID2PID(task_name) + pid2_str = ID2PID(other_task_name) if not pid1_str or not pid2_str: - print("Unable to launch {} and {} in a pair! Exiting...".format(name1, name2)) + print("Unable to launch {} and {} in a pair! Exiting...".format(task_name, other_task_name)) return 1 - # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms) - run("echo " + pid1_str + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") - run("echo " + pid2_str + " > /sys/fs/resctrl/level-ab-core-" + core + "/tasks") - addpid(pid1_str) - addpid(pid2_str) - - ### Dispatch all the Level-C tasks ### - for task in levelC: - tid = int(task[T_ID]) - name = all_tasks[tid][A_BIN] - period = all_tasks[tid][A_PERIOD] - suite = all_tasks[tid][A_SUITE] - ccx = task[T_CCX] - - if suite == "TACLe": - binary = "./baseline/bin/" + name - elif suite == "SD-VBS": - name += "_qcif" - binary = "./SD-VBS/" + name - elif suite == "DIS": - binary = "./dis/" + name - else: - print("Invalid suite name " + suite + " in Level-C tasks! Exiting...") - return 1 - # XXX XXX XXX: FIXME when LITMUS is fixed - core = str(int(ccx)*4 + 1); - - lookupID = name + str(tid) - if ID2PID(lookupID): - print("ERROR: Task ID {} is already running! Did you end the previous case study?".format(lookupID)) - return 1 - # Arg format: - arg = " " + lookupID + " -1 " + core + " NULL 0 " + period + " " + str(CRIT_LEVEL_C) - bench_tsk = subprocess.Popen(input_cmd[name] + " | numactl --interleave=all " + binary + arg, shell=True, executable='/bin/bash') - # Find benchmark PID (avoid getting shell or numactl PID) - pid_str = ID2PID(lookupID) - if not pid_str: - print("Unable to launch {} as a Level-C thread! Exiting...".format(name)) - return 1 - # Add this task to the appropriate cache partition (Class of Service in Intel CAT terms) - run("echo " + pid_str + " > /sys/fs/resctrl/level-c-ccx-" + ccx + "/tasks") - addpid(pid_str) + # run("echo " + pid1_str + " > /sys/fs/resctrl/core-" + str(phys_core) + "/tasks") + # run("echo " + pid2_str + " > /sys/fs/resctrl/core-" + str(phys_core) + "/tasks") + pairID += 1 if __name__ == "__main__": if len(sys.argv) < 2: -- cgit v1.2.2