[Openmp-commits] [PATCH] D143702: [NFC] Convert openmp/runtime/tools/summarizeStats.py to python 3 syntax

Tobias Hieta via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Feb 14 00:07:09 PST 2023


thieta updated this revision to Diff 497221.
thieta marked 6 inline comments as done.
thieta added a comment.

Removed unecessary lists


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143702/new/

https://reviews.llvm.org/D143702

Files:
  openmp/runtime/tools/summarizeStats.py


Index: openmp/runtime/tools/summarizeStats.py
===================================================================
--- openmp/runtime/tools/summarizeStats.py
+++ 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):
@@ -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,13 +295,13 @@
                 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():
                     if key[0:5] == 'Total':
@@ -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()
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143702.497221.patch
Type: text/x-patch
Size: 2669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230214/2cd9c386/attachment.bin>


More information about the Openmp-commits mailing list