), color=Color('m_teps', scale=colormap, ), text=Text(value=' '), ).configure_scale( textBandWidth=20, bandSize=20 ) print chart.to_dict(data=False) save(chart=chart, df=dfd, plotname='%s_%s' % (name, dataset), formats=['html', 'svg', 'png', 'pdf', 'tablehtml'], sortby=['algorithm', 'dataset', 'do_a', 'do_b'], columns=['algorithm', 'dataset', 'do_a', 'do_b', 'm_teps', 'engine', 'edges_visited', 'elapsed', 'gunrock_version', 'gpuinfo.name', 'details'] )
header=alt.Header(title=my[plot]["column"][1]), )) if "row" in my[plot]: chart[plot] = chart[plot].encode(row=alt.Row( my[plot]["row"][0], type=datatypes[my[plot]["row"][0]], header=alt.Header(title=my[plot]["row"][1]), )) with open(os.path.join(outputdir, plot + ".html"), "w") as f: spec = chart[plot].to_dict() f.write(html_template.format(spec=json.dumps(spec), title=plot)) save( chart[plot], df=pd.DataFrame(), plotname=plot, outputdir=outputdir, formats=["pdf"], ) #### # if I wanted to get codenames, here's how I'd do it # products_codename_params = { # "client_id": intel_credentials["client_id"], # "locale_geo_id": "en-US", # } # r = requests.get(products_codename_url, auth=intel_auth, params=products_codename_params) # print(r.content) # helpful links on FLOPS/core/cycle
# next line should filter the duplicate PRs df = (keepFastest(['algorithm', 'dataset', 'engine']))(df) # now make the graph save(df=df, plotname=name, formats=['tablehtml'], sortby=['algorithm', 'dataset', 'sub_algorithm', 'engine', 'gunrock_version'], columns=['algorithm', 'dataset', 'sub_algorithm', 'engine', 'm_teps', 'elapsed', 'edges_visited', 'gunrock_version', # 'gpuinfo.name', 'time', 'details'], ) for (data, caption) in [('m_teps', 'MTEPS'), ('elapsed', 'Elapsed time (ms)')]: chart = Chart(df).mark_point().encode( x=X('dataset:N', axis=Axis(
chart = Chart(df).mark_bar().encode( x=X( 'tag:N', axis=False, ), column=Column('dataset', axis=Axis( title='Dataset', orient='bottom', )), y=Y( 'm_teps', axis=Axis(title='MTEPS', ), scale=Scale(type='log'), ), color=Color( 'tag:N', legend=Legend(title='Optimizations'), ), ) print chart.to_dict(data=False) save(chart=chart, df=df, plotname=name, formats=['html', 'svg', 'png', 'pdf', 'tablehtml'], sortby=['algorithm', 'dataset', 'engine', 'gunrock_version'], columns=[ 'algorithm', 'dataset', 'engine', 'tag', 'm_teps', 'edges_visited', 'traversal_mode', 'gunrock_version', 'gpuinfo.name', 'details' ])
'[gpuinfo.name]:N', legend=Legend(title='GPU', ), ), shape=Shape( 'scalability:N', legend=Legend(title='Scalability Type', ), ), ).transform_filter((datum.algorithm != 'DOBFS') | (datum.idempotent == False)) print([(key, value) for key, value in chart[algorithm].to_dict().items() if key not in ['data']]) save( df=dfplot, plotname=name + '_' + algorithm, formats=['tablemd', 'tablehtml'], sortby=[ 'algorithm', 'scalability', 'dataset', 'gpuinfo.name', 'num_gpus', 'idempotent' ], columns=columnsOfInterest, ) save( chart=chart[algorithm], df=dfplot, plotname=name + '_' + algorithm, formats=['json', 'html', 'svg', 'png', 'pdf'], ) save(plotname=name, formats=['md'], mdtext=("""
), tooltip=[ 'dataset', '%s_%s_frontier' % (base, frontier), '%s_mteps' % base ], ).interactive() print([(key, value) for key, value in chart[frontier].to_dict().items() if key not in ['data']]) save(chart=chart[frontier], df=df, plotname='%s_%s' % (frontier, name), formats=['html', 'svg', 'png', 'pdf', 'tablehtml'], sortby=['algorithm', 'dataset', 'engine', 'gunrock_version'], columns=[ 'algorithm', 'dataset', 'engine', '%s_%s_frontier' % (base, frontier), '%s_mteps' % base, '%s_runtime' % base, 'edges_visited', 'traversal_mode', 'gunrock_version', 'gpuinfo.name', 'details' ]) save( df=df, plotname=name, formats=['tablemd', 'tablehtml'], sortby=['dataset'], columns=columnsOfInterest, ) save(
shape=Shape('[gpuinfo.name]:N', legend=Legend( title='GPU', ), ), tooltip=['[gpuinfo.name]:N', 'm_teps', 'elapsed'], ).interactive() print([(key, value) for key, value in chart.to_dict().items() if key not in ['data']]) # was: print(chart.to_dict(data=False)) save(chart=chart, df=df, plotname=name, formats=['tablehtml', 'tablemd', 'md', 'html', 'svg', 'png', 'pdf'], sortby=['algorithm', 'dataset', 'engine', 'gunrock_version'], columns=columnsOfInterest, mdtext=(""" # Comparison on Different GPUs We ran Gunrock on several GPUs on 5 primitives times 9 datasets. As the compute and memory bandwidth capabilities of the GPUs increase, so does Gunrock's performance. """ + getChartHTML(chart, anchor=name) + """ [Source data](tables/%s_table.html), with links to the output JSON for each run """ % name), )
), scale=Scale(type='log'), ), color=Color('traversal_mode:N', # scale=Scale(range=cb.diverging.Spectral_3.hex_colors), scale=Scale(range=cb.qualitative.Dark2_8.hex_colors), legend=Legend(title='Traversal Mode'), ), ) print chart.to_dict(data=False) save(chart=chart, df=df, plotname=name, formats=['html', 'svg', 'png', 'pdf', 'tablehtml'], sortby=['algorithm', 'dataset', 'engine', 'gunrock_version'], columns=['algorithm', 'dataset', 'engine', 'tag', 'm_teps', 'edges_visited', 'traversal_mode', 'gunrock_version', 'gpuinfo.name', 'details'] )
scale=Scale(type='log'), ), color=Color('gpuinfo_name:N', legend=Legend( title='GPU', ), ), shape=Shape('gpuinfo_name:N', legend=Legend( title='GPU', ), ), ) print chart.to_dict(data=False) save(chart=chart, df=df, plotname=name, formats=['tablehtml', 'html', 'svg', 'png', 'pdf'], sortby=['algorithm', 'dataset', 'engine', 'gunrock_version'], columns=['algorithm', 'dataset', 'm_teps', 'gunrock_version', 'gpuinfo_name', 'time', 'details'], )
shape=Shape( 'engine:N', legend=Legend(title='Engine', ), ), color=Color( '[gpuinfo.name]:N', legend=Legend(title='GPU', ), ), tooltip=['num_gpus', 'm_teps', 'engine', '[gpuinfo.name]:N'], ).interactive() print([(key, value) for key, value in chart['all'].to_dict().items() if key not in ['data']]) save( df=df, plotname=name, formats=['tablemd', 'tablehtml'], sortby=['algorithm', 'dataset', 'num_gpus', 'engine', 'm_teps'], columns=columnsOfInterest, ) save( chart=chart['all'], df=df, plotname=name, formats=['json', 'html', 'svg', 'png', 'pdf'], ) for dataset in datasets: chart[dataset] = Chart(df).mark_point().encode( x=X( 'num_gpus:N',
shape=Shape('engine', legend=Legend( title='Engine', ), ), color=Color('engine', legend=Legend( title='Engine', ), ), ) print([(key, value) for key, value in chart[data].to_dict().items() if key not in ['data']]) save(chart=chart[data], df=df, plotname='%s_%s' % (name, data), formats=['json', 'html', 'svg', 'png', 'pdf'], ) # https://github.com/altair-viz/altair/issues/289#issuecomment-270949488 # Maybe like this? # Mark: symbol # Y: Dataset # Row: Library # X: Speedup (log scale axis) # Column: Algorithm # Color: Speedup < 1 colorings = ['bw', 'color'] coloring_ranges = {'bw': ['#a0a0a0', '#101010'], 'color': ['#ef8a62', '#67a9cf'], }
), # Altair 1 text value # text=Text(value=' '), # Altair 1 configure_scale # ).configure_scale( # textBandWidth=12, # bandSize=12 ) print([(key, value) for key, value in chart[dataset].to_dict().items() if key not in ['data']]) save(chart=chart[dataset], df=dfd, plotname='%s_%s' % (name, dataset), formats=['html', 'svg', 'png', 'pdf', 'tablehtml', 'tablemd'], sortby=['algorithm', 'dataset', 'engine', 'gunrock_version'], columns=[ item for item in columnsOfInterest if item not in ['num_vertices', 'num_edges'] ]) dfab = dfab[[ 'dataset', 'do_a', 'do_b', 'num_edges', 'num_vertices', 'm_teps' ]] dfab['average_degree'] = dfab['num_edges'] / dfab['num_vertices'] for y_axis in ['do_a', 'do_b']: chart[y_axis] = Chart(dfab).mark_point().encode( y=Y( y_axis, axis=Axis( format='.1',
title='Primitive', orient='top', )), y=Y( 'elapsed', axis=Axis(title='Elapsed time (ms)', ), scale=Scale(type='log'), ), color=Color( '[gpuinfo.runtime_version]:N', legend=Legend(title='GPU runtime', ), ), shape=Shape( '[gpuinfo.runtime_version]:N', legend=Legend(title='GPU runtime', ), ), ) print chart.to_dict(data=False) save( chart=chart, df=df, plotname=name, formats=['html', 'svg', 'png', 'pdf', 'tablehtml'], sortby=['algorithm', 'dataset', 'engine', 'gunrock_version'], columns=[ 'algorithm', 'dataset', 'm_teps', 'elapsed', 'gunrock_version', 'gpuinfo.name', 'gpuinfo.driver_version', 'details' ], )
(fpwsp, "GFLOPS per Watt vs. Peak Processing Power"), (fpwbw, "GFLOPS per Watt vs. Memory Bandwidth"), (ai, "Arithmetic Intensity over Time"), (aisp, "Arithmetic Intensity vs. Peak Processing Power"), (aibw, "Arithmetic Intensity vs. Memory Bandwidth"), (pwr, "Power over Time"), (pwrdens, "Power density over Time"), ]: # save html # print chart.to_dict() with open(os.path.join(outputdir, title + ".html"), "w") as f: spec = chart.to_dict() # spec['height'] = 750 # spec['width'] = 1213 # spec['encoding']['tooltip'] = {"field": "Model", "type": "nominal"} # this chart.to_dict -> json.dumps can probably be simplified f.write(template.format(spec=json.dumps(spec), title=title)) # f.write(chart.from_json(spec_str).to_html( # title=title, template=template)) save( chart, df=pd.DataFrame(), plotname=title, outputdir=outputdir, formats=["pdf"], ) readme += "- [%s](plots/%s.html)\n" % (title, title) with open(os.path.join(outputdir, "../README.md"), "w") as f: f.write(readme)
shape=alt.Shape( "dataset", type="nominal", ), ).interactive()) has_variants = "variant" in tables[table].columns # multiple variants if has_variants: charts[table] = charts[table].encode(color=alt.Color( "variant", type="nominal", ), ) save( chart=charts[table], df=tables[table], plotname=table, outputdir="./", formats=["png", "pdf", "json"], ) with open(f"README.md", "w") as plotspage: plotspage.write("""## Scalability plots <script type="text/javascript"> var svgopt = { renderer: "svg" } """) divs = "" for chart in sorted(charts): chart_id = chart.replace("-", "_") # note to self: { } in fstrings need to be {{ }} plotspage.write(f"""
# scale=Scale(type='log'), ), shape=Shape( 'partition_method', legend=Legend(title='Partition Method', ), ), color=Color( 'partition_method', legend=Legend(title='Partition Method', ), ), ).transform_filter(datum.num_gpus == 4) print([(key, value) for key, value in chart.to_dict().items() if key not in ['data']]) save( chart=chart, df=df, plotname=name, formats=['json', 'html', 'svg', 'png', 'pdf'], ) save( df=df, plotname=name, formats=['tablemd', 'tablehtml'], sortby=['algorithm', 'dataset', 'partition_method', 'num_gpus'], columns=columnsOfInterest, ) save( plotname=name, formats=['md'], mdtext=("""
scale=Scale(type='log'), ), shape=Shape('dataset', ), color=Color('dataset', ), ) print chart.to_dict(data=False) save(chart=chart, df=df, plotname='%s_%s' % (frontier, name), formats=['html', 'svg', 'png', 'pdf', 'tablehtml'], sortby=['algorithm', 'dataset', 'engine', 'gunrock_version'], columns=['algorithm', 'dataset', 'engine', '%s_%s_frontier' % (base, frontier), '%s_mteps' % base, '%s_runtime' % base, 'edges_visited', 'traversal_mode', 'gunrock_version', 'gpuinfo.name', 'details'] )
'm_teps', 'elapsed', 'gunrock_version', 'gpuinfo.name', 'time', 'details'] # would prefer a cleanup call https://github.com/altair-viz/altair/issues/183 # without this, output is gigantic df = (keepTheseColumnsOnly(columnsOfInterest))(df) gmean_columns = ['algorithm', 'num_gpus'] # http://stackoverflow.com/questions/30795858/add-calculated-row-to-pandas-dataframe dfgmean = df.groupby(gmean_columns).agg(lambda x: gmean(list(x))) dfgmean = dfgmean.reset_index() save(df=dfgmean, plotname='%s_gmean' % name, formats=['tablehtml'], sortby=gmean_columns, columns=gmean_columns + ['speedup'] ) # now make the graph chart = {} sortby_dict = {'all': ['algorithm', 'dataset', 'partition_method', 'num_gpus' ], 'geomean': ['algorithm', 'num_gpus', ] }