Skip to content

Commit

Permalink
ocl: implemented warning about incorrectly merged duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
hfp committed Sep 18, 2023
1 parent 579110d commit 13298f0
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions src/acc/opencl/smm/tune_multiply.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@ def manipulator(self):
self.typeid = (
int(typename.group(1)) if typename and typename.group(1) else 0
)
device = re.search(
'INFO ACC/OpenCL:\\s+ndevices=[0-9]+\\s+device[0-9]+="([^"]+)"',
str(run_result["stderr"]),
)
devicepat = 'INFO ACC/OpenCL:\\s+ndevices=[0-9]+\\s+device[0-9]+="([^"]+)"'
device = re.search(devicepat, str(run_result["stderr"]))
self.device = device.group(1) if device and device.group(1) else ""
elif self.args.update is not None and "" != self.args.update:
self.device = self.args.update
Expand All @@ -113,7 +111,7 @@ def manipulator(self):
"{},{},{},{}".format( # t,m,n,k (key)
self.typeid, self.mnk[0], self.mnk[1], self.mnk[2]
),
"{}, {}, {}, {}, {}".format( # value: some can be neg. hence "-*[0-9]+"
"{}, {}, {}, {}, {}".format( # value: if neg. "-*[0-9]+"
"(-*[0-9]+),(-*[0-9]+),(-*[0-9]+),(-*[0-9]+)", # bs,bm,bn,bk
"(-*[0-9]+),(-*[0-9]+)", # ws,wg
"(-*[0-9]+),(-*[0-9]+),(-*[0-9]+)", # lu,nz,al
Expand Down Expand Up @@ -147,7 +145,7 @@ def manipulator(self):
if not paramt:
sys.tracebacklimit = 0
raise RuntimeError(
"All tunable parameters are fixed with environment variables!"
"All parameters are fixed with environment variables!"
)
for param in params + paramt:
manipulator.add_parameter(param)
Expand Down Expand Up @@ -408,10 +406,18 @@ def merge_jsons(self, filenames):
retain.append(filename)
else:
delete.append(filename)
if retain:
print("Worse and newer (retain): {}".format(" ".join(retain)))
if delete:
print("Worse and older (delete): {}".format(" ".join(delete)))
if not self.args.nogflops:
if retain:
print(
"Worse and newer (retain): {}".format(" ".join(retain))
)
if delete:
print(
"Worse and older (delete): {}".format(" ".join(delete))
)
elif bool(worse):
print("WARNING: incorrectly merged duplicates")
print(" due to nogflops argument!")
print(
"Merged {} of {} JSONs into {}".format(
len(merged), len(filenames), self.args.csvfile
Expand Down Expand Up @@ -452,7 +458,7 @@ def save_final_config(self, configuration, final=True):
if final:
if not filenames and glob.glob(self.args.csvfile):
print(
"WARNING: no JSON file found but (unrelated?) {}".format(
"WARNING: no JSON file found but {} exists.".format(
self.args.csvfile
)
)
Expand All @@ -478,7 +484,7 @@ def save_final_config(self, configuration, final=True):
filename,
)
)
# no validation in SIGINT (user may fired signal due to apps misbehavior)
# no validation in SIGINT (signal may be due to application)
if 0 == self.args.check and self.handle_sigint != getsignal(SIGINT):
run_result = self.launch(self.environment(config) + ["CHECK=1"])
if 0 != run_result["returncode"]:
Expand All @@ -487,7 +493,7 @@ def save_final_config(self, configuration, final=True):
def handle_sigint(self, signum, frame):
"""Handle SIGINT or CTRL-C"""
print(
"\nWARNING: tuning {}x{}x{}-kernel was interrupted".format(
"\nWARNING: tuning {}x{}x{}-kernel was interrupted.".format(
self.mnk[0], self.mnk[1], self.mnk[2]
)
)
Expand Down Expand Up @@ -646,7 +652,8 @@ def handle_sigint(self, signum, frame):
type=int,
default=env_value("OPENCL_LIBSMM_SMM_LU", "-1"),
dest="lu",
help="Loop unroll (-2) full, (-1) no hints (default), (0) inner, (1) outer-dehint, (2) literal",
help="Loop unroll (-2) full, (-1) no hints (default),"
+ " (0) inner, (1) outer-dehint, (2) literal",
)
argparser.add_argument(
"-nz",
Expand Down

0 comments on commit 13298f0

Please sign in to comment.