Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 66-absolute-access-is-probably-not-copied-correctly-after-_eval_subs
  • const_fix
  • fhennig/v2.0-deprecations
  • fma
  • gpu_bufferfield_fix
  • gpu_liveness_opts
  • holzer-master-patch-46757
  • hyteg
  • improved_comm
  • master
  • target_dh_refactoring
  • v2.0-dev
  • vectorization_sqrt_fix
  • zikeliml/124-rework-tutorials
  • zikeliml/Task-96-dotExporterForAST
  • last/Kerncraft
  • last/LLVM
  • last/OpenCL
  • release/0.2.1
  • release/0.2.10
  • release/0.2.11
  • release/0.2.12
  • release/0.2.13
  • release/0.2.14
  • release/0.2.15
  • release/0.2.2
  • release/0.2.3
  • release/0.2.4
  • release/0.2.6
  • release/0.2.7
  • release/0.2.8
  • release/0.2.9
  • release/0.3.0
  • release/0.3.1
  • release/0.3.2
  • release/0.3.3
  • release/0.3.4
  • release/0.4.0
  • release/0.4.1
  • release/0.4.2
  • release/0.4.3
  • release/0.4.4
  • release/1.0
  • release/1.0.1
  • release/1.1
  • release/1.1.1
  • release/1.2
  • release/1.3
  • release/1.3.1
  • release/1.3.2
  • release/1.3.3
  • release/1.3.4
  • release/1.3.5
  • release/1.3.6
  • release/1.3.7
  • release/2.0.dev0
56 results

Target

Select target project
No results found
Select Git revision
  • AssignmentCollection.__str__
  • AssignmentCollection.free-bound_fields
  • AssignmentCollection.has_exclusive_writes
  • ConditionalFieldAccess
  • Datahandling.add_arrays
  • Field.__repr__
  • Field.hashable_contents
  • InterpolatorAccess.__getnewargs__
  • KernelFunction.field_read
  • KernelFuntion.fields_read
  • KernelWrapper
  • LoopCounterSymbols-nonnegative
  • NotIterable
  • RecursiveDotDict
  • SerialDataHandling.run_kernel-kwargs
  • SympyAssignment.__hash__
  • TextureDeclaration.__str__
  • WIP
  • WIP2
  • add-AssignmentCollection.free-bound_fields
  • add-Field.itemsize
  • add-arrays-ext
  • add-dependency-jinja2
  • add-pystencils-autodiff
  • always-use-codegen.rewriting.optimize
  • append-assignments-to-ast
  • assert-cast_func-arg-is-type
  • assertion-headers
  • assumptions-cast_func
  • astnodes-for-interpolation
  • astnodes-for-interpolation-rebased
  • auto-for-assignments
  • auto-optimizations
  • autodiff
  • bugfix-avoid-east-and-west-const
  • bugfix-collate-types-for-boolean-function
  • bugfix-fields_accessed-for-InterpolatorAccess
  • bugfix-ghostlayers-gpu
  • bugfix-textures
  • c11-printer
  • cast_func-assumptions
  • complex-numbers
  • complex-numbers-with-type-interference
  • create_boundary_kwargs
  • create_type_in_cast_func
  • csqrt
  • cuda-array-interface
  • cuda-autotune
  • cuda.TextureReference.set_array
  • custom-fields-different-size-in-transformations
  • dark-mode
  • destructuring-field-binding
  • documentation-for-json-backend
  • dtype-for-add_arrays
  • dtype-from-fields
  • eliminate-usage-of-equation-collection
  • extra-asserts-sympy-issue
  • fix-ParallelDataHandling-bug!
  • fix-TypedImaginaryUnit.__getnewargs__
  • fix-arrayhandlers
  • fix-custom-fields-cudakernel
  • fix-dirichlet
  • fix-documentation
  • fix-free/defined-symbols-for-non-Assignments
  • fix-kerncraft
  • fix-llvm-gpu
  • fix-opencl
  • fix-opencl-extra-in-readme
  • fix-opencl-llvm-gpu
  • fix-rotate_weights_and_apply
  • fix-trailing-whitespace-in-rng.py
  • foo
  • function-call-printing
  • functional_coordinate_transform
  • gpu_liveness_opts
  • graph-datahandling
  • graph-datahandling-tom
  • graphviz
  • graphviz-01_tutorial
  • hyteg
  • improved_comm
  • infer-symbol-types-from-definition
  • infinity
  • infocomp_hacked
  • interpolation-24.0.9
  • interpolation-refactoring
  • kernel-wrapper-typeannotations
  • krasser-feature-branch
  • llvm-experiments
  • make_python_function
  • make_python_function-rebased
  • master
  • matrix-symbols
  • mlir
  • no-cuda-for-doc/lint
  • not-unify-shapes-branch
  • omit-globals-when-printing-c-code
  • opencl-datahandling
  • opencl-to-spirv
  • original_assignment-hack
  • 1.0
  • release/0.2.1
  • release/0.2.2
  • release/0.2.3
  • release/0.2.4
  • release/0.2.6
  • release/0.2.7
  • release/1.0
  • release/1.0.1
  • release/1.1
  • release/1.1.1
  • v1.0
  • v1.1
113 results
Show changes
288 files
+ 22776
52675
Compare changes
  • Side-by-side
  • Inline

Files

+4 −4
Original line number Original line Diff line number Diff line
[flake8]
[flake8]
max-line-length=120
max-line-length=120
exclude=pystencils/jupyter.py,
exclude=src/pystencils/jupyter.py,
        pystencils/plot.py
        src/pystencils/plot.py
        pystencils/session.py
        src/pystencils/session.py
ignore = W293 W503 W291 C901
ignore = W293 W503 W291 C901 E741

.gitattributes

0 → 100644
+1 −0
Original line number Original line Diff line number Diff line
src/pystencils/_version.py export-subst
+17 −2
Original line number Original line Diff line number Diff line
__pycache__
__pycache__
.ipynb_checkpoints
.ipynb_checkpoints
.coverage
.coverage*
*.pyc
*.pyc
*.vti
*.vti
/build
/build
/dist
/dist
/*.egg-info
*.egg-info
.cache
.cache
_build
_build
/html_doc
/.idea
/.idea
.vscode
.cache
.cache
_local_tmp
_local_tmp
RELEASE-VERSION
RELEASE-VERSION
test-report
test-report
src/pystencils/boundaries/createindexlistcython.c
src/pystencils/boundaries/createindexlistcython.*.so
tests/tmp
tests/var
tests/kerncraft_inputs/.2d-5pt.c_kerncraft/
tests/kerncraft_inputs/.3d-7pt.c_kerncraft/
report.xml
coverage_report/


# macOS
**/.DS_Store
*.uuid
+241 −63
Original line number Original line Diff line number Diff line
stages:
stages:
  - pretest
  - test
  - test
  - nightly
  - docs
  - deploy
  - deploy




# --------------------------  Templates ------------------------------------------------------------------------------------

# Base configuration for jobs meant to run at every commit
.every-commit:
  rules:
    - if: $CI_PIPELINE_SOURCE != "schedule"

# Configuration for jobs meant to run on each commit to pycodegen/pystencils/master
.every-commit-master:
  rules:
    - if: '$CI_PIPELINE_SOURCE != "schedule" && $CI_PROJECT_PATH == "pycodegen/pystencils" && $CI_COMMIT_BRANCH == "master"'

# Base configuration for jobs meant to run at a schedule
.scheduled:
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule"

# --------------------------  Tests ------------------------------------------------------------------------------------
# --------------------------  Tests ------------------------------------------------------------------------------------


# Normal test - runs on every commit all but "long run" tests
# Normal test - runs on every commit all but "long run" tests
tests-and-coverage:
tests-and-coverage:
  stage: test
  stage: pretest
  except:
  extends: .every-commit
    variables:
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full:cupy12.3
      - $ENABLE_NIGHTLY_BUILDS
  before_script:
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
    - pip install -e .
  script:
  script:
    - env
    - pip list
    - export NUM_CORES=$(nproc --all)
    - export NUM_CORES=$(nproc --all)
    - mkdir -p ~/.config/matplotlib
    - mkdir -p ~/.config/matplotlib
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - mkdir public
    - mkdir public
    - py.test -v -n $NUM_CORES --cov-report html --cov-report term --cov=. -m "not longrun" --html test-report/index.html
    - pytest -v -n $NUM_CORES --cov-report html --cov-report xml --cov-report term --cov=. -m "not longrun" --html test-report/index.html --junitxml=report.xml
    - python -m coverage xml
  tags:
  tags:
    - docker
    - docker
    - cuda
    - cuda11
    - AVX
    - AVX
  coverage: /Total coverage:\s\d+.\d+\%/
  artifacts:
  artifacts:
    when: always
    when: always
    paths:
    paths:
      - coverage_report
      - coverage_report
      - test-report
      - test-report
    reports:
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml
      junit: report.xml


# Nightly test  - runs "long run" jobs only
# Normal test with longruns
test-longrun:
tests-and-coverage-with-longrun:
  stage: test
  stage: test
  only:
  when: manual
    variables:
  allow_failure: true
      - $ENABLE_NIGHTLY_BUILDS
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full:cupy12.3
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  before_script:
    - pip install sympy --upgrade
    - pip install -e .
  script:
  script:
    - env
    - pip list
    - export NUM_CORES=$(nproc --all)
    - export NUM_CORES=$(nproc --all)
    - mkdir -p ~/.config/matplotlib
    - mkdir -p ~/.config/matplotlib
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - py.test -v -n $NUM_CORES --cov-report html --cov-report term --cov=. --html test-report/index.html
    - mkdir public
    - py.test -v -n $NUM_CORES
  tags:
    - docker
    - cuda11
    - AVX

# pipeline with latest python version
latest-python:
  stage: test
  extends: .every-commit
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/latest_python
  before_script:
    - pip install -e .
  script:
    - env
    - pip list
    - pip install -e .
    - export NUM_CORES=$(nproc --all)
    - mkdir -p ~/.config/matplotlib
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - mkdir public
    - py.test -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml
  tags:
  tags:
    - docker
    - docker
    - cuda
    - AVX
    - AVX
  artifacts:
  artifacts:
    paths:
    when: always
      - coverage_report
    reports:
      - test-report
      junit: report.xml



# Minimal tests in windows environment
# Minimal tests in windows environment
minimal-windows:
#minimal-windows:
#  stage: test
#  tags:
#    - win
#  script:
#    - export NUM_CORES=$(nproc --all)
#    - source /cygdrive/c/Users/build/Miniconda3/Scripts/activate
#    - source activate pystencils
#    - pip install joblib
#    - pip list
#    - python -c "import numpy"
#    - py.test -v -m "not (notebook or longrun)"

ubuntu:
  stage: test
  stage: test
  except:
  extends: .every-commit
    variables:
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/ubuntu
      - $ENABLE_NIGHTLY_BUILDS
  before_script:
  tags:
    - ln -s /usr/include/locale.h /usr/include/xlocale.h
    - win
    - pip3 install -e .
  script:
  script:
    - source /cygdrive/c/Users/build/Miniconda3/Scripts/activate
    - export NUM_CORES=$(nproc --all)
    - source activate pystencils_dev
    - mkdir -p ~/.config/matplotlib
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - sed -i 's/--doctest-modules //g' pytest.ini
    - env
    - env
    - conda env list
    - pip list
    - python -c "import numpy"
    - pytest -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml
    - python setup.py quicktest
  tags:
    - docker
    - cuda11
    - AVX
  artifacts:
    when: always
    reports:
      junit: report.xml


minimal-ubuntu:
.multiarch_template:
  stage: test
  stage: test
  except:
  extends: .every-commit
    variables:
  allow_failure: true
      - $ENABLE_NIGHTLY_BUILDS
  before_script: &multiarch_before_script
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_ubuntu
    # - pip3 install -v .
    - export PYTHONPATH=src
    - python3 -c "import pystencils as ps; ps.cpu.cpujit.read_config()"
    - sed -i '/^fail_under.*/d' pytest.ini
  script:
  script:
    - python3 setup.py quicktest
    - export NUM_CORES=$(nproc --all)
    - mkdir -p ~/.config/matplotlib
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - sed -i 's/--doctest-modules //g' pytest.ini
    - env
    - pip3 list
    - python3 -m pytest -v -n $NUM_CORES --reruns 2 --cov-report html --cov-report xml --cov=. --junitxml=report.xml tests/test_*vec*.py tests/test_random.py tests/test_half_precision.py
    - python3 -m coverage xml
  tags:
  tags:
    - docker
    - docker
    - multiarch
  artifacts:
    when: always
    paths:
      - coverage_report
    reports:
      coverage_report:
        coverage_format: cobertura
        path: coverage.xml
      junit: report.xml


minimal-conda:
arm64v8:
  stage: test
  extends: .multiarch_template
  except:
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/arm64
  variables:
    QEMU_CPU: "cortex-a76"
  before_script:
    - *multiarch_before_script

ppc64le:
  extends: .multiarch_template
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/ppc64le
  before_script:
    - *multiarch_before_script

arm64v9:
  # SVE support is still unreliable in GCC 13 (incorrect code for fixed-width vectors, internal compiler errors).
  # For half precision Clang is necessary
  extends: .multiarch_template
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/arm64
  variables:
  variables:
      - $ENABLE_NIGHTLY_BUILDS
    # disable pointer authentication to speed up emulation by 3x
    QEMU_CPU: "max,pauth-impdef=on"
  before_script:
    - *multiarch_before_script
    - sed -i s/g\+\+/clang++/g ~/.config/pystencils/config.json

riscv64:
  # RISC-V vector extension support is incomplete in GCC 13.
  extends: .multiarch_template
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/riscv64
  variables:
    # explicitly set SIMD as detection requires QEMU >= 8.1
    PYSTENCILS_SIMD: "rvv"
    QEMU_CPU: "rv64,v=true,zicboz=true"
  before_script:
    - *multiarch_before_script
    - sed -i 's/march=native/march=rv64imfdvzicboz/g' ~/.config/pystencils/config.json
    - sed -i s/g\+\+/clang++/g ~/.config/pystencils/config.json

minimal-conda:
  stage: pretest
  extends: .every-commit
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_conda
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_conda
  before_script:
    - pip install -e .
  script:
  script:
    - python setup.py quicktest
    - python quicktest.py
  tags:
  tags:
    - docker
    - docker
    - cuda




minimal-sympy-master:
minimal-sympy-master:
  stage: test
  stage: test
  except:
  extends: .every-commit
    variables:
      - $ENABLE_NIGHTLY_BUILDS
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_conda
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/minimal_conda
  before_script:
    - pip install -e .
  script:
  script:
    - python -m pip install --upgrade git+https://github.com/sympy/sympy.git
    - python -m pip install --upgrade git+https://github.com/sympy/sympy.git
    - python setup.py quicktest
    - python quicktest.py
  allow_failure: true
  allow_failure: true
  tags:
  tags:
    - docker
    - docker
    - cuda




pycodegen-integration:
pycodegen-integration:
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  stage: test
  stage: test
  when: manual
  when: manual
  allow_failure: true
  script:
  script:
    - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pycodegen.git
    - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@i10git.cs.fau.de/pycodegen/pycodegen.git
    - cd pycodegen
    - cd pycodegen
@@ -118,50 +257,89 @@ pycodegen-integration:
    - git fetch test
    - git fetch test
    - git reset --hard $CI_COMMIT_SHA
    - git reset --hard $CI_COMMIT_SHA
    - cd ..
    - cd ..
    - export PYTHONPATH=`pwd`/pystencils:`pwd`/lbmpy:`pwd`/pygrandchem:`pwd`/pystencils_walberla:`pwd`/lbmpy_walberla
    - pip install -e pystencils/
    - pip install -e lbmpy/
    - cmake --version
    - ./install_walberla.sh
    - ./install_walberla.sh
    - export NUM_CORES=$(nproc --all)
    - export NUM_CORES=$(nproc --all)
    - mkdir -p ~/.config/matplotlib
    - mkdir -p ~/.config/matplotlib
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - cd pystencils
    - cd pystencils
    - py.test -v -n $NUM_CORES .
    - py.test -v -n $NUM_CORES --junitxml=report.xml .
    - cd ../lbmpy
    - cd ../lbmpy
    - py.test -v -n $NUM_CORES .
    - py.test -v -n $NUM_CORES --junitxml=report.xml .
    - cd ../pygrandchem
    - py.test -v -n $NUM_CORES .
    - cd ../walberla/build/
    - cd ../walberla/build/
    - make CodegenJacobiCPU CodegenJacobiGPU MicroBenchmarkGpuLbm LbCodeGenerationExample
    - make -j $NUM_CORES CodegenJacobiCPU CodegenJacobiGPU CodegenPoissonCPU CodegenPoissonGPU MicroBenchmarkGpuLbm LbCodeGenerationExample
    - make -j $NUM_CORES multiphaseCPU multiphaseGPU FluctuatingMRT FlowAroundSphereCodeGen FieldLayoutAndVectorizationTest GeneratedOutflowBC
    - cd apps/benchmarks/UniformGridGPU
    - make -j $NUM_CORES
    - cd ../UniformGridCPU
    - make -j $NUM_CORES
  tags:
  tags:
    - docker
    - docker
    - cuda
    - cuda11
    - AVX
    - AVX
  artifacts:
    when: always
    reports:
      junit: pycodegen/*/report.xml


# -------------------- Scheduled Tasks --------------------------------------------------------------------------


# Nightly test against the latest (pre-release) version of SymPy published on PyPI
nightly-sympy:
  stage: nightly
  needs: []
  extends: .scheduled
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/latest_python
  before_script:
    - pip install -e .
    - pip install --upgrade --pre sympy
  script:
    - env
    - pip list
    - export NUM_CORES=$(nproc --all)
    - mkdir -p ~/.config/matplotlib
    - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
    - mkdir public
    - pytest -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml
  tags:
    - docker
    - AVX
    - cuda
  artifacts:
    when: always
    reports:
      junit: report.xml


# -------------------- Linter & Documentation --------------------------------------------------------------------------
# -------------------- Linter & Documentation --------------------------------------------------------------------------




flake8-lint:
flake8-lint:
  stage: test
  stage: pretest
  except:
  extends: .every-commit
    variables:
      - $ENABLE_NIGHTLY_BUILDS
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  script:
  script:
    - flake8 pystencils
    - flake8 src/pystencils
  tags:
  tags:
    - docker
    - docker
    - cuda




build-documentation:
build-documentation:
  stage: test
  stage: docs
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  extends: .every-commit
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/documentation
  needs: []
  before_script:
    - pip install -e .
  script:
  script:
    - export PYTHONPATH=`pwd`
    - mkdir html_doc
    - mkdir html_doc
    - sphinx-build -b html doc  html_doc
    - sphinx-build -W -b html doc  html_doc
    - sphinx-build -W -b html doc  html_doc
  tags:
  tags:
    - docker
    - docker
    - cuda
  artifacts:
  artifacts:
    paths:
    paths:
      - html_doc
      - html_doc
@@ -169,7 +347,9 @@ build-documentation:


pages:
pages:
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full
  extends: .every-commit-master
  stage: deploy
  stage: deploy
  needs: ["tests-and-coverage", "build-documentation"]
  script:
  script:
    - ls -l
    - ls -l
    - mv coverage_report html_doc
    - mv coverage_report html_doc
@@ -179,5 +359,3 @@ pages:
      - public
      - public
  tags:
  tags:
    - docker
    - docker
  only:
    - master@pycodegen/pystencils
+1 −0
Original line number Original line Diff line number Diff line
@@ -2,3 +2,4 @@
line_length=100
line_length=100
balanced_wrapping=True
balanced_wrapping=True
multi_line_output=4
multi_line_output=4
known_third_party=sympy
+6 −5
Original line number Original line Diff line number Diff line
@@ -3,12 +3,13 @@ Contributors:
-------------
-------------


  - Martin Bauer <martin.bauer@fau.de>
  - Martin Bauer <martin.bauer@fau.de>
  - Markus Holzer <markus.holzer@fau.de>
  - Stephan Seitz <stephan.seitz@fau.de>
  - Stephan Seitz <stephan.seitz@fau.de>
  - Michael Kuron <mkuron@icp.uni-stuttgart.de>
  - Jan Hönig <jan.hoenig@fau.de>
  - Jan Hönig <jan.hoenig@fau.de>
  - Nils Kohl <nils.kohl@fau.de>
  - Julian Hammer <julian.hammer@fau.de>
  - Julian Hammer <julian.hammer@fau.de>
  - Christian Godenschwager <christian.godenschwager@fau.de>
  - Nils Kohl <nils.kohl@fau.de>
  - Markus Holzer <markus.holzer@fau.de>
  - Frederik Hennig <frederik.hennig@fau.de>
  - Michael Kuron <mkuron@icp.uni-stuttgart.de>
  - Dominik Ernst <dominik.ernst@fau.de>
  - Dominik Ernst <dominik.ernst@fau.de>
  - João Victor Tozatti Risso <joaovictortr@protonmail.com>
  - Christian Godenschwager <christian.godenschwager@fau.de>
  - Dominik Thoennes <dominik.thoennes@fau.de>

CHANGELOG.md

0 → 100644
+7 −0
Original line number Original line Diff line number Diff line
# Change Log

## Unreleased

### Removed
* LLVM backend because it was not used much and not good integrated in pystencils.
* OpenCL backend because it was not used much and not good integrated in pystencils.

CONTRIBUTING.md

0 → 100644
+87 −0
Original line number Original line Diff line number Diff line
# Contributing

Contributions to pystencils are always welcome, and they are greatly appreciated!
A list of open problems can be found [here]( https://i10git.cs.fau.de/pycodegen/pystencils/-/issues).
Of course, it is also always appreciated to bring own ideas and problems to the community!


Please submit all contributions to the official [GitLab repository](https://i10git.cs.fau.de/pycodegen/pystencils) in the form of a Merge Request. Please do not submit git diffs or files containing the changes.
There also exists a GitHub repository, which is only a mirror to the GitLab repository. Contributions to the GitHub repository are not considered.

`pystencils` is an open-source python package under the license of  AGPL3. Thus we consider the act of contributing to the code by submitting a Merge Request as the "Sign off" or agreement to the AGPL3 license.

You can contribute in many different ways:

## Types of Contributions

### Report Bugs

Report bugs at [https://i10git.cs.fau.de/pycodegen/pystencils/-/issues](https://i10git.cs.fau.de/pycodegen/pystencils/-/issues).

For pystencils, it is often necessary to provide the python and [SymPy](https://www.sympy.org/en/index.html) versions used and hardware information like the
processor architecture and the compiler version used to compile the generated kernels.

### Fix Issues

Look through the GitLab issues. Different tags are indicating the status of the issues.
The "bug" tag indicates problems with pystencils, while the "feature" tag shows ideas that should be added in the future.

### Write Documentation

The documentation of pystencils can be found [here](https://pycodegen.pages.i10git.cs.fau.de/pystencils/). Jupyter notebooks are used to provide an
interactive start to pystencils. It is always appreciated if new document notebooks are provided
since this helps others a lot.

## Get Started!

Ready to contribute? Here is how to set up `pystencils` for local development.

1. Fork the `pystencils` repo on GitLab.
2. Clone your fork locally:
```bash
    $ git clone https://i10git.cs.fau.de/your-name/pystencils
```
3. Install your local copy into a virtualenv. It is also recommended to use anaconda or miniconda to manage the python environments.
```bash
    $ mkvirtualenv pystencils
    $ cd pystencils/
    $ pip install -e .
```
4. Create a branch for local development:
```bash
    $ git checkout -b name-of-your-bugfix-or-feature
```
   Now you can make your changes locally.

5. When you're done making changes, check that your changes pass flake8 and the
   tests
```bash
    $ flake8 pystencils
    $ py.test -v -n $NUM_CORES -m "not longrun" .
   
```

   To get all packages needed for development, a requirements list can be found [here](https://i10git.cs.fau.de/pycodegen/pycodegen/-/blob/master/conda_environment_dev.yml). This includes flake8 and pytest.

6. Commit your changes and push your branch to GitHub::
```bash
    $ git add .
    $ git commit -m "Your detailed description of your changes."
    $ git push origin name-of-your-bugfix-or-feature
```
7. Submit a Merge Request on GitLab.

## Merge Request Guidelines

Before you submit a Merge Request, check that it meets these guidelines:

1. All functionality that is implemented through this Merge Request should be covered by unit tests. These are implemented in `pystencil_tests`
2. If the Merge Request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring.
3. If you have a maintainer status for `pystencils`, you can merge Merge Requests to the master branch. However, every Merge Request needs to be reviewed by another developer. Thus it is not allowed to merge a Merge Request, which is submitted by oneself.

## Tips

To run a subset of tests:
```bash
$ py.test my_test.py
```
 No newline at end of file
+3 −3
Original line number Original line Diff line number Diff line
include README.md
include AUTHORS.txt
include COPYING.txt
include CONTRIBUTING.md
include RELEASE-VERSION
include CHANGELOG.md
+28 −14
Original line number Original line Diff line number Diff line
@@ -2,16 +2,16 @@ pystencils
==========
==========


[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/mabau/pystencils/master?filepath=doc%2Fnotebooks)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/mabau/pystencils/master?filepath=doc%2Fnotebooks)
[![Docs](https://img.shields.io/badge/read-the_docs-brightgreen.svg)](http://pycodegen.pages.walberla.net/pystencils)
[![Docs](https://img.shields.io/badge/read-the_docs-brightgreen.svg)](https://pycodegen.pages.i10git.cs.fau.de/pystencils)
[![pypi-package](https://badge.fury.io/py/pystencils.svg)](https://badge.fury.io/py/pystencils)
[![pypi-package](https://badge.fury.io/py/pystencils.svg)](https://badge.fury.io/py/pystencils)
[![pipeline status](https://i10git.cs.fau.de/pycodegen/pystencils/badges/master/pipeline.svg)](https://i10git.cs.fau.de/pycodegen/pystencils/commits/master)
[![pipeline status](https://i10git.cs.fau.de/pycodegen/pystencils/badges/master/pipeline.svg)](https://i10git.cs.fau.de/pycodegen/pystencils/commits/master)
[![coverage report](https://i10git.cs.fau.de/pycodegen/pystencils/badges/master/coverage.svg)](http://pycodegen.pages.walberla.net/pystencils/coverage_report)
[![coverage report](https://i10git.cs.fau.de/pycodegen/pystencils/badges/master/coverage.svg)](http://pycodegen.pages.i10git.cs.fau.de/pystencils/coverage_report)


Run blazingly fast stencil codes on numpy arrays.
Run blazingly fast stencil codes on numpy arrays.


*pystencils* uses sympy to define stencil operations, that can be executed on numpy arrays.
*pystencils* uses sympy to define stencil operations, that can be executed on numpy arrays.
Exploiting the stencil structure makes *pystencils* run faster than normal numpy code and even as Cython and numba,
Exploiting the stencil structure makes *pystencils* run faster than normal numpy code and even as Cython and numba,
[as demonstrated in this notebook](http://pycodegen.pages.walberla.net/pystencils/notebooks/demo_benchmark.html).
[as demonstrated in this notebook](https://pycodegen.pages.i10git.cs.fau.de/pystencils/notebooks/demo_benchmark.html).




Here is a code snippet that computes the average of neighboring cells:
Here is a code snippet that computes the average of neighboring cells:
@@ -33,15 +33,15 @@ kernel(f=f_arr, g=g_arr)
It comes with automatic finite difference discretization for PDEs:
It comes with automatic finite difference discretization for PDEs:


```python
```python
import pystencils as ps
import sympy as sp

c, v = ps.fields("c, v(2): [2D]")
c, v = ps.fields("c, v(2): [2D]")
adv_diff_pde = ps.fd.transient(c) - ps.fd.diffusion(c, sp.symbols("D")) + ps.fd.advection(c, v)
adv_diff_pde = ps.fd.transient(c) - ps.fd.diffusion(c, sp.symbols("D")) + ps.fd.advection(c, v)
discretize = ps.fd.Discretization2ndOrder(dx=1, dt=0.01)
discretize = ps.fd.Discretization2ndOrder(dx=1, dt=0.01)
discretization = discretize(adv_diff_pde)
discretization = discretize(adv_diff_pde)
```
```


Look at the [documentation](http://pycodegen.pages.walberla.net/pystencils) to learn more.


Installation
Installation
------------
------------


@@ -52,12 +52,10 @@ pip install pystencils[interactive]
Without `[interactive]` you get a minimal version with very little dependencies.
Without `[interactive]` you get a minimal version with very little dependencies.


All options:
All options:
-  `gpu`: use this if an Nvidia GPU is available and CUDA is installed
- `gpu`: use this if an NVIDIA or AMD GPU is available and CUDA or ROCm is installed
-  `pyopencl`: basic OpenCL support (experimental)
- `alltrafos`: pulls in additional dependencies for loop simplification e.g. libisl
- `alltrafos`: pulls in additional dependencies for loop simplification e.g. libisl
- `bench_db`: functionality to store benchmark result in object databases
- `bench_db`: functionality to store benchmark result in object databases
- `interactive`: installs dependencies to work in Jupyter including image I/O, plotting etc.
- `interactive`: installs dependencies to work in Jupyter including image I/O, plotting etc.
- `autodiff`: enable derivation of adjoint kernels and generation of Torch/Tensorflow operations
- `doc`: packages to build documentation
- `doc`: packages to build documentation


Options can be combined e.g.
Options can be combined e.g.
@@ -65,9 +63,25 @@ Options can be combined e.g.
pip install pystencils[interactive, gpu, doc]
pip install pystencils[interactive, gpu, doc]
```
```


pystencils is also fully compatible with Windows machines. If working with visual studio and cupy makes sure to run example files first to ensure that cupy can find the compiler's executable.


Documentation
Documentation
-------------
-------------


Read the docs [here](http://pycodegen.pages.walberla.net/pystencils) and
Read the docs [here](https://pycodegen.pages.i10git.cs.fau.de/pystencils) and
check out the Jupyter notebooks in `doc/notebooks`.
check out the Jupyter notebooks in `doc/notebooks`. The **Changelog** of pystencils can be found [here](https://i10git.cs.fau.de/pycodegen/pystencils/-/blob/master/CHANGELOG.md).

Authors
-------

Many thanks go to the [contributors](https://i10git.cs.fau.de/pycodegen/pystencils/-/blob/master/AUTHORS.txt) of pystencils.

### Please cite us

If you use pystencils in a publication, please cite the following articles:

Overview:
  - M. Bauer et al, Code Generation for Massively Parallel Phase-Field Simulations. Association for Computing Machinery, 2019. https://doi.org/10.1145/3295500.3356186

Performance Modelling:
  - D. Ernst et al, Analytical performance estimation during code generation on modern GPUs. Journal of Parallel and Distributed Computing, 2023. https://doi.org/10.1016/j.jpdc.2022.11.003
Original line number Original line Diff line number Diff line
@@ -7,14 +7,14 @@
#     conda env create -f conda_environment_user.yml
#     conda env create -f conda_environment_user.yml
#     . activate pystencils
#     . activate pystencils
#
#
# If you have CUDA installed and want to use your GPU, uncomment the last line to install pycuda
# If you have CUDA or ROCm installed and want to use your GPU, uncomment the last line to install cupy
#
#
# ----------------------------------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------------------------------------


name: pystencils
name: pystencils
dependencies:
dependencies:
  # Basic dependencies:
  # Basic dependencies:
  - python >= 3.6
  - python >= 3.8
  - numpy
  - numpy
  - sympy >= 1.1
  - sympy >= 1.1
  - appdirs # to find default cache directory on each platform
  - appdirs # to find default cache directory on each platform
@@ -32,4 +32,4 @@ dependencies:
      - ipy_table  # HTML tables for jupyter notebooks
      - ipy_table  # HTML tables for jupyter notebooks
      - pyevtk # VTK output for serial simulations
      - pyevtk # VTK output for serial simulations
      - blitzdb # file-based No-SQL database to store simulation results
      - blitzdb # file-based No-SQL database to store simulation results
      #- pycuda # add this if you have CUDA installed
      #- cupy # add this if you have CUDA or ROCm installed
+53 −34
Original line number Original line Diff line number Diff line
import os
import os
import pytest
import tempfile
import runpy
import runpy
import sys
import sys
import tempfile
import warnings

import nbformat
import pytest
from nbconvert import PythonExporter

from pystencils.boundaries.createindexlist import *  # NOQA
# Trigger config file reading / creation once - to avoid race conditions when multiple instances are creating it
# Trigger config file reading / creation once - to avoid race conditions when multiple instances are creating it
# at the same time
# at the same time
from pystencils.cpu import cpujit
from pystencils.cpu import cpujit
@@ -14,12 +20,17 @@ try:
    pyximport.install(language_level=3)
    pyximport.install(language_level=3)
except ImportError:
except ImportError:
    pass
    pass
from pystencils.boundaries.createindexlistcython import *  # NOQA




SCRIPT_FOLDER = os.path.dirname(os.path.realpath(__file__))
SCRIPT_FOLDER = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.abspath('pystencils'))
sys.path.insert(0, os.path.abspath('pystencils'))


# the Ubuntu pipeline uses an older version of pytest which uses deprecated functionality.
# This leads to many warinings in the test and coverage pipeline.
pytest_numeric_version = [int(x, 10) for x in pytest.__version__.split('.')]
pytest_numeric_version.reverse()
pytest_version = sum(x * (100 ** i) for i, x in enumerate(pytest_numeric_version))



def add_path_to_ignore(path):
def add_path_to_ignore(path):
    if not os.path.exists(path):
    if not os.path.exists(path):
@@ -28,46 +39,49 @@ def add_path_to_ignore(path):
    collect_ignore += [os.path.join(SCRIPT_FOLDER, path, f) for f in os.listdir(os.path.join(SCRIPT_FOLDER, path))]
    collect_ignore += [os.path.join(SCRIPT_FOLDER, path, f) for f in os.listdir(os.path.join(SCRIPT_FOLDER, path))]




collect_ignore = [os.path.join(SCRIPT_FOLDER, "doc", "conf.py")]
collect_ignore = [os.path.join(SCRIPT_FOLDER, "doc", "conf.py"),
add_path_to_ignore('pystencils_tests/benchmark')
                  os.path.join(SCRIPT_FOLDER, "src", "pystencils", "opencl", "opencl.autoinit")]
add_path_to_ignore('tests/benchmark')
add_path_to_ignore('_local_tmp')
add_path_to_ignore('_local_tmp')




collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/autodiff.py")]

try:
try:
    import pycuda
    import cupy
except ImportError:
except ImportError:
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/pystencils_tests/test_cudagpu.py")]
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_gpu.py")]
    add_path_to_ignore('pystencils/gpucuda')
    add_path_to_ignore('src/pystencils/gpu')


try:
try:
    import llvmlite
    import waLBerla
except ImportError:
except ImportError:
    collect_ignore += [os.path.join(SCRIPT_FOLDER, 'pystencils_tests/backends/llvm.py')]
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_aligned_array.py"),
    add_path_to_ignore('pystencils/llvm')
                       os.path.join(SCRIPT_FOLDER, "tests/test_datahandling_parallel.py"),
                       os.path.join(SCRIPT_FOLDER, "doc/notebooks/03_tutorial_datahandling.ipynb"),
                       os.path.join(SCRIPT_FOLDER, "src/pystencils/datahandling/parallel_datahandling.py"),
                       os.path.join(SCRIPT_FOLDER, "tests/test_small_block_benchmark.ipynb")]


try:
try:
    import kerncraft
    import blitzdb
except ImportError:
except ImportError:
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_kerncraft_coupling.py"),
    add_path_to_ignore('src/pystencils/runhelper')
                       os.path.join(SCRIPT_FOLDER, "pystencils_tests/benchmark/benchmark.py")]
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_parameterstudy.py")]
    add_path_to_ignore('pystencils/kerncraft_coupling')
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_json_serializer.py")]


try:
try:
    import waLBerla
    import islpy
except ImportError:
except ImportError:
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_aligned_array.py"),
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "src/pystencils/integer_set_analysis.py")]
                       os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_datahandling_parallel.py"),
                       os.path.join(SCRIPT_FOLDER, "doc/notebooks/03_tutorial_datahandling.ipynb"),
                       os.path.join(SCRIPT_FOLDER, "pystencils/datahandling/parallel_datahandling.py"),
                       os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_small_block_benchmark.ipynb")]


try:
try:
    import blitzdb
    import graphviz
except ImportError:
except ImportError:
    add_path_to_ignore('pystencils/runhelper')
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "src/pystencils/backends/dot.py")]
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "doc/notebooks/01_tutorial_getting_started.ipynb")]


try:
    import pyevtk
except ImportError:
    collect_ignore += [os.path.join(SCRIPT_FOLDER, "src/pystencils/datahandling/vtk.py")]


collect_ignore += [os.path.join(SCRIPT_FOLDER, 'setup.py')]
collect_ignore += [os.path.join(SCRIPT_FOLDER, 'setup.py')]


@@ -77,10 +91,6 @@ for root, sub_dirs, files in os.walk('.'):
            collect_ignore.append(f)
            collect_ignore.append(f)




import nbformat
from nbconvert import PythonExporter


class IPythonMockup:
class IPythonMockup:
    def run_line_magic(self, *args, **kwargs):
    def run_line_magic(self, *args, **kwargs):
        pass
        pass
@@ -127,9 +137,15 @@ class IPyNbFile(pytest.File):
        exporter.exclude_markdown = True
        exporter.exclude_markdown = True
        exporter.exclude_input_prompt = True
        exporter.exclude_input_prompt = True


        notebook_contents = self.fspath.open()
        notebook_contents = self.fspath.open(encoding='utf-8')

        with warnings.catch_warnings():
            warnings.filterwarnings("ignore", "IPython.core.inputsplitter is deprecated")
            notebook = nbformat.read(notebook_contents, 4)
            notebook = nbformat.read(notebook_contents, 4)
            code, _ = exporter.from_notebook_node(notebook)
            code, _ = exporter.from_notebook_node(notebook)
        if pytest_version >= 50403:
            yield IPyNbTest.from_parent(name=self.name, parent=self, code=code)
        else:
            yield IPyNbTest(self.name, self, code)
            yield IPyNbTest(self.name, self, code)


    def teardown(self):
    def teardown(self):
@@ -139,4 +155,7 @@ class IPyNbFile(pytest.File):
def pytest_collect_file(path, parent):
def pytest_collect_file(path, parent):
    glob_exprs = ["*demo*.ipynb", "*tutorial*.ipynb", "test_*.ipynb"]
    glob_exprs = ["*demo*.ipynb", "*tutorial*.ipynb", "test_*.ipynb"]
    if any(path.fnmatch(g) for g in glob_exprs):
    if any(path.fnmatch(g) for g in glob_exprs):
        if pytest_version >= 50403:
            return IPyNbFile.from_parent(fspath=path, parent=parent)
        else:
            return IPyNbFile(path, parent)
            return IPyNbFile(path, parent)

doc/conf.py

100644 → 100755
+13 −8
Original line number Original line Diff line number Diff line
@@ -4,10 +4,11 @@
import datetime
import datetime
import sphinx_rtd_theme
import sphinx_rtd_theme
import os
import os
import re
import sys
import sys


sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('.'))
from version_from_git import version_number_from_git
import pystencils


extensions = [
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.autodoc',
@@ -25,11 +26,14 @@ templates_path = ['_templates']
source_suffix = '.rst'
source_suffix = '.rst'
master_doc = 'index'
master_doc = 'index'


copyright = '{}, Martin Bauer'.format(datetime.datetime.now().year)
copyright = f'{datetime.datetime.now().year}, Martin Bauer, Markus Holzer, Frederik Hennig'
author = 'Martin Bauer'
author = 'Martin Bauer, Markus Holzer, Frederik Hennig'
version = version_number_from_git()
# The short X.Y version (including .devXXXX, rcX, b1 suffixes if present)
release = version_number_from_git()
version = re.sub(r'(\d+\.\d+)\.\d+(.*)', r'\1\2', pystencils.__version__)
language = None
version = re.sub(r'(\.dev\d+).*?$', r'\1', version)
# The full version, including alpha/beta/rc tags.
release = pystencils.__version__
language = 'en'
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**.ipynb_checkpoints']
default_role = 'any'
default_role = 'any'
pygments_style = 'sphinx'
pygments_style = 'sphinx'
@@ -47,13 +51,14 @@ nbsphinx_execute = 'never'
nbsphinx_codecell_lexer = 'python3'
nbsphinx_codecell_lexer = 'python3'


# Example configuration for intersphinx: refer to the Python standard library.
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'python': ('https://docs.python.org/3.6', None),
intersphinx_mapping = {'python': ('https://docs.python.org/3.8', None),
                       'numpy': ('https://docs.scipy.org/doc/numpy/', None),
                       'numpy': ('https://docs.scipy.org/doc/numpy/', None),
                       'matplotlib': ('https://matplotlib.org/', None),
                       'matplotlib': ('https://matplotlib.org/', None),
                       'sympy': ('https://docs.sympy.org/latest/', None),
                       'sympy': ('https://docs.sympy.org/latest/', None),
                       }
                       }


autodoc_member_order = 'bysource'
autodoc_member_order = 'bysource'
bibtex_bibfiles = ['sphinx/pystencils.bib']


project = 'pystencils'
project = 'pystencils'
html_logo = "img/logo.png"
html_logo = 'img/logo.png'
+1 −0
Original line number Original line Diff line number Diff line
@@ -14,5 +14,6 @@ pystencils can help you to generate blazingly fast code for image processing, nu


.. image:: /img/pystencils_arch_block_diagram.svg
.. image:: /img/pystencils_arch_block_diagram.svg
    :height: 450px
    :height: 450px
    :align: center