Skip to content

Commit

Permalink
change argument names
Browse files Browse the repository at this point in the history
  • Loading branch information
bhatele committed Nov 14, 2023
1 parent 6c2528b commit ea66ae8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pipit/tests/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ def test_comm_matrix(data_dir, ping_pong_otf2_trace):
def test_comm_over_time(data_dir, ping_pong_otf2_trace):
ping_pong = Trace.from_otf2(str(ping_pong_otf2_trace))

hist, edges = ping_pong.comm_over_time(output="size", kind="send", bins=5)
hist, edges = ping_pong.comm_over_time(output="bytes", message_type="send", bins=5)

assert len(edges) == 6
assert all(hist[0:3] == 0)
assert hist[4] == 4177920 * 2

hist, edges = ping_pong.comm_over_time(output="counts", kind="receive", bins=5)
hist, edges = ping_pong.comm_over_time(output="count", message_type="receive", bins=5)

assert len(edges) == 6
assert all(hist[0:3] == 0)
Expand Down
26 changes: 15 additions & 11 deletions pipit/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,24 +440,27 @@ def message_histogram(self, bins=20, **kwargs):

return np.histogram(sizes, bins=bins, **kwargs)

def comm_over_time(self, output="size", kind="send", bins=50, **kwargs):
def comm_over_time(self, output="bytes", message_type="send", bins=50, **kwargs):
"""Returns histogram of communication volume over time.
Args:
output (str, optional). Whether to measure volume by "count" or "size".
Defaults to "size".
kind (str, optional): Whether to compute for "send" or "receive". Defaults
to "send".
bins (int, optional): Number of bins in the histogram. Defaults to 50.
output (str, optional). Whether to measure volume by "count" or
"bytes". Defaults to "bytes".
message_type (str, optional): Whether to compute for sends or
receives. Defaults to "send".
bins (int, optional): Number of bins in the histogram. Defaults to
50.
Returns:
hist: Volume in each time interval
hist: Volume in bytes or number of messages in each time interval
edges: Edges of time intervals
"""
# Filter by send or receive events
events = self.events[
self.events["Name"].isin(
["MpiSend", "MpiIsend"] if kind == "send" else ["MpiRecv", "MpiIrecv"]
["MpiSend", "MpiIsend"] if message_type == "send" else ["MpiRecv", "MpiIrecv"]
)
]

Expand All @@ -477,11 +480,12 @@ def comm_over_time(self, output="size", kind="send", bins=50, **kwargs):
)

def comm_by_process(self, output="size"):
"""Returns total communication volume per process.
"""Returns total communication volume in bytes of number of messagsper
process.
Returns:
pd.DataFrame: DataFrame containing total communication volume sent and
received in each process
pd.DataFrame: DataFrame containing total communication volume or
number of messags sent and received by each process.
"""
comm_matrix = self.comm_matrix(output=output)

Expand Down

0 comments on commit ea66ae8

Please sign in to comment.