Skip to content
Snippets Groups Projects
Commit 4ca0734a authored by Kaushik Kulkarni's avatar Kaushik Kulkarni
Browse files

PytatoPyOpenCLArrayContext: do not implement transform_loopy_program

parent 879f3f95
No related branches found
No related tags found
No related merge requests found
...@@ -134,18 +134,9 @@ class PytatoPyOpenCLArrayContext(ArrayContext): ...@@ -134,18 +134,9 @@ class PytatoPyOpenCLArrayContext(ArrayContext):
return LazilyCompilingFunctionCaller(self, f) return LazilyCompilingFunctionCaller(self, f)
def transform_loopy_program(self, t_unit): def transform_loopy_program(self, t_unit):
from warnings import warn raise ValueError("PytatoPyOpenCLArrayContext does not implement "
warn( "transform_loopy_program. Sub-classes are supposed "
"Using arraycontext.PytatoPyOpenCLArrayContext.transform_loopy_program " "to implement it.")
"to transform a program. This is deprecated and will stop working "
"in 2022. Instead, subclass PytatoPyOpenCLArrayContext and implement "
"the specific logic required to transform the program for your "
"package or application. Check higher-level packages "
"(e.g. meshmode), which may already have subclasses you may want "
"to build on.",
DeprecationWarning, stacklevel=2)
return t_unit
def tag(self, tags: Union[Sequence[Tag], Tag], array): def tag(self, tags: Union[Sequence[Tag], Tag], array):
return array.tagged(tags) return array.tagged(tags)
......
...@@ -33,6 +33,7 @@ from arraycontext import ( ...@@ -33,6 +33,7 @@ from arraycontext import (
freeze, thaw, freeze, thaw,
FirstAxisIsElementsTag, FirstAxisIsElementsTag,
PyOpenCLArrayContext, PyOpenCLArrayContext,
PytatoPyOpenCLArrayContext,
ArrayContainer,) ArrayContainer,)
from arraycontext import ( # noqa: F401 from arraycontext import ( # noqa: F401
pytest_generate_tests_for_array_contexts, pytest_generate_tests_for_array_contexts,
...@@ -56,6 +57,16 @@ class _PyOpenCLArrayContextForTests(PyOpenCLArrayContext): ...@@ -56,6 +57,16 @@ class _PyOpenCLArrayContextForTests(PyOpenCLArrayContext):
return t_unit return t_unit
class _PytatoPyOpenCLArrayContextForTests(PytatoPyOpenCLArrayContext):
"""Like :class:`PytatoPyOpenCLArrayContext`, but applies no program
transformations whatsoever. Only to be used for testing internal to
:mod:`arraycontext`.
"""
def transform_loopy_program(self, t_unit):
return t_unit
class _PyOpenCLArrayContextWithHostScalarsForTestsFactory( class _PyOpenCLArrayContextWithHostScalarsForTestsFactory(
_PytestPyOpenCLArrayContextFactoryWithClass): _PytestPyOpenCLArrayContextFactoryWithClass):
actx_class = _PyOpenCLArrayContextForTests actx_class = _PyOpenCLArrayContextForTests
...@@ -68,12 +79,7 @@ class _PyOpenCLArrayContextForTestsFactory( ...@@ -68,12 +79,7 @@ class _PyOpenCLArrayContextForTestsFactory(
class _PytatoPyOpenCLArrayContextForTestsFactory( class _PytatoPyOpenCLArrayContextForTestsFactory(
_PytestPytatoPyOpenCLArrayContextFactory): _PytestPytatoPyOpenCLArrayContextFactory):
"""Like :class:`PytatoPyOpenCLArrayContext`, but applies no program transformations actx_class = _PytatoPyOpenCLArrayContextForTests
whatsoever. Only to be used for testing internal to :mod:`arraycontext`.
"""
def transform_loopy_program(self, t_unit):
return t_unit
pytest_generate_tests = pytest_generate_tests_for_array_contexts([ pytest_generate_tests = pytest_generate_tests_for_array_contexts([
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment