Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/v1-bisection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/v2-bisection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 12 additions & 1 deletion bisection.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ class TorchBench:
workdir: str
devbig: str
models: List[str]
first_time: bool
torch_src: TorchSource

def __init__(self, srcpath: str,
Expand All @@ -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:
Expand All @@ -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)
Expand All @@ -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"""
Expand Down