From e78d0677ece3fb30a9b7f8ac36c46f488a742f8e Mon Sep 17 00:00:00 2001 From: Xu Zhao Date: Fri, 14 Jan 2022 17:27:31 -0500 Subject: [PATCH 1/2] Install the dependencies the first time run the benchmark. --- bisection.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bisection.py b/bisection.py index c26f048f29..3ee3db1350 100644 --- a/bisection.py +++ b/bisection.py @@ -273,6 +273,7 @@ class TorchBench: workdir: str devbig: str models: List[str] + first_time: bool torch_src: TorchSource def __init__(self, srcpath: str, @@ -287,6 +288,7 @@ def __init__(self, srcpath: str, self.workdir = workdir self.devbig = devbig self.branch = branch + self.first_time = True self.models = list() def prep(self) -> bool: @@ -298,7 +300,12 @@ def prep(self) -> bool: self.models = [ model for model in os.listdir(os.path.join(self.srcpath, "torchbenchmark", "models")) if os.path.isdir(os.path.join(self.srcpath, "torchbenchmark", "models", model)) ] return True - + + def _install_benchmark(self): + "Install and build TorchBench dependencies" + command = ["python", "install.py"] + subprocess.check_call(command, cwd=self.srcpath, shell=False) + def run_benchmark(self, commit: Commit, targets: List[str]) -> str: # Return the result json file path output_dir = os.path.join(self.workdir, commit.sha) @@ -311,6 +318,10 @@ def run_benchmark(self, commit: Commit, targets: List[str]) -> str: else: os.mkdir(output_dir) bmfilter = targets_to_bmfilter(targets, self.models) + # If the first time to run benchmark, install the dependencies first + if self.first_time: + self._install_benchmark() + self.first_time = False print(f"Running TorchBench for commit: {commit.sha}, filter {bmfilter} ...", end="", flush=True) if not self.devbig: command = f"""bash .github/scripts/run.sh "{output_dir}" "{bmfilter}" 2>&1 | tee {output_dir}/benchmark.log""" From 03b9417fd2394f99a09140dc185c74e1dd049f69 Mon Sep 17 00:00:00 2001 From: Xu Zhao Date: Fri, 14 Jan 2022 18:06:29 -0500 Subject: [PATCH 2/2] Remove pytorch nightly and dep install --- .github/workflows/v1-bisection.yml | 5 +---- .github/workflows/v2-bisection.yml | 10 ++++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/v1-bisection.yml b/.github/workflows/v1-bisection.yml index 52d8616d6b..c235cad53c 100644 --- a/.github/workflows/v1-bisection.yml +++ b/.github/workflows/v1-bisection.yml @@ -28,11 +28,8 @@ jobs: conda create -y -n "$BISECT_CONDA_ENV" python="${PYTHON_VERSION}" . activate "$BISECT_CONDA_ENV" conda install -y numpy requests=2.22 ninja pyyaml mkl mkl-include setuptools cmake cffi \ - typing_extensions future six dataclasses tabulate gitpython + typing_extensions future six dataclasses tabulate gitpython tqdm conda install -y -c pytorch "${MAGMA_VERSION}" - # Install pytorch nightly - conda install -y -c pytorch-nightly torchtext torchvision cudatoolkit="${CUDA_VERSION}" - python install.py - name: Bisection run: | export BISECT_ISSUE="${{ github.event.inputs.issue_name }}" diff --git a/.github/workflows/v2-bisection.yml b/.github/workflows/v2-bisection.yml index ce7443d793..b601970aad 100644 --- a/.github/workflows/v2-bisection.yml +++ b/.github/workflows/v2-bisection.yml @@ -27,16 +27,14 @@ jobs: run: | conda create -y -n "$BISECT_CONDA_ENV" python=${{ }} . activate "$BISECT_CONDA_ENV" - conda install -y numpy requests ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six dataclasses tabulate gitpython git-lfs + conda install -y numpy requests ninja pyyaml mkl mkl-include setuptools cmake cffi \ + typing_extensions future six dataclasses tabulate gitpython git-lfs tqdm # Install magma conda install -y -c pytorch "${MAGMA_VERSION}" - # Install pytorch nightly - conda install -y -c pytorch-nightly torchtext torchvision cudatoolkit="${CUDA_VER}" - python install.py - name: Bisection run: | - export BISECT_ISSUE="${{ github.event.inputs.issue_name }}" - export BISECT_BASE="${HOME}/${BISECT_DIR}/${BISECT_ISSUE}" + BISECT_ISSUE="${{ github.event.inputs.issue_name }}" + BISECT_BASE="${HOME}/${BISECT_DIR}/${BISECT_ISSUE}" bash ./.github/scripts/run-bisection.sh # Update the result json symbolic link ln -sf "${BISECT_BASE}/gh${GITHUB_RUN_ID}/result.json" "${BISECT_BASE}/result.json"