Exemplo n.º 1
0
def compute_error_rate(num_file):
    global raw_out_dir
    global workload
    global ref_ipc
    global NODE
    global error_rate_count
    global error_rate_per_app
    global ipc_alone_error_accum
    global plt_error
    global total_num_of_sample_point

    slowdown_error_raw = []
    slowdown_error_accum = 0
    for sim_index in range(1, num_file + 1, 1):
        raw_out_file_name = "sim_" + str(sim_index) + ".out"
        for file in os.listdir(raw_out_dir):
            if fnmatch.fnmatch(file, raw_out_file_name):
                fo_in = open(raw_out_dir + file, "r")
                content = fo_in.read()
                fo_in.close()
        insns_persrc = get.get_insns_persrc(content)
        active_cycles = get.get_active_cycles(content)
        non_overlap_penalty = get.get_non_overlap_penalty(content)
        workload_array = re.split("[ ]", workload[sim_index])
        ipc_ref = re.split("[ ]", ref_ipc[sim_index])

        for i in range(0, NODE, 1):
            est_ipc_alone = float(insns_persrc[i]) / (int(active_cycles[i]) - int(non_overlap_penalty[i]))
            ipc_alone_error = (est_ipc_alone - float(ipc_ref[i])) / float(ipc_ref[i])
            # print ipc_alone_error
            ipc_alone_error_accum = ipc_alone_error_accum + abs(ipc_alone_error)

            ipc_share = float(insns_persrc[i]) / int(active_cycles[i])
            est_slowdown = est_ipc_alone / ipc_share
            actual_slowdown = float(ipc_ref[i]) / ipc_share
            # print actual_slowdown
            slowdown_error = (est_slowdown - actual_slowdown) / actual_slowdown
            # print slowdown_error

            # slowdown error distribution profiling
            plt_error = plt_error + [abs(slowdown_error)]
            slowdown_error_raw = slowdown_error_raw + [abs(slowdown_error)]
            slowdown_error_accum = slowdown_error_accum + abs(slowdown_error)
            total_num_of_sample_point = total_num_of_sample_point + 1

            for j in range(0, num_app, 1):
                if compare(workload_array[i], spec_workload[j]):
                    error_rate_per_app[j] = [abs(slowdown_error)] + error_rate_per_app[j]
                    error_rate_count[j] = error_rate_count[j] + 1
    return [slowdown_error_raw, slowdown_error_accum]
Exemplo n.º 2
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
  #print "Weighted Speedup = " + str("%.3f" % ws)
  #print "Harmonic Speedup = " + str("%.3f" % hs)
  #print "Unfairness = " + str("%.3f" % uf)