From dc8b5aba81a46e9c6564796f27edfd57d769a4dc Mon Sep 17 00:00:00 2001 From: Frederik Hennig <frederik.hennig@fau.de> Date: Mon, 11 Mar 2024 19:32:40 +0100 Subject: [PATCH] start rebuilding the documentation --- doc/sphinx/nbackend/arrays.rst | 6 --- doc/sphinx/nbackend/ast.rst | 6 --- doc/sphinx/nbackend/expressions.rst | 15 ------ doc/sphinx/nbackend/type_system.rst | 6 --- docs/.gitignore | 1 + docs/Makefile | 20 +++++++ docs/make.bat | 35 ++++++++++++ docs/source/_static/img/logo.png | Bin 0 -> 10116 bytes docs/source/api/index.rst | 10 ++++ docs/source/api/kernelcreation/index.rst | 14 +++++ docs/source/api/sympyextensions/astnodes.rst | 9 ++++ docs/source/api/sympyextensions/field.rst | 9 ++++ docs/source/api/sympyextensions/index.rst | 10 ++++ docs/source/api/types/basic_types.rst | 6 +++ docs/source/api/types/index.rst | 18 +++++++ docs/source/api/types/quick.rst | 6 +++ docs/source/backend/arrays.rst | 6 +++ docs/source/backend/ast.rst | 9 ++++ .../source/backend}/index.rst | 8 ++- .../nbackend => docs/source/backend}/jit.rst | 2 +- .../source/backend}/kernelcreation.rst | 2 +- .../source/backend}/rationale.rst | 0 docs/source/conf.py | 51 ++++++++++++++++++ docs/source/index.rst | 18 +++++++ pyproject.toml | 2 +- src/pystencils/backend/arrays.py | 2 +- src/pystencils/backend/jit/__init__.py | 3 +- .../backend/kernelcreation/__init__.py | 2 +- src/pystencils/backend/kernelfunction.py | 2 +- src/pystencils/config.py | 8 +-- .../datahandling/datahandling_interface.py | 3 +- .../datahandling/parallel_datahandling.py | 1 - .../datahandling/serial_datahandling.py | 4 +- src/pystencils/kernelcreation.py | 13 ++++- src/pystencils/runhelper/db.py | 2 +- src/pystencils/sympyextensions/__init__.py | 4 +- src/pystencils/types/__init__.py | 10 ++++ src/pystencils/types/basic_types.py | 8 ++- src/pystencils/types/quick.py | 32 +++++------ 39 files changed, 282 insertions(+), 81 deletions(-) delete mode 100644 doc/sphinx/nbackend/arrays.rst delete mode 100644 doc/sphinx/nbackend/ast.rst delete mode 100644 doc/sphinx/nbackend/expressions.rst delete mode 100644 doc/sphinx/nbackend/type_system.rst create mode 100644 docs/.gitignore create mode 100644 docs/Makefile create mode 100644 docs/make.bat create mode 100644 docs/source/_static/img/logo.png create mode 100644 docs/source/api/index.rst create mode 100644 docs/source/api/kernelcreation/index.rst create mode 100644 docs/source/api/sympyextensions/astnodes.rst create mode 100644 docs/source/api/sympyextensions/field.rst create mode 100644 docs/source/api/sympyextensions/index.rst create mode 100644 docs/source/api/types/basic_types.rst create mode 100644 docs/source/api/types/index.rst create mode 100644 docs/source/api/types/quick.rst create mode 100644 docs/source/backend/arrays.rst create mode 100644 docs/source/backend/ast.rst rename {doc/sphinx/nbackend => docs/source/backend}/index.rst (63%) rename {doc/sphinx/nbackend => docs/source/backend}/jit.rst (69%) rename {doc/sphinx/nbackend => docs/source/backend}/kernelcreation.rst (51%) rename {doc/sphinx/nbackend => docs/source/backend}/rationale.rst (100%) create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst diff --git a/doc/sphinx/nbackend/arrays.rst b/doc/sphinx/nbackend/arrays.rst deleted file mode 100644 index b668d3c0a..000000000 --- a/doc/sphinx/nbackend/arrays.rst +++ /dev/null @@ -1,6 +0,0 @@ -****** -Arrays -****** - -.. automodule:: pystencils.nbackend.arrays - :members: diff --git a/doc/sphinx/nbackend/ast.rst b/doc/sphinx/nbackend/ast.rst deleted file mode 100644 index ca0ccf2b9..000000000 --- a/doc/sphinx/nbackend/ast.rst +++ /dev/null @@ -1,6 +0,0 @@ -******************** -Abstract Syntax Tree -******************** - -.. automodule:: pystencils.nbackend.ast - :members: diff --git a/doc/sphinx/nbackend/expressions.rst b/doc/sphinx/nbackend/expressions.rst deleted file mode 100644 index 8dcf58b61..000000000 --- a/doc/sphinx/nbackend/expressions.rst +++ /dev/null @@ -1,15 +0,0 @@ -*********************** -Expression Manipulation -*********************** - -Variables and Constants -======================= - -.. automodule:: pystencils.nbackend.typed_expressions - :members: - -Functions -========= - -.. automodule:: pystencils.nbackend.functions - :members: diff --git a/doc/sphinx/nbackend/type_system.rst b/doc/sphinx/nbackend/type_system.rst deleted file mode 100644 index 75d126ddb..000000000 --- a/doc/sphinx/nbackend/type_system.rst +++ /dev/null @@ -1,6 +0,0 @@ -*************** -The Type System -*************** - -.. automodule:: pystencils.nbackend.types - :members: diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 000000000..378eac25d --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +build diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 000000000..d0c3cbf10 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 000000000..747ffb7b3 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=source +set BUILDDIR=build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/source/_static/img/logo.png b/docs/source/_static/img/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..784183cd932787cfce3cf6c38e77622f40699e8f GIT binary patch literal 10116 zcmXw91z1#Fw56r|>Fy8_hDPab2@x2Ekw!*BO1e9wduT>UK^$N}x&+Cg1f{#XQ$XJ3 zeedyo!*GW?=bpXK*=w)8_KDWjQF}~CPl$nm@mND$Sr2%JKfLhqfZx)XA69@j95+P` z1AO4eAK&^Ta82N%4t2x8AY6EOVY)wto&X=xxvLnt>pQ=5_p)?_VR(6Y@!L7QcYAB; z0^@gfwaGb<rpLfw#n4bzF!0XZ&+|*8JWubHJKx&5Jd^gt%TyQ*Q8g2Z%&6oHjwVU_ zVjJqf>Qvz8IWMCTH=Vj_?~0PJ8G?>DX<1EFOv6;P3OH#aIAb)^9$Un*4!oyTp)(s6 zl-~HE^{V~r*PZ$x123Vj!H(enNSov~&$6};d~eJD8ec9no!`tOern*et(i7^&f|g7 zIJd{;(@8r6PFz(8X*5!V<#R|^JeI^fJUrSnI5p0oC6_sQQeHY4uxmOt<-FPb7ok5s z?YK53!LCi}n)`4QV9>259T2sMyD8*}hCT2xTE9eVI@!F3Y+^W1$~hHw?NdMd%@6|N z4Q#)^t!?Tvr;Jt(otQ9Gn)JZFQZzN4r|%=+wJBR5#=)A&6na}!5W(ZhWdv7obF2B- zyGjRzS7r&r2L6NMv!PM9akKk|u?0M?FZxh}z|EZ6;|AlR2x>)jJtd_sEDH}uM?RHH z$XX$3Vy}eD5{BZ(S=bVP{j4LU%5!`;F7Xkn;&i5hC|RC0xWo?c2p61E^a?jj;oM(r zN3jzHvZkv7fza~9cOFSFc~w<h>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|-GE>{US+w@Gy?SiP%<j&IEvBU*WLR`XaWFIXrt?s!}fbwi^XVv z07k4g2D3m=)LI(DP%j+-G>GeQ#J``*T~XINkoJMCUxji#z!Q_`ep`Km)<iD;yQoj7 z0`lu{_Vf2fP43%vVt<PT0thrxY;A2nRaYnD5>e;YB-p9&6XR)%{j?HV2)x;stzSZc zMC`_j6vnSweKzyFY=QIuKu3Vn_gIs;weiQLLvN{`xpJ*VfElaa{9hHus+p2T#`3{k zGnw5doK!s}Ejgr4|FJ(vZ%wQ3{J9hl5u4fJ_VzQLuYJ9Wz#*#Oc;O=k(@E1(-wtR| zpDu9zX{!nO27VrD0)brmX{318)z#5o2TG~L<UWJLe$C9-W6bXC?wZ4&Xpo~oK|tfT zu(1(J*$rOPss_bwY`oK)Jg?x?xKvMZx5_>TPJ9hLG8+}u{)R*vj@05QBzJN$CyoQ7 zY>Mw&|Li-xKDFVx9nSazg+dtHLX>%YKIwrT`wVwPKrO52ykWnNCJ`TSX#wd8)Ki ziu`tVc5<1M?j+R+*oq<}BaNSEyy4auD-B6j#J}uEQ#~``)EK}}<3sy0U1<jd+@Vu` edtvR}KN7Uhl#?)Ac><i6!_ZLCQAR3Sg#Hgk#Qp~W literal 0 HcmV?d00001 diff --git a/docs/source/api/index.rst b/docs/source/api/index.rst new file mode 100644 index 000000000..cd608643b --- /dev/null +++ b/docs/source/api/index.rst @@ -0,0 +1,10 @@ +############# +API Reference +############# + +.. toctree:: + :maxdepth: 2 + + sympyextensions/index + kernelcreation/index + types/index diff --git a/docs/source/api/kernelcreation/index.rst b/docs/source/api/kernelcreation/index.rst new file mode 100644 index 000000000..582ee1668 --- /dev/null +++ b/docs/source/api/kernelcreation/index.rst @@ -0,0 +1,14 @@ +*************** +Kernel Creation +*************** + +The primary interface for creating numerical kernels in pystencils is the function `create_kernel`. + + +.. autoclass:: pystencils.CreateKernelConfig + :members: + +.. autofunction:: pystencils.create_kernel + +.. autoclass:: pystencils.backend.KernelFunction + :members: diff --git a/docs/source/api/sympyextensions/astnodes.rst b/docs/source/api/sympyextensions/astnodes.rst new file mode 100644 index 000000000..4d5c4b89f --- /dev/null +++ b/docs/source/api/sympyextensions/astnodes.rst @@ -0,0 +1,9 @@ +---------------- +Kernel Structure +---------------- + +.. automodule:: pystencils.sympyextensions.astnodes + +.. autoclass:: pystencils.sympyextensions.AssignmentCollection + :members: + diff --git a/docs/source/api/sympyextensions/field.rst b/docs/source/api/sympyextensions/field.rst new file mode 100644 index 000000000..a435c716c --- /dev/null +++ b/docs/source/api/sympyextensions/field.rst @@ -0,0 +1,9 @@ +------------------------- +Fields (pystencils.field) +------------------------- + +.. automodule:: pystencils.field + :members: + +.. autoclass:: pystencils.sympyextensions.ConditionalFieldAccess + :members: diff --git a/docs/source/api/sympyextensions/index.rst b/docs/source/api/sympyextensions/index.rst new file mode 100644 index 000000000..606a36771 --- /dev/null +++ b/docs/source/api/sympyextensions/index.rst @@ -0,0 +1,10 @@ +***************** +Symbolic Language +***************** + +.. toctree:: + :maxdepth: 1 + + field + astnodes + diff --git a/docs/source/api/types/basic_types.rst b/docs/source/api/types/basic_types.rst new file mode 100644 index 000000000..7a8156c45 --- /dev/null +++ b/docs/source/api/types/basic_types.rst @@ -0,0 +1,6 @@ + +Data Type Class Hierarchy +------------------------- + +.. automodule:: pystencils.types.basic_types + :members: diff --git a/docs/source/api/types/index.rst b/docs/source/api/types/index.rst new file mode 100644 index 000000000..2ac0410f6 --- /dev/null +++ b/docs/source/api/types/index.rst @@ -0,0 +1,18 @@ +********** +Data Types +********** + +Type System Module (pystencils.types) +------------------------------------- + +.. automodule:: pystencils.types + +.. autofunction:: pystencils.types.create_type +.. autofunction:: pystencils.types.create_numeric_type + +.. toctree:: + :maxdepth: 1 + + basic_types + quick + diff --git a/docs/source/api/types/quick.rst b/docs/source/api/types/quick.rst new file mode 100644 index 000000000..34bc3cae5 --- /dev/null +++ b/docs/source/api/types/quick.rst @@ -0,0 +1,6 @@ +Data Type Abbreviations +----------------------- + + +.. automodule:: pystencils.types.quick + :members: \ No newline at end of file diff --git a/docs/source/backend/arrays.rst b/docs/source/backend/arrays.rst new file mode 100644 index 000000000..c1b09d44c --- /dev/null +++ b/docs/source/backend/arrays.rst @@ -0,0 +1,6 @@ +****** +Arrays +****** + +.. automodule:: pystencils.backend.arrays + :members: diff --git a/docs/source/backend/ast.rst b/docs/source/backend/ast.rst new file mode 100644 index 000000000..68aca4ee5 --- /dev/null +++ b/docs/source/backend/ast.rst @@ -0,0 +1,9 @@ +******************** +Abstract Syntax Tree +******************** + +.. automodule:: pystencils.backend.ast.structural + :members: + +.. automodule:: pystencils.backend.ast.expressions + :members: diff --git a/doc/sphinx/nbackend/index.rst b/docs/source/backend/index.rst similarity index 63% rename from doc/sphinx/nbackend/index.rst rename to docs/source/backend/index.rst index 752fa9ccb..3ee952ad9 100644 --- a/doc/sphinx/nbackend/index.rst +++ b/docs/source/backend/index.rst @@ -1,6 +1,6 @@ -############################################################# -Developer's Reference: Code Generation Backend (``nbackend``) -############################################################# +############################################## +Developer's Reference: Code Generation Backend +############################################## These pages provide a detailed overview of the next-gen code generation backend ``nbackend`` currently being @@ -11,8 +11,6 @@ all code generation functionality currently implemented in *pystencils* version :maxdepth: 1 rationale - type_system - expressions arrays ast kernelcreation diff --git a/doc/sphinx/nbackend/jit.rst b/docs/source/backend/jit.rst similarity index 69% rename from doc/sphinx/nbackend/jit.rst rename to docs/source/backend/jit.rst index 71541527f..f7a02dbd4 100644 --- a/doc/sphinx/nbackend/jit.rst +++ b/docs/source/backend/jit.rst @@ -2,5 +2,5 @@ Just-In-Time Compilation ************************ -.. automodule:: pystencils.nbackend.jit +.. automodule:: pystencils.backend.jit :members: diff --git a/doc/sphinx/nbackend/kernelcreation.rst b/docs/source/backend/kernelcreation.rst similarity index 51% rename from doc/sphinx/nbackend/kernelcreation.rst rename to docs/source/backend/kernelcreation.rst index 8232a23a1..b07f62158 100644 --- a/doc/sphinx/nbackend/kernelcreation.rst +++ b/docs/source/backend/kernelcreation.rst @@ -2,5 +2,5 @@ Kernel Creation *************** -.. automodule:: pystencils.nbackend.kernelcreation +.. automodule:: pystencils.kernelcreation diff --git a/doc/sphinx/nbackend/rationale.rst b/docs/source/backend/rationale.rst similarity index 100% rename from doc/sphinx/nbackend/rationale.rst rename to docs/source/backend/rationale.rst diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 000000000..ae9c01750 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,51 @@ +import datetime +import re + +from pystencils import __version__ as pystencils_version + +project = "pystencils" +html_logo = "_static/img/logo.png" + +copyright = ( + f"{datetime.datetime.now().year}, Martin Bauer, Markus Holzer, Frederik Hennig" +) +author = "Martin Bauer, Markus Holzer, Frederik Hennig" + +version = re.sub(r"(\d+\.\d+)\.\d+(.*)", r"\1\2", pystencils_version) +version = re.sub(r"(\.dev\d+).*?$", r"\1", version) +# The full version, including alpha/beta/rc tags. +release = pystencils_version + +language = "en" +default_role = "any" +pygments_style = "sphinx" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.doctest", + "sphinx.ext.intersphinx", + "sphinx.ext.mathjax", + "sphinx.ext.napoleon", +] + +templates_path = ["_templates"] +exclude_patterns = [] + +autodoc_member_order = "bysource" +autodoc_typehints = "description" + +intersphinx_mapping = { + "python": ("https://docs.python.org/3.8", None), + "numpy": ("https://docs.scipy.org/doc/numpy/", None), + "matplotlib": ("https://matplotlib.org/", None), + "sympy": ("https://docs.sympy.org/latest/", None), +} + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "furo" +html_static_path = ["_static"] diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 000000000..a62225f96 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,18 @@ + +Welcome to pystencils's documentation! +====================================== + +.. toctree:: + :maxdepth: 1 + + api/index.rst + backend/index.rst + + + +.. Indices and tables +.. ================== + +.. * :ref:`genindex` +.. * :ref:`modindex` +.. * :ref:`search` diff --git a/pyproject.toml b/pyproject.toml index 0ccdca068..5ef106e59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ use_cython = [ ] doc = [ 'sphinx', - 'sphinx_rtd_theme', + 'furo', 'nbsphinx', 'sphinxcontrib-bibtex', 'sphinx_autodoc_typehints', diff --git a/src/pystencils/backend/arrays.py b/src/pystencils/backend/arrays.py index 16203ac1c..421426afc 100644 --- a/src/pystencils/backend/arrays.py +++ b/src/pystencils/backend/arrays.py @@ -19,7 +19,7 @@ or even the field shape must be fixed. The code generation backend models such requirements and assumptions as *constraints*. Constraints are external to the arrays themselves. They are created by the AST passes which -require them and exposed through the `PsKernelFunction` class to the compiler kernel's runtime +require them and exposed through the `KernelFunction` class to the compiler kernel's runtime environment. It is the responsibility of the runtime environment to fulfill all constraints. For example, if an array ``arr`` should have both a fixed shape and fixed strides, diff --git a/src/pystencils/backend/jit/__init__.py b/src/pystencils/backend/jit/__init__.py index b3340a9ab..7938f7083 100644 --- a/src/pystencils/backend/jit/__init__.py +++ b/src/pystencils/backend/jit/__init__.py @@ -2,7 +2,7 @@ JIT compilation in the ``nbackend`` is managed by subclasses of `JitBase`. A JIT compiler may freely be created and configured by the user. It can then be passed to `create_kernel` using the ``jit`` argument of -`CreateKernelConfig`, in which case it is hooked into the `PsKernelFunction.compile` method +`CreateKernelConfig`, in which case it is hooked into the `KernelFunction.compile` method of the generated kernel function:: my_jit = MyJit() @@ -29,6 +29,7 @@ Both are available here through `LegacyCpuJit` and `LegacyGpuJit`. from .jit import JitBase, NoJit, LegacyCpuJit, LegacyGpuJit no_jit = NoJit() +"""Disables just-in-time compilation for a kernel.""" __all__ = [ "JitBase", diff --git a/src/pystencils/backend/kernelcreation/__init__.py b/src/pystencils/backend/kernelcreation/__init__.py index c3846e2c9..dea2db232 100644 --- a/src/pystencils/backend/kernelcreation/__init__.py +++ b/src/pystencils/backend/kernelcreation/__init__.py @@ -92,7 +92,7 @@ and vectorization on CPU platforms with vector capabilities. Finalization ^^^^^^^^^^^^ -At last, the kernel is packed up as a `PsKernelFunction`. +At last, the kernel is packed up as a `KernelFunction`. It is furthermore annotated with constraints collected during the translation, and returned to the user. """ diff --git a/src/pystencils/backend/kernelfunction.py b/src/pystencils/backend/kernelfunction.py index 45ec32603..97837492b 100644 --- a/src/pystencils/backend/kernelfunction.py +++ b/src/pystencils/backend/kernelfunction.py @@ -137,7 +137,7 @@ class KernelFunction: @property def name(self) -> str: return self._name - + @name.setter def name(self, n: str): self._name = n diff --git a/src/pystencils/config.py b/src/pystencils/config.py index cb82785df..2d3327104 100644 --- a/src/pystencils/config.py +++ b/src/pystencils/config.py @@ -110,7 +110,7 @@ class CreateKernelConfig: """Just-in-time compiler used to compile and load the kernel for invocation from the current Python environment. If left at `None`, a default just-in-time compiler will be inferred from the `target` parameter. - To explicitly disable JIT compilation, pass `nbackend.jit.no_jit`. + To explicitly disable JIT compilation, pass `pystencils.nbackend.jit.no_jit`. """ function_name: str = "kernel" @@ -122,18 +122,18 @@ class CreateKernelConfig: Options: - `None`: Required ghost layers are inferred from field accesses - `int`: A uniform number of ghost layers in each spatial coordinate is applied - - `Sequence[int, tuple[int, int]]`: Ghost layers are specified for each spatial coordinate. + - ``Sequence[int, tuple[int, int]]``: Ghost layers are specified for each spatial coordinate. In each coordinate, a single integer specifies the ghost layers at both the lower and upper iteration limit, while a pair of integers specifies the lower and upper ghost layers separately. When manually specifying ghost layers, it is the user's responsibility to avoid out-of-bounds memory accesses. - If `ghost_layers=None` is specified, the iteration region may otherwise be set using the `iteration_slice` option. + If ``ghost_layers=None`` is specified, the iteration region may otherwise be set using the `iteration_slice` option. """ iteration_slice: None | Sequence[slice] = None """Specifies the kernel's iteration slice. - `iteration_slice` may only be set if `ghost_layers = None`. + `iteration_slice` may only be set if ``ghost_layers=None``. If it is set, a slice must be specified for each spatial coordinate. TODO: Specification of valid slices and their behaviour """ diff --git a/src/pystencils/datahandling/datahandling_interface.py b/src/pystencils/datahandling/datahandling_interface.py index d7a49bab0..33b565e82 100644 --- a/src/pystencils/datahandling/datahandling_interface.py +++ b/src/pystencils/datahandling/datahandling_interface.py @@ -3,7 +3,7 @@ from typing import Callable, Dict, Iterable, Optional, Sequence, Tuple, Union import numpy as np -from pystencils.enums import Target, Backend +from pystencils.enums import Target from pystencils.field import Field, FieldType @@ -18,7 +18,6 @@ class DataHandling(ABC): """ _GPU_LIKE_TARGETS = [Target.GPU] - _GPU_LIKE_BACKENDS = [Backend.CUDA] # ---------------------------- Adding and accessing data ----------------------------------------------------------- @property diff --git a/src/pystencils/datahandling/parallel_datahandling.py b/src/pystencils/datahandling/parallel_datahandling.py index c0ddc9a46..9edd1d437 100644 --- a/src/pystencils/datahandling/parallel_datahandling.py +++ b/src/pystencils/datahandling/parallel_datahandling.py @@ -7,7 +7,6 @@ import waLBerla as wlb from pystencils.datahandling.blockiteration import block_iteration, sliced_block_iteration from pystencils.datahandling.datahandling_interface import DataHandling -from pystencils.enums import Backend from pystencils.field import Field, FieldType from pystencils.sympyextensions.typed_sympy import FieldPointerSymbol from pystencils.utils import DotDict diff --git a/src/pystencils/datahandling/serial_datahandling.py b/src/pystencils/datahandling/serial_datahandling.py index 0f5ddb431..4eb341df5 100644 --- a/src/pystencils/datahandling/serial_datahandling.py +++ b/src/pystencils/datahandling/serial_datahandling.py @@ -254,12 +254,12 @@ class SerialDataHandling(DataHandling): self.to_gpu(name) def run_kernel(self, kernel_function, **kwargs): - arrays = self.gpu_arrays if kernel_function.ast.backend in self._GPU_LIKE_BACKENDS else self.cpu_arrays + arrays = self.gpu_arrays if kernel_function.target.is_gpu() else self.cpu_arrays kernel_function(**{**arrays, **kwargs}) def get_kernel_kwargs(self, kernel_function, **kwargs): result = {} - result.update(self.gpu_arrays if kernel_function.ast.backend in self._GPU_LIKE_BACKENDS else self.cpu_arrays) + result.update(self.gpu_arrays if kernel_function.target.is_gpu() else self.cpu_arrays) result.update(kwargs) return [result] diff --git a/src/pystencils/kernelcreation.py b/src/pystencils/kernelcreation.py index a79c68c59..b2fe4b664 100644 --- a/src/pystencils/kernelcreation.py +++ b/src/pystencils/kernelcreation.py @@ -36,8 +36,17 @@ __all__ = ["create_kernel"] def create_kernel( assignments: AssignmentCollection | list[Assignment] | Assignment, config: CreateKernelConfig = CreateKernelConfig(), -): - """Create a kernel function from an assignment collection.""" +) -> KernelFunction: + """Create a kernel function from a set of assignments. + + Args: + assignments: The kernel's sequence of assignments, expressed using SymPy + config: The configuration for the kernel translator + + Returns: + The numerical kernel in pystencil's internal representation, ready to be + exported or compiled + """ ctx = KernelCreationContext( default_dtype=config.default_dtype, index_dtype=config.index_dtype diff --git a/src/pystencils/runhelper/db.py b/src/pystencils/runhelper/db.py index acbe5dfa9..0acf53bc6 100644 --- a/src/pystencils/runhelper/db.py +++ b/src/pystencils/runhelper/db.py @@ -9,7 +9,7 @@ from blitzdb.backends.file.backend import serializer_classes from blitzdb.backends.file.utils import JsonEncoder from pystencils.cpu.cpujit import get_compiler_config -from pystencils import CreateKernelConfig, Target, Backend, Field +from pystencils import CreateKernelConfig, Target, Field import json import sympy as sp diff --git a/src/pystencils/sympyextensions/__init__.py b/src/pystencils/sympyextensions/__init__.py index 1f0a4c5f4..fd1145bcb 100644 --- a/src/pystencils/sympyextensions/__init__.py +++ b/src/pystencils/sympyextensions/__init__.py @@ -3,7 +3,8 @@ from .astnodes import ( AugmentedAssignment, AddAugmentedAssignment, AssignmentCollection, - SymbolGen + SymbolGen, + ConditionalFieldAccess ) from .typed_sympy import TypedSymbol, CastFunc from .simplificationstrategy import SimplificationStrategy @@ -63,6 +64,7 @@ __all__ = [ "AddAugmentedAssignment", "AssignmentCollection", "SymbolGen", + "ConditionalFieldAccess", "TypedSymbol", "CastFunc", "SimplificationStrategy", diff --git a/src/pystencils/types/__init__.py b/src/pystencils/types/__init__.py index 140151b2b..98fd2dd24 100644 --- a/src/pystencils/types/__init__.py +++ b/src/pystencils/types/__init__.py @@ -1,3 +1,13 @@ +""" +The `pystencils.types` module contains the set of classes used by pystencils +to model data types. Data types are used extensively within the code generator, +but can safely be ignored by most users unless you wish to force certain types on +symbols, generate mixed-precision kernels, et cetera. + +For more user-friendly and less verbose access to the type modelling system, refer to +the `pystencils.types.quick` submodule. +""" + from .basic_types import ( PsType, PsCustomType, diff --git a/src/pystencils/types/basic_types.py b/src/pystencils/types/basic_types.py index 4648c3210..f62571922 100644 --- a/src/pystencils/types/basic_types.py +++ b/src/pystencils/types/basic_types.py @@ -291,17 +291,15 @@ class PsNumericType(PsType, ABC): """Class to model numeric types, which are all types that may occur at the top-level inside arithmetic-logical expressions. - Constants - --------- + **Constants** Every numeric type has to act as a factory for compile-time constants of that type. - The `PsTypedConstant` class relies on `create_constant` to instantiate constants + The `PsConstant` class relies on `create_constant` to instantiate constants of a given numeric type. The object returned by `create_constant` must implement the necessary arithmetic operations, and its arithmetic behaviour must match the given type. `create_constant` should fail whenever its input cannot safely be interpreted as the given - type. As for which interpretations are considered 'safe', it should be as restrictive as possible. - However, `create_constant` must *never* fail for the literals ``0``, ``1`` and ``-1``. + type. """ @abstractmethod diff --git a/src/pystencils/types/quick.py b/src/pystencils/types/quick.py index 60ec516f1..7e8628f61 100644 --- a/src/pystencils/types/quick.py +++ b/src/pystencils/types/quick.py @@ -1,8 +1,4 @@ -"""Abbreviations and creation functions for pystencils type-modelling classes -for quick, user-friendly construction and compact pattern matching. - -This module is meant to be included whole, e.g. as `from pystencils.nbackend.types.quick import *` -""" +"""Quick access to the pystencils data type system.""" from __future__ import annotations @@ -29,7 +25,7 @@ def create_type(type_spec: UserTypeSpec) -> PsType: """Create a pystencils type object from a variety of specifications. Possible arguments are: - - Strings ('str'): will be parsed as common C types, throwing an exception if that fails. + - Strings (`str`): will be parsed as common C types, throwing an exception if that fails. To construct a `PsCustomType` instead, use the constructor of `PsCustomType` or its abbreviation ``types.quick.Custom`` instead - Python builtin data types (instances of `type`): Attempts to interpret Python numeric types like so: @@ -39,7 +35,7 @@ def create_type(type_spec: UserTypeSpec) -> PsType: - Supported Numpy scalar data types (see https://numpy.org/doc/stable/reference/arrays.scalars.html) are converted to pystencils scalar data types - Instances of `numpy.dtype`: Attempt to interpret scalar types like above, and structured types as structs. - - Instances of `PsAbstractType` will be returned as they are + - Instances of `PsType` will be returned as they are """ from .parsing import parse_type_string, interpret_python_type, interpret_numpy_dtype @@ -56,7 +52,7 @@ def create_type(type_spec: UserTypeSpec) -> PsType: def create_numeric_type(type_spec: UserTypeSpec) -> PsNumericType: - """Like `make_type`, but only for numeric types.""" + """Like `create_type`, but only for numeric types.""" dtype = create_type(type_spec) if not isinstance(dtype, PsNumericType): raise ValueError( @@ -66,31 +62,31 @@ def create_numeric_type(type_spec: UserTypeSpec) -> PsNumericType: Custom = PsCustomType -"""`Custom(name)` matches `PsCustomType(name)`""" +"""Custom data types are modelled only by their name.""" Scalar = PsScalarType -"""`Scalar()` matches any subclass of `PsScalarType`""" +"""``Scalar()`` matches any subclass of ``PsScalarType``""" Ptr = PsPointerType -"""`Ptr(t)` matches `PsPointerType(base_type=t)`""" +"""``Ptr(t)`` matches ``PsPointerType(base_type=t)``""" Arr = PsArrayType -"""`Arr(t, s)` matches PsArrayType(base_type=t, size=s)""" +"""``Arr(t, s)`` matches ``PsArrayType(base_type=t, size=s)``""" Bool = PsBoolType -"""Bool() matches PsBoolType()""" +"""``Bool()`` matches ``PsBoolType()``""" AnyInt = PsIntegerType -"""`AnyInt(width)` matches both `PsUnsignedIntegerType(width)` and `PsSignedIntegerType(width)`""" +"""``AnyInt(width)`` matches both ``PsUnsignedIntegerType(width)`` and ``PsSignedIntegerType(width)``""" UInt = PsUnsignedIntegerType -"""`UInt(width)` matches `PsUnsignedIntegerType(width)`""" +"""``UInt(width)`` matches ``PsUnsignedIntegerType(width)``""" Int = PsSignedIntegerType -"""`Int(width)` matches `PsSignedIntegerType(width)`""" +"""``Int(width)`` matches ``PsSignedIntegerType(width)``""" SInt = PsSignedIntegerType -"""`SInt(width)` matches `PsSignedIntegerType(width)`""" +"""``SInt(width)` matches `PsSignedIntegerType(width)``""" Fp = PsIeeeFloatType -"""`Fp(width)` matches `PsIeeeFloatType(width)`""" +"""``Fp(width)` matches `PsIeeeFloatType(width)``""" -- GitLab