-
Notifications
You must be signed in to change notification settings - Fork 9
_match_messages #131
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
base: develop
Are you sure you want to change the base?
_match_messages #131
Changes from 1 commit
bb020d1
0840a8b
3e65096
2ee3f03
7c87624
098318e
8c20fb9
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 |
|---|---|---|
|
|
@@ -190,6 +190,78 @@ def _match_events(self): | |
|
|
||
| self.events = self.events.astype({"_matching_event": "Int32"}) | ||
|
|
||
| def _match_messages(self): | ||
| """ | ||
| Matches corresponding MpiSend/MpiRecv and MpiIsend/MpiIrecv instant events | ||
| """ | ||
| if "_matching_event" not in self.events.columns: | ||
| self.events["_matching_event"] = None | ||
|
|
||
| if "_matching_timestamp" not in self.events.columns: | ||
| self.events["_matching_timestamp"] = np.nan | ||
|
|
||
| matching_events = list(self.events["_matching_event"]) | ||
| matching_times = list(self.events["_matching_timestamp"]) | ||
|
|
||
|
movsesyanae marked this conversation as resolved.
Outdated
|
||
| mpi_events = self.events[ | ||
|
Contributor
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. Should rename to |
||
| self.events["Name"].isin(["MpiSend", "MpiRecv", "MpiIsend", "MpiIrecv"]) | ||
|
Contributor
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. Update to check if the event name is in |
||
| ] | ||
|
|
||
| queue = [[] for _ in range(len(self.events["Process"].unique()))] | ||
|
Contributor
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. Update queue to be a dict per process, and index the dict per receiver process with sender processes. Also comments should be added to explain this. |
||
|
|
||
| df_indices = list(mpi_events.index) | ||
| timestamps = list(mpi_events["Timestamp (ns)"]) | ||
| names = list(mpi_events["Name"]) | ||
| attrs = list(mpi_events["Attributes"]) | ||
| processes = list(mpi_events["Process"]) | ||
|
|
||
| # Iterate through all events | ||
| for i in range(len(mpi_events)): | ||
|
Contributor
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. Change to iterate over send events and receive events separately, so that if a process with a receive event is iterated over, we can confirm that the send event has already been seen and added to the queue. |
||
| curr_df_index = df_indices[i] | ||
| curr_timestamp = timestamps[i] | ||
| curr_name = names[i] | ||
| curr_attrs = attrs[i] | ||
| curr_process = processes[i] | ||
|
|
||
| if curr_name == "MpiSend" or curr_name == "MpiIsend": | ||
| # Add current dataframe index, timestmap, and process to stack | ||
| if "receiver" in curr_attrs: | ||
| queue[curr_attrs["receiver"]].append( | ||
|
Contributor
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. Update for new dict queue implementation. |
||
| (curr_df_index, curr_timestamp, curr_name, curr_process) | ||
| ) | ||
| elif curr_name == "MpiRecv" or curr_name == "MpiIrecv": | ||
| if "sender" in curr_attrs: | ||
| send_process = None | ||
| i = 0 | ||
|
|
||
| # we want to iterate through the queue in order | ||
| # until we find the corresponding "send" event | ||
| while send_process != curr_attrs["sender"] and i < len( | ||
|
Contributor
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. Update for new dict queue implementation. |
||
| queue[curr_process] | ||
| ): | ||
| send_df_index, send_timestamp, send_name, send_process = queue[ | ||
| curr_process | ||
| ][i] | ||
| i += 1 | ||
|
|
||
| if send_process == curr_attrs["sender"] and i <= len( | ||
| queue[curr_process] | ||
| ): | ||
| # remove matched event from queue | ||
| del queue[curr_process][i - 1] | ||
|
|
||
| # Fill in the lists with the matching values if event found | ||
| matching_events[send_df_index] = curr_df_index | ||
| matching_events[curr_df_index] = send_df_index | ||
|
|
||
| matching_times[send_df_index] = curr_timestamp | ||
| matching_times[curr_df_index] = send_timestamp | ||
|
|
||
| self.events["_matching_event"] = matching_events | ||
| self.events["_matching_timestamp"] = matching_times | ||
|
|
||
| self.events = self.events.astype({"_matching_event": "Int32"}) | ||
|
|
||
| def _match_caller_callee(self): | ||
| """Matches callers (parents) to callees (children) and adds three | ||
| columns to the dataframe: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.