From 27c6688788637f7d5380db29c55346aa27cb632a Mon Sep 17 00:00:00 2001 From: Matthias Diener <mdiener@illinois.edu> Date: Fri, 18 Jun 2021 14:33:00 -0500 Subject: [PATCH] rename PytatoArrayContext to PytatoPyOpenCLArrayContext --- arraycontext/__init__.py | 4 ++-- arraycontext/impl/pytato.py | 18 +++++++++--------- arraycontext/pytest.py | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/arraycontext/__init__.py b/arraycontext/__init__.py index b367382..ac01321 100644 --- a/arraycontext/__init__.py +++ b/arraycontext/__init__.py @@ -51,7 +51,7 @@ from .container.traversal import ( from_numpy, to_numpy) from .impl.pyopencl import PyOpenCLArrayContext -from .impl.pytato import PytatoArrayContext +from .impl.pytato import PytatoPyOpenCLArrayContext from .pytest import (pytest_generate_tests_for_array_contexts, pytest_generate_tests_for_pyopencl_array_context) @@ -79,7 +79,7 @@ __all__ = ( "thaw", "freeze", "from_numpy", "to_numpy", - "PyOpenCLArrayContext", "PytatoArrayContext", + "PyOpenCLArrayContext", "PytatoPyOpenCLArrayContext", "make_loopy_program", diff --git a/arraycontext/impl/pytato.py b/arraycontext/impl/pytato.py index d406488..8e8cbbc 100644 --- a/arraycontext/impl/pytato.py +++ b/arraycontext/impl/pytato.py @@ -1,6 +1,6 @@ """ .. currentmodule:: arraycontext -.. autoclass:: PytatoArrayContext +.. autoclass:: PytatoPyOpenCLArrayContext """ __copyright__ = """ Copyright (C) 2020-1 University of Illinois Board of Trustees @@ -46,7 +46,7 @@ class _PytatoFakeNumpyLinalgNamespace(BaseFakeNumpyLinalgNamespace): class _PytatoFakeNumpyNamespace(BaseFakeNumpyNamespace): """ - A :mod:`numpy` mimic for :class:`PytatoArrayContext`. + A :mod:`numpy` mimic for :class:`PytatoPyOpenCLArrayContext`. .. note:: @@ -354,7 +354,7 @@ class PytatoExecutable: self.output_template) -class PytatoArrayContext(ArrayContext): +class PytatoPyOpenCLArrayContext(ArrayContext): """ A :class:`ArrayContext` that uses :mod:`pytato` data types to represent the DOF arrays targeting OpenCL for offloading operations. @@ -386,7 +386,7 @@ class PytatoArrayContext(ArrayContext): return type(self)(self.queue, self.allocator) def empty(self, shape, dtype): - raise ValueError("PytatoArrayContext does not support empty") + raise ValueError("PytatoPyOpenCLArrayContext does not support empty") def zeros(self, shape, dtype): import pytato as pt @@ -423,8 +423,8 @@ class PytatoArrayContext(ArrayContext): if isinstance(array, cla.Array): return array.with_queue(None) if not isinstance(array, pt.Array): - raise TypeError("PytatoArrayContext.freeze invoked with non-pytato " - f"array of type '{type(array)}'") + raise TypeError("PytatoPyOpenCLArrayContext.freeze invoked with " + f"non-pytato array of type '{type(array)}'") prg = pt.generate_loopy(array, cl_device=self.queue.device) evt, (cl_array,) = prg(self.queue) @@ -437,7 +437,7 @@ class PytatoArrayContext(ArrayContext): import pyopencl.array as cla if not isinstance(array, cla.Array): - raise TypeError("PytatoArrayContext.thaw expects CL arrays, got " + raise TypeError("PytatoPyOpenCLArrayContext.thaw expects CL arrays, got " f"{type(array)}") return pt.make_data_wrapper(array.with_queue(self.queue)) @@ -510,8 +510,8 @@ class PytatoArrayContext(ArrayContext): def einsum(self, spec, *args, arg_names=None, tagged=()): if arg_names is not None: from warnings import warn - warn("'arg_names' don't bear any significance in PytatoArrayContext.", - stacklevel=2) + warn("'arg_names' don't bear any significance in " + "PytatoPyOpenCLArrayContext.", stacklevel=2) import pytato as pt import pyopencl.array as cla diff --git a/arraycontext/pytest.py b/arraycontext/pytest.py index f2dedae..a9c06eb 100644 --- a/arraycontext/pytest.py +++ b/arraycontext/pytest.py @@ -32,7 +32,7 @@ THE SOFTWARE. # {{{ pytest integration from arraycontext.impl.pyopencl import PyOpenCLArrayContext -from arraycontext.impl.pytato import PytatoArrayContext +from arraycontext.impl.pytato import PytatoPyOpenCLArrayContext import pyopencl as cl from pyopencl.tools import _ContextFactory from typing import List @@ -50,11 +50,11 @@ class _PyOpenCLArrayContextFactory(_ContextFactory): self.device.platform.name.strip())) -class _PytatoArrayContextFactory(_ContextFactory): +class _PytatoPyOpenCLArrayContextFactory(_ContextFactory): def __call__(self): ctx = super().__call__() - from arraycontext.impl.pytato import PytatoArrayContext - return PytatoArrayContext(cl.CommandQueue(ctx)) + from arraycontext.impl.pytato import PytatoPyOpenCLArrayContext + return PytatoPyOpenCLArrayContext(cl.CommandQueue(ctx)) def __str__(self): return ("<Pytato array context factory for <pyopencl.Device '%s' on '%s'>" @@ -63,7 +63,7 @@ class _PytatoArrayContextFactory(_ContextFactory): types_to_factories = {PyOpenCLArrayContext: _PyOpenCLArrayContextFactory, - PytatoArrayContext: _PytatoArrayContextFactory} + PytatoPyOpenCLArrayContext: _PytatoPyOpenCLArrayContextFactory} def pytest_generate_tests_for_array_contexts(metafunc, actx_list=None) -> None: @@ -91,7 +91,7 @@ def pytest_generate_tests_for_array_contexts(metafunc, actx_list=None) -> None: """ if actx_list is None: - actx_list = [PyOpenCLArrayContext, PytatoArrayContext] + actx_list = [PyOpenCLArrayContext, PytatoPyOpenCLArrayContext] actx_factories = [types_to_factories[a] for a in actx_list] -- GitLab