Skip to content
Open
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
2 changes: 2 additions & 0 deletions projects/rocprofiler-compute/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Full documentation for ROCm Compute Profiler is available at [https://rocm.docs.

### Changed

* Split Python version requirements by mode. Profile mode now runs on Python 3.8+ (standard library only). Analyze mode requires Python 3.9+ and exits with a clear message on older interpreters instead of failing with an import error.

* Renamed the `Pct of Peak` / `PoP` analysis column to `Percent of Peak` in analysis output.

* Moved `--gui` and `--tui` analyze options to experimental status. These features now require the `--experimental` flag to be enabled (e.g., `rocprof-compute analyze --experimental --gui`).
Expand Down
6 changes: 6 additions & 0 deletions projects/rocprofiler-compute/docs/how-to/analyze/mode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ profiling. Your level of familiarity with the profiled application, computing
environment, and experience with ROCm Compute Profiler should inform the analysis method you
choose.

.. note::

Analyze mode requires Python 3.9 or newer; its dependencies (numpy, pandas,
dash, textual) drop support for older versions. Profile mode runs on Python
3.8+. See the Python version support table in :doc:`/install/quickstart`.

.. note::

Analyze mode merges separate counter collection files (pmc_perf_*.csv or results_*.csv) into a unified pmc_perf.csv for analysis.
Expand Down
18 changes: 17 additions & 1 deletion projects/rocprofiler-compute/docs/install/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,23 @@ Ensure ROCm is installed and follow the steps:

.. code-block:: shell-session

python3 --version # Requires Python 3.8+
python3 --version

The required Python version depends on which mode you use:

.. list-table:: Python version support
:header-rows: 1
:widths: 40 60

* - Component
- Python requirement
* - Profile mode (standard library only)
- 3.8 or newer
* - Analyze mode (numpy, pandas, dash, textual)
- 3.9 or newer

Analyze mode aborts with a clear message if launched on Python older
than 3.9.
Comment on lines +81 to +82

3. Check the installation dependencies.

Expand Down
4 changes: 3 additions & 1 deletion projects/rocprofiler-compute/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[project]
name = "rocprof_compute"
requires-python = ">=3.9"
# Baseline floor for the project (profile mode). Analyze mode requires >=3.9,
# enforced at runtime in src/rocprof-compute.
requires-python = ">=3.8"

[tool.ruff]
line-length = 88
Expand Down
1 change: 1 addition & 0 deletions projects/rocprofiler-compute/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Analyze mode only. These dependencies require Python >=3.9.
astunparse==1.6.2
dash-bootstrap-components==2.0.4
dash-svg==0.0.12
Expand Down
56 changes: 37 additions & 19 deletions projects/rocprofiler-compute/src/rocprof-compute
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,32 @@ def check_version(local_ver: str, desired_ver: str, operator: str) -> bool:


def check_python_version() -> None:
"""Check that Python version meets minimum requirement for rocprofiler-compute.
"""Check the baseline Python version required to launch rocprofiler-compute.

Both profile and analyze modes require Python 3.8+.
Profile mode runs on Python 3.8+ (standard library only). Analyze mode has a
higher floor enforced separately in check_analyze_python_version().
"""
min_python = (3, 8)
# Check which version of python is being used
if sys.version_info < min_python: # noqa: UP036
print(
f"[ERROR] Python {min_python[0]}.{min_python[1]} or higher "
f"is required for rocprofiler-compute. "
f"The current version is "
console_error(
f"Python {min_python[0]}.{min_python[1]} or higher "
"is required for rocprofiler-compute. "
"The current version is "
f"{sys.version_info[0]}.{sys.version_info[1]}."
)
sys.exit(1)


def check_analyze_python_version() -> None:
"""Enforce the analyze-mode Python floor (its dependencies require 3.9+)."""
min_python = (3, 9)
if sys.version_info < min_python:
console_error(
f"analyze mode requires Python {min_python[0]}.{min_python[1]} "
"or higher. The current version is "
f"{sys.version_info[0]}.{sys.version_info[1]}. "
"Profile mode supports Python 3.8+."
)


def verify_deps() -> None:
Expand All @@ -94,6 +106,9 @@ def verify_deps() -> None:
version_pattern = re.compile(r"^([^=<>]+)([=<>]+)(.*)$")

for dependency in dependencies:
dependency = dependency.strip()
if not dependency or dependency.startswith("#"):
continue
match = version_pattern.match(dependency)
if match:
package, operator, desired_version = match.groups()
Expand All @@ -104,38 +119,40 @@ def verify_deps() -> None:
local_version = metadata.distribution(package).version
except metadata.PackageNotFoundError:
error = True
print(
f"[ERROR] The '{dependency}' package was not found "
"in the current execution environment."
console_error(
f"The '{dependency}' package was not found "
"in the current execution environment.",
exit=False,
)
continue

# Check version requirement
if desired_version and not check_version(
local_version, desired_version, operator
):
print(
f"[ERROR] the '{dependency}' distribution does not meet "
console_error(
f"the '{dependency}' distribution does not meet "
"version requirements to use rocprofiler-compute."
f"\n --> version installed : {local_version}",
exit=False,
)
print(f" --> version installed : {local_version}")
error = True

if error:
print(
console_error(
"\nPlease verify all of the python dependencies called out "
"in the requirements file"
"\nare installed locally prior to running "
"rocprofiler-compute."
f"\n\nSee: {check_file}"
)
print("are installed locally prior to running rocprofiler-compute.")
print(f"\nSee: {check_file}")
sys.exit(1)
return


def main() -> None:
"""Main function for rocprofiler-compute"""

# Check Python version requirement applies to both profile and analyze modes
# Baseline Python floor for any mode (profile is 3.8+); analyze adds its own
check_python_version()

rocprof_compute = RocProfCompute()
Expand All @@ -145,7 +162,8 @@ def main() -> None:
if mode == "profile":
rocprof_compute.run_profiler()
elif mode == "analyze":
# Analyze mode requires external dependencies - verify them
# Analyze mode needs a higher Python floor and external dependencies
check_analyze_python_version()
verify_deps()
rocprof_compute.run_analysis()
else:
Expand Down
Loading