How to use scalar_formatter method in yandex-tank

Best Python code snippet using yandex-tank

core.py

Source:core.py Github

copy

Full Screen

...270 unit=result.get('unit'),271 error=result.get('errorMessage'),272 calculation_time=result.get('calculationTime'),273 queueing_time=result.get('queueingTime'))274def scalar_formatter(result: List, pricing_key: PricingKey, _instrument: InstrumentBase)\275 -> Optional[Union[FloatWithInfo, SeriesWithInfo]]:276 if not result:277 return None278 result = __flatten_result(result)279 if len(result) > 1 and 'date' in result[0]:280 columns = [x for x in result[0].keys() if x != 'value']281 compressed_results = pd.DataFrame(result).groupby(columns).sum().reset_index().to_dict('records')282 r = [__float_with_info_from_result(r, pricing_key.for_pricing_date(r['date'])) for r in compressed_results]283 return FloatWithInfo.compose(284 r,285 pricing_key)286 else:287 return __float_with_info_from_result(result[0], pricing_key)288def __dataframe_formatter(result: List, pricing_key: PricingKey, columns: Tuple[str, ...])\...

Full Screen

Full Screen

vis.py

Source:vis.py Github

copy

Full Screen

1"""Plotting functions2Note:3 It relies on Matplotlib4"""5from __future__ import division6import warnings7import logging8logger = logging.getLogger('pygrfnn.vis')9import numpy as np10from functools import wraps11from numpy.polynomial.polynomial import polyroots12from utils import find_nearest13from utils import nice_log_values14from grfnn import grfnn_update_event15from resonances import fareySequence, resonanceSequence16try:17 import matplotlib as mpl18 import matplotlib.pyplot as plt19 import matplotlib.gridspec as gridspec20except ImportError:21 warnings.warn("Failed to import matplotlib. Plotting functions will be disabled.")22# graphical output decorator23def check_display(fun):24 """Decorator to check for display capability25 Args:26 fun (``function``): Function to be timed27 Returns:28 ``function``: decorated function29 """30 @wraps(fun)31 def display_wrapper(*args, **kwargs):32 try:33 import matplotlib as mpl34 import os35 return fun(*args, **kwargs)36 except ImportError:37 warnings.warn("Couldn't import matplotlib, so visualizations are disabled")38 # logging.info("Couldn't import matplotlib, so visualizations are disabled")39 except Exception as e:40 logging.error(str(e))41 warnings.warn(str(e))42 # warnings.warn("Something went wrong when trying to plot. "43 # "Are you sure there's a display available?")44 logging.error("Something went wrong when trying to plot. "45 "Are you sure there's a display available?")46 return display_wrapper47@check_display48def tf_simple(TF, t, f, title=None, x=None, display_op=np.abs,49 cmap='binary', vmin=None, vmax=None):50 """Simple time-frequency representation (TFR).51 Show the TFR in the top plot and the original time signal in the bottom52 plot, if ``x`` is passed.53 Args:54 TF (:class:`numpy.ndarray`): time-frequency representation55 t (:class:`numpy.ndarray`): time vector56 f (:class:`numpy.ndarray`): frequency vector57 title (``string``): title of the plot58 x (:class:`numpy.array`): original time domain signal. If ``None``, no59 time domain plot is shown60 display_op (``function``): operator to apply to the TF representation (e.g.61 :func:`numpy.abs`)62 cmap (``string``): colormap to use in the TF representation63 vmin (``float``): lower limit of the colormap64 vmax (``float``): upper limit of the colormap65 Note:66 Is the caller's responsibility to issue :func:`matplotlib.pyplot.show()`67 if necessary.68 """69 opTF = display_op(TF)70 if x is None:71 fig, axTF = plt.subplots(1)72 axOnset = None73 else:74 # fig, (axTF, axT) = plt.subplots(2, 1, sharex=True)75 fig = plt.figure()76 gs = gridspec.GridSpec(2, 1,77 width_ratios=[1],78 height_ratios=[3, 1]79 )80 gs.update(wspace=0.0, hspace=0.0) # set the spacing between axes.81 axTF = fig.add_subplot(gs[0])82 axOnset = fig.add_subplot(gs[1], sharex=axTF)83 axTF.pcolormesh(t, f, opTF, cmap=cmap, vmin=vmin, vmax=vmax)84 if title is not None:85 axTF.set_title(title)86 axTF.set_yscale('log')87 axTF.set_yticks(nice_log_values(f))88 axTF.get_yaxis().set_major_formatter(mpl.ticker.ScalarFormatter())89 axTF.axis('tight')90 if axOnset is not None:91 plt.setp(axTF.get_xticklabels(), visible=False)92 axOnset.plot(t, x)93 axOnset.yaxis.set_ticks_position('right')94 axOnset.axis('tight')95 # plt.show()96@check_display97def tf_detail(TF, t, f, title=None, t_detail=None, x=None, display_op=np.abs,98 figsize=None, cmap='binary', vmin=None, vmax=None):99 """100 Detailed time-frequency representation (TFR).101 Show the TFR in the top plot. Also show the frequency representation at a102 specific time instants (last time by default) on the plot on the right. If103 specified, the original time signal ``x`` is shown the bottom plot.104 Args:105 TF (:class:`numpy.ndarray`): time-frequency representation106 t (:class:`numpy.ndarray`): time vector107 f (:class:`numpy.ndarray`): frequency vector108 title (``string``): title of the plot109 t_detail (``float`` or ``list``): time instant(s) to be detailed110 x (:class:`numpy.ndarray`): original time domain signal. If *None*, not111 time domain plot is shown112 display_op (``function``): operator to apply to the TF representation113 (e.g. :func:`numpy.angle`)114 figsize (``tuple``): matplotlib's figure size (optional)115 cmap (``string``): colormap to use in the TF representation116 vmin (``float``): lower limit of the colormap117 vmax (``float``): upper limit of the colormap118 Returns:119 ``(handles, ...)``: tuple of handles to plotted elements. They can be120 used to create animations121 Note:122 ``vmin`` and ``vmax`` are useful when comparing different time-frequency123 representations, so they all share the same color scale.124 Note:125 Is the caller's responsibility to issue :func:`matplotlib.pyplot.show()`126 if necessary.127 """128 if figsize is not None:129 fig = plt.figure(figsize=figsize)130 else:131 fig = plt.figure()132 opTF = display_op(TF)133 if t_detail is None:134 wr = [1, 2, 20]135 detail = None136 else:137 wr = [1, 2, 20, 6]138 if x is None:139 hr = [1]140 axOnset = None141 else:142 hr = [3, 1]143 gs = gridspec.GridSpec(len(hr), len(wr),144 width_ratios=wr,145 height_ratios=hr146 )147 gs.update(wspace=0.0, hspace=0.0) # set the spacing between axes.148 axCB = fig.add_subplot(gs[0])149 axTF = fig.add_subplot(gs[2])150 if x is not None:151 axOnset = fig.add_subplot(gs[len(wr)+2], sharex=axTF)152 if t_detail is not None:153 axF = fig.add_subplot(gs[3], sharey=axTF)154 nice_freqs = nice_log_values(f)155 # TF image156 # im = axTF.pcolormesh(t, f, opTF, cmap=cmap)157 im = axTF.imshow(opTF,158 extent=[min(t), max(t), min(f), max(f)],159 cmap=cmap,160 vmin=vmin,161 vmax=vmax,162 origin='lower'163 )164 with warnings.catch_warnings():165 warnings.filterwarnings("ignore")166 axTF.set_yscale('log')167 axTF.set_yticks(nice_freqs)168 axTF.get_yaxis().set_major_formatter(mpl.ticker.ScalarFormatter())169 axTF.invert_yaxis()170 if title is not None:171 axTF.set_title(title)172 # Add colorbar173 cb = plt.colorbar(im, ax=axTF, cax=axCB)174 cb.ax.yaxis.set_ticks_position('left')175 # TF detail176 # find detail index177 tf_line = None178 tf_x_min, tf_x_max = 0, np.max(opTF)179 if vmin is not None:180 tf_x_min = vmin181 if vmax is not None:182 tf_x_max = vmax183 if t_detail is not None:184 if isinstance(t_detail, np.ndarray):185 t_detail = t_detail.tolist()186 elif not isinstance(t_detail, list):187 t_detail = [t_detail]188 t_detail, idx = find_nearest(t, t_detail)189 # axF.invert_xaxis()190 detail = axF.semilogy(opTF[:, idx], f)191 axF.set_yticks(nice_freqs)192 axF.get_yaxis().set_major_formatter(mpl.ticker.ScalarFormatter())193 axF.xaxis.set_ticks_position('top')194 axF.axis('tight')195 axF.set_xlim(tf_x_min, tf_x_max)196 axF.yaxis.set_ticks_position('right')197 plt.setp(axF.get_xaxis().get_ticklabels(), rotation=-90 )198 axTF.hold(True)199 tf_line = axTF.plot([t_detail, t_detail], [np.min(f), np.max(f)])200 # tf_line = [axTF.axvline(td) for td in t_detail]201 axTF.hold(False)202 axTF.axis('tight')203 # onset signal204 t_line = None205 if axOnset is not None:206 plt.setp(axTF.get_xticklabels(), visible=False)207 axOnset.plot(t, x, color='k')208 if t_detail is not None:209 t_line = axOnset.plot([t_detail, t_detail], [np.min(x), np.max(x)])210 # t_line = [axOnset.axvline(td) for td in t_detail]211 axOnset.yaxis.set_ticks_position('right')212 axOnset.axis('tight')213 # plt.show()214 return (fig, im, tf_line, t_line, detail)215@check_display216def plot_connections(connection, title=None, f_detail=None, display_op=np.abs,217 detail_type='polar', cmap='binary', vmin=None, vmax=None):218 """plot_connections(connection, t_detail=None, display_op=np.abs,219 detail_type='polar')220 Args:221 connection (:class:`.Connection`): connection object222 title (``string``): Title to be displayed223 f_detail (``float``): frequency of the detail plot224 display_op (``function``): operator to apply to the connection225 matrix (e.g. :func:`numpy.abs`)226 detail_type (``string``): detail complex display type (``'cartesian',227 'polar', 'magnitude'`` or ``'phase'``)228 cmap (``string``): colormap to use in the TF representation229 vmin (``float``): lower limit of the colormap230 vmax (``float``): upper limit of the colormap231 Note:232 Is the caller's responsibility to issue :func:`matplotlib.pyplot.show()`233 if necessary.234 """235 fig = plt.figure()236 if f_detail is not None:237 gs = gridspec.GridSpec(2, 1,238 width_ratios=[1],239 height_ratios=[3, 1]240 )241 gs.update(wspace=0.0, hspace=0.0) # set the spacing between axes.242 axConn = fig.add_subplot(gs[0])243 axDetail = fig.add_subplot(gs[1])244 else:245 axConn = fig.add_subplot(1, 1, 1)246 f_source = connection.source.f247 f_dest = connection.destination.f248 matrix = connection.matrix249 opMat = display_op(matrix)250 # axConn.pcolormesh(f_source, f_dest, opMat, cmap=cmap)251 axConn.imshow(opMat,252 extent=[min(f_source), max(f_source),253 min(f_dest), max(f_dest)],254 cmap=cmap,255 vmin=vmin,256 vmax=vmax,257 origin='lower'258 )259 with warnings.catch_warnings():260 warnings.filterwarnings("ignore")261 # axConn.invert_yaxis()262 axConn.set_xscale('log')263 axConn.set_xticks(nice_log_values(f_source))264 axConn.get_xaxis().set_major_formatter(mpl.ticker.ScalarFormatter())265 axConn.set_yscale('log')266 axConn.set_yticks(nice_log_values(f_dest))267 axConn.get_yaxis().set_major_formatter(mpl.ticker.ScalarFormatter())268 axConn.set_ylabel(r'$f_{\mathrm{dest}}$')269 if title is not None:270 axConn.set_title(title)271 if f_detail is None:272 axConn.set_xlabel(r'$f_{\mathrm{source}}$')273 else:274 (f_detail, idx) = find_nearest(f_dest, f_detail)275 conn = matrix[idx, :]276 axConn.hold(True)277 axConn.plot([np.min(f_source), np.max(f_source)],278 [f_detail, f_detail],279 color='r')280 axConn.hold(False)281 scalar_formatter = mpl.ticker.ScalarFormatter()282 if detail_type is 'polar':283 axDetail.semilogx(f_source, np.abs(conn))284 axDetailb = axDetail.twinx()285 axDetailb.semilogx(f_source, np.angle(conn), color='r')286 axDetailb.set_xticks(nice_log_values(f_source))287 axDetailb.get_xaxis().set_major_formatter(scalar_formatter)288 axDetailb.set_ylim([-np.pi, np.pi])289 axDetail.axis('tight')290 elif detail_type is 'magnitude':291 y_min, y_max = 0, np.abs(conn)292 if vmin is not None:293 y_min = vmin294 if vmax is not None:295 y_max = vmax296 axDetail.semilogx(f_source, np.abs(conn))297 axDetail.set_xticks(nice_log_values(f_source))298 axDetail.get_xaxis().set_major_formatter(scalar_formatter)299 # axDetail.axis('tight')300 axDetail.set_ylim([y_min, y_max])301 elif detail_type is 'phase':302 axDetail.semilogx(f_source, np.angle(conn), color='r')303 axDetail.set_xticks(nice_log_values(f_source))304 axDetail.get_xaxis().set_major_formatter(scalar_formatter)305 axDetail.set_ylim([-np.pi, np.pi])306 else:307 axDetail.semilogx(f_source, np.real(conn))308 axDetailb = axDetail.twinx()309 axDetailb.semilogx(f_source, np.imag(conn), color='r')310 axDetailb.set_xticks(nice_log_values(f_source))311 axDetailb.get_xaxis().set_major_formatter(scalar_formatter)312 axDetail.axis('tight')313 axDetail.set_xlabel(r'$f_{\mathrm{dest}}$')314 axConn.set(aspect=1, adjustable='box-forced')315 # plt.show()316@check_display317class GrFNN_RT_plot(object):318 """319 On-line GrFNN state visualization.320 Args:321 grfnn (:class:`.Model`): GrFNN to be plotted322 update_interval (``float``): Update interval (in seconds). This is323 an approximation, as the update will happen as a multiple of the324 integration step time.325 fig_name (``string``): Name of the figure to use. If specified, the same326 figure will be reused in consecutive runs. If None, a new figure327 will be created each time the caller script runs.328 title (``string``): optional title of the plot329 Note:330 This function probably won't work on an iPython Notebook. A possible331 implementation using mpld3 should be possible to code, but is not in the332 short term planning.333 Note:334 This function calls :func:`matplotlib.pyplot.ion` internally to allow335 for on-line updating of the plot.336 Note:337 There is probably room for optimization here. For example,338 http://goo.gl/J7Yyor does some interesting analysis/optimizations for339 updating plots340 """341 def __init__(self, grfnn, update_interval=0, fig_name=None, title=''):342 self.grfnn = grfnn343 self.update_interval = update_interval344 self.title = title345 self.fig_name = fig_name346 plt.ion()347 if fig_name is None:348 self.fig = plt.figure()349 else:350 self.fig = plt.figure(fig_name)351 self.ax = self.fig.add_subplot(111)352 self.ax.grid(True)353 self.line1, = self.ax.semilogx(grfnn.f, np.abs(grfnn.z), 'k')354 self.ax.axis((np.min(grfnn.f), np.max(grfnn.f), 0, 1))355 plt.xticks(nice_log_values(grfnn.f))356 self.ax.set_title('{}'.format(self.title))357 self.fig.canvas.draw()358 self.last_update = 0359 def update_callback(sender, **kwargs):360 """361 Update the plot when necessary362 """363 t = kwargs['t']364 if 'force' in kwargs:365 force = kwargs['force']366 else:367 force = False368 if force or (t - self.last_update >= self.update_interval):369 z = sender.z370 self.line1.set_ydata(np.abs(z))371 self.ax.set_title('{} (t = {:0.2f}s)'.format(self.title, t))372 self.fig.canvas.draw()373 self.last_update = t374 grfnn_update_event.connect(update_callback, sender=grfnn, weak=False)375@check_display376def vector_field(params, F=1.0):377 """378 Display the vector field of an oscillator.379 For a given set of intrinsic parameters, show the vector field for an380 oscillator as the one defined by :func:`.zdot`.381 Args:382 params (:class:`.Zparam`): oscillator intrinsic parameters383 F (``scalar`` or ``iterable``): Forcing values to plot384 """385 colormap = plt.cm.gist_heat386 try:387 len(F)388 except:389 F = [F]390 # FIXME: customizable?391 colors = [colormap(i) for i in np.linspace(0, 0.7, len(F))]392 # \dot{r} = f(r, F)393 r = np.arange(0, 1/np.sqrt(params.epsilon), 0.01)394 rdot = np.add.outer(params.alpha * r +395 params.beta1 * r**3 +396 ((params.epsilon* params.beta2 * r**5) /397 (1 - params.epsilon * r**2)),398 F)399 # plot it400 plt.figure()401 ax = plt.gca()402 ax.set_color_cycle(colors)403 plt.plot(r, rdot, zorder=0, linewidth=2)404 plt.title(r'$\alpha={:.3g},'405 r'\beta_1={:.3g},'406 r'\beta_2={:.3g}$'.format(params.alpha,407 params.beta1,408 params.beta2))409 ## assymptote410 # plt.vlines(x=1/np.sqrt(epsilon), ymin=-1, ymax=2, color='r', linestyle=':')411 # plt.ylim(-5,5)412 ax.axhline(y=0,xmin=min(r),xmax=max(r),c="k",zorder=5, alpha=0.5)413 plt.xlabel(r'$r$')414 plt.ylabel(r'$\dot{r}$', labelpad=-10)415 # find roots (r^*)416 roots = [None] * len(F)417 for i in xrange(len(F)):418 r = polyroots([F[i], # ^0419 params.alpha, # ^1420 -params.epsilon*F[i], # ^2421 params.beta1-params.epsilon*params.alpha, # ^3422 0, # ^4423 params.epsilon*(params.beta2-params.beta1)]) # ^5424 r = np.real(r[np.abs(np.imag(r)) < 1e-20])425 r = r[(r>=0) & (r < 1/params.sqe)]426 roots[i] = r427 # print roots428 # plot the roots429 plt.gca().set_color_cycle(colors)430 for r in roots:431 plt.plot(r, np.zeros_like(r), 'o', markersize=4, zorder=10)432def plotResonanceDiagram(N, exclude_inf=True):433 """434 Generate resonance plot.435 As the one shown in http://goo.gl/dOSV2z436 To Do:437 Complete documentation438 """439 ALPHA = 0.2440 plt.figure()441 ticks = set([])442 for h, k in fareySequence(N, 1):443 ticks.add((h,k))444 for a, b in resonanceSequence(N, k):445 if b == 0:446 if not exclude_inf:447 plt.plot([h/k, h/k], [0, 1], 'b:', alpha=2*ALPHA)448 plt.plot([0, 1], [h/k, h/k], 'b:', alpha=2*ALPHA)449 continue450 m = a/b451 cp, cm = m*h/k, -m*h/k452 x = np.array([0, h/k, 1])453 y = np.array([cp, 0, cm+m])454 plt.plot( x, y, 'b', alpha=ALPHA)455 plt.plot( y, x, 'b', alpha=ALPHA)456 plt.plot( x, 1-y, 'b', alpha=ALPHA)457 plt.plot(1-y, x, 'b', alpha=ALPHA)458 plt.xlim(0, 1)459 plt.ylim(0, 1)460 plt.xticks([h/k for h,k in ticks], [r"$\frac{{{:d}}}{{{:d}}}$".format(h,k) for h,k in ticks])461 plt.yticks([h/k for h,k in ticks], [r"$\frac{{{:d}}}{{{:d}}}$".format(h,k) for h,k in ticks])462 # plt.xticks([h/k for h,k in ticks], [r"${:d}/{:d}$".format(h,k) for h,k in ticks])463 # plt.yticks([h/k for h,k in ticks], [r"${:d}/{:d}$".format(h,k) for h,k in ticks])...

Full Screen

Full Screen

draw_collective_communication.py

Source:draw_collective_communication.py Github

copy

Full Screen

1import matplotlib.pyplot as plt2import numpy as np3from matplotlib.ticker import ScalarFormatter4from matplotlib.transforms import Bbox5import pandas as pd6COLUMNS_USED = ['Benchmark Name', 'Object Size (in bytes)', '#Nodes', 'Average Time (s)', 'Std Time (s)']7COLUMNS_DTYPE = [np.object, np.int64, np.int64, np.float64, np.float64]8LARGE_OBJECT_SIZES = [2**20, 2**25, 2**30]9SMALL_OBJECT_SIZES = [2**10, 2**15]10TASKS = ['multicast', 'gather', 'reduce', 'allreduce_slow', 'allreduce_fast']11size_dict = {12 1024: "1KB",13 32768: "32KB",14 1048576: "1MB",15 33554432: "32MB",16 1073741824: "1GB",17}18task_dict = {19 "multicast": "Broadcast", 20 "gather": "Gather", 21 "reduce": "Reduce", 22 "allreduce": "Allreduce", 23 "allreduce_slow": "Allreduce(i)", 24 "allreduce_fast": "Allreduce(ii)", 25}26def read_results(path):27 results = pd.read_csv(path, dtype=dict(zip(COLUMNS_USED, COLUMNS_DTYPE)))28 return results[COLUMNS_USED].sort_values(by=COLUMNS_USED)29def read_ray_results(path):30 results = pd.read_csv(31 path,32 names=['Benchmark Name', '#Nodes', 'Object Size (in bytes)', 'Average Time (s)', 'Std Time (s)'],33 dtype=dict(zip(COLUMNS_USED, COLUMNS_DTYPE)))34 return results[COLUMNS_USED].sort_values(by=COLUMNS_USED)35def filter_by_name_and_size(df, name, size):36 f_name = (df['Benchmark Name'] == name)37 f_size = (df['Object Size (in bytes)'] == size)38 return df[f_name & f_size].iloc[:, [2, 3, 4]]39def prepare_plot_data(hoplite_results, mpi_results, gloo_results, ray_results, dask_results):40 plot_data = {}41 for task in TASKS:42 for object_size in SMALL_OBJECT_SIZES + LARGE_OBJECT_SIZES:43 if task == 'multicast':44 all_lines = [45 ("Hoplite", filter_by_name_and_size(hoplite_results, task, object_size)), 46 ("OpenMPI", filter_by_name_and_size(mpi_results, task, object_size)), 47 ("Ray", filter_by_name_and_size(ray_results, 'ray_' + task, object_size)), 48 ("Dask", filter_by_name_and_size(dask_results, task, object_size)),49 ("Gloo (Broadcast)", filter_by_name_and_size(gloo_results, 'broadcast_one_to_all', object_size)),50 ]51 elif task == 'gather' or task == 'reduce':52 all_lines = [53 ("Hoplite", filter_by_name_and_size(hoplite_results, task, object_size)), 54 ("OpenMPI", filter_by_name_and_size(mpi_results, task, object_size)), 55 ("Ray", filter_by_name_and_size(ray_results, 'ray_' + task, object_size)), 56 ("Dask", filter_by_name_and_size(dask_results, task, object_size)),57 ]58 elif task == 'allreduce_slow':59 all_lines = [60 ("Hoplite", filter_by_name_and_size(hoplite_results, 'allreduce', object_size)), 61 ("Ray", filter_by_name_and_size(ray_results, 'ray_' + 'allreduce', object_size)), 62 ("Dask", filter_by_name_and_size(dask_results, 'allreduce', object_size)),63 # ("Gloo (Ring)", ...)64 ]65 elif task == 'allreduce_fast':66 all_lines = [67 ("Hoplite", filter_by_name_and_size(hoplite_results, 'allreduce', object_size)), 68 ("OpenMPI", filter_by_name_and_size(mpi_results, 'allreduce', object_size)), 69 ("Gloo (Ring Chunked)", filter_by_name_and_size(gloo_results, 'allreduce_ring_chunked', object_size)), 70 ("Gloo (Halving Doubling)", filter_by_name_and_size(gloo_results, 'allreduce_halving_doubling', object_size)), 71 # ("Gloo (Bcube)", ...)72 ]73 else:74 assert False75 plot_data[(task, object_size)] = all_lines76 return plot_data77def render(axes, plot_data, tasks, object_sizes):78 plt.setp(axes, xticks=[4, 8, 12, 16])79 plt.setp(axes[-1], xlabel="Number of Nodes")80 plt.setp(axes[:, 0], ylabel="Latency (s)")81 color_dict = {}82 n_color = 083 color_map = plt.get_cmap('tab20')84 # color_list = ["#60ACFC", "#21C2DB", "#62D5B2", "#D4EC59", "#FEB64D", "#FA816D", "#D15B7F"]85 for i, task in enumerate(tasks):86 for j, object_size in enumerate(object_sizes):87 ax = axes[j][i]88 for name, data in plot_data[(task, object_size)]:89 axis = data['#Nodes']90 mean = data['Average Time (s)']91 err = data['Std Time (s)']92 scalar_formatter = ScalarFormatter(useMathText=True)93 scalar_formatter.set_powerlimits((-1, 1))94 ax.yaxis.set_major_formatter(scalar_formatter)95 if name in color_dict:96 ax.errorbar(axis, mean, yerr=err, linewidth=1, elinewidth=1, capsize=2, color=color_dict[name])97 else:98 color_dict[name] = color_map(n_color * 2)99 n_color += 1100 ax.errorbar(axis, mean, yerr=err, linewidth=1, elinewidth=1, capsize=2, label=name, color=color_dict[name])101 ax.set_title(" ".join([task_dict[task], size_dict[object_size]]))102if __name__ == '__main__':103 hoplite_results = read_results('hoplite-cpp/hoplite_results.csv')104 mpi_results = read_results('mpi-cpp/mpi_results.csv')105 gloo_results = read_results('gloo-cpp/gloo_results.csv')106 ray_results = read_ray_results('ray-python/ray-microbenchmark.csv')107 dask_results = read_results('dask-python/dask_results.csv')108 plot_data = prepare_plot_data(hoplite_results, mpi_results, gloo_results, ray_results, dask_results)109 # Large objects110 fig, axes = plt.subplots(3, 5, figsize=(15.5, 6), sharex='all')111 render(axes, plot_data, TASKS, LARGE_OBJECT_SIZES)112 fig.legend(loc="upper center", ncol=7, bbox_to_anchor=(0.5, 1.06), fontsize=12.5)113 fig.tight_layout()114 fig.savefig("microbenchmarks-large.pdf", bbox_inches=Bbox([[0, 0], [16, 6.5]]))115 # Small objects116 fig, axes = plt.subplots(2, 5, figsize=(15.5, 4), sharex='all')117 render(axes, plot_data, TASKS, SMALL_OBJECT_SIZES)118 fig.legend(loc="upper center", ncol=7, bbox_to_anchor=(0.5, 1.08), fontsize=12.5)119 fig.tight_layout()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run yandex-tank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful