Skip to content

Commit 7b28054

Browse files
Igor Shilovfacebook-github-bot
authored andcommitted
Disable memory benchmarking (#589)
Summary: Our tests have been red for a while due to failing memory bechmarks. ## Issue When benchmarking opacus we run the training script multiple times within one process: ``` for i in range(args.num_runs): run_layer_benchmark( ... ) ``` We use built-in pytorch tools to check memory stats. Crucially, we verify that `torch.cuda.memory_allocated()` is 0 before the run starts. Normally, it should be 0, as all previous tensors are out of scope and should have been collected. It all worked fine until something changed and some GPU memory stayed allocated between runs. No idea why, but explicit cache clearing or object deletion didn't help. So I gave up and disabled memory benchmarking, since it seems like it's not a complicated thing to do due to some PyTorch update Pull Request resolved: #589 Reviewed By: JohnlNguyen Differential Revision: D45691684 Pulled By: karthikprasad fbshipit-source-id: 82006e503240532840d3fb6dc0314f2202780973
1 parent e8bc932 commit 7b28054

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

.circleci/config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ commands:
273273
python benchmarks/generate_report.py --path-to-results /tmp/report_layers --save-path benchmarks/results/report-${report_id}.pkl --format pkl
274274
275275
python benchmarks/check_threshold.py --report-path "./benchmarks/results/report-"$report_id".pkl" --metric runtime --threshold <<parameters.runtime_ratio_threshold>> --column <<parameters.report_column>>
276-
python benchmarks/check_threshold.py --report-path "./benchmarks/results/report-"$report_id".pkl" --metric memory --threshold <<parameters.memory_ratio_threshold>> --column <<parameters.report_column>>
277276
when: always
278277
- store_artifacts:
279278
path: benchmarks/results/

benchmarks/utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def generate_report(path_to_results: str, save_path: str, format: str) -> None:
230230
pivot = results.pivot_table(
231231
index=["batch_size", "num_runs", "num_repeats", "forward_only", "layer"],
232232
columns=["gsm_mode"],
233-
values=["runtime", "memory"],
233+
values=["runtime"],
234234
)
235235

236236
def add_ratio(df, metric, variant):
@@ -245,7 +245,6 @@ def add_ratio(df, metric, variant):
245245
if "baseline" in results["gsm_mode"].tolist():
246246
for m in set(results["gsm_mode"].tolist()) - {"baseline"}:
247247
add_ratio(pivot, "runtime", m)
248-
add_ratio(pivot, "memory", m)
249248
pivot.columns = pivot.columns.set_names("value", level=1)
250249

251250
output = pivot.sort_index(axis=1).sort_values(

0 commit comments

Comments
 (0)