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

Adds an annotation-based profiling API for measuring the performance of Hatchet and Thicket #142

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

ilumsden
Copy link
Collaborator

This PR adds APIs that can be used to measure Hatchet and Thicket's performance. By default, these APIs will do nothing. However, users can set the HATCHET_PERF_PLUGIN environment variable to enable these profiling APIs with a specified profiling tool. Currently, the following values for HATCHET_PERF_PLUGIN are recognized:

These values for HATCHET_PERF_PLUGIN are case-insensitive.

@ilumsden ilumsden added area-utils Issues and PRs related to Hatchets high-level API and other utility libraries priority-normal Normal priority issues and PRs status-ready-for-review This PR is ready to be reviewed by assigned reviewers type-feature Requests for new features or PRs which implement new features labels Jul 14, 2024
@ilumsden ilumsden self-assigned this Jul 14, 2024
@ilumsden ilumsden force-pushed the configurable_annotations branch from 9cd3fb6 to 856e382 Compare July 14, 2024 21:48
Copy link
Collaborator

@dyokelson dyokelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few changes requested but overall looks pretty good - my big picture concern is that going forward we will have to add the annotation decorator to every single function for any new functionality we add? Is there a way to automate it?



src_file = 0


_hpctk_reader_mod_annotate = annotate(fmt="hpctoolkit_reader.{}")
_hpctk_reader_annotate = annotate(fmt="HPCToolkitReader.{}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see the naming for fmt to be kind of confusing for someone seeing these two naming conventions - we are basically wanting to separate anything not in the class from the functionality within the class right? Is there a better way to name the regions to be more intuitive? Maybe mod could be fmt="hpctoolkit_external" or something to imply it's external to the class functionality, or it could be generically annotated like in node.py, graphframe.py, and string_dialect.py where you just annotate() the function outside the class.



_hpctk_reader_latest_mod_annotate = annotate(fmt="hpctoolkit_reader_latest.{}")
_hpctk_reader_latest_annotate = annotate(fmt="HPCToolkitReaderLatest.{}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment here as to the old hpctoolkit_reader.py - let's rename of of the annotation regions to more obviously separate the two.

@@ -19,6 +20,11 @@
ABC = ABCMeta("ABC", (object,), {"__slots__": ()})


_dataframe_writer_mod_annotate = annotate(fmt="dataframe_writer.{}")
_dataframe_writer_annotate = annotate(fmt="DataframeWriter.{}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment here as to hpctoolkit readers - let's rename the annotated region. I think just changing the case is kind of confusing to imply it is external to the class...another idea would be to add a qualifier like "module" or "class" to the annotation string possibly? Just an idea.

return "caliper"
elif plugin_name.lower() == "perfflowaspect" and _PYCALIPER_AVAILABLE:
return "perfflowaspect"
return "none"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it will fail silently - what if someone wants perfflowaspect and sets the env var but the library is not installed correctly? We should probably display a helpful error message in cases like that (somewhat like how you display caliper information in your prints maybe).

print("Caliper is available?", _PYCALIPER_AVAILABLE)
if plugin_name.lower() == "caliper" and _PYCALIPER_AVAILABLE:
return "caliper"
elif plugin_name.lower() == "perfflowaspect" and _PYCALIPER_AVAILABLE:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this line say and _PERFFLOWASPECT_AVAILABLE


def _validate_perf_plugin(plugin_name):
print("Perf Plugin =", plugin_name)
print("Caliper is available?", _PYCALIPER_AVAILABLE)
Copy link
Collaborator

@dyokelson dyokelson Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This print line could be moved inside the if-statement below, and a similar one could be used for perfflowaspect within it's if-statement to be more verbose (see comment for line 31)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-utils Issues and PRs related to Hatchets high-level API and other utility libraries priority-normal Normal priority issues and PRs status-ready-for-review This PR is ready to be reviewed by assigned reviewers type-feature Requests for new features or PRs which implement new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants