Skip to content

Commit 89c5576

Browse files
authored
OpenMP: Fix Python 3 SyntaxErrors (#123940)
1. `print()` is a function in Python 3. 2. New-style exceptions are required in Python 3.
1 parent a7a4c16 commit 89c5576

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

openmp/runtime/tools/summarizeStats.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python
22

3+
34
import pandas as pd
45
import numpy as np
56
import re
@@ -37,7 +38,7 @@ def draw_circle_frame(self, x0, y0, r):
3738

3839
frame_dict = {'polygon': draw_poly_frame, 'circle': draw_circle_frame}
3940
if frame not in frame_dict:
40-
raise ValueError, 'unknown value for `frame`: %s' % frame
41+
raise ValueError("unknown value for `frame`: %s" % frame)
4142

4243
class RadarAxes(PolarAxes):
4344
"""
@@ -143,7 +144,7 @@ def readFile(fname):
143144
res["counters"] = readCounters(f)
144145
return res
145146
except (OSError, IOError):
146-
print "Cannot open " + fname
147+
print("Cannot open " + fname)
147148
return None
148149

149150
def usefulValues(l):
@@ -235,7 +236,7 @@ def compPie(data):
235236
compKeys[key] = data[key]
236237
else:
237238
nonCompKeys[key] = data[key]
238-
print "comp keys:", compKeys, "\n\n non comp keys:", nonCompKeys
239+
print("comp keys:", compKeys, "\n\n non comp keys:", nonCompKeys)
239240
return [compKeys, nonCompKeys]
240241

241242
def drawMainPie(data, filebase, colors):
@@ -299,10 +300,10 @@ def main():
299300
chartType = "radar"
300301
drawRadarChart(data, s, filebase, params, colors[n])
301302
"""radar Charts finish here"""
302-
plt.savefig(filebase+"_"+s+"_"+chartType, bbox_inches='tight')
303-
elif s == 'timers':
304-
print "overheads in "+filebase
305-
numThreads = tmp[s]['SampleCount']['Total_OMP_parallel']
303+
plt.savefig(filebase + "_" + s + "_" + chartType, bbox_inches="tight")
304+
elif s == "timers":
305+
print("overheads in " + filebase)
306+
numThreads = tmp[s]["SampleCount"]["Total_OMP_parallel"]
306307
for key in data.keys():
307308
if key[0:5] == 'Total':
308309
del data[key]

0 commit comments

Comments
 (0)