Skip to content

Commit

Permalink
add generated test script
Browse files Browse the repository at this point in the history
  • Loading branch information
123epsilon committed Aug 18, 2023
1 parent 8fcbac1 commit b790f46
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
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

0 comments on commit b790f46

Please sign in to comment.