def get_batch_stat (path, numSim): pkt_lat_tot_avg_array = [] pkt_lat_tot_max_array = [] pkt_lat_net_avg_array = [] pkt_lat_net_max_array = [] throughput_array = [] deflect_array = [] for sim_index in range(1, numSim+1, 1): input_file = path + "sim_" + str(sim_index) + ".out" exist = os.path.exists(input_file) if (exist is False): print "Fail to find " + str (sim_index) + ".out or its counterpart." continue stat = get.get_stat (input_file) [pkt_lat_tot_avg, pkt_lat_tot_max] = get.get_pkt_lat_tot (stat) pkt_lat_tot_avg_array.append(pkt_lat_tot_avg) pkt_lat_tot_max_array.append(pkt_lat_tot_max) [pkt_lat_net_avg, pkt_lat_net_max] = get.get_pkt_lat_net (stat) pkt_lat_net_avg_array.append(pkt_lat_net_avg) pkt_lat_net_max_array.append(pkt_lat_net_max) throughput = get.get_throughput(stat) throughput_array.append(throughput) deflect = get.get_deflect(stat) deflect_array.append(deflect) return pkt_lat_tot_avg_array, pkt_lat_net_avg_array, throughput_array, deflect_array
for dir in os.listdir (target_dir): if dir == ".DS_Store": continue num_sim_file = 0 # number of workloads get simulated in each folder _ws_per_workload = [0] * NUM_WORKLOAD _hs_per_workload = [0] * NUM_WORKLOAD _uf_per_workload = [0] * NUM_WORKLOAD for sim_index in range (1, NUM_WORKLOAD+1, 1): sim_file = target_dir + dir + "/sim_" + str(sim_index) + ".out" if os.path.isfile (sim_file) is False: print "The file " + sim_file + " doesn't exist." continue # read in the referenced IPC ipc_alone = get.get_ipc_alone (workload_dir, sim_index) stat_share_design = get.get_stat (sim_file) ipc_share_design = get.get_ipc_share (stat_share_design) (ws_design, hs_design, uf_design) = get.cmp_metric (ipc_alone, ipc_share_design) _ws_per_workload [num_sim_file] = ws_design _hs_per_workload [num_sim_file] = hs_design _uf_per_workload [num_sim_file] = uf_design num_sim_file = num_sim_file + 1 total_num = total_num + 1 ws_plt = ws_plt + [get.cmp_geo_avg (_ws_per_workload)] hs_plt = hs_plt + [get.cmp_geo_avg (_hs_per_workload)] uf_plt = uf_plt + [get.cmp_geo_avg (_uf_per_workload)] para_value_plt = para_value_plt + [dir] num_value = num_value + 1 # increase the number of value being swept print "number of value : " + str (num_value)
import fnmatch import string import compute import get dir_0 = "../preliminary/synthSweep/uc/" pkt_lat_tot_avg_array = [] pkt_lat_tot_max_array = [] for sim_index in range(1, 21, 1): input_file = dir_0 + "sim_" + str(sim_index) + ".out" exist = os.path.exists(input_file) if (exist is False): print "Fail to find " + str (sim_index) + ".out or its counterpart." continue stat = get.get_stat (input_file) [pkt_lat_tot_avg, pkt_lat_tot_max] = get.get_pkt_lat_tot (stat) pkt_lat_tot_avg_array.append(pkt_lat_tot_avg) pkt_lat_tot_max_array.append(pkt_lat_tot_max) print "-------Packet Total Latency --------" print "injRate latAvg latMax" inj_rate = 0 for lat_avg, lat_max in zip(pkt_lat_tot_avg_array, pkt_lat_tot_max_array): inj_rate = inj_rate + 0.02 print inj_rate, lat_avg, lat_max print "-------Packet Network Latency --------" pkt_lat_tot_avg_array = [] pkt_lat_tot_max_array = []
hs_norm_raw = [] uf_norm_raw = [] max_ws = 0 max_hs = 0 min_uf = 100 l1miss_aggr = 0 num_sim = 0 for index in range (1, NUM_SIM+1): ipc_alone = get.get_ipc_alone (PATH_WORKLOAD, index) design_file = PATH_DESIGN + "sim_" + str(index) + ".out" baseline_file = PATH_BASELINE + "sim_" + str(index) + ".out" if os.path.isfile (design_file) is False or os.path.isfile (baseline_file) is False: print "The file doesn't exist." continue stat_share_design = get.get_stat (design_file) stat_share_baseline = get.get_stat (baseline_file) ipc_share_design = get.get_ipc_share (stat_share_design) ipc_share_baseline = get.get_ipc_share (stat_share_baseline) # normalized to the baseline design (ws_design, hs_design, uf_design, uf_baseline) = get.cmp_metric_bs (ipc_alone, ipc_share_baseline, ipc_share_design) ws_norm = ws_norm + ws_design/NODE hs_norm = hs_norm + hs_design uf_norm = uf_norm + float(uf_design)/uf_baseline ws_norm_raw = ws_norm_raw + [ws_design/NODE] hs_norm_raw = hs_norm_raw + [hs_design] uf_norm_raw = uf_norm_raw + [float(uf_design)/uf_baseline] num_sim = num_sim + 1 if (ws_design/NODE > max_ws): max_ws = ws_design/NODE if (hs_design > max_hs): max_hs = hs_design if (float(uf_design)/uf_baseline < min_uf): min_uf = float(uf_design)/uf_baseline
sum_ws = 0 sum_hs = 0 sum_uf = 0 eff_count = 0 ipc_alone = [2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91, 2.08, 2.16, 1.77, 1.91] for sim_index in range(1, 27, 1): input_file_alone = dir_alone + "sim_" + str(sim_index) + ".out" input_file_share = dir_share + "sim_" + str(sim_index) + ".out" exist_alone = os.path.exists(input_file_alone) exist_share = os.path.exists(input_file_share) if (exist_alone is False or exist_share is False): print "Fail to find " + str (sim_index) + ".out or its counterpart." continue #print input_file_alone + " v.s. " + input_file_share stat_alone = get.get_stat (input_file_alone) stat_share = get.get_stat (input_file_share) insns_alone = get.get_insns_persrc (stat_alone) insns_share = get.get_insns_persrc (stat_share) act_t_alone = get.get_active_cycles (stat_alone) act_t_share = get.get_active_cycles (stat_share) #ipc_alone = compute.cmp_ipc (insns_alone, act_t_alone) ipc_share = compute.cmp_ipc (insns_share, act_t_share) ws = compute.cmp_ws (ipc_alone, ipc_share) hs = compute.cmp_hs (ipc_alone, ipc_share) uf = compute.cmp_uf (ipc_alone, ipc_share) eff_count = eff_count + 1 sum_ws = sum_ws + ws sum_hs = sum_hs + hs sum_uf = sum_uf + uf