Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocl: improved tuning script #821

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/acc/opencl/smm/opencl_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sed -n "s/FAILED\[..*\] \(..*\): \(..*\)/\1 \2/p" "$1" | while read -r LINE; do
EXPORT="${EXPORT} OPENCL_LIBSMM_SMM_${KEYVAL}"
done
if [ "${EXPORT}" ]; then
OUTPUT=$(eval "${EXPORT} ${EXE} ${MNK} 2>&1" | sed "s/^/ /")
echo -e "${MNK}: ${KEYVALS}\n${OUTPUT}"
echo "${MNK}: ${KEYVALS}"
eval "${EXPORT} ${EXE} ${MNK} 2>&1" | sed "s/^/ /"
fi
done
13 changes: 6 additions & 7 deletions src/acc/opencl/smm/tune_multiply.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,13 @@ def run(self, desired_result, input, limit):
cfgenv + ["CHECK={}".format(self.args.check)], verbose=self.args.verbose
)
self.run_result = self.call_program(runcmd)
returncode = self.run_result["returncode"]
if 0 == returncode:
result = self.run_result["returncode"]
if 0 == result:
performance = re.search(
"device:\\s+([0-9]+[^ ]*) ms\\s+([0-9]+[^ ]*)",
str(self.run_result["stdout"]),
)
else:
if not returncode:
returncode = "?"
performance = None
if performance and performance.group(1) and performance.group(2):
mseconds = float(performance.group(1))
Expand All @@ -325,7 +323,7 @@ def run(self, desired_result, input, limit):
else runcmd
)
mnk = "x".join(map(str, self.mnk))
print("FAILED[{}] {}: {}".format(returncode, mnk, failed), flush=True)
print("FAILED[{}] {}: {}".format(result, mnk, failed), flush=True)
return Result(time=float("inf"), accuracy=0.0, size=100.0)

def update_jsons(self, filenames):
Expand Down Expand Up @@ -504,8 +502,8 @@ def save_final_config(self, configuration, final=True):
return # nothing to save
config = configuration.data if configuration else None
cfgenv = self.environment(config) if config else None
result = self.run_result["returncode"] if config and self.run_result else 1
envchk = os.getenv("CHECK") # conside CHECKing result unless CHECK=0
result = self.run_result["returncode"] if config and self.run_result else 1
if 0 == result and 0 == self.args.check and (envchk is None or "0" != envchk):
self.run_result = self.call_program(self.launch(cfgenv + ["CHECK=1"]))
result = self.run_result["returncode"] if self.run_result else 1
Expand Down Expand Up @@ -555,7 +553,8 @@ def save_final_config(self, configuration, final=True):
# check return code (consider not saving parameters)
if 0 != result and not final: # incorrect result
failed = " ".join(map(str, cfgenv)).replace("OPENCL_LIBSMM_SMM_", "")
print("FAILED: {}".format(failed))
mnk = "x".join(map(str, self.mnk))
print("FAILED[{}] {}: {}".format(result, mnk, failed), flush=True)
return
if final and os.path.exists(filedot):
filepattern = "{}-*.json".format(default_basename)
Expand Down
Loading