Skip to content

Timings parsing

Matt Larsen edited this page Jan 19, 2021 · 2 revisions

This is an incomplete example, since I used it for a study, but its should be a good start.

import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import glob
import sys

file_list = glob.glob('./*/*.csv')
print(file_list)


rank_dfs = []
for f in file_list:
  rank = f.split('_')[-1].split('.')[0]
  res = f.split('/')[1]
#  print(res)
  df = pd.read_csv(f, sep=' ', names=['cycle', 'name', 'time'])
  df['rank'] = int(rank)
  df['res'] = int(res)
  rank_dfs.append(df)

frame = pd.concat(rank_dfs)
print(frame)
#sys.exit(0)

max_rank = frame.groupby(['cycle', 'name', 'res'], as_index=False)['time'].max()
max_rank = max_rank.groupby(['cycle', 'name', 'res'], as_index=False)['time'].mean()
max_rank = max_rank[max_rank['cycle'] ==0]

#max_rank.reset_index()

#pd.set_option('display.max_rows', max_rank.shape[0]+1)

filter_list = ['exec_slice_scene',
               'exec_scene1',
               'exec_contour_scene',
               'slice_f1_slice',
               'velocity_mag_f1_contour',
               'velocity_mag_combine_composite_vector',
               'velocity_mag_magnitude_vector_magnitude']

max_rank = max_rank[max_rank['name'].isin(filter_list)]

name_map = {'exec_slice_scene' : 'render_slice',
             'exec_scene1' : 'render',
             'exec_contour_scene' : 'render_contour',
             'slice_f1_slice' : 'slice',
             'velocity_mag_f1_contour' : 'contour',
             'velocity_mag_combine_composite_vector' : 'composite_vector',
             'velocity_mag_magnitude_vector_magnitude' : 'vector_magnitde'}

max_rank['name'] = max_rank['name'].replace(name_map)
print(max_rank)
print(max_rank.res.unique())

fig,ax = plt.subplots()
for name in max_rank.name.unique():
  ax.plot(max_rank[max_rank['name']==name].res,
          max_rank[max_rank['name']==name].time,label=name)

labels = ['6', '48','384','3072']
res_labels = [r'$248^3$', r'$512^3$',r'$1024^3$',r'$2048^3$']

plt.xticks(max_rank.res.unique(), labels)
ax2 = ax.twiny()
ax2.set_xlim(ax.get_xlim())
#ax2.set_xticks(new_tick_locations)
ax2.set_xticklabels(res_labels)
ax2.set_xlabel("Data Set Resolution")
plt.xticks(max_rank.res.unique())
ax.set_xlabel("Total GPUs")
ax.set_ylabel("time (s)")
ax.legend(loc='best')
plt.title('Weak Scaling of Ascent Filters on Summit')

#plt.bar(max_rank['name'], max_rank['time'])
plt.show()
Clone this wiki locally