Beispiel #1
0
def maskpred_traces():

    ## read in all data
    global data_map
    data_map = {}
    for benchmark in benchmarks:
        print benchmark
        data_map[benchmark] = {}  # init map

        # gs320 directory protocol
        filenames = glob.glob("*/%s-*gs320*.stats" % benchmark)
        for filename in filenames:
            control_line = mfgraph.grep(filename,
                                        "  switch_16_messages_out_Control")[0]
            control_line = string.replace(control_line, "[", " ")
            control_line = string.split(control_line)

            data_line = mfgraph.grep(filename,
                                     "  switch_16_messages_out_Data")[0]
            data_line = string.replace(data_line, "[", " ")
            data_line = string.split(data_line)

            # to calculate the request bandwidth, we add up all the
            # outgoing control messages and subtract the number of PutXs
            # (which conveniently happens to be the number of virtual
            # network zero data messages sent.  We need to subtract out
            # the number of PutXs, since the GS320 protocol sends a
            # forwarded control message to 'ack' a PutX from a processor.
            control_msgs = float(control_line[1]) - float(data_line[2])

            sharing_misses = get_data(filename, "sharing_misses:")
            total_misses = get_data(filename, "Total_misses:")
            control_msgs_per_miss = control_msgs / total_misses
            cycles = get_data(filename, "Ruby_cycles:")

            if not data_map[benchmark].has_key("Directory"):
                data_map[benchmark]["Directory"] = []
            indirections = 100.0 * (sharing_misses / total_misses)
            data_map[benchmark]["Directory"].append(
                [control_msgs_per_miss, indirections, cycles])

        # mask prediction data
        filenames = glob.glob("*/%s-*mcast*.stats" % benchmark)
        filenames.sort()
        for filename in filenames:
            predictor = string.split(filename, "-")[3]

            # calculate indirections
            data_lines = mfgraph.grep(filename, "multicast_retries:")

            if not data_lines:
                continue  # missing data

            lst = string.split(string.replace(data_lines[0], "]", ""))
            total_misses = float(lst[6])
            total_misses_alt = get_data(filename, "Total_misses:")
            non_retry = float(lst[13])
            retry = total_misses - non_retry
            indirections = 100.0 * (retry / total_misses)
            cycles = get_data(filename, "Ruby_cycles:")

            # calculate bandwidth
            data_lines = mfgraph.grep(filename,
                                      "  switch_16_messages_out_Control:")

            if not data_lines:
                continue  # missing data

            lst = string.split(string.replace(data_lines[0], "]", ""))
            control_msgs = float(lst[1])
            control_msgs_per_miss = control_msgs / total_misses

            print "  ", predictor, "->", benchmark, control_msgs_per_miss, indirections, cycles
            if not data_map[benchmark].has_key(predictor):
                data_map[benchmark][predictor] = []
            data_map[benchmark][predictor].append(
                [control_msgs_per_miss, indirections, cycles])

    ## Make the graphs
    all_data = []
    all_parameters = []
    for benchmark in benchmarks:
        print benchmark
        # collect data
        data = []

        # mask prediction data
        for predictor in data_map[benchmark].keys():
            include_list = []
            include_list.append("^Directory")
            include_list.append("^AlwaysBroadcast")
            #include_list.append("^AlwaysUnicast")

            # Graph1
            #              include_list.append("Counter:Implicit:5:DataBlock:0:0")
            #              include_list.append("Owner:Implicit:DataBlock:0:0")
            #              include_list.append("BroadcastCounter:Implicit:DataBlock:0:0")
            #              include_list.append("OwnerGroup:Implicit:DataBlock:0:0")
            #              include_list.append("OwnerBroadcast:Implicit:DataBlock:0:0")

            # Graph2
            #              include_list.append("Counter:Implicit:5:.*:0:0")
            #              include_list.append("Owner:Implicit:.*:0:0")
            #              include_list.append("BroadcastCounter:Implicit:.*:0:0")
            #              include_list.append("OwnerGroup:Implicit:.*:0:0")
            #              include_list.append("OwnerBroadcast:Implicit:.*:0:0")

            # Graph3

            #            include_list.append("Owner:Implicit:DataBlock:.*:0")
            #            include_list.append("Counter:Implicit:5:DataBlock:.*:0")
            #            include_list.append("OwnerGroup:Implicit:DataBlock:.*:0")
            #            include_list.append("OwnerGroupMod:Implicit:DataBlock:.*:0")
            #            include_list.append("OwnerBroadcast:Implicit:DataBlock:.*:0")
            #            include_list.append("BroadcastCounter:Implicit:DataBlock:.*:0")

            # Graph4
            #            include_list.append("Owner:Implicit:DataBlock:4:.*")
            #            include_list.append("Counter:Implicit:5:DataBlock:4:.*")
            #            include_list.append("BroadcastCounter:Implicit:DataBlock:4:.*")
            #            include_list.append("OwnerGroup:Implicit:DataBlock:4:.*")
            #            include_list.append("OwnerGroupMod:Implicit:DataBlock:4:.*")
            #            include_list.append("OwnerBroadcast:Implicit:DataBlock:4:.*")

            include_list.append("^StickySpatial:Both:1:DataBlock:0:.*")
            #            include_list.append("^OwnerGroup:.*:DataBlock:0:0")

            #            include_list.append("^Owner:Implicit:DataBlock:4:.*")
            #            include_list.append("^Counter:.*:5:DataBlock:0:0")
            #            include_list.append("^OwnerGroup:.*:DataBlock:0:0")
            #            include_list.append("^BroadcastCounter:Implicit:DataBlock:4:.*")
            #            include_list.append("^OwnerGroup:Implicit:DataBlock:.*:0")
            #            include_list.append("^OwnerGroupMod:Implicit:DataBlock:0:0")
            #            include_list.append("^OwnerBroadcast:Implicit:DataBlock:0:0")
            #            include_list.append("^OwnerBroadcastMod:Implicit:DataBlock:0:0")

            #            include_list.append("^BroadcastCounter:Implicit:1:DataBlock:4:.*")
            #            include_list.append("^OwnerGroup:Implicit:DataBlock:[06]:0")
            #            include_list.append("^BroadcastCounter:Implicit:1:DataBlock:0:0")
            #            include_list.append("^Counter:Implicit:1:DataBlock:[06]:0")
            #            include_list.append("^Pairwise:Implicit:DataBlock:4:.*")
            #            include_list.append("^StickySpatial:Implicit:2:DataBlock:0:0")

            #            include_list.append("^Counter:Implicit:1:DataBlock:.*:0")
            #            include_list.append("^BroadcastCounter:Implicit:1:DataBlock:.*:0")
            #            include_list.append("^Pairwise:Implicit:DataBlock:.*:0")

            #            include_list.append("^Counter:Implicit:1:PC:.*:0")
            #            include_list.append("^BroadcastCounter:Implicit:1:PC:.*:0")
            #            include_list.append("^Pairwise:Implicit:PC:.*:0")

            #            include_list.append("^StickySpatial:.*:0:DataBlock:8")

            include = 0  # false
            for pat in include_list:
                if re.compile(pat).search(predictor):
                    include = 1  # true
            if not include:
                #                print "  ", predictor, "-> skipped"
                continue

            predictor_desc = predictor_name_transform(predictor)

            (control_msgs_per_miss, indirections,
             cycles) = get_maskpred_data(benchmark, predictor)
            (dir_control_msgs_per_miss, dir_indirections,
             dir_cycles) = get_maskpred_data(benchmark, "Directory")
            #            indirections = 100*indirections/dir_indirections

            print "  ", predictor, "->", benchmark, predictor_desc, control_msgs_per_miss, indirections
            data.append(
                [predictor_desc, [control_msgs_per_miss, indirections]])

        # graph the data
        all_data.append(data)
        all_parameters.append({"title": benchmark_names[benchmark]})

    # only display the legend on the last graph
    all_parameters[-1]["legend"] = "on"

    output = mfgraph.multi_graph(
        all_data,
        all_parameters,
        legend="off",
        xsize=1.8,
        ysize=1.8,
        xlabel="control messages per miss",
        ylabel="indirections (percent of all misses)",
        #                                 linetype = ["dotted"] + (["none"] * 10),
        linetype=["none"] * 10,
        colors=["1 0 0", "0 0 1", "0 .5 0", "0 0 0", "1 0 1"],
        fills=["1 0 0", "0 0 1", "0 .5 0", "0 .5 1", "1 0 1"],
        xmin=0.0,
        ymin=0.0,
        cols=3,
        #                    ymax = 100.0,
        marktype=(["circle", "box", "diamond", "triangle"] * 10),
        #                                 marktype = ["none"] + (["circle", "box", "diamond", "triangle"] * 10),
        title_fontsize="12",
        legend_hack="yes",
    )

    mfgraph.run_jgraph(output, "traces")
Beispiel #2
0
def maskpred_traces():

    ## read in all data
    global data_map
    data_map = {}
    for benchmark in benchmarks:
        print benchmark
        data_map[benchmark] = {} # init map
        
        # gs320 directory protocol
        filenames = glob.glob("*/%s-*gs320*.stats" % benchmark)
        for filename in filenames:
            control_line = mfgraph.grep(filename, "  switch_16_messages_out_Control")[0]
            control_line = string.replace(control_line, "[", " ");
            control_line = string.split(control_line)

            data_line = mfgraph.grep(filename, "  switch_16_messages_out_Data")[0]
            data_line = string.replace(data_line, "[", " ");
            data_line = string.split(data_line)

            # to calculate the request bandwidth, we add up all the
            # outgoing control messages and subtract the number of PutXs
            # (which conveniently happens to be the number of virtual
            # network zero data messages sent.  We need to subtract out
            # the number of PutXs, since the GS320 protocol sends a
            # forwarded control message to 'ack' a PutX from a processor.
            control_msgs = float(control_line[1]) - float(data_line[2])

            sharing_misses = get_data(filename, "sharing_misses:")
            total_misses = get_data(filename, "Total_misses:")
            control_msgs_per_miss = control_msgs/total_misses
            cycles = get_data(filename, "Ruby_cycles:")

            if not data_map[benchmark].has_key("Directory"):
                data_map[benchmark]["Directory"] = []
            indirections = 100.0 * (sharing_misses/total_misses)
            data_map[benchmark]["Directory"].append([control_msgs_per_miss, indirections, cycles])
    
        # mask prediction data
        filenames = glob.glob("*/%s-*mcast*.stats" % benchmark)
        filenames.sort()
        for filename in filenames:
            predictor = string.split(filename, "-")[3]
            
            # calculate indirections
            data_lines = mfgraph.grep(filename, "multicast_retries:")

            if not data_lines:
                continue # missing data

            lst = string.split(string.replace(data_lines[0], "]", ""))
            total_misses = float(lst[6])
            total_misses_alt = get_data(filename, "Total_misses:")
            non_retry = float(lst[13])
            retry = total_misses - non_retry
            indirections = 100.0 * (retry/total_misses)
            cycles = get_data(filename, "Ruby_cycles:")

            # calculate bandwidth
            data_lines = mfgraph.grep(filename, "  switch_16_messages_out_Control:")

            if not data_lines:
                continue # missing data

            lst = string.split(string.replace(data_lines[0], "]", ""))
            control_msgs = float(lst[1])
            control_msgs_per_miss = control_msgs/total_misses

            print "  ", predictor, "->", benchmark, control_msgs_per_miss, indirections, cycles
            if not data_map[benchmark].has_key(predictor):
                data_map[benchmark][predictor] = []
            data_map[benchmark][predictor].append([control_msgs_per_miss, indirections, cycles])

    ## Make the graphs
    all_data = []
    all_parameters = []
    for benchmark in benchmarks:
        print benchmark
        # collect data
        data = []

        # mask prediction data
        for predictor in data_map[benchmark].keys():
            include_list = []
            include_list.append("^Directory")
            include_list.append("^AlwaysBroadcast")
            #include_list.append("^AlwaysUnicast")
            
# Graph1
#              include_list.append("Counter:Implicit:5:DataBlock:0:0")
#              include_list.append("Owner:Implicit:DataBlock:0:0")
#              include_list.append("BroadcastCounter:Implicit:DataBlock:0:0")
#              include_list.append("OwnerGroup:Implicit:DataBlock:0:0")
#              include_list.append("OwnerBroadcast:Implicit:DataBlock:0:0")

# Graph2
#              include_list.append("Counter:Implicit:5:.*:0:0")
#              include_list.append("Owner:Implicit:.*:0:0")
#              include_list.append("BroadcastCounter:Implicit:.*:0:0")
#              include_list.append("OwnerGroup:Implicit:.*:0:0")
#              include_list.append("OwnerBroadcast:Implicit:.*:0:0")

# Graph3

#            include_list.append("Owner:Implicit:DataBlock:.*:0")
#            include_list.append("Counter:Implicit:5:DataBlock:.*:0")
#            include_list.append("OwnerGroup:Implicit:DataBlock:.*:0")
#            include_list.append("OwnerGroupMod:Implicit:DataBlock:.*:0")
#            include_list.append("OwnerBroadcast:Implicit:DataBlock:.*:0")
#            include_list.append("BroadcastCounter:Implicit:DataBlock:.*:0")

# Graph4
#            include_list.append("Owner:Implicit:DataBlock:4:.*")
#            include_list.append("Counter:Implicit:5:DataBlock:4:.*")
#            include_list.append("BroadcastCounter:Implicit:DataBlock:4:.*")
#            include_list.append("OwnerGroup:Implicit:DataBlock:4:.*")
#            include_list.append("OwnerGroupMod:Implicit:DataBlock:4:.*")
#            include_list.append("OwnerBroadcast:Implicit:DataBlock:4:.*")

            include_list.append("^StickySpatial:Both:1:DataBlock:0:.*")
#            include_list.append("^OwnerGroup:.*:DataBlock:0:0")

#            include_list.append("^Owner:Implicit:DataBlock:4:.*")
#            include_list.append("^Counter:.*:5:DataBlock:0:0")
#            include_list.append("^OwnerGroup:.*:DataBlock:0:0")
#            include_list.append("^BroadcastCounter:Implicit:DataBlock:4:.*")
#            include_list.append("^OwnerGroup:Implicit:DataBlock:.*:0")
#            include_list.append("^OwnerGroupMod:Implicit:DataBlock:0:0")
#            include_list.append("^OwnerBroadcast:Implicit:DataBlock:0:0")
#            include_list.append("^OwnerBroadcastMod:Implicit:DataBlock:0:0")

#            include_list.append("^BroadcastCounter:Implicit:1:DataBlock:4:.*")
#            include_list.append("^OwnerGroup:Implicit:DataBlock:[06]:0")
#            include_list.append("^BroadcastCounter:Implicit:1:DataBlock:0:0")
#            include_list.append("^Counter:Implicit:1:DataBlock:[06]:0")
#            include_list.append("^Pairwise:Implicit:DataBlock:4:.*")
#            include_list.append("^StickySpatial:Implicit:2:DataBlock:0:0")

#            include_list.append("^Counter:Implicit:1:DataBlock:.*:0")
#            include_list.append("^BroadcastCounter:Implicit:1:DataBlock:.*:0")
#            include_list.append("^Pairwise:Implicit:DataBlock:.*:0")

#            include_list.append("^Counter:Implicit:1:PC:.*:0")
#            include_list.append("^BroadcastCounter:Implicit:1:PC:.*:0")
#            include_list.append("^Pairwise:Implicit:PC:.*:0")

#            include_list.append("^StickySpatial:.*:0:DataBlock:8")
            
            include = 0 # false
            for pat in include_list:
                if re.compile(pat).search(predictor):
                    include = 1 # true
            if not include:
#                print "  ", predictor, "-> skipped"
                continue
            
            predictor_desc = predictor_name_transform(predictor)

            (control_msgs_per_miss, indirections, cycles) = get_maskpred_data(benchmark, predictor)
            (dir_control_msgs_per_miss, dir_indirections, dir_cycles) = get_maskpred_data(benchmark, "Directory")
#            indirections = 100*indirections/dir_indirections
            
            print "  ", predictor, "->", benchmark, predictor_desc, control_msgs_per_miss, indirections
            data.append([predictor_desc, [control_msgs_per_miss, indirections]])

        # graph the data
        all_data.append(data)
        all_parameters.append({ "title" : benchmark_names[benchmark] })

    # only display the legend on the last graph
    all_parameters[-1]["legend"] = "on"

    output = mfgraph.multi_graph(all_data,
                                 all_parameters,
                                 legend = "off",
                                 xsize = 1.8,
                                 ysize = 1.8,
                                 xlabel = "control messages per miss",
                                 ylabel = "indirections (percent of all misses)",
#                                 linetype = ["dotted"] + (["none"] * 10),
                                 linetype = ["none"] * 10,
                                 colors = ["1 0 0", "0 0 1", "0 .5 0", "0 0 0", "1 0 1"],
                                 fills = ["1 0 0", "0 0 1", "0 .5 0", "0 .5 1", "1 0 1"],
                                 xmin = 0.0,
                                 ymin = 0.0,
                                 cols = 3,
                                 #                    ymax = 100.0,
                                 marktype = (["circle", "box", "diamond", "triangle"] * 10),
#                                 marktype = ["none"] + (["circle", "box", "diamond", "triangle"] * 10),
                                 title_fontsize = "12",
                                 legend_hack = "yes",
                                 )

    mfgraph.run_jgraph(output, "traces")
Beispiel #3
0
def make_graph(graph):
    name = graph[0]
    print name
    name = "graphs/" + name
    benchmarks = graph[1]
    data_points = graph[2:]

    ## calculate the line configurations
    marktype_lst = []
    mrotate_lst = []
    color_lst = []
    fill_lst = []
    linetype_lst = []

    for series in data_points:
        ## the lines connecting the points        
        marktype_lst.append("none")
        mrotate_lst.append(0)
        color_lst.append(grey)
        fill_lst.append(grey)
        linetype_lst.append("solid")

        ## the data points
        for (predictor, mark) in series:
            if predictor in ("None", "AlwaysBroadcast"):
                marktype_lst.append("none")
                mrotate_lst.append(0)
                color_lst.append(black)
                fill_lst.append(black)
                linetype_lst.append("dotted")

            (marktype, mrotate) = predictor_to_shape(predictor)
            marktype_lst.append(marktype)
            mrotate_lst.append(mrotate)

            (color, fill) = mark
            color_lst.append(color)
            fill_lst.append(fill)
            linetype_lst.append("none")
        
    ## Make the graphs
    all_data = []
    all_parameters = []

    for benchmark in benchmarks:
        print " ", benchmark
        # collect data
        data = []

        for series in data_points:
            segments = []
            points = []
            for data_point in series:
                predictor = data_point[0]
                predictor_desc = predictor_name_transform(predictor)

                # get the data
                #lst = (-1, -1, -1, -1)
                pred_data = get_maskpred_data(benchmark, predictor)
                dir_data = get_maskpred_data(benchmark, "None")
                bcast_data = get_maskpred_data(benchmark, "AlwaysBroadcast")

                if None in (pred_data, dir_data, bcast_data):
                    x_value = -1
                    y_value = -1
                else:
                    (control_msgs_per_miss, indirections, cycles, total_bandwidth) = pred_data
                    (dir_control_msgs_per_miss, dir_indirections, dir_cycles, dir_total_bandwidth) = dir_data
                    (bcast_control_msgs_per_miss, bcast_indirections, bcast_cycles, bcast_total_bandwidth) = bcast_data

                    normalized_cycles = 100*cycles/dir_cycles  # correct one
                    normalized_bandwidth = 100*total_bandwidth/bcast_total_bandwidth # correct one

                    if not runtime:
                        x_value = control_msgs_per_miss
                        y_value = indirections

                    else:
                        x_value = normalized_bandwidth
                        y_value = normalized_cycles

                print "   ", predictor, "->", benchmark, predictor_desc, x_value, y_value
                if predictor == "None":
                    points.append(["", [x_value, y_value], [x_value, 0]])
                if predictor == "AlwaysBroadcast":
                    points.append(["", [x_value, y_value], [0, y_value]])
                points.append([predictor_desc, [x_value, y_value]])
                segments.append([x_value, y_value])

            data.append([""] + segments)
            for line in points:
                data.append(line)
            
        # graph the data
        all_data.append(data)
        all_parameters.append({ "title" : benchmark_names[benchmark] })

    # only display the legend on the last graph
##     all_parameters[-1]["legend"] = "on"
##     if len(benchmarks) == 6:
##         all_parameters[-1]["legend_x"] = -80
##         all_parameters[-1]["legend_y"] = -70
##         all_parameters[-1]["legend_default"] = "hjl vjt"
        
    if not runtime:
        xlabel = "request messages per miss"
        ylabel = "indirections (percent of all misses)"
    else:
        xlabel = "normalized traffic per miss"
        ylabel = "normalized runtime"
        
    output = mfgraph.multi_graph(all_data,
                                 all_parameters,
                                 legend = "off",
                                 xsize = 1.8,
                                 ysize = 1.8,
                                 xlabel = xlabel,
                                 ylabel = ylabel,
                                 linetype = linetype_lst,
                                 colors = color_lst,
                                 fills = fill_lst,
                                 xmin = 0.0,
                                 ymin = 0.0,
                                 cols = 3,
                                 #ymax = 100.0,
                                 marktype = marktype_lst,
                                 mrotate = mrotate_lst,
                                 title_fontsize = "12",
                                 legend_hack = "yes",
                                 )

    mfgraph.run_jgraph(output, name)