diff --git a/openmp/runtime/tools/summarizeStats.py b/openmp/runtime/tools/summarizeStats.py --- a/openmp/runtime/tools/summarizeStats.py +++ b/openmp/runtime/tools/summarizeStats.py @@ -37,7 +37,7 @@ frame_dict = {'polygon': draw_poly_frame, 'circle': draw_circle_frame} if frame not in frame_dict: - raise ValueError, 'unknown value for `frame`: %s' % frame + raise ValueError('unknown value for `frame`: %s' % frame) class RadarAxes(PolarAxes): """ @@ -143,7 +143,7 @@ res["counters"] = readCounters(f) return res except (OSError, IOError): - print "Cannot open " + fname + print("Cannot open " + fname) return None def usefulValues(l): @@ -171,7 +171,7 @@ def normalizeValues(data, countField, factor): """Normalize values into a rate by dividing them all by the given factor""" - data[[k for k in data.keys() if k != countField]] /= factor + data[[k for k in list(data.keys()) if k != countField]] /= factor def setRadarFigure(titles): @@ -192,7 +192,7 @@ """Draw the radar plots""" tmp_lin = data * 0 tmp_log = data * 0 - for key in data.keys(): + for key in list(data.keys()): if data[key] >= 1: tmp_log[key] = np.log10(data[key]) else: @@ -206,7 +206,7 @@ ax.set_yscale('log') ax.legend() ax.set_xticks(index + width * n / 2) - ax.set_xticklabels(tmp[s]['Total'].keys(), rotation=50, horizontalalignment='right') + ax.set_xticklabels(list(tmp[s]['Total'].keys()), rotation=50, horizontalalignment='right') plt.xlabel("OMP Constructs") plt.ylabel(statProperties[s][0]) plt.title(statProperties[s][1]) @@ -214,7 +214,7 @@ def derivedTimerStats(data): stats = {} - for key in data.keys(): + for key in list(data.keys()): if key == 'OMP_worker_thread_life': totalRuntime = data['OMP_worker_thread_life'] elif key in ('FOR_static_iterations', 'OMP_PARALLEL_args', @@ -227,7 +227,7 @@ def compPie(data): compKeys = {} nonCompKeys = {} - for key in data.keys(): + for key in list(data.keys()): if key in ('OMP_critical', 'OMP_single', 'OMP_serial', 'OMP_parallel', 'OMP_master', 'OMP_task_immediate', 'OMP_task_taskwait', 'OMP_task_taskyield', 'OMP_task_taskgroup', @@ -235,7 +235,7 @@ compKeys[key] = data[key] else: nonCompKeys[key] = data[key] - print "comp keys:", compKeys, "\n\n non comp keys:", nonCompKeys + print("comp keys:", compKeys, "\n\n non comp keys:", nonCompKeys) return [compKeys, nonCompKeys] def drawMainPie(data, filebase, colors): @@ -250,8 +250,8 @@ def drawSubPie(data, tag, filebase, colors): explode = [] - labels = data.keys() - sizes = data.values() + labels = list(data.keys()) + sizes = list(data.values()) total = sum(sizes) percent = [] for i in range(len(sizes)): @@ -295,15 +295,15 @@ normalizeValues(tmp["counters"], "SampleCount", elapsedTime / 1.e9) """Plotting radar charts""" - params = setRadarFigure(data.keys()) + params = setRadarFigure(list(data.keys())) chartType = "radar" drawRadarChart(data, s, filebase, params, colors[n]) """radar Charts finish here""" plt.savefig(filebase+"_"+s+"_"+chartType, bbox_inches='tight') elif s == 'timers': - print "overheads in "+filebase + print("overheads in "+filebase) numThreads = tmp[s]['SampleCount']['Total_OMP_parallel'] - for key in data.keys(): + for key in list(data.keys()): if key[0:5] == 'Total': del data[key] stats[filebase] = derivedTimerStats(data) @@ -315,7 +315,7 @@ drawSubPie(dataSubSet[1], "Non Computational Time", filebase, colors) with open('derivedStats_{}.csv'.format(filebase), 'w') as f: f.write('================={}====================\n'.format(filebase)) - f.write(pd.DataFrame(stats[filebase].items()).to_csv()+'\n') + f.write(pd.DataFrame(list(stats[filebase].items())).to_csv()+'\n') n += 1 plt.close()