Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generated tests to CI #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion .github/workflows/ci_build_test_cpp_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: "Setting up Python"
uses: actions/setup-python@75f3110429a8c05be0e1bf360334e4cced2b63fa # v2.3.3
with:
python-version: "3.11"
python-version: "3.10"

- name: Sync source deps
run: |
Expand Down Expand Up @@ -59,3 +59,7 @@ jobs:
# Some things put stuff in cache with weird, root read-only
# permissions. Take them back.
sudo chown -R "$(whoami)" "${cache_dir}"

- name: Run generated tests
run: |
bash build_tools/ci/run_paritybench_test.sh
21 changes: 21 additions & 0 deletions build_tools/ci/run_paritybench_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

git clone https://github.com/jansel/pytorch-jit-paritybench.git

cd pytorch-jit-paritybench

git checkout 7e55a422588c1d1e00f35a3d3a3ff896cce59e18
pip install -r requirements.txt
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install expecttest

cd ..

pip install ./compiler
pip install ./runtime
pip install . --no-deps
source build/iree/.env

python python/test/generated/main.py --tests-dir ./pytorch-jit-paritybench --limit 100 -j 4 --no-log


11 changes: 10 additions & 1 deletion python/test/generated/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import logging

log = logging.getLogger("turbine-test")
logging.basicConfig(level=logging.INFO)

ENV_FILE = "JITPARITYBENCH_PATH.txt"

Expand Down Expand Up @@ -41,6 +40,11 @@ def get_args(raw_args=None):
help="jit-paritybench location (i.e. /path/to/pytorch-jit-paritybench)",
)
# parser.add_argument("--device", default="cuda", type=str, help="evaluate modules using cuda or cpu") # excluded for now as we only have turbine-cpu, can use this later
parser.add_argument(
"--no-log",
action='store_true',
help="disable logging during execution",
)

args = parser.parse_args(raw_args)
return args
Expand All @@ -60,6 +64,11 @@ def read_path() -> str:
if __name__ == "__main__":
args = get_args()

if args.no_log:
logging.basicConfig(level=logging.ERROR)
else:
logging.basicConfig(level=logging.INFO)

if args.tests_dir is not None:
pb = args.tests_dir
write_path(pb) # store this path for next time
Expand Down