def plot_nested_doll_mix5_samelength(config, local_dir, logs, iters): with mpl.style.context(('color5')): pf.preprocess(local_dir) perfdf = pf.load_file(os.path.join(local_dir, 'sessiter.output')) fig = plt.figure() spec = mpl.gridspec.GridSpec(2, 1, height_ratios=[1, 3]) spec.update(hspace=0.2, left=0.18, right=.98, top=.8, bottom=0.22) ax0 = fig.add_subplot(spec[0]) ax1 = fig.add_subplot(spec[1], sharex=ax0) plt.setp(ax0.get_xticklabels(), visible=False) df, _ = pf.session_counters(perfdf, colnames=['scheduled'], ax=ax0) def smoother(ss): sampled = ss.resample('50ms').interpolate(method='time') print("previous len: {} now: {}".format(len(ss), len(sampled))) return sampled df, _, _ = pl.memory_usage(logs, mem_type='GPU_0_bfc', per_sess=True, ax=ax1, show_avg=False, smoother=smoother) ax0.set_title('Scheduled Tasks') ax0.legend().set_visible(False) handles, labels = ax1.get_legend_handles_labels() ax1.legend(handles=handles, labels=[ 'alexnet_100', 'overfeat_50', 'googlenet_50', "inception3_25", "resnet50_50" ], ncol=3, loc='upper center', bbox_to_anchor=(0.48, -0.19), frameon=False) ax0.set_ylabel('# of Tasks') ax1.set_xlabel('Time (s)') ax1.set_title('Memory Usage') ax1.tick_params(axis='x', labelsize=8) ax1.tick_params(axis='y', labelsize=8) ax0.tick_params(axis='y', labelsize=8) return fig
def plot_case_study1_diff(config, local_dir, logs, iters): with mpl.style.context(('color3')): # mpl.rcParams['axes.prop_cycle'] = mpl.cycler('color', ['ed7d31', 'dcedd0', '244185']) pf.preprocess(local_dir) perfdf = pf.load_file(os.path.join(local_dir, 'sessiter.output')) df, fig = pf.session_counters( perfdf, colnames=['counter', 'scheduled', 'pending'], zorders={ '16262ffc6e3ddddf': 5, 'cfe7d613e94bcc28': 10, '318dbb0290ba058d': 1 }) fig.axes[0].legend().remove() fig.axes[0].set_ylabel('Aggregate\nMemory Usage\n(byte * s)') # fig.axes[0].set_yscale('symlog') # fig.axes[0].yaxis.set_major_locator(pu.MaxNLocator(nbins=4, min_n_ticks=2)) fig.axes[1].legend().remove() fig.axes[1].set_ylabel('Scheduled\nTasks') fig.axes[2].set_ylabel('Pending\nTasks') ax = fig.axes[-1] ax.set_xlabel('Time (s)') ax.set_xlim(left=0) fig.tight_layout(rect=[0, 0.18, 1, 1]) # fig.subplots_adjust(bottom=.18, left=.16, right=.98, top=.98) handles, labels = ax.get_legend_handles_labels() ax.legend( handles=handles, labels=['googlenet_100', 'overfeat_50', 'resnet50_50'], # labels=labels, ncol=3, loc='upper center', bbox_to_anchor=(0.42, -0.55), frameon=False) fig.set_size_inches(3.45, 3.6, forward=True) return fig
def plot_case_bigsmall_wc(config, local_dir, logs, iters): pf.preprocess(local_dir) perfdf = pf.load_file(os.path.join(local_dir, 'sessiter.output')) fig = plt.figure() spec = mpl.gridspec.GridSpec(2, 1, height_ratios=[1, 3]) spec.update(hspace=0.2, left=0.16, right=.98, top=.8, bottom=0.18) ax0 = fig.add_subplot(spec[0]) ax1 = fig.add_subplot(spec[1], sharex=ax0) plt.setp(ax0.get_xticklabels(), visible=False) df, _ = pf.session_counters(perfdf, colnames=['scheduled'], ax=ax0) def smoother(ss): sampled = ss.resample('500us').interpolate(method='time') print("previous len: {} now: {}".format(len(ss), len(sampled))) return sampled df, _, _ = pl.memory_usage(logs, mem_type='GPU_0_bfc', per_sess=True, ax=ax1, show_avg=False, smoother=smoother) ax0.legend().set_visible(False) handles, labels = ax1.get_legend_handles_labels() ax1.legend(handles=handles, labels=['alexnet_100', 'inception3_25'], ncol=2, loc='upper center', bbox_to_anchor=(0.5, -0.2), frameon=False) ax0.set_ylabel('Scheduled\nTasks') ax1.set_xlabel('Time (s)') ax1.set_xlim([0, 115 * 1e9]) ax1.tick_params(axis='x', labelsize=8) ax1.tick_params(axis='y', labelsize=8) ax0.tick_params(axis='y', labelsize=8) return fig