Skip to content

Commit

Permalink
OpenMP: Fix Python 3 SyntaxErrors (#123940)
Browse files Browse the repository at this point in the history
1. `print()` is a function in Python 3.
2. New-style exceptions are required in Python 3.
  • Loading branch information
cclauss authored Jan 27, 2025
1 parent a7a4c16 commit 89c5576
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions openmp/runtime/tools/summarizeStats.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python


import pandas as pd
import numpy as np
import re
Expand Down Expand Up @@ -37,7 +38,7 @@ def draw_circle_frame(self, x0, y0, r):

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):
"""
Expand Down Expand Up @@ -143,7 +144,7 @@ def readFile(fname):
res["counters"] = readCounters(f)
return res
except (OSError, IOError):
print "Cannot open " + fname
print("Cannot open " + fname)
return None

def usefulValues(l):
Expand Down Expand Up @@ -235,7 +236,7 @@ def compPie(data):
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):
Expand Down Expand Up @@ -299,10 +300,10 @@ def main():
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
numThreads = tmp[s]['SampleCount']['Total_OMP_parallel']
plt.savefig(filebase + "_" + s + "_" + chartType, bbox_inches="tight")
elif s == "timers":
print("overheads in " + filebase)
numThreads = tmp[s]["SampleCount"]["Total_OMP_parallel"]
for key in data.keys():
if key[0:5] == 'Total':
del data[key]
Expand Down

0 comments on commit 89c5576

Please sign in to comment.