diff --git a/scripts/run.py b/scripts/dpdk.py similarity index 94% rename from scripts/run.py rename to scripts/dpdk.py index 2e25093..e7fe7ce 100755 --- a/scripts/run.py +++ b/scripts/dpdk.py @@ -19,7 +19,7 @@ import netexp only_max_qps = True # [[counter names], counting mode (0 = sampling, 1 = counting)] pmc_counters = [ - #"", + "", # [["mem_load_l3_miss_retired.local_dram"], 1], # [["mem_load_l3_miss_retired.remote_dram"], 1], # [["mem_load_l3_miss_retired.remote_hitm"], 1], @@ -31,8 +31,7 @@ pmc_counters = [ # [["mem_trans_retired.load_latency_gt_128"], 0], # [["mem_trans_retired.load_latency_gt_256"], 0], # [["mem_trans_retired.load_latency_gt_512"], 0], - - [["mem_trans_retired.load_latency_gt_8", ""], 0], + #[["mem_trans_retired.load_latency_gt_8", ""], 0], ] # pkt_pad @@ -124,8 +123,8 @@ def main(): output_dirname = "run" conf = netexp.NetExpConf() - conf.srv_mechspec = mechspec.LAB.SKYLAKE3_10G - conf.clt_mechspecs = [mechspec.LAB.SKYLAKE6_10G, mechspec.LAB.SKYLAKE5_10G, mechspec.LAB.SKYLAKE7_10G, mechspec.LAB.SKYLAKE8_10G] + conf.srv_mechspec = mechspec.LAB.SKYLAKE1_10G + conf.clt_mechspecs = [mechspec.LAB.SKYLAKE3_10G, mechspec.LAB.SKYLAKE5_10G] conf.mst_mechspec = mechspec.LAB.SKYLAKE2_10G conf.finalize_mechspecs() conf.root_dir = "/numam.d/build/bin" @@ -154,13 +153,19 @@ def main(): conf.pmc_sampling_rate = 4096 conf.pmc_counting_interval = 0.1 - options = getopt.getopt(sys.argv[1:], 'sc')[0] + options = getopt.getopt(sys.argv[1:], 'scSD')[0] for opt, arg in options: if opt in ('-s'): netexp.stop_all(conf) return elif opt in ('-c'): conf.enable_client_only=True + elif opt in ('-S'): + netexp.setup(conf, bench = True, dpdk = False) + return + elif opt in ('-D'): + netexp.setup(conf, bench=False, dpdk=True) + return tc.init("~/results.d/numam_neo/" + output_dirname + "_" + datetime.datetime.now().strftime('%Y%m%d%H%M%S')) cpcmd = "cp " + __file__ + " " + tc.get_odir() + "/" diff --git a/scripts/libs/libmechspec.py b/scripts/libs/libmechspec.py index fbcb000..79bb8ca 100644 --- a/scripts/libs/libmechspec.py +++ b/scripts/libs/libmechspec.py @@ -9,7 +9,7 @@ class NetSpec: class LabNetSpecs: def __init__(self) -> None: - self.SKYLAKE1_10G = NetSpec(fqdn = "skylake1.rcs.uwaterloo.ca",ip = "192.168.123.11", mac = "") + self.SKYLAKE1_10G = NetSpec(fqdn = "skylake1.rcs.uwaterloo.ca",ip = "192.168.123.11", mac = "3c:15:fb:62:9b:28") self.SKYLAKE2_10G = NetSpec(fqdn = "skylake2.rcs.uwaterloo.ca",ip = "192.168.123.12", mac = "3c:15:fb:c9:f3:36") self.SKYLAKE3_10G = NetSpec(fqdn = "skylake3.rcs.uwaterloo.ca",ip = "192.168.123.13", mac = "3c:15:fb:c9:f3:4b") self.SKYLAKE4_10G = NetSpec(fqdn = "skylake4.rcs.uwaterloo.ca",ip = "192.168.123.14", mac = "") diff --git a/scripts/netexp.py b/scripts/netexp.py index 2c1097e..567b22e 100644 --- a/scripts/netexp.py +++ b/scripts/netexp.py @@ -1,5 +1,6 @@ import time import subprocess as sp +import os import libpar as par import libtc as tc @@ -60,7 +61,8 @@ class NetExpConf: def __build_fqdn_arr(self, ns): ret = [] for n in ns: - ret.append(n.fqdn) + if n != None: + ret.append(n.fqdn) return ret def get_pmc_str(self): @@ -148,7 +150,76 @@ def stop_all(conf : NetExpConf): if conf.enable_pmc: tc.log_print("Stopping server PMC...") tc.remote_exec(conf.srv_fqdns, "sudo killall -9 pmcstat", check=False) - + + +def __run_setup_cmd(conf : NetExpConf, cmd : str, desc : str): + all = [] + all.extend(conf.srv_fqdns) + all.extend(conf.clt_fqdns) + all.extend(conf.mst_fqdns) + + ssrv : list[tuple[str, sp.Popen]] = [] + for s in all: + tc.log_print(f"Running \'{desc}\' on {s}...") + ssrv.append((s, tc.remote_exec([s], cmd, blocking=False, check=False)[0])) + + for p in ssrv: + _ , stderr = p[1].communicate() + if p[1].returncode != 0: + print(f"{ p[0] } \'{desc}\' failed. stderr:\n{stderr.decode()}\n") + else: + print(f"{ p[0] } \'{desc}\' succeeded") + +def setup(conf : NetExpConf, bench : False, dpdk : False): + libtopo_path = "/libtopo" + dpdk_path = "/dpdk" + bench_path = "/numam.d" + if dpdk: + setup_cmd = f'''sudo rm -rf {libtopo_path}; sudo rm -rf /usr/local/include/libtopo; + sudo rm -rf /usr/local/lib/libtopo; + sudo mkdir -p {libtopo_path}; + sudo chmod 777 {libtopo_path}; + cd {libtopo_path}; + git clone https://git.quacker.org/d/libtopo; + cd libtopo; + mkdir build; + cd build; + cmake ../; + sudo make install''' + __run_setup_cmd(conf, setup_cmd, "dpdk - libtopo") + setup_cmd = f'''sudo pkg install -y meson pkgconf py39-pyelftools; + sudo rm -rf {dpdk_path} + sudo mkdir -p {dpdk_path}; + sudo chmod 777 {dpdk_path}; + cd {dpdk_path}; + git clone https://git.quacker.org/d/numam-dpdk; + cd numam-dpdk; + git checkout migration; + CC=gcc CXX=g++ meson -Denable_kmods=true build; + cd build; + sudo ninja install''' + __run_setup_cmd(conf, setup_cmd, "dpdk - dpdk") + if bench: + setup_cmd = f'''sudo rm -rf {bench_path}; + sudo mkdir -p {bench_path}; + sudo chmod 777 {bench_path}''' + __run_setup_cmd(conf, setup_cmd, "bench - remove") + all = [] + all.extend(conf.srv_fqdns) + all.extend(conf.clt_fqdns) + all.extend(conf.mst_fqdns) + dir = f"{os.path.dirname(__file__)}/../" + for clt in all: + print("Syncing files to " + clt + "...") + rsync_cmd = f"rsync -az --no-perms --rsync-path=\"sudo rsync\" --omit-dir-times -e \"ssh -p77\" {dir} {tc.get_ssh_user()}@{clt}:{bench_path}/" + sp.check_call(rsync_cmd, shell=True) + setup_cmd = f'''cd {bench_path}; + sudo rm -rf build; + mkdir build; + cd build; + cmake ../; + make -j8 khat cat rat memloadgen''' + __run_setup_cmd(conf, setup_cmd, "bench - compile") def run(conf : NetExpConf): stop_all(conf) diff --git a/scripts/setup_dpdk.sh b/scripts/setup_dpdk.sh deleted file mode 100755 index b45a57f..0000000 --- a/scripts/setup_dpdk.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -dpdk_dir="/dpdk" -libtopo_dir="/libtopo" -root="$(dirname "$0")/.." -servers="skylake8.rcs.uwaterloo.ca" -rsync_flags="-az" -ssh_args="-o StrictHostKeyChecking=no -p77" - -user=$1 - - -if [ -z $user ] -then - user=$(whoami) -fi - -echo "USER: $user" - -compile() { - # separate these functions because we might change kernel (reboot) without needing to recompile - echo "====================$1====================" - ssh $(echo $ssh_args $user@$1) "sudo sh -c \"sudo rm -rf $libtopo_dir; sudo rm -rf /usr/local/include/libtopo; sudo rm -rf /usr/local/lib/libtopo;sudo mkdir -p $libtopo_dir; sudo chmod 777 $libtopo_dir; cd $libtopo_dir; git clone https://git.quacker.org/d/libtopo; cd libtopo; mkdir build; cd build; cmake ../; sudo make install\"" - ssh $(echo $ssh_args $user@$1) "sudo sh -c \"sudo pkg install -y meson pkgconf py39-pyelftools; sudo rm -rf $dpdk_dir; sudo mkdir -p $dpdk_dir; sudo chmod 777 $dpdk_dir; cd $dpdk_dir; git clone https://git.quacker.org/d/numam-dpdk; cd numam-dpdk; git checkout migration; CC=gcc CXX=g++ meson -Denable_kmods=true build; cd build; ninja install\"" - wait - echo "$1 Done." - echo "" -} - -i=0 -for server in $servers -do - i=$(expr $i + 1) - compile "$server" & -done - -wait \ No newline at end of file diff --git a/scripts/setup_program.sh b/scripts/setup_program.sh deleted file mode 100755 index cb8628c..0000000 --- a/scripts/setup_program.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -dpdk_dir="/numam.d" -root="$(dirname "$0")/.." -servers="icelake1-int.rcs.uwaterloo.ca" -#icelake2-int.rcs.uwaterloo.ca" -#servers="skylake2.rcs.uwaterloo.ca skylake3.rcs.uwaterloo.ca skylake5.rcs.uwaterloo.ca skylake6.rcs.uwaterloo.ca skylake7.rcs.uwaterloo.ca skylake8.rcs.uwaterloo.ca icelake2-int.rcs.uwaterloo.ca milan1-int.rcs.uwaterloo.ca" -rsync_flags="-rv -e \"ssh -p77\"" -ssh_args="-o StrictHostKeyChecking=no -p77" - -user=$1 - - -if [ -z $user ] -then - user=$(whoami) -fi - -echo "USER: $user" - -compile() { - # separate these functions because we might change kernel (reboot) without needing to recompile - echo "====================$1====================" - ssh $(echo $ssh_args $user@$1) "sudo sh -c \"rm -rf $dpdk_dir; mkdir $dpdk_dir; chmod 777 $dpdk_dir\"" - rsync -rv -e "ssh -p77" $root/ $user@$1:$dpdk_dir/ - ssh $(echo $ssh_args $user@$1) "sudo sh -c \"cd $dpdk_dir; rm -rf build; mkdir build; cd build; cmake ../; make -j8 khat cat rat memloadgen\"" - wait - echo "$1 Done." - echo "" -} - -i=0 -for server in $servers -do - i=$(expr $i + 1) - compile "$server" & -done - -wait \ No newline at end of file diff --git a/scripts/test.py b/scripts/test.py deleted file mode 100644 index a3876ee..0000000 --- a/scripts/test.py +++ /dev/null @@ -1,10 +0,0 @@ -import libpar as par - -path = "/home/quackerd/results.d/numam_neo/run_20220807093909/affinity1,3,5,7,9,11,13,15,17,19,21,23_pad0_load0,fixed:0,fixed:0_pmc.mem_load_l3_miss_retired.local_dram/pmc.txt.tmp" - -with open(path, "r") as f: - p = par.pmc_parser(f.read()) - -print(str(p.cores)) -print(str(p.count)) -print(str(p.counter)) \ No newline at end of file diff --git a/scripts/tmp.py b/scripts/tmp.py deleted file mode 100644 index 4ecf4cf..0000000 --- a/scripts/tmp.py +++ /dev/null @@ -1,21 +0,0 @@ -import time -import subprocess as sp - -import libpar as par -import libtc as tc -import libmechspec as mechspec -import numpy as np - -FILE : str = "/home/quackerd/1028361.txt" - -parser = par.khat_parser() -with open(FILE, "r") as f: - parser.parse(f.read()) - - -re = [] -for i in range(0, len(parser.clt_swlat)): - ertt = parser.clt_swlat[i] - parser.srv_swlat[i] - re.append(ertt) - -print("Median: " + str(np.percentile(re, 50))) \ No newline at end of file