diff --git a/README.rst b/README.rst index ce0c3a3e037c1ecf779d630bc1c0e8e0c9bda21c..ca4df168b5f4df06c8a60199b80128305b59fd58 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 0000000000000000000000000000000000000000..7837eaf5032cf9287c0f44d139fc44d5b3f637a6 --- /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 4f86faae130faf438b5d7c089a49576d4db66433..18dd4da2c519885b2fb0c93120df7f7db82d923b 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 0000000000000000000000000000000000000000..c6ab9702dfebe1a3e902994148917b30b4dd5840 --- /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 0000000000000000000000000000000000000000..522bdd4ba3f3e69cb197157e78801d9be06f42c9 --- /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 3b588df411d52615e270ec6f91305105d13640c6..5f047b9d1238f8ddfed2a4ac5ffa2c6d8745487b 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 4a52ca8d277ae36f020d7c4c0df70fb795e583e3..918b53ebfc6261c68dd8a6a4f41ad68a560a41ce 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 c56a780a28b3f0c16e322287be9a15400c11ae92..c7d57e46918732720ce87672cf4f78c0895a24f3 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())