-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b020433
commit 4f58872
Showing
14 changed files
with
134 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,26 +2,41 @@ name: Python Tests | |
|
||
on: | ||
push: | ||
# branches: [main] | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
tests: | ||
runs-on: [self-hosted, Linux, X64, gpu] | ||
container: | ||
image: nvidia/cuda:11.8.0-base-ubuntu20.04 | ||
image: nvidia/cuda:11.8.0-devel-ubuntu20.04 | ||
options: --gpus all | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.8" | ||
- name: Install dependencies | ||
- name: Setup cmake | ||
uses: jwlawson/[email protected] | ||
with: | ||
cmake-version: '3.19.x' | ||
- name: Setup ccache | ||
run: | | ||
apt update && apt install -y ccache | ||
- name: Build hidet | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Run pytest | ||
pip install -r requirements-dev.txt | ||
bash scripts/build_wheel.sh | ||
WHEEL=$(find ./scripts/ -maxdepth 1 -name '*.whl') | ||
echo "Built wheel: $WHEEL" | ||
pip install --no-deps --force-reinstall $WHEEL | ||
- name: Run minimal tests | ||
run: | | ||
python -m pytest -v tests/minimal/test_add.py | ||
- name: Run full tests | ||
run: | | ||
# stop the build if format is not correct | ||
python -m pytest -v ./tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
recursive-include python/hidet/lib *.so | ||
recursive-include python/hidet/include *.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
from . import hidet_models | ||
from . import torch_models | ||
from . import onnx_models | ||
|
||
from . import utils | ||
|
||
from .utils import benchmark_func, check_unary, check_binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# python test | ||
pytest | ||
|
||
# for models to test | ||
torchvision | ||
transformers | ||
|
||
# check the correctness with onnxruntime | ||
onnxruntime-gpu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import pytest | ||
import numpy as np | ||
import hidet | ||
|
||
|
||
def test_add(): | ||
a = hidet.randn([10], device='cuda') | ||
b = hidet.randn([10], device='cuda') | ||
c = a + b | ||
c_np = a.numpy() + b.numpy() | ||
np.testing.assert_allclose(actual=c.numpy(), desired=c_np, atol=1e-5, rtol=1e-5) | ||
|
||
|
||
if __name__ == '__main__': | ||
pytest.main([__file__]) |