Skip to content

Commit

Permalink
rocprofv3: rocprofv3-avail tool (#15)
Browse files Browse the repository at this point in the history
* support avail tool

Updating avail library and script

Listing on Std output incase the output folder is not given

Extending list metrics test

misc fix

misc fix

fixing memory leak

changing list-metrics to list-avail

fixing formatting issue

Fixing CMakeLists

Add test for list avil with trace

Fix test fail

clang tidy errors fixed

Removing build commands for rocprofv3-trigger-list

Addressing review changes

addressing review comment

moving avail to libexec

merge fix

Fix test failures

updating doc

Fix doc error

* updating legacy doc

* fix formatting issue

* Addressing review comments
  • Loading branch information
SrirakshaNag authored Dec 5, 2024
1 parent 50b185b commit c42bdc3
Show file tree
Hide file tree
Showing 16 changed files with 933 additions and 257 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ Full documentation for ROCprofiler-SDK is available at [rocm.docs.amd.com/projec
- `Dispatch_Id`
- CSV column for counter collection


## ROCprofiler-SDK 0.5.0 for ROCm release 6.3 (AFAR VII)
### Additions
--List supported PC Sampling Configurations
### Changes

### Added

Expand Down
10 changes: 10 additions & 0 deletions source/bin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@ install(
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ
WORLD_EXECUTE
COMPONENT tools)

configure_file(rocprofv3_avail.py
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprofv3_avail COPYONLY)

install(
FILES ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/rocprofv3_avail
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ
WORLD_EXECUTE
COMPONENT tools)
26 changes: 18 additions & 8 deletions source/bin/rocprofv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ def add_parser_bool_argument(gparser, *args, **kwargs):
add_parser_bool_argument(
display_options,
"-L",
"--list-metrics",
help="List metrics for counter collection. Backed by a valid YAML file. In earlier rocprof versions, this was known as --list-basic, --list-derived and --list-counters",
"--list-avail",
help="List available PC sampling configurations and metrics for counter collection. Backed by a valid YAML file. In earlier rocprof versions, this was known as --list-basic, --list-derived and --list-counters",
)

advanced_options = parser.add_argument_group("Advanced options")
Expand Down Expand Up @@ -678,9 +678,14 @@ def _write_env_value():
ROCPROF_KOKKOSP_LIBRARY = (
f"{ROCM_DIR}/lib/rocprofiler-sdk/librocprofiler-sdk-tool-kokkosp.so"
)
ROCPROF_LIST_AVAIL_TOOL_LIBRARY = f"{ROCM_DIR}/libexec/librocprofv3-list-avail.so"

prepend_preload = [itr for itr in args.preload if itr]
append_preload = [ROCPROF_TOOL_LIBRARY, ROCPROF_SDK_LIBRARY]
append_preload = [
ROCPROF_TOOL_LIBRARY,
ROCPROF_LIST_AVAIL_TOOL_LIBRARY,
ROCPROF_SDK_LIBRARY,
]

update_env("LD_PRELOAD", ":".join(prepend_preload), prepend=True)
update_env("LD_PRELOAD", ":".join(append_preload), append=True)
Expand Down Expand Up @@ -709,7 +714,7 @@ def _write_env_value():
)

if args.output_file is not None or args.output_directory is not None:
update_env("ROCPROF_OUTPUT_LIST_METRICS_FILE", True)
update_env("ROCPROF_OUTPUT_LIST_AVAIL_FILE", True)

if not args.output_format:
args.output_format = ["csv"]
Expand Down Expand Up @@ -841,8 +846,8 @@ def _write_env_value():
overwrite_if_true=True,
)
update_env(
"ROCPROF_LIST_METRICS",
args.list_metrics,
"ROCPROF_LIST_AVAIL",
args.list_avail,
overwrite_if_true=True,
)

Expand Down Expand Up @@ -891,8 +896,13 @@ def log_config(_env):
sys.stderr.write("\n")
sys.stderr.flush()

if args.list_metrics:
app_args = [f"{ROCM_DIR}/libexec/rocprofv3-trigger-list-metrics"]
if args.list_avail:
update_env("ROCPROFILER_PC_SAMPLING_BETA_ENABLED", "on")
path = os.path.join(f"{ROCM_DIR}", "bin/rocprofv3_avail")
if app_args:
exit_code = subprocess.check_call(["python3", path], env=app_env)
else:
app_args = ["python3", path]

elif not app_args:
log_config(app_env)
Expand Down
Loading

0 comments on commit c42bdc3

Please sign in to comment.