From 3acabe2ae80958c97b45ae8094bacced55768478 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Mon, 25 May 2020 11:25:33 -0500 Subject: [PATCH] More doc/other setup --- README.rst | 47 +++++++++++++++++++++++----------------------- doc/design.rst | 8 ++++++++ doc/index.rst | 8 ++++++-- doc/misc.rst | 28 +++++++++++++++++++++++++++ doc/reference.rst | 4 ++++ pytato/__init__.py | 6 ++++++ pytato/array.py | 38 ++++++++++++++++++++++++++++++------- setup.py | 4 ++-- 8 files changed, 108 insertions(+), 35 deletions(-) create mode 100644 doc/design.rst create mode 100644 doc/misc.rst create mode 100644 doc/reference.rst diff --git a/README.rst b/README.rst index ce0c3a3..ca4df16 100644 --- a/README.rst +++ b/README.rst @@ -13,28 +13,27 @@ Pytato: Get Descriptions of Array Computations via Lazy Evaluation * `Documentation <https://documen.tician.de/pytato>`__ (read how things work) -Pytato is licensed to you under the MIT/X Consortium license: - -Copyright (c) 2020 Andreas Kloeckner, Matt Wala, Xiaoyu Wei, and Contributors. - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +Example:: + import pytato as pt + import numpy as np + + ns = pt.Namespace() + pt.SizeParameter(ns, "n") # -> prescribes shape=(), dtype=np.intp + a = pt.Placeholder(ns, "a", "n,n", dtype=np.float32) + + # Also: pt.roll + # If we can: np.roll + a2a = a@(2*a) + + aat = a@a.T + + # FIXME: those names are only local...? + # maybe change name of DictOfNamedArrays + result = pt.DictOfNamedArrays({"a2a": a2a, "aat": aat}) + + prg = pt.generate_loopy(result) + +Pytato is licensed to you under the MIT/X Consortium license. See +the `documentation <https://documen.tician.de/pytato/misc.html>`__ +for further details diff --git a/doc/design.rst b/doc/design.rst new file mode 100644 index 0000000..7837eaf --- /dev/null +++ b/doc/design.rst @@ -0,0 +1,8 @@ +Design Decisions in Pytato +========================== + +- There is one (for now) computation :class:`pytato.N +- Shapes and dtypes are computed eagerly. +- Array data is computed eagerly. +- Results of array computations may *beomc + diff --git a/doc/index.rst b/doc/index.rst index 4f86faa..18dd4da 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -2,8 +2,12 @@ Welcome to Pytato's documentation! =================================== .. toctree:: - :maxdepth: 2 - :caption: Contents: + :maxdepth: 2 + :caption: Contents: + + reference + design + misc Indices and tables ================== diff --git a/doc/misc.rst b/doc/misc.rst new file mode 100644 index 0000000..c6ab970 --- /dev/null +++ b/doc/misc.rst @@ -0,0 +1,28 @@ +License +======= + +Pytato is licensed to you under the MIT/X Consortium license: + +Copyright (c) 2020 Andreas Kloeckner, Matt Wala, Xiaoyu Wei, and Contributors. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + diff --git a/doc/reference.rst b/doc/reference.rst new file mode 100644 index 0000000..522bdd4 --- /dev/null +++ b/doc/reference.rst @@ -0,0 +1,4 @@ +Reference +========= + +.. automodule:: pytato.array diff --git a/pytato/__init__.py b/pytato/__init__.py index 3b588df..5f047b9 100644 --- a/pytato/__init__.py +++ b/pytato/__init__.py @@ -23,3 +23,9 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ + +from pytato.array import ( + DottedName, Namespace, Array, DictOfNamedArrays, + ) + +__all__ = ("DottedName", "Namespace", "Array", "DictOfNamedArrays") diff --git a/pytato/array.py b/pytato/array.py index 4a52ca8..918b53e 100644 --- a/pytato/array.py +++ b/pytato/array.py @@ -25,10 +25,36 @@ THE SOFTWARE. """ __doc__ = """ + + Expression trees based on this package are picklable as long as no non-picklable data (e.g. :class:`pyopencl.array.Array`) -is referenced from :class:`DataArray`. +is referenced from :class:`DataWrapper`. + +Array Interface +--------------- + +.. currentmodule:: pytato + +.. autoclass :: Namespace +.. autoclass :: Array +.. autoclass :: DictOfNamedArrays + +Supporting Functionality +------------------------ + +.. autoclass :: DottedName + +Built-in Expression Nodes +------------------------- +.. currentmodule:: pytato.array + +.. autoclass:: IndexLambda +.. autoclass:: Einsum +.. autoclass:: DataWrapper +.. autoclass:: Placeholder +.. autoclass:: LoopyFunction """ @@ -97,13 +123,11 @@ class Array: .. attribute:: shape - A tuple of integers or :mod:`pymbolic` expressions. - Shape may be (at most affinely) symbolic. - `a[::n]` - `a[::n]` - `17*(n +32*(k+76*l))` Identifiers (:class:`pymbolic.Variable`) refer to names from :attr:`namespace`. + A tuple of integers or :mod:`pymbolic` expressions. + Shape may be (at most affinely) symbolic in these + identifiers. # FIXME: -> https://gitlab.tiker.net/inducer/pytato/-/issues/1 @@ -303,7 +327,7 @@ class Placeholder(Array): def __init__(self, namespace, name, shape, tags=None): if name is None: - raise ValueError("PlaceholderArray instances must have a name") + raise ValueError("Placeholder instances must have a name") super().__init__( namespace=namespace, name=name, diff --git a/setup.py b/setup.py index c56a780..c7d57e4 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ exec(compile(version_file_contents, version_file_name, 'exec'), ver_dic) setup(name="pytato", version=ver_dic["VERSION_TEXT"], - description="", + description="Get Descriptions of Array Computations via Lazy Evaluation", long_description=open("README.rst", "r").read(), classifiers=[ 'Development Status :: 4 - Beta', @@ -38,7 +38,7 @@ setup(name="pytato", ], author="Andreas Kloeckner, Matt Wala, Xiaoyu Wei", - url="http://gitlab.tiker.net/inducer/pytato", + url="http://github.com/inducer/pytato", author_email="inform@tiker.net", license="MIT", packages=find_packages()) -- GitLab