Skip to content

Fix/single out 906 unit test #536

Fix/single out 906 unit test

Fix/single out 906 unit test #536

Workflow file for this run

name: Run tests
on:
pull_request:
push: { branches: main }
jobs:
run-test-suite:
name: Run test suite
runs-on: ubuntu-latest
container: jjerphan/numba_dpex_dev:latest
# TODO: setup runners with a compatible gpu and activate this option:
# options: --device=/dev/dri # enable gpu passthrough
steps:
- name: Checkout code
uses: actions/checkout@v3
# Use a pinned commit from the `feature/engine-api` branch at
# https://github.com/scikit-learn/scikit-learn.git to enable smooth
# synchronization with the development of this branch.
# Development tracker: https://github.com/scikit-learn/scikit-learn/pull/25535/
# TODO: Remove this step when the plugin API is officially released
- name: Install pytest, sklearn branch "feature/engine-api", and sklearn-numba-dpex
run: pip install pytest git+https://github.com/scikit-learn/scikit-learn.git@a897a34d7d989bf317de17f80948639c0fd5ecf1#egg=scikit-learn -e .
- name: Check device
run: python -c "import dpctl; dpctl.select_default_device().print_device_info()"
# HACK: We force the test `test_need_to_workaround_numba_dpex_906` to run
# in a separate process. Indeed, the test only requires action if it fails
# in all circumstances, but should be ignored as long as it fails only
# occasionally. With recent updates the test started to fail when ran
# along all the other tests, while still succeeding when singled out. See
# https://github.com/IntelPython/numba-dpex/issues/906 for more context
# on the issue.
- name: Run sklearn_numba_dpex tests
run: pytest -v sklearn_numba_dpex/-k "not test_need_to_workaround_numba_dpex_906"
- name: Run sklearn_numba_dpex tests
run: pytest -v sklearn_numba_dpex/-k test_need_to_workaround_numba_dpex_906
# TODO: run those tests in a separate pipeline
# NB: `sklearn_numba_dpex` engine set the estimators to output arrays of type
# `dpctl.tensor.usm_ndarray` and store fitted attributes with this same type.
# This behavior is not compatible with sklearn unit tests, that expects numpy
# arrays or at least arrays that would closely mimic the NumPy Python API. To
# keep compatibility with sklearn unit tests the engine must be set to a
# different behavior where its methods are wrapped in data conversion steps so
# that fitted attributes and outputs are numpy arrays. Currently this behavior is
# activated when the environment variable SKLEARN_NUMBA_DPEX_TESTING_MODE is set
# to 1.
- name: Run sklearn test suites with sklearn_numba_dpex engines
run: SKLEARN_RUN_FLOAT32_TESTS=1 SKLEARN_NUMBA_DPEX_TESTING_MODE=1 pytest -v --sklearn-engine-provider sklearn_numba_dpex --pyargs sklearn.cluster.tests.test_k_means