-
Notifications
You must be signed in to change notification settings - Fork 9
Add Option to Turn Off _fill_perfdata #168
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
Changes from all commits
e69ada1
89a8a15
3e87b2e
af09ae9
e66ba50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -203,7 +203,11 @@ def thicketize_graphframe(gf, prf): | |
|
|
||
| @staticmethod | ||
| def from_caliper( | ||
| filename_or_stream, query=None, intersection=False, disable_tqdm=False | ||
| filename_or_stream, | ||
| query=None, | ||
| intersection=False, | ||
| fill_perfdata=True, | ||
| disable_tqdm=False, | ||
| ): | ||
| """Read in a Caliper .cali or .json file. | ||
|
|
||
|
|
@@ -212,48 +216,62 @@ def from_caliper( | |
| `.cali` or JSON-split format, or an open file object to read one | ||
| query (str): cali-query in CalQL format | ||
| intersection (bool): whether to perform intersection or union (default) | ||
| fill_perfdata (bool): whether to fill missing performance data with NaNs | ||
| disable_tqdm (bool): whether to display tqdm progress bar | ||
| """ | ||
| return Thicket.reader_dispatch( | ||
| GraphFrame.from_caliper, | ||
| intersection, | ||
| fill_perfdata, | ||
| disable_tqdm, | ||
| filename_or_stream, | ||
| query, | ||
| ) | ||
|
|
||
| @staticmethod | ||
| def from_hpctoolkit(dirname, intersection=False, disable_tqdm=False): | ||
| def from_hpctoolkit( | ||
| dirname, intersection=False, fill_perfdata=True, disable_tqdm=False | ||
| ): | ||
| """Create a GraphFrame using hatchet's HPCToolkit reader and use its attributes | ||
| to make a new thicket. | ||
|
|
||
| Arguments: | ||
| dirname (str): parent directory of an HPCToolkit experiment.xml file | ||
| intersection (bool): whether to perform intersection or union (default) | ||
| fill_perfdata (bool): whether to fill missing performance data with NaNs | ||
| disable_tqdm (bool): whether to display tqdm progress bar | ||
|
|
||
| Returns: | ||
| (thicket): new thicket containing HPCToolkit profile data | ||
| """ | ||
| return Thicket.reader_dispatch( | ||
| GraphFrame.from_hpctoolkit, intersection, disable_tqdm, dirname | ||
| GraphFrame.from_hpctoolkit, | ||
| intersection, | ||
| fill_perfdata, | ||
| disable_tqdm, | ||
| dirname, | ||
| ) | ||
|
|
||
| @staticmethod | ||
| def from_caliperreader( | ||
| filename_or_caliperreader, intersection=False, disable_tqdm=False | ||
| filename_or_caliperreader, | ||
| intersection=False, | ||
| fill_perfdata=True, | ||
| disable_tqdm=False, | ||
| ): | ||
| """Helper function to read one caliper file. | ||
|
|
||
| Arguments: | ||
| filename_or_caliperreader (str or CaliperReader): name of a Caliper output | ||
| file in `.cali` format, or a CaliperReader object | ||
| intersection (bool): whether to perform intersection or union (default) | ||
| fill_perfdata (bool): whether to fill missing performance data with NaNs | ||
| disable_tqdm (bool): whether to display tqdm progress bar | ||
| """ | ||
| return Thicket.reader_dispatch( | ||
| GraphFrame.from_caliperreader, | ||
| intersection, | ||
| fill_perfdata, | ||
| disable_tqdm, | ||
| filename_or_caliperreader, | ||
| ) | ||
|
|
@@ -295,7 +313,9 @@ def from_literal(graph_dict): | |
| return tk | ||
|
|
||
| @staticmethod | ||
| def reader_dispatch(func, intersection, disable_tqdm, *args, **kwargs): | ||
| def reader_dispatch( | ||
| func, intersection, fill_perfdata, disable_tqdm, *args, **kwargs | ||
| ): | ||
| """Create a thicket from a list, directory of files, or a single file. | ||
|
|
||
| Arguments: | ||
|
|
@@ -353,6 +373,7 @@ def reader_dispatch(func, intersection, disable_tqdm, *args, **kwargs): | |
| thickets=ens_list, | ||
| axis="index", | ||
| calltree=calltree, | ||
| fill_perfdata=fill_perfdata, | ||
| disable_tqdm=disable_tqdm, | ||
| ) | ||
|
|
||
|
|
@@ -372,6 +393,7 @@ def concat_thickets( | |
| calltree (str): calltree to use -> "union" or "intersection" | ||
|
|
||
| Keyword Arguments: | ||
| fill_perfdata (bool): (if axis="index") Whether to fill missing performance data with NaNs | ||
| headers (list): (if axis="columns") List of headers to use for the new columnar multi-index | ||
| metadata_key (str): (if axis="columns") Name of the column from the metadata tables to replace the 'profile' | ||
| index. If no argument is provided, it is assumed that there is no profile-wise | ||
|
|
@@ -381,10 +403,16 @@ def concat_thickets( | |
| (thicket): concatenated thicket | ||
| """ | ||
|
|
||
| def _index(thickets, from_statsframes=False, disable_tqdm=disable_tqdm): | ||
| def _index( | ||
| thickets, | ||
| from_statsframes=False, | ||
| fill_perfdata=True, | ||
| disable_tqdm=disable_tqdm, | ||
| ): | ||
| thicket_parts = Ensemble._index( | ||
| thickets=thickets, | ||
| from_statsframes=from_statsframes, | ||
| fill_perfdata=fill_perfdata, | ||
| disable_tqdm=disable_tqdm, | ||
| ) | ||
|
|
||
|
|
@@ -1112,6 +1140,12 @@ def filter_metadata(self, select_function): | |
| else: | ||
| raise InvalidFilter("The argument passed to filter must be a callable.") | ||
|
|
||
| # If fill_perfdata is False, may need to squash | ||
| if len(new_thicket.graph) != len( | ||
| new_thicket.dataframe.index.get_level_values("node").unique() | ||
| ): | ||
| new_thicket = new_thicket.squash() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what this is trying to do. From what I can tell, this is trying to see if the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is detecting if
The purpose of this is that there is a case when the index is not full, and a filter is performed on the metadata that nodes disappear from the performance data, if the metadata for those profiles was filtered out. The code above will update the graph using squash if this happens.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, if I'm understanding right, what you're trying to do is 1) check if any nodes were removed from the performance data as a side effect of filtering profiles from the metadata and 2) fix the graph with
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If what I wrote above is correct, then this code will not do what you're wanting.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code (assuming the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It tells you if there are profiles in the performance dataframe that do not exist in The actual issue I noticed with this is that they will both always be in sync due to
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your code is not checking if there are profiles in the dataframe that don't exist in I actually just encountered this same type of thing in Befikir's sorted(tk.profile) == sorted(unique_perf_indices.tolist())This will check that both the dataframe and
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
But that is what I was trying to accomplish with that code. That would indicate that there are missing profiles in the performance data, which is what I was saying. However, it doesn't address
which your correct would be an issue, if not for
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For reference, if we are trying to update the state of the profiles in a Thicket we should be using
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you're 100% positive that you've ensured the graph and dataframe contain the same node objects, then this is fine. |
||
|
|
||
| return new_thicket | ||
|
|
||
| def filter(self, filter_func): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.