-
Notifications
You must be signed in to change notification settings - Fork 18
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
base: develop
Are you sure you want to change the base?
Conversation
…nd annotations all of Hatchet
9cd3fb6
to
856e382
Compare
d62c31c
to
3345880
Compare
There was a problem hiding this 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.{}") |
There was a problem hiding this comment.
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.{}") |
There was a problem hiding this comment.
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.{}") |
There was a problem hiding this comment.
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.
hatchet/util/perf_measure.py
Outdated
return "caliper" | ||
elif plugin_name.lower() == "perfflowaspect" and _PYCALIPER_AVAILABLE: | ||
return "perfflowaspect" | ||
return "none" |
There was a problem hiding this comment.
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).
hatchet/util/perf_measure.py
Outdated
print("Caliper is available?", _PYCALIPER_AVAILABLE) | ||
if plugin_name.lower() == "caliper" and _PYCALIPER_AVAILABLE: | ||
return "caliper" | ||
elif plugin_name.lower() == "perfflowaspect" and _PYCALIPER_AVAILABLE: |
There was a problem hiding this comment.
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
hatchet/util/perf_measure.py
Outdated
|
||
def _validate_perf_plugin(plugin_name): | ||
print("Perf Plugin =", plugin_name) | ||
print("Caliper is available?", _PYCALIPER_AVAILABLE) |
There was a problem hiding this comment.
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)
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 forHATCHET_PERF_PLUGIN
are recognized:caliper
: use the Caliper Python bindings from Adds Python bindings to Caliper with pybind11 Caliper#573perfflowaspect
: use PerfFlow Aspectnone
: disable profiling APIs. This is what is used when the environment variable is not setThese values for
HATCHET_PERF_PLUGIN
are case-insensitive.