From b31c5f8fdc8a1a18f99a55d1520080b2fa9eb305 Mon Sep 17 00:00:00 2001 From: Keith Lowery Date: Thu, 15 Dec 2022 15:11:54 +0000 Subject: [PATCH] profile parameters are now contingent on whether rocscope is in the PATH Signed-off-by: coleramos425 [ROCm/rocprofiler-compute commit: 46013280163cf1c337a569d37e2b917cd8224fcf] --- projects/rocprofiler-compute/src/parser.py | 65 ++++++++++++---------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/projects/rocprofiler-compute/src/parser.py b/projects/rocprofiler-compute/src/parser.py index 86f5e0c216..7a2c8b53ff 100644 --- a/projects/rocprofiler-compute/src/parser.py +++ b/projects/rocprofiler-compute/src/parser.py @@ -22,6 +22,8 @@ import os import argparse +import subprocess + from common import ( OMNIPERF_HOME, PROG, @@ -116,35 +118,40 @@ def parse(my_parser): default=None, help="\t\t\tKernel filtering.", ) - profile_group.add_argument( - "-l", - "--i-feel-lucky", - required=False, - default=False, - action="store_true", - dest="lucky", - help="\t\t\tProfile only the most time consuming kernels.", - ) - - profile_group.add_argument( - "-r", - "--use-rocscope", - required=False, - default=False, - action="store_true", - dest="use_rocscope", - help="\t\t\tUse rocscope for profiling", - ) - - profile_group.add_argument( - "-s", - "--kernel-summaries", - required=False, - default=False, - action="store_true", - dest="summaries", - help="\t\t\tCreate kernel summaries.", - ) + + result = subprocess.run(["which", "rocscope"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + if result.returncode == 0: + profile_group.add_argument( + "-l", + "--i-feel-lucky", + required=False, + default=False, + action="store_true", + dest="lucky", + help="\t\t\tProfile only the most time consuming kernels.", + ) + profile_group.add_argument( + "-r", + "--use-rocscope", + required=False, + default=False, + action="store_true", + dest="use_rocscope", + help="\t\t\tUse rocscope for profiling", + ) + profile_group.add_argument( + "-s", + "--kernel-summaries", + required=False, + default=False, + action="store_true", + dest="summaries", + help="\t\t\tCreate kernel summaries.", + ) + else: + profile_group.add_argument("--i-feel-lucky", default=False, dest="lucky", help=argparse.SUPPRESS) + profile_group.add_argument("--use-rocscope", default=False, dest="use_rocscope", help=argparse.SUPPRESS) + profile_group.add_argument("--kernel-summaries", default=False, dest="summaries", help=argparse.SUPPRESS) profile_group.add_argument( "-b",