Skip to content

Commit 3d51db6

Browse files
committed
Support NVIDIA OpenMP GPU trace output
1 parent ce81e95 commit 3d51db6

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

toolchain/mfc/run/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __profiler_prepend() -> typing.List[str]:
6464
def __runner_prepend() -> typing.List[str]:
6565
profiler = __profiler_prepend()
6666

67-
if __runtime_trace_requested() and ARG("gpu") == gpuConfigOptions.ACC.value:
67+
if __runtime_trace_requested() and ARG("gpu") in (gpuConfigOptions.ACC.value, gpuConfigOptions.MP.value):
6868
return ["python3", os.path.join(MFC_ROOT_DIR, "toolchain", "mfc", "run", "trace.py")] + profiler
6969

7070
return profiler
@@ -130,8 +130,8 @@ def __generate_job_script(targets, case: input.MFCInputFile):
130130
"MFC_TRACE_STDOUT": "1" if sys.stdout.isatty() else "0",
131131
}
132132
)
133-
if gpu_acc:
134-
env.update({"MFC_TRACE_ACC_NOTIFY": "1", "NV_ACC_NOTIFY": "1"})
133+
if gpu_acc or gpu_mp:
134+
env.update({"MFC_TRACE_GPU_NOTIFY": "1", "NVCOMPILER_ACC_NOTIFY": "1", "NV_ACC_NOTIFY": "1"})
135135
if ARG("mpi"):
136136
env.update({"MFC_TRACE_MPI": "1"})
137137

toolchain/mfc/run/trace.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ def main() -> int:
3838
if any(arg.endswith("/syscheck") for arg in command):
3939
env = os.environ.copy()
4040
env["MFC_TRACE"] = "0"
41+
env.pop("MFC_TRACE_GPU_NOTIFY", None)
4142
env.pop("MFC_TRACE_ACC_NOTIFY", None)
43+
env["NVCOMPILER_ACC_NOTIFY"] = "0"
4244
env["NV_ACC_NOTIFY"] = "0"
4345
return subprocess.run(command, env=env, check=False).returncode
4446

4547
trace_file = os.environ.get("MFC_TRACE_FILE")
46-
if not os.environ.get("MFC_TRACE_ACC_NOTIFY") or not trace_file:
48+
if not (os.environ.get("MFC_TRACE_GPU_NOTIFY") or os.environ.get("MFC_TRACE_ACC_NOTIFY")) or not trace_file:
4749
return subprocess.run(command, check=False).returncode
4850

4951
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)

0 commit comments

Comments
 (0)