You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lazy Array framework we will be using: github.com/inducer/pytato
Lazy Array Context requires a context for symbolic operations (i.e. Pytato.Namespace) and an execution context. (probably a PyOpenCL command queue).
Compile is a new operation that needs to be supported by ArrayContext. ArrayContext.compile would take a python callable, f, and return a JIT-ed function corresponding to f.
Looking at PyOpenCLArrayContext
freeze: gets rid of the array context's queue, giving the caller the freedom to operate on the frozen array without being wary of the actx's state.
thaw: attaches the array context's queue to the array, so any operations on the array are enqueued onto actx's queue.
compile: takes a python callable and just returns the python callable.
Proposal: PytatoPyOpenCLArrayContext
Uses pytato for lazy evaluation and any valued arrays are represented via pyopencl arrays.
freeze: takes a Union[pytato.Array, pyopencl.array] and returns a pyopencl.array without the actx's queue.
thaw: takes a pyopencl.array and returns a pytato.DataWrapper with the actx's namespace and queue attached to the cl array.
compile: takes a callable and a numpy object array of DofArrays of pyopencl arrays and returns a A: CompiledOperator that would have a method A.__call__(self, x: np.ndarray[DofArray[PyOpenCLArray]]) -> np.ndarray[DofArray[PyOpenCLArray]]. The pyopencl arrays fed into and out of A.__call__ would still have the actx's command queue.
Background
ArrayContext. ArrayContext.compile would take a python callable,f, and return a JIT-ed function corresponding tof.Looking at PyOpenCLArrayContext
Proposal: PytatoPyOpenCLArrayContext
pytatofor lazy evaluation and any valued arrays are represented via pyopencl arrays.Union[pytato.Array, pyopencl.array]and returns apyopencl.arraywithout the actx's queue.pyopencl.arrayand returns apytato.DataWrapperwith the actx's namespace and queue attached to the cl array.A: CompiledOperatorthat would have a methodA.__call__(self, x: np.ndarray[DofArray[PyOpenCLArray]]) -> np.ndarray[DofArray[PyOpenCLArray]]. The pyopencl arrays fed into and out ofA.__call__would still have the actx's command queue.