mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/57925 1. adds test_scripts.py that will run added scripts and verify that there are no errors 2. adds local ddp_nccl_allreduce experiment script test with command `pytest test_scripts.py` Test Plan: Imported from OSS Reviewed By: agolynski Differential Revision: D28382452 Pulled By: gcramer23 fbshipit-source-id: 21028a990ebfedf1aad6b007a723c02403e8bea8
23 lines
525 B
Python
23 lines
525 B
Python
import subprocess
|
|
from os.path import join
|
|
from pathlib import Path
|
|
|
|
script_dir = join(
|
|
Path(__file__).parent, "experiment_scripts"
|
|
)
|
|
encoding = 'utf-8'
|
|
|
|
|
|
def run_script(script_name):
|
|
# runs the script and asserts that there are no errors
|
|
p = subprocess.run(
|
|
["bash", f"{join(script_dir,script_name)}"],
|
|
stdout=subprocess.PIPE,
|
|
stderr=subprocess.PIPE
|
|
)
|
|
error = p.stderr.decode(encoding)
|
|
assert not error
|
|
|
|
|
|
def test_ddp_nccl_allreduce():
|
|
run_script("ddp_nccl_allreduce.sh")
|