Skip to content

Commit

Permalink
Make command run in subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
janeyx99 committed Jun 27, 2023
1 parent 87c3eb3 commit 663c9ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/userbenchmark-regression-detector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
if [ -d .userbenchmark ]; then rm -Rf .userbenchmark; fi
# TODO: scale this to run other benchmarks, but let's start with optim
python -m userbenchmark.optim.run -m BERT_pytorch -d cuda -o AdamW --df no_foreach -f pt2_
python -m userbenchmark.optim.run_optim_benchmarks -c ${{ github.event.inputs.userbenchmark_options }}
cp -r ./.userbenchmark/optim ../benchmark-output
- name: Detect potential regressions
continue-on-error: true
Expand Down
8 changes: 8 additions & 0 deletions userbenchmark/optim/run_optim_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ def main() -> None:
assert not OUTPUT_DIR.exists() or not any(OUTPUT_DIR.glob("*")), \
f'{OUTPUT_DIR} must be empty or nonexistent. Its contents will be wiped by this script.'

command = [sys.executable, '-m', 'userbenchmark.optim.run', '-m', 'BERT_pytorch', '-d', 'cuda', '-o', 'Adam', '--df', 'no_foreach', '-f', 'pt2_']
completed_process = subprocess.run(command, check=True)
# While it is certainly unexpected for a subprocess to fail, we don't want to halt entirely
# as there can be valuable benchmarks to gather from the other subprocesses.
if completed_process.returncode != 0:
print(f'OH NO, the subprocess for model {m} and device {d} exited with {completed_process.returncode}!')

return
# Run benchmarks in subprocesses to take isolate contexts and memory
for m, d in itertools.product(args.models, args.devices):
command = [sys.executable, '-m', 'userbenchmark.optim.run', '--continue-on-error',
Expand Down

0 comments on commit 663c9ce

Please sign in to comment.