Test split (#231)

* Split tests

Split tests into "Test CPU" and "Test GPU".

Add test flag "TEST_DEVICES" which is a comma separated list of devices:
CPU,GPU,ANE

* Run tests based on provided TEST_DEVICES flag

By default will run all "CPU,GPU,ANE"

* fix bad quote

* Revert changes and use GPU=1

This is done through setting the default Tensor Device to Device.CPU of
GPU=1 is set.

Run GPU tests: GPU=1 pytest -s -v
This commit is contained in:
Liam
2021-01-01 15:19:03 +01:00
committed by GitHub
parent 4a7cf2e420
commit ebd72ff437
10 changed files with 137 additions and 213 deletions

View File

@@ -15,24 +15,6 @@ jobs:
- name: Check <1000 lines
run: sloccount tinygrad test examples; if [ $(sloccount tinygrad | sed -n 's/.*Total Physical Source Lines of Code (SLOC)[ ]*= \([^ ]*\).*/\1/p' | tr -d ',') -gt 1000 ]; then exit 1; fi
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install OpenCL
run: sudo apt-get install pocl-opencl-icd
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Dependencies
run: pip install -e '.[gpu,testing]'
- name: Run Pytest
run: python -m pytest -s -v
linter:
name: Indentation Linter
runs-on: ubuntu-latest
@@ -53,3 +35,41 @@ jobs:
run: |
python -m pylint --disable=all -e W0311 --jobs=0 --indent-string=' ' **/*.py
testcpu:
name: CPU Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install OpenCL
run: sudo apt-get install pocl-opencl-icd
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Dependencies
run: pip install -e '.[testing]'
- name: Run Pytest
run: python -m pytest -s -v
testgpu:
name: GPU Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install OpenCL
run: sudo apt-get install pocl-opencl-icd
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Dependencies
run: pip install -e '.[gpu,testing]'
- name: Run Pytest
run: GPU=1 python -m pytest -s -v