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

Target

Select target project
No results found
Show changes
Commits on Source (187)
Showing
with 1067 additions and 1069 deletions
[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 E741 ignore = W293 W503 W291 C901 E741
pystencils/_version.py export-subst src/pystencils/_version.py export-subst
...@@ -5,7 +5,7 @@ __pycache__ ...@@ -5,7 +5,7 @@ __pycache__
*.vti *.vti
/build /build
/dist /dist
/*.egg-info *.egg-info
.cache .cache
_build _build
/html_doc /html_doc
...@@ -15,15 +15,16 @@ _build ...@@ -15,15 +15,16 @@ _build
_local_tmp _local_tmp
RELEASE-VERSION RELEASE-VERSION
test-report test-report
pystencils/boundaries/createindexlistcython.c src/pystencils/boundaries/createindexlistcython.c
pystencils/boundaries/createindexlistcython.*.so src/pystencils/boundaries/createindexlistcython.*.so
pystencils_tests/tmp tests/tmp
pystencils_tests/var tests/var
pystencils_tests/kerncraft_inputs/.2d-5pt.c_kerncraft/ tests/kerncraft_inputs/.2d-5pt.c_kerncraft/
pystencils_tests/kerncraft_inputs/.3d-7pt.c_kerncraft/ tests/kerncraft_inputs/.3d-7pt.c_kerncraft/
report.xml report.xml
coverage_report/ coverage_report/
# macOS # macOS
**/.DS_Store **/.DS_Store
*.uuid
stages: stages:
- pretest - 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: pretest 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:
- pip install sympy --upgrade
- env - env
- pip list - 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 --junitxml=report.xml - 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
- python3 -m coverage xml - python -m coverage xml
tags: tags:
- docker - docker
- cuda11 - 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: reports:
cobertura: coverage.xml coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: report.xml junit: report.xml
# pipeline with latest python version # Normal test with longruns
latest-python: tests-and-coverage-with-longrun:
stage: test stage: test
except: 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/latest_python before_script:
- pip install sympy --upgrade
- pip install -e .
script: script:
- env - env
- pip list - pip list
...@@ -50,75 +73,66 @@ latest-python: ...@@ -50,75 +73,66 @@ latest-python:
- 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 -m "not longrun" --junitxml=report.xml - py.test -v -n $NUM_CORES
tags: tags:
- docker - docker
- cuda11
- AVX - AVX
artifacts:
when: always
reports:
junit: report.xml
# Nightly test - runs "long run" jobs only # pipeline with latest python version
test-longrun: latest-python:
stage: test stage: test
only: extends: .every-commit
variables: image: i10git.cs.fau.de:5005/pycodegen/pycodegen/latest_python
- $ENABLE_NIGHTLY_BUILDS before_script:
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/full - pip install -e .
script: script:
- env
- pip list
- pip install -e .
- 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 --junitxml=report.xml - mkdir public
- py.test -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml
tags: tags:
- docker - docker
- cuda11
- AVX - AVX
artifacts: artifacts:
when: always when: always
paths:
- coverage_report
- test-report
reports: reports:
junit: report.xml junit: report.xml
# Minimal tests in windows environment # Minimal tests in windows environment
minimal-windows: #minimal-windows:
stage: test # stage: test
except: # tags:
variables: # - win
- $ENABLE_NIGHTLY_BUILDS # script:
tags: # - export NUM_CORES=$(nproc --all)
- win # - source /cygdrive/c/Users/build/Miniconda3/Scripts/activate
script: # - source activate pystencils
- export NUM_CORES=$(nproc --all) # - pip install joblib
- source /cygdrive/c/Users/build/Miniconda3/Scripts/activate # - pip list
- source activate pystencils # - python -c "import numpy"
- pip install joblib # - py.test -v -m "not (notebook or longrun)"
- pip list
- python -c "import numpy"
- py.test -v -m "not (notebook or longrun)"
ubuntu: ubuntu:
stage: test stage: test
except: extends: .every-commit
variables:
- $ENABLE_NIGHTLY_BUILDS
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/ubuntu image: i10git.cs.fau.de:5005/pycodegen/pycodegen/ubuntu
before_script: before_script:
- apt-get -y remove python3-sympy
- ln -s /usr/include/locale.h /usr/include/xlocale.h - ln -s /usr/include/locale.h /usr/include/xlocale.h
- pip3 install `grep -Eo 'sympy[>=]+[0-9\.]+' setup.py | sed 's/>/=/g'` - pip3 install -e .
# - pip3 install `grep -Eo 'sympy[>=]+[0-9\.]+' setup.py | sed 's/>/=/g'`
script: script:
- 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
- sed -i 's/--doctest-modules //g' pytest.ini - sed -i 's/--doctest-modules //g' pytest.ini
- env - env
- pip3 list - pip list
- pytest-3 -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml - pytest -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml
tags: tags:
- docker - docker
- cuda11 - cuda11
...@@ -130,10 +144,11 @@ ubuntu: ...@@ -130,10 +144,11 @@ ubuntu:
.multiarch_template: .multiarch_template:
stage: test stage: test
except: extends: .every-commit
variables: allow_failure: true
- $ENABLE_NIGHTLY_BUILDS
before_script: &multiarch_before_script before_script: &multiarch_before_script
# - pip3 install -v .
- export PYTHONPATH=src
- python3 -c "import pystencils as ps; ps.cpu.cpujit.read_config()" - python3 -c "import pystencils as ps; ps.cpu.cpujit.read_config()"
- sed -i '/^fail_under.*/d' pytest.ini - sed -i '/^fail_under.*/d' pytest.ini
script: script:
...@@ -143,20 +158,26 @@ ubuntu: ...@@ -143,20 +158,26 @@ ubuntu:
- sed -i 's/--doctest-modules //g' pytest.ini - sed -i 's/--doctest-modules //g' pytest.ini
- env - env
- pip3 list - pip3 list
- pytest-3 -v -n $NUM_CORES --junitxml=report.xml pystencils_tests/test_*vec*.py pystencils_tests/test_random.py - python3 -m pytest -v -n $NUM_CORES --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
- AVX - AVX
artifacts: artifacts:
when: always when: always
paths:
- coverage_report
reports: reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: report.xml junit: report.xml
arm64v8: arm64v8:
extends: .multiarch_template extends: .multiarch_template
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/arm64 image: i10git.cs.fau.de:5005/pycodegen/pycodegen/arm64
variables: variables:
PYSTENCILS_SIMD: "neon" QEMU_CPU: "cortex-a76"
before_script: before_script:
- *multiarch_before_script - *multiarch_before_script
- sed -i s/march=native/march=armv8-a/g ~/.config/pystencils/config.json - sed -i s/march=native/march=armv8-a/g ~/.config/pystencils/config.json
...@@ -164,51 +185,41 @@ arm64v8: ...@@ -164,51 +185,41 @@ arm64v8:
ppc64le: ppc64le:
extends: .multiarch_template extends: .multiarch_template
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/ppc64le image: i10git.cs.fau.de:5005/pycodegen/pycodegen/ppc64le
variables:
PYSTENCILS_SIMD: "vsx"
before_script: before_script:
- *multiarch_before_script - *multiarch_before_script
- sed -i s/mcpu=native/mcpu=power8/g ~/.config/pystencils/config.json - sed -i s/mcpu=native/mcpu=power8/g ~/.config/pystencils/config.json
arm64v9: arm64v9:
# Compiler support for SVE is still pretty rough: GCC 10+11 produce incorrect code for fixed-width vectors, # SVE support is still unreliable in GCC 11 (incorrect code for fixed-width vectors, internal compiler errors).
# while Clang 12 produces memory-corrupting heisenbugs unless we enable the address sanitizer. # For half precision Clang is necessary
# In the RNG tests, GCC 10+11 produce an internal compiler error.
# The memory corruption seems to only happen with qemu-user, not with qemu-system.
# Once the compilers and QEMU have improved, this job should be cleaned up to match the others.
extends: .multiarch_template extends: .multiarch_template
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/arm64 image: i10git.cs.fau.de:5005/pycodegen/pycodegen/arm64
variables:
PYSTENCILS_SIMD: "sve256,sve512,sve"
ASAN_OPTIONS: detect_leaks=0
LD_PRELOAD: /usr/lib/aarch64-linux-gnu/libasan.so.6
before_script: before_script:
- *multiarch_before_script - *multiarch_before_script
- sed -i s/march=native/march=armv8-a+sve/g ~/.config/pystencils/config.json - sed -i s/march=native/march=armv9-a+sve2+sme/g ~/.config/pystencils/config.json
- sed -i s/g\+\+/clang++/g ~/.config/pystencils/config.json - sed -i s/g\+\+/clang++/g ~/.config/pystencils/config.json
riscv64: riscv64:
# The RISC-V vector extension is still experimental and needs special compiler flags. # RISC-V vector extension are currently not supported by GCC.
# Once they are officially released, this job should be cleaned up to match the others.
extends: .multiarch_template extends: .multiarch_template
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/riscv64 image: i10git.cs.fau.de:5005/pycodegen/pycodegen/riscv64
variables: variables:
# explicitly set SIMD as detection requires QEMU >= 8.1
PYSTENCILS_SIMD: "rvv" PYSTENCILS_SIMD: "rvv"
QEMU_CPU: "rv64,v=true" QEMU_CPU: "rv64,v=true,zicboz=true"
before_script: before_script:
- *multiarch_before_script - *multiarch_before_script
- sed -i 's/march=native/march=rv64imfdv0p10 -menable-experimental-extensions/g' ~/.config/pystencils/config.json - sed -i 's/march=native/march=rv64imfdvzicboz/g' ~/.config/pystencils/config.json
- sed -i s/g\+\+/clang++/g ~/.config/pystencils/config.json - sed -i s/g\+\+/clang++-15/g ~/.config/pystencils/config.json
- sed -i 's/fopenmp/fopenmp=libgomp -I\/usr\/include\/riscv64-linux-gnu/g' ~/.config/pystencils/config.json
minimal-conda: minimal-conda:
stage: pretest stage: pretest
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 setup.py quicktest - python quicktest.py
tags: tags:
- docker - docker
- cuda - cuda
...@@ -216,13 +227,13 @@ minimal-conda: ...@@ -216,13 +227,13 @@ minimal-conda:
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
...@@ -248,7 +259,6 @@ pycodegen-integration: ...@@ -248,7 +259,6 @@ pycodegen-integration:
- cd .. - cd ..
- pip install -e pystencils/ - pip install -e pystencils/
- pip install -e lbmpy/ - pip install -e lbmpy/
- pip install -e pygrandchem/
- cmake --version - cmake --version
- ./install_walberla.sh - ./install_walberla.sh
- export NUM_CORES=$(nproc --all) - export NUM_CORES=$(nproc --all)
...@@ -258,14 +268,12 @@ pycodegen-integration: ...@@ -258,14 +268,12 @@ pycodegen-integration:
- py.test -v -n $NUM_CORES --junitxml=report.xml . - py.test -v -n $NUM_CORES --junitxml=report.xml .
- cd ../lbmpy - cd ../lbmpy
- py.test -v -n $NUM_CORES --junitxml=report.xml . - py.test -v -n $NUM_CORES --junitxml=report.xml .
- cd ../pygrandchem
- py.test -v -n $NUM_CORES --junitxml=report.xml .
- cd ../walberla/build/ - cd ../walberla/build/
- make -j $NUM_CORES CodegenJacobiCPU CodegenJacobiGPU CodegenPoissonCPU CodegenPoissonGPU MicroBenchmarkGpuLbm LbCodeGenerationExample - make -j $NUM_CORES CodegenJacobiCPU CodegenJacobiGPU CodegenPoissonCPU CodegenPoissonGPU MicroBenchmarkGpuLbm LbCodeGenerationExample
- make -j $NUM_CORES multiphaseCPU multiphaseGPU FluctuatingMRT FlowAroundSphereCodeGen - make -j $NUM_CORES multiphaseCPU multiphaseGPU FluctuatingMRT FlowAroundSphereCodeGen FieldLayoutAndVectorizationTest GeneratedOutflowBC
- cd apps/benchmarks/UniformGridGPU - cd apps/benchmarks/UniformGridGPU
- make -j $NUM_CORES - make -j $NUM_CORES
- cd ../UniformGridGenerated - cd ../UniformGridCPU
- make -j $NUM_CORES - make -j $NUM_CORES
tags: tags:
- docker - docker
...@@ -276,26 +284,57 @@ pycodegen-integration: ...@@ -276,26 +284,57 @@ pycodegen-integration:
reports: reports:
junit: pycodegen/*/report.xml 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: pretest 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
build-documentation: build-documentation:
stage: test stage: docs
extends: .every-commit
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/documentation 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 -b html doc html_doc
- sphinx-build -W -b html doc html_doc - sphinx-build -W -b html doc html_doc
...@@ -308,7 +347,9 @@ build-documentation: ...@@ -308,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
...@@ -318,5 +359,3 @@ pages: ...@@ -318,5 +359,3 @@ pages:
- public - public
tags: tags:
- docker - docker
only:
- master@pycodegen/pystencils
include README.md
include COPYING.txt
include AUTHORS.txt include AUTHORS.txt
include CONTRIBUTING.md include CONTRIBUTING.md
CHANGELOG.md include CHANGELOG.md
global-include *.pyx
include versioneer.py
include pystencils/_version.py
...@@ -52,7 +52,7 @@ pip install pystencils[interactive] ...@@ -52,7 +52,7 @@ 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
- `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.
...@@ -63,7 +63,7 @@ Options can be combined e.g. ...@@ -63,7 +63,7 @@ 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 pycuda makes sure to run example files first to ensure that pycuda can find the compiler's executable. 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
------------- -------------
...@@ -81,4 +81,7 @@ Many thanks go to the [contributors](https://i10git.cs.fau.de/pycodegen/pystenci ...@@ -81,4 +81,7 @@ Many thanks go to the [contributors](https://i10git.cs.fau.de/pycodegen/pystenci
If you use pystencils in a publication, please cite the following articles: If you use pystencils in a publication, please cite the following articles:
Overview: 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 - M. Bauer et al, Code Generation for Massively Parallel Phase-Field Simulations. Association for Computing Machinery, 2019. https://doi.org/10.1145/3295500.3356186
\ No newline at end of file
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
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# 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
# #
# ---------------------------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------------------------
...@@ -32,4 +32,4 @@ dependencies: ...@@ -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
...@@ -8,7 +8,7 @@ import nbformat ...@@ -8,7 +8,7 @@ import nbformat
import pytest import pytest
from nbconvert import PythonExporter from nbconvert import PythonExporter
from pystencils.boundaries.createindexlistcython import * # NOQA 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
...@@ -40,47 +40,48 @@ def add_path_to_ignore(path): ...@@ -40,47 +40,48 @@ def add_path_to_ignore(path):
collect_ignore = [os.path.join(SCRIPT_FOLDER, "doc", "conf.py"), collect_ignore = [os.path.join(SCRIPT_FOLDER, "doc", "conf.py"),
os.path.join(SCRIPT_FOLDER, "pystencils", "opencl", "opencl.autoinit")] os.path.join(SCRIPT_FOLDER, "src", "pystencils", "opencl", "opencl.autoinit")]
add_path_to_ignore('pystencils_tests/benchmark') add_path_to_ignore('tests/benchmark')
add_path_to_ignore('_local_tmp') add_path_to_ignore('_local_tmp')
try: try:
import pycuda import cupy
except ImportError: except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "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 waLBerla import waLBerla
except ImportError: except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_aligned_array.py"), collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_aligned_array.py"),
os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_datahandling_parallel.py"), 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, "doc/notebooks/03_tutorial_datahandling.ipynb"),
os.path.join(SCRIPT_FOLDER, "pystencils/datahandling/parallel_datahandling.py"), os.path.join(SCRIPT_FOLDER, "src/pystencils/datahandling/parallel_datahandling.py"),
os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_small_block_benchmark.ipynb")] os.path.join(SCRIPT_FOLDER, "tests/test_small_block_benchmark.ipynb")]
try: try:
import blitzdb import blitzdb
except ImportError: except ImportError:
add_path_to_ignore('pystencils/runhelper') add_path_to_ignore('src/pystencils/runhelper')
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_parameterstudy.py")] collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_parameterstudy.py")]
collect_ignore += [os.path.join(SCRIPT_FOLDER, "tests/test_json_serializer.py")]
try: try:
import islpy import islpy
except ImportError: except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/integer_set_analysis.py")] collect_ignore += [os.path.join(SCRIPT_FOLDER, "src/pystencils/integer_set_analysis.py")]
try: try:
import graphviz import graphviz
except ImportError: except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/backends/dot.py")] 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")] collect_ignore += [os.path.join(SCRIPT_FOLDER, "doc/notebooks/01_tutorial_getting_started.ipynb")]
try: try:
import pyevtk import pyevtk
except ImportError: except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/datahandling/vtk.py")] 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')]
......
...@@ -26,14 +26,14 @@ templates_path = ['_templates'] ...@@ -26,14 +26,14 @@ templates_path = ['_templates']
source_suffix = '.rst' source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
copyright = f'{datetime.datetime.now().year}, Martin Bauer' copyright = f'{datetime.datetime.now().year}, Martin Bauer, Markus Holzer, Frederik Hennig'
author = 'Martin Bauer' author = 'Martin Bauer, Markus Holzer, Frederik Hennig'
# The short X.Y version (including .devXXXX, rcX, b1 suffixes if present) # The short X.Y version (including .devXXXX, rcX, b1 suffixes if present)
version = re.sub(r'(\d+\.\d+)\.\d+(.*)', r'\1\2', pystencils.__version__) version = re.sub(r'(\d+\.\d+)\.\d+(.*)', r'\1\2', pystencils.__version__)
version = re.sub(r'(\.dev\d+).*?$', r'\1', version) version = re.sub(r'(\.dev\d+).*?$', r'\1', version)
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = pystencils.__version__ release = pystencils.__version__
language = None 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'
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -27,11 +27,11 @@ Code printing ...@@ -27,11 +27,11 @@ Code printing
GPU Indexing GPU Indexing
------------- -------------
.. autoclass:: pystencils.gpucuda.AbstractIndexing .. autoclass:: pystencils.gpu.AbstractIndexing
:members: :members:
.. autoclass:: pystencils.gpucuda.BlockIndexing .. autoclass:: pystencils.gpu.BlockIndexing
:members: :members:
.. autoclass:: pystencils.gpucuda.LineIndexing .. autoclass:: pystencils.gpu.LineIndexing
:members: :members:
[project]
name = "pystencils"
description = "Speeding up stencil computations on CPUs and GPUs"
dynamic = ["version"]
readme = "README.md"
authors = [
{ name = "Martin Bauer" },
{ name = "Jan Hönig " },
{ name = "Markus Holzer" },
{ name = "Frederik Hennig" },
{ email = "cs10-codegen@fau.de" },
]
license = { file = "COPYING.txt" }
requires-python = ">=3.10"
dependencies = ["sympy>=1.9,<=1.12.1", "numpy>=1.8.0", "appdirs", "joblib", "pyyaml", "fasteners"]
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: Jupyter",
"Topic :: Software Development :: Code Generators",
"Topic :: Scientific/Engineering :: Physics",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
]
[project.urls]
"Bug Tracker" = "https://i10git.cs.fau.de/pycodegen/pystencils/-/issues"
"Documentation" = "https://pycodegen.pages.i10git.cs.fau.de/pystencils/"
"Source Code" = "https://i10git.cs.fau.de/pycodegen/pystencils"
[project.optional-dependencies]
gpu = ['cupy']
alltrafos = ['islpy', 'py-cpuinfo']
bench_db = ['blitzdb', 'pymongo', 'pandas']
interactive = [
'matplotlib',
'ipy_table',
'imageio',
'jupyter',
'pyevtk',
'rich',
'graphviz',
]
use_cython = [
'Cython'
]
doc = [
'sphinx',
'sphinx_rtd_theme',
'nbsphinx',
'sphinxcontrib-bibtex',
'sphinx_autodoc_typehints',
'pandoc',
]
tests = [
'pytest',
'pytest-cov',
'pytest-html',
'ansi2html',
'pytest-xdist',
'flake8',
'nbformat',
'nbconvert',
'ipython',
'matplotlib',
'py-cpuinfo',
'randomgen>=1.18',
]
[build-system]
requires = [
"setuptools>=61",
"versioneer[toml]>=0.29",
# 'Cython'
]
build-backend = "setuptools.build_meta"
[tool.setuptools.package-data]
pystencils = [
"include/*.h",
"boundaries/createindexlistcython.pyx"
]
[tool.setuptools.packages.find]
where = ["src"]
include = ["pystencils", "pystencils.*"]
namespaces = false
[tool.versioneer]
# See the docstring in versioneer.py for instructions. Note that you must
# re-run 'versioneer.py setup' after changing this section, and commit the
# resulting files.
VCS = "git"
style = "pep440"
versionfile_source = "src/pystencils/_version.py"
versionfile_build = "pystencils/_version.py"
tag_prefix = "release/"
parentdir_prefix = "pystencils-"
try:
import pycuda.gpuarray as gpuarray
except ImportError:
gpuarray = None
import numpy as np
import pystencils
class PyCudaArrayHandler:
def __init__(self):
import pycuda.autoinit # NOQA
def zeros(self, shape, dtype=np.float64, order='C'):
cpu_array = np.zeros(shape=shape, dtype=dtype, order=order)
return self.to_gpu(cpu_array)
def ones(self, shape, dtype=np.float64, order='C'):
cpu_array = np.ones(shape=shape, dtype=dtype, order=order)
return self.to_gpu(cpu_array)
def empty(self, shape, dtype=np.float64, layout=None):
if layout:
cpu_array = pystencils.field.create_numpy_array_with_layout(shape=shape, dtype=dtype, layout=layout)
return self.to_gpu(cpu_array)
else:
return gpuarray.empty(shape, dtype)
@staticmethod
def to_gpu(array):
return gpuarray.to_gpu(array)
@staticmethod
def upload(array, numpy_array):
array.set(numpy_array)
@staticmethod
def download(array, numpy_array):
array.get(numpy_array)
def randn(self, shape, dtype=np.float64):
cpu_array = np.random.randn(*shape).astype(dtype)
return self.to_gpu(cpu_array)
from_numpy = to_gpu
class PyCudaNotAvailableHandler:
def __getattribute__(self, name):
raise NotImplementedError("Unable to initiaize PyCuda! "
"Try to run `import pycuda.autoinit` to check whether PyCuda is working correctly!")
#pragma once
extern "C++" {
#ifdef __CUDA_ARCH__
template <typename DTYPE_T, std::size_t DIMENSION> struct PyStencilsField {
DTYPE_T *data;
DTYPE_T shape[DIMENSION];
DTYPE_T stride[DIMENSION];
};
#else
#include <array>
template <typename DTYPE_T, std::size_t DIMENSION> struct PyStencilsField {
DTYPE_T *data;
std::array<DTYPE_T, DIMENSION> shape;
std::array<DTYPE_T, DIMENSION> stride;
};
#endif
}