Ejemplo n.º 1
0
def process_type(t, df, plot_args, benchmark_order):
    if t == "perf":
        df = prepare.calculate_overhead(df, column="time")
        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)
        filter_inputs(df)

        plot = draw.VarBarplotOverhead()
        plot_args.update({
            "ylabel": "Normalized runtime\n(w.r.t. native)",
            "logy": True,
        })

    elif t == "mem":
        df = prepare.calculate_overhead(df, column="maxsize")
        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)
        filter_inputs(df)

        plot = draw.VarBarplotOverhead()
        plot_args.update({
            "ylabel": "Memory overhead\n(w.r.t. native)",
            "logy": True,
        })

    return plot, []
Ejemplo n.º 2
0
def main(t="perf"):
    logging.info("Processing data")
    if t == "perf":
        df = prepare.process_results("perf")
        df = prepare.calculate_overhead(df,
                                        column="cycles",
                                        over_compilertype="gcc-native")
        prepare.reorder_compilers(df, t)
        draw.barplot_overhead(df,
                              filename="phoenix_%s.pdf" % t,
                              ylim=(0, 2.7),
                              yticks=range(0, 3),
                              ylabel="Normalized runtime\n(w.r.t. native GCC)",
                              figsize=(5, 3))
    else:
        logging.error("Unknown plot type")
        exit(-1)
Ejemplo n.º 3
0
def main(t="perf"):
    logging.info("Processing data")
    df = prepare.process_results(t)
    if t == "tput":
        prepare.reorder_compilers(df, t)
        plot = draw.LinePlotTput()
        plot.get_data(df, [])
        plot.build_plot(
            # xlim=(0, 55),
            xticks=range(0, 100, 10),
            # ylim=(0.15, 0.72),
            yticks=np.arange(0.1, 1, 0.1),
        )
        plot.save_plot("nginx_%s.pdf" % t)

    else:
        logging.error("Unknown plot type")
        exit(-1)
Ejemplo n.º 4
0
def main(t="perf"):
    logging.info("Processing data")
    df = prepare.process_results(t)
    if t == "tput":
        df["lat"] /= 1000
        prepare.reorder_compilers(df, t)
        plot = draw.LinePlotTput()
        plot.get_data(df, [])
        plot.build_plot(xlim=(90, 290),
                        xticks=range(100, 300, 50),
                        ylim=(0.0, 3.0),
                        yticks=np.arange(0.5, 3.0, 0.5),
                        legend_loc='upper right')
        plot.save_plot("memcached_%s.pdf" % t)

    else:
        logging.error("Unknown plot type")
        exit(-1)
Ejemplo n.º 5
0
def main(t="perf"):
    logging.info("Processing data")
    df = prepare.process_results(t)
    if t == "tput":
        prepare.reorder_compilers(df, t)
        plot = draw.LinePlotTput()
        plot.get_data(df, [])
        plot.build_plot(
            xlim=(0, 65),
            xticks=range(0, 100, 10),
            ylim=(0.1, 0.8),
            yticks=np.arange(0.2, 0.79, 0.1),
            legend_loc=(0.01, 0.45),
            figsize=(5, 2.5),
        )
        plot.save_plot("%s_%s.pdf" % (BENCH_NAME, t))

    else:
        logging.error("Unknown plot type")
        exit(-1)
Ejemplo n.º 6
0
def process_type(t, df, plot_args, benchmark_order):
    columns = []

    # type specific processing
    if t == "perf":
        df = prepare.calculate_overhead(df)
        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)

        plot = draw.BarplotOverhead()
        plot_args.update({
            "ylabel": "Normalized runtime\n(w.r.t. native)",
            "logy": True,
        })

    elif t == "mem":
        df = prepare.calculate_overhead(df, column="maxsize")
        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)

        plot = draw.BarplotOverhead()
        plot_args.update({
            "ylabel": "Memory overhead\n(w.r.t. native)",
            "logy": True,
        })

    elif t == "multi":
        df = prepare.calculate_overhead(df)
        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)
        # df.sort_values(["threads"], inplace=True)

        plot = draw.BarplotOverhead()
        plot_args.update({
            "ylabel": "Scaling",
            "ylim": (0.95, 1.4),
            "logy": False,
            "ncol": 5,
        })

    else:
        logging.error("Unknown plot type")
        exit(-1)

    # no need to return plot_args, dict is mutable and is passed by reference
    return plot, columns
Ejemplo n.º 7
0
def main(t="tput"):
    logging.info("Processing data")
    if t == "tput":
        df = prepare.process_results(t)

        # NOTE: specific names and order
        names = ["bin/httpd", "nginx", "bin/memcached"]  # df["name"].unique()
        titles = ["Apache", "Nginx", "Memcached"]  # df["name"].unique()
        idxs = ["(a)", "(b)", "(c)"]

        fig = plt.figure()
        plot = draw.LinePlotTput()

        for idx, name in enumerate(names):
            sub = fig.add_subplot(1, len(names), idx + 1)
            dff = df[df["name"] == name].copy()
            prepare_specific(name, dff)

            # NOTE 1: since all compilers perform roughly the same, we leave gcc only for simplicity
            prepare.reorder_compilers(dff, t)
            limits = limits_specific(name)

            plot.get_data(dff, [])

            xlabel = " "
            ylabel = ""
            if idx == 1: xlabel = r"Throughput ($\times 10^3$ msg/s)"
            if idx == 0: ylabel = r"Latency (ms)"

            plot.build_plot(
                xlabel=xlabel,
                ylabel=ylabel,
                subplot=sub,
                xlim=limits["xlim"],
                xticks=limits["xticks"],
                ylim=limits["ylim"],
                yticks=limits["yticks"],
                figsize=(12, 3),
            )
            subplot = plot.get_current_subplot()

            subplot.text(0.5,
                         1.02,
                         idxs[idx] + " " + titles[idx],
                         fontsize=12,
                         horizontalalignment='center',
                         transform=subplot.transAxes)
            for showlegendname in ["nginx"]:
                if showlegendname not in name:
                    subplot.legend().set_visible(False)

        plot.save_plot(filename="merged_%s.pdf" % t)

    elif t == "perf":
        plot_args = {
            "ylabel": "Normalized runtime\n(w.r.t. native)",
            "ylim": (0.85, 10),
            "vline_position": 2.5,
            "logy": True,
            "text_points": OVERFLOWS.get(t, ())
        }
        (file_name, df) = prepare.read_raw()
        plot = draw.BarplotOverhead()
        plot.df = df
        plot.df = plot.df.set_index("name")
        plot.build_plot(**plot_args)
        plot.save_plot("%s_%s.pdf" % (BENCH_NAME, t))

    elif t == "mem":
        plot_args = {
            "ylabel": "Memory overhead\n(w.r.t. native)",
            "ylim": (0.85, 10),
            "vline_position": 2.5,
            "logy": True,
            "text_points": OVERFLOWS.get(t, ())
        }
        (file_name, df) = prepare.read_raw()
        plot = draw.BarplotOverhead()
        plot.df = df
        plot.df = plot.df.set_index("name")
        plot.build_plot(**plot_args)
        plot.save_plot("%s_%s.pdf" % (BENCH_NAME, t))

    elif t == "mpxcount":
        (file_name, df) = prepare.read_raw()
        prepare.reorder_compilers(df, t)
        labels = df["compilertype"].unique()
        plot_args = {
            "ylabel": "MPX instructions\n(w.r.t. all instructions, %)",
            "xlabels": labels,
            "ylim": (0, 52),
            "yticks": range(0, 90, 10),
            "df_callback": prepare.reorder_and_rename_benchmarks,
            "df_callback_args": (BENCHMARK_ORDER, )
        }
        plot = draw.BarplotClusteredStacked()
        plot.columns = [
            "bndcl", "bndcu", "bndldx", "bndstx", "bndmovreg", "bndmovmem"
        ]
        plot.df = df
        plot.build_plot(**plot_args)
        plot.save_plot("%s_%s.pdf" % (BENCH_NAME, t))

    elif t == "multi":
        plot_args = {
            "ylabel": "Speedup of 8 threads \nw.r.t. 2 threads",
            "ylim": (0.51, 4.5),
            "vline_position": 1.5,
            "logy": True,
        }
        (file_name, df) = prepare.read_raw()
        plot = draw.BarplotMultithreaded()
        plot.df = df
        plot.df = plot.df.set_index("name")
        plot.build_plot(**plot_args)
        plot.save_plot("%s_%s.pdf" % (BENCH_NAME, t))

    elif t == "cache":
        (file_name, df) = prepare.read_raw()
        prepare.reorder_compilers(df, t)
        labels = df["compilertype"].unique()
        plot_args = {
            "ylabel": "Cache hits and misses\n(w.r.t. all instructions, %)",
            "xlabels": labels,
            "ylim": (0, 100),
            "yticks": range(0, 150, 20),
            "df_callback": prepare.reorder_and_rename_benchmarks,
            "df_callback_args": (BENCHMARK_ORDER, )
        }
        plot = draw.BarplotClusteredStacked()
        plot.columns = [
            "L1 load hits", "L1 store hits", "L2 load hits", "LLC load hits",
            "LLC load misses", "LLC store misses"
        ]
        plot.df = df
        plot.build_plot(**plot_args)
        plot.save_plot("%s_%s.pdf" % (BENCH_NAME, t))

    elif t == "instr":
        plot_args = {
            "ylabel": "Instruction overhead\n(w.r.t. native)",
            "ylim": (0.85, 10),
            "vline_position": 2.5,
            "logy": True,
            "text_points": OVERFLOWS.get(t, ())
        }
        (file_name, df) = prepare.read_raw()
        plot = draw.BarplotOverhead()
        plot.df = df
        plot.df = plot.df.set_index("name")
        plot.build_plot(**plot_args)
        plot.save_plot("%s_%s.pdf" % (BENCH_NAME, t))

    elif t == "ipc":
        plot_args = {
            "ylabel": "Processor IPC\n(instructions/cycle)",
            "ylim": (0, 5.4),
            "vline_position": 2.5,
            "yticks": range(0, 10, 1),
            "ncol": 6,
        }
        (file_name, df) = prepare.read_raw()
        plot = draw.BarplotWithNative()
        plot.df = df
        plot.df = plot.df.set_index("name")
        plot.build_plot(**plot_args)
        plot.save_plot("%s_%s.pdf" % (BENCH_NAME, t))

    elif t == "mpx_feature_perf":
        plot_args = {
            "ylabel": "Normalized runtime\n(w.r.t. native)",
            "ylim": (0.85, 10),
            "vline_position": 2.5,
            "build_names": "mpx_feature",
            "logy": True,
            "ncol": 6,
        }
        (file_name, df) = prepare.read_raw()
        plot = draw.BarplotMPXFature()
        plot.df = df
        plot.df = plot.df.set_index("name")
        plot.build_plot(**plot_args)
        plot.save_plot("%s_%s.pdf" % (BENCH_NAME, t))

    elif t == "mpx_feature_mem":
        plot_args = {
            "ylabel": "Memory overhead\n(w.r.t. native)",
            "ylim": (0.85, 10),
            "vline_position": 2.5,
            "build_names": "mpx_feature",
            "logy": True,
            "ncol": 6,
        }
        (file_name, df) = prepare.read_raw()
        plot = draw.BarplotMPXFature()
        plot.df = df
        plot.df = plot.df.set_index("name")
        plot.build_plot(**plot_args)
        plot.save_plot("%s_%s.pdf" % (BENCH_NAME, t))

    else:
        logging.error("Unknown plot type")
        exit(-1)
Ejemplo n.º 8
0
def process_type(t, df, plot_args, benchmark_order):
    columns = []

    # type specific processing
    if t == "perf":
        df = prepare.calculate_overhead(df)
        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)

        plot = draw.BarplotOverhead()
        plot_args.update({
            "ylabel": "Normalized runtime\n(w.r.t. native)",
            "logy": True,
        })


    elif t == "mem":
        df = prepare.calculate_overhead(df, column="maxsize")
        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)

        plot = draw.BarplotOverhead()
        plot_args.update({
            "ylabel": "Memory overhead\n(w.r.t. native)",
            "logy": True,
        })

    elif t == "mpxcount":
        columns = ["bndcl", "bndcu", "bndldx", "bndstx", "bndmovreg", "bndmovmem"]
        df = prepare.calculate_ratio(df, columns, "instructions")
        prepare.reorder_compilers(df, t)
        labels = df["compilertype"].unique()
        for column in columns:
            df[column] *= 100

        plot = draw.BarplotClusteredStacked()
        plot_args.update({
            "ylabel": "MPX instructions\n(w.r.t. all instructions, %)",
            "xlabels": labels,
            "ylim": (0, 52),
            "yticks": range(0, 90, 10),
            "df_callback": prepare.reorder_and_rename_benchmarks,
            "df_callback_args": (benchmark_order,)
        })

    elif t == "multi":
        df = prepare.calculate_multithreading_overhead(df, over=2)
        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)

        df["threads"] = Categorical(df["threads"], [8])
        df.sort_values(["threads"], inplace=True)

        plot = draw.BarplotMultithreaded()
        plot_args.update({
            "ylabel": "Speedup of 8 threads \nw.r.t. 2 threads",
            "ylim": (0.9, 4.5),
            "logy": True,
        })

    elif t == "cache":
        # values over 1000 instructions
        columns = ["l1_dcache_loads", "l1_dcache_load_misses", "l1_dcache_stores", "l1_dcache_store_misses",
                   "llc_loads", "llc_load_misses", "llc_stores", "llc_store_misses"]
        df = prepare.calculate_ratio(df, columns, "instructions")
        for c in columns:
            df[c] *= 100

        # differences
        df["L1 load hits"] = df["l1_dcache_loads"] - df["l1_dcache_load_misses"]
        df["LLC load hits"] = df["llc_loads"] - df["llc_load_misses"]
        df["L2 load hits"] = df["l1_dcache_load_misses"] - df["LLC load hits"]
        df["LLC load misses"] = df["llc_load_misses"]

        # df["l1_dcache_store_hits"] = df["l1_dcache_stores"] - df["l1_dcache_store_misses"]
        df["L1 store hits"] = df["l1_dcache_stores"] - df["llc_store_misses"]
        df["LLC store misses"] = df["llc_store_misses"]

        # ordering
        prepare.reorder_compilers(df, t)
        df = df.dropna(subset=['compilertype', 'name'])

        labels = df["compilertype"].unique()

        columns = ["L1 load hits", "L1 store hits",
                   "L2 load hits",
                   "LLC load hits", "LLC load misses", "LLC store misses"]

        plot = draw.BarplotClusteredStacked()
        plot_args.update({
            "ylabel": "Cache hits and misses\n(w.r.t. all instructions, %)",
            "xlabels": labels,
            "ylim": (0, 100),
            "yticks": range(0, 150, 20),
            "df_callback": prepare.reorder_and_rename_benchmarks,
            "df_callback_args": (benchmark_order,)
        })

    elif t == "instr":
        df = prepare.calculate_overhead(df, column="instructions")
        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)

        plot = draw.BarplotOverhead()
        plot_args.update({
            "ylabel": "Instruction overhead\n(w.r.t. native)",
            "logy": True,
        })

    elif t == "misc_stat":
        # values over 1000 instructions
        columns = ["dtlb_stores", "dtlb_store_misses", "dtlb_load_misses", "dtlb_loads", "branch_misses",
                   "branch_instructions"]
        df = prepare.calculate_ratio(df, columns, "instructions")
        for c in columns:
            df[c] *= 100

        # differences
        df["dtlb_stores"] -= df["dtlb_store_misses"]
        df["dtlb_loads"] -= df["dtlb_load_misses"]
        df["branch_instructions"] -= df["branch_misses"]

        prepare.reorder_compilers(df, t)
        df = df.dropna(subset=['compilertype', 'name'])

        labels = df["compilertype"].unique()

        plot = draw.BarplotClusteredStacked()
        plot_args.update({
            "ylabel": "Other statistics\n(w.r.t. all instructions, %)",
            "xlabels": labels,
            "ylim": (0, 100),
            "yticks": range(0, 150, 20),
            "df_callback": prepare.reorder_and_rename_benchmarks,
            "df_callback_args": (benchmark_order,)
        })

    elif t == "ku_instr":
        df = prepare.calculate_overhead(df, column="instructions:k")
        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)

        plot = draw.BarplotOverhead()
        plot_args.update({
            "ylabel": "Kernel instruction overhead\n(w.r.t. native)",
            "logy": True,
        })

    elif t == "native_mem_access":
        # values over 1000 instructions
        columns = ["l1_dcache_loads", "l1_dcache_stores"]
        df = prepare.calculate_ratio(df, columns, "instructions")

        df["overhead"] = df["l1_dcache_loads"] + df["l1_dcache_stores"]
        df["overhead"] *= 100

        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)

        plot = draw.BarplotOverhead()
        plot_args.update({
            "ylabel": "Memory accesses\n(w.r.t. all instructions, %)",
            "ylim": (0, 115),
            "yticks": range(0, 101, 20),
        })

    elif t == "ipc":
        # IPC (instructions/cycle) is saved in "instructions" column
        df = prepare.calculate_ratio(df, ["instructions"], "cycles")
        df["overhead"] = df["instructions"]

        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)

        plot = draw.BarplotWithNative()
        plot_args.update({
            "ylabel": "Processor IPC\n(instructions/cycle)",
            "ylim": (0, 5.4),
            "yticks": range(0, 10, 1),
            "ncol": 6,
        })

    elif t == "mpx_feature_perf":
        df = prepare.calculate_overhead(df)
        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)

        plot = draw.BarplotMPXFature()
        plot_args.update({
            "ylabel": "Normalized runtime\n(w.r.t. native)",
            "build_names": "mpx_feature",
            "logy": True,
            "ncol": 6,
        })

    elif t == "mpx_feature_mem":
        df = prepare.calculate_overhead(df, column="maxsize")
        prepare.reorder_and_rename_benchmarks(df, benchmark_order)
        prepare.reorder_compilers(df, t)

        plot = draw.BarplotMPXFature()
        plot_args.update({
            "ylabel": "Memory overhead\n(w.r.t. native)",
            "build_names": "mpx_feature",
            "logy": True,
            "ncol": 6,
        })

    else:
        logging.error("Unknown plot type")
        exit(-1)

    # no need to return plot_args, dict is mutable and is passed by reference
    return plot, columns