diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2cb29ceb1fc4e7d02e3c8cd4812eeb8653a5725..4c1545e1b1011e0f35b3aa2316a9cdde464a4304 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,19 +51,39 @@ jobs: python -m pip install mypy ./run-mypy.sh - pytest3: - name: Pytest Conda Py3 + pytest3_pocl: + name: Pytest Conda Py3 POCL runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: "Main Script" run: | - export MPLBACKEND=Agg curl -L -O https://gitlab.tiker.net/inducer/ci-support/raw/main/ci-support.sh . ./ci-support.sh build_py_project_in_conda_env test_py_project + pytest3_intel_cl: + name: Pytest Conda Py3 Intel + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: "Main Script" + run: | + curl -L -O https://raw.githubusercontent.com/illinois-scicomp/machine-shop-maintenance/main/install-intel-icd.sh + sudo bash ./install-intel-icd.sh + + CONDA_ENVIRONMENT=.test-conda-env-py3.yml + echo "- ocl-icd-system" >> "$CONDA_ENVIRONMENT" + sed -i "/pocl/ d" "$CONDA_ENVIRONMENT" + export PYOPENCL_TEST=intel + source /opt/enable-intel-cl.sh + + curl -L -O https://tiker.net/ci-support-v0 + . ./ci-support-v0 + build_py_project_in_conda_env + test_py_project + examples3: name: Examples Conda Py3 runs-on: ubuntu-latest diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b60234eb7609ccc4ed242351cce88f14217b4ae..f1a2d7599883101411a291514eb326fea68e3870 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,8 +38,7 @@ Python 3 POCL Examples: - test -n "$SKIP_EXAMPLES" && exit - export PY_EXE=python3 - export PYOPENCL_TEST=portable:pthread - # cython is here because pytential (for now, for TS) depends on it - - export EXTRA_INSTALL="pybind11 cython numpy mako matplotlib" + - export EXTRA_INSTALL="pybind11 numpy mako" - curl -L -O https://gitlab.tiker.net/inducer/ci-support/raw/main/build-py-project-and-run-examples.sh - ". ./build-py-project-and-run-examples.sh" tags: @@ -51,7 +50,6 @@ Python 3 POCL Examples: Python 3 Conda: script: | - export MPLBACKEND=Agg curl -L -O https://gitlab.tiker.net/inducer/ci-support/raw/main/build-and-test-py-project-within-miniconda.sh . ./build-and-test-py-project-within-miniconda.sh tags: @@ -82,7 +80,7 @@ Flake8: Pylint: script: | export PY_EXE=python3 - EXTRA_INSTALL="Cython pybind11 numpy mako matplotlib scipy mpi4py oct2py" + EXTRA_INSTALL="pybind11 numpy mako" curl -L -O https://gitlab.tiker.net/inducer/ci-support/raw/master/prepare-and-run-pylint.sh . ./prepare-and-run-pylint.sh "$CI_PROJECT_NAME" examples/*.py test/test_*.py tags: diff --git a/arraycontext/pytest.py b/arraycontext/pytest.py index 9e938b4e57391fe56b73893d0456a14c52ce2b48..db5dcb054435d81e9e6456490070fdea6cec29b0 100644 --- a/arraycontext/pytest.py +++ b/arraycontext/pytest.py @@ -61,8 +61,10 @@ class PytestPyOpenCLArrayContextFactory: from gc import collect collect() + # On Intel CPU CL, existence of a command queue does not ensure that + # the context survives. ctx = cl.Context([self.device]) - return cl.CommandQueue(ctx) + return ctx, cl.CommandQueue(ctx) def __call__(self) -> ArrayContext: raise NotImplementedError @@ -73,8 +75,15 @@ class _PyOpenCLArrayContextFactory(PytestPyOpenCLArrayContextFactory): def __call__(self): from arraycontext import PyOpenCLArrayContext + + # The ostensibly pointless assignment to *ctx* keeps the CL context alive + # long enough to create the array context, which will then start + # holding a reference to the context to keep it alive in turn. + # On some implementations (notably Intel CPU), holding a reference + # to a queue does not keep the context alive. + ctx, queue = self.get_command_queue() return PyOpenCLArrayContext( - self.get_command_queue(), + queue, force_device_scalars=self.force_device_scalars) def __str__(self):