Skip to content

Commit

Permalink
Change et_replay test to a unit test (#118)
Browse files Browse the repository at this point in the history
Summary:

This DIFF is to change test_et_replay from a binary to a unit test, so when the dependent libraries change, the test will run automatically.

Reviewed By: briancoutinho

Differential Revision: D57590633
  • Loading branch information
shengfukevin authored and facebook-github-bot committed May 22, 2024
1 parent 49da106 commit 5e6a04d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions et_replay/tools/et_replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,9 @@ def preprocess_graph(self):
self.reset_registry()

def benchTime(self):
# A dictionary to save the benchmark result.
benchmark_result = {"execution finished": False}

start_time = datetime.now()
self.preprocess_graph()
if self.generator:
Expand Down Expand Up @@ -1368,6 +1371,7 @@ def benchTime(self):
# Comment out this for now since it will introduce additional cudaMalloc.
# self.reset_registry()
prof.step()
benchmark_result["execution finished"] = True
print("Execution finished!")
else:
for iter in range(self.numWarmupIters + self.numIters):
Expand Down Expand Up @@ -1403,6 +1407,7 @@ def benchTime(self):
if iter >= self.numWarmupIters:
total_time += event_1.elapsed_time(event_2)
# self.reset_registry()
benchmark_result["execution finished"] = True
print("Execution finished!")

if self.profile_memory:
Expand Down Expand Up @@ -1459,7 +1464,9 @@ def benchTime(self):
)
)

def readComputeArgs(self):
return benchmark_result

def readComputeArgs(self, check_args: bool = True):
parser = argparse.ArgumentParser(description="Execution Trace Compute Replay")
parser.add_argument(
"--warmup-iter", type=int, default=5, help="Number of warm up iterations."
Expand Down Expand Up @@ -1600,7 +1607,7 @@ def readComputeArgs(self):
self.args, _ = parser.parse_known_args()

# Check if both 'input' and 'trace_path' are not provided
if self.args.input is None and self.args.trace_path is None:
if check_args and self.args.input is None and self.args.trace_path is None:
parser.print_help(sys.stderr)
sys.exit(1)

Expand Down

0 comments on commit 5e6a04d

Please sign in to comment.