temp save

This commit is contained in:
quackerd 2021-03-17 21:45:01 -04:00
parent cd4785f08a
commit 997587c519
6 changed files with 98 additions and 81 deletions

1
.pyenv Normal file
View File

@ -0,0 +1 @@
PYTHONPATH="./scripts/libs"

View File

@ -103,7 +103,6 @@ retry:
}
pthread_mutex_unlock(&alloc_lock);
printf("size: 0x%lx alloc: %p\n", size, ret);
return ret;
}

View File

@ -689,11 +689,11 @@ main(int argc, char *argv[])
portid);
}
if (nm_obj_count(NM_LEVEL_NUMA) > (int)MAX_NODES) {
if (rte_socket_count() > (int)MAX_NODES) {
rte_exit(EXIT_FAILURE, "Too many numa nodes\n");
}
for (int i = 0; i < nm_obj_count(NM_LEVEL_NUMA); i++) {
for (int i = 0; i < (int)rte_socket_count(); i++) {
uint32_t nodeid = i;
ntr(NTR_DEP_USER1, NTR_LEVEL_INFO,
"main: creating mempool for node %d\n", nodeid);
@ -714,22 +714,19 @@ main(int argc, char *argv[])
options.s_mempools[nodeid] = mbuf_pool;
ntr(NTR_DEP_USER1, NTR_LEVEL_INFO,
"main: created mempool for node %d\n", nodeid);
break; // XXX: hack
}
// init threads
// auto cores = nm_get_cores();
uint64_t cpuset = options.cpuset;
for (int i = 0; i < options.num_threads; i++) {
uint32_t lcore_id = cmask_get_next_cpu(&cpuset);
uint32_t node_id = get_node_from_core(lcore_id);
uint32_t node_id = rte_lcore_to_socket_id(lcore_id);
auto *tinfo = (struct thread_info *)nm_malloc(node_id, sizeof(struct thread_info));
tinfo->cache_lines = nm_malloc(node_id, CACHELINE_SIZE * options.thread_cacheline_cnt);
tinfo->load_buffer = nm_malloc(node_id, THREAD_LOAD_BUFFER_SZ);
tinfo->tid = i;
tinfo->lcore_id = lcore_id;
tinfo->node_id = 0; // XXX: hack
tinfo->node_id = node_id;
options.s_thr_info.push_back(tinfo);
ntr(NTR_DEP_USER1, NTR_LEVEL_INFO,
"main: thread %d assigned to cpu %d, node %d\n", tinfo->tid,

View File

@ -21,12 +21,17 @@ def process_dir(rootdir):
if os.path.isfile(each_dir) and each_dir.endswith(".txt"):
output = None
try:
with open(each_dir, 'r') as f:
if len(f.readlines()) <= 1:
print("Skipping empty file - " + each_dir)
continue
with open(each_dir, 'r') as f:
output = f.read()
parser = par.khat_parser()
parser.parse(output)
print("Processed raw data - " + each_dir)
ret.append(parser)
parser = par.khat_parser()
parser.parse(output)
print("Processed raw data - " + each_dir)
ret.append(parser)
except:
print("Unrecognized format - " + subdir)
@ -35,7 +40,7 @@ def process_dir(rootdir):
marker_map = ["o", "P", "s", "v", "*", "+", "^", "1", "2", "d", "X", "o", "P", "s", "v", "*", "+", "^", "1", "2", "d", "X"]
color_map = ["xkcd:black", "xkcd:red", "xkcd:blue", "xkcd:green", "xkcd:cyan", "xkcd:yellow", "xkcd:purple", "xkcd:orange", "xkcd:salmon", "xkcd:lightgreen", "xkcd:indigo", "xkcd:brown"]
color_map = ["xkcd:black", "xkcd:red", "xkcd:blue", "xkcd:green", "xkcd:cyan", "xkcd:yellow", "xkcd:purple", "xkcd:orange", "xkcd:salmon", "xkcd:lightgreen", "xkcd:indigo", "xkcd:brown", "xkcd:bubblegum", "xkcd:lavender", "xkcd:maroon", "xkcd:fern", "xkcd:sky", "xkcd:orchid", "xkcd:sienna"]
parser_idx_labels = ["srv_hw", "srv_sw", "clt_hw", "clt_sw"]
def add_curve(eax, label : str, qps_arr : [], lat_arr : [], marker : str, color : str):
@ -98,7 +103,7 @@ def generate_graph(aff_to_parser : {}, parser_idx : int, fn : str):
rax[0].legend()
rax[1].legend()
fig.set_size_inches(23.4, 16.5)
plt.savefig(fn, dpi=300)
plt.savefig(fn, dpi=150)
plt.close()
def main():

View File

@ -12,7 +12,7 @@ import math
import concurrent.futures as CF
import libpar as par
num_bins = 1000
num_bins = 250
extra_pct = []
def saveplot(fp : str, data : [], title : str):
@ -82,7 +82,7 @@ def process_dir(rootdir):
for subdir in os.listdir(rootdir):
each_dir = os.path.join(rootdir, subdir)
if os.path.isfile(each_dir):
if each_dir.endswith("sample.txt") or each_dir.endswith(".sample"):
if each_dir.endswith(".txt") or each_dir.endswith(".sample"):
process_file(each_dir)
else:
process_dir(each_dir)

View File

@ -12,30 +12,39 @@ import re
import libpar as par
import libtc as tc
step_inc_pct = 100
init_step = 1000000 #
start_step = 1000000
term_qps = 50000000
term_pct = 1
inc_pct = 50
# load_gen
loadgen_load = "fixed:16"
# pkt_pad
enable_pktpad = False
jumbo_frame_threshold = 1518
pkt_pads = [
"8192"
#"0",
#"256",
#"512",
#"1024",
"0",
# "256",
# "512",
# "1024",
#"1518",
#"2048",
#"4096"
#"4096",
#"8192",
#"9018"
]
pkt_pads_depth = {}
pkt_pads_depth["0"] = "0"
pkt_pads_depth["256"] = "16"
pkt_pads_depth["512"] = "8"
pkt_pads_depth["1024"] = "4"
pkt_pads_depth["1518"] = "6"
pkt_pads_depth["2048"] = "2"
pkt_pads_depth["4096"] = "1"
pkt_pads_depth["8192"] = "1"
pkt_pads_depth["9018"] = "1"
# memgen
enable_memgen = False
memgen_mask = [
"0xFFFFFF000000",
"0x000000FFFFFF",
"0xFFFFFF000000",
"0xFFFFFF000000",
"0xFFFFFF000000",
@ -50,7 +59,9 @@ memgen_mask = [
memgen_target = [
"0xA",
"0xA000000",
"0xA",
"0xA",
"0xA",
"0xA",
"0xA",
@ -69,16 +80,24 @@ root_dir = os.path.join(file_dir,"..")
sample_filename = "sample.txt"
affinity = [
"0xAAAAAA",
"0x20",
"0xA0",
"0xAA0",
"0xAAAA0",
"0x2000000",
"0xA000000",
"0xAA000000",
"0xAAAA000000",
"0xAAAAAA000000",
#"0x20",
#"0x2000000",
# "0xA0",
# "0xAA0",
# "0xAAAA0",
# "0xAAAAA",
# "0xAAAAAA",
# "0x2000000",
# "0xA000000",
# "0xAA000000",
# "0xAAAA000000",
# "0xAAAAA000000",
# "0xAAAAAA000000",
"0x2000002",
"0xA00000A",
"0xAA0000AA",
"0xAAAA00AAAA",
"0xAAAAAAAAAAAA"
]
master = ["skylake2.rcs.uwaterloo.ca"]
@ -157,8 +176,10 @@ def run_exp(affinity : str, ld : int, pkt_pad : str, aff_idx : int):
" -H " + client_spec[i] + \
" -s " + server_spec[0] + \
" -r " + str(client_rage_quit) + \
" -D 1 -l 100 " + \
" -P " + pkt_pad
" -l 100 " + \
" -w " + loadgen_load + \
" -P " + pkt_pad + \
" -D " + pkt_pads_depth[pkt_pad]
if int(pkt_pad) > jumbo_frame_threshold:
client_cmd += " -J "
tc.log_print(client_cmd)
@ -195,7 +216,7 @@ def run_exp(affinity : str, ld : int, pkt_pad : str, aff_idx : int):
while True:
# either failed or timeout
# we use failure detection to save time for long durations
if tc.errthr_get_failed() or cur >= int(warmup + duration) * 2 :
if tc.errthr_get_failed() or cur >= int(warmup + duration) * 3 :
break
if p.poll() != None:
@ -213,7 +234,8 @@ def run_exp(affinity : str, ld : int, pkt_pad : str, aff_idx : int):
if success:
return
def keep_results():
def keep_results(qps_only : bool = False):
success = True
target_scp_fn = tc.get_odir() + "/sample.txt"
scpcmd = "scp -P77 oscar@" + master[0] + ":" + test_dir + "/" + sample_filename + " " + target_scp_fn
tc.log_print(scpcmd)
@ -229,15 +251,24 @@ def keep_results():
sp.check_call(mvcmd, shell=True)
tc.log_print("=== Summary - qps: " + str(parser.qps) + " master loss: " + str(float(parser.master_loss) / float(parser.master_recv + parser.master_loss) * 100.00) + " slave loss: " + str(float(parser.slave_loss) / float(parser.slave_recv + parser.slave_loss) * 100.0) + "%" )
tc.log_print("=== Server HW:")
tc.log_print(par.mutilate_data.build_mut_output(parser.srv_hwlat, [parser.qps]) + "\n")
tc.log_print("=== Server SW:")
tc.log_print(par.mutilate_data.build_mut_output(parser.srv_swlat, [parser.qps]) + "\n")
tc.log_print("=== Client HW:")
tc.log_print(par.mutilate_data.build_mut_output(parser.clt_hwlat, [parser.qps]) + "\n")
tc.log_print("=== Client SW:")
tc.log_print(par.mutilate_data.build_mut_output(parser.clt_swlat, [parser.qps]) + "\n")
return parser.qps
if not qps_only:
try:
tc.log_print("=== Server HW:")
tc.log_print(par.mutilate_data.build_mut_output(parser.srv_hwlat, [parser.qps]) + "\n")
tc.log_print("=== Server SW:")
tc.log_print(par.mutilate_data.build_mut_output(parser.srv_swlat, [parser.qps]) + "\n")
tc.log_print("=== Client HW:")
tc.log_print(par.mutilate_data.build_mut_output(parser.clt_hwlat, [parser.qps]) + "\n")
tc.log_print("=== Client SW:")
tc.log_print(par.mutilate_data.build_mut_output(parser.clt_swlat, [parser.qps]) + "\n")
except:
success = False
if not success:
rmcmd = "rm " + target_fn
tc.log_print(rmcmd)
sp.check_call(rmcmd, shell=True)
return (parser.qps if success else -1)
def main():
global hostfile
@ -280,46 +311,30 @@ def main():
for i in range(0, len(affinity)):
for epad in pkt_pads:
eaff = affinity[i]
step_mul = 100
last_load = 0
cur_load = start_step
tc.begin(eaff + "_" + epad)
#tc.log_print("============ Affinity: " + str(eaff) + " PktPad: " + epad + " Load: MAX" + " ============")
#run_exp(eaff, 0, epad, i)
#keep_results()
#stop_all()
tc.log_print("============ Affinity: " + str(eaff) + " PktPad: " + epad + " Load: MAX" + " ============")
run_exp(eaff, 0, epad, i)
max_qps = keep_results(qps_only=True)
stop_all()
if client_only:
break
while True:
finish = (int)(max_qps - max(master_qps, 0.01 * max_qps))
step = (int)(finish / 10)
cur_load = step
while cur_load <= finish:
tc.log_print("============ Affinity: " + str(eaff) + " PktPad: " + epad + " Load: " + str(cur_load) + " ============")
run_exp(eaff, cur_load, epad, i)
qps = keep_results()
pct = int((qps - last_load) / init_step * 100)
tc.log_print("last_load: " + str(last_load) + " this_load: " + str(qps) + " inc_pct: " + str(pct) + "%")
if cur_load > term_qps:
tc.log_print("qps more than " + str(term_qps) + "%. Done.")
break
if pct <= term_pct:
tc.log_print("inc_pct less than TERM_PCT " + str(term_pct) + "%. Done.")
break
if pct <= inc_pct:
step_mul += step_inc_pct
tc.log_print("inc_pct less than INC_PCT " + str(inc_pct) + "%. Increasing step multiplier to " + str(step_mul) + "%")
last_load = qps
cur_load += int(init_step * step_mul / 100)
if keep_results() != -1:
# increment only on success
cur_load += step
tc.log_print("")
tc.end()
stop_all()