pystencils merge requestshttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests2020-10-07T10:54:06+02:00https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/169Fix: Replaced accidental `continue` by `break` in boundaries/createindexlist.py2020-10-07T10:54:06+02:00Frederik HennigFix: Replaced accidental `continue` by `break` in boundaries/createindexlist.pyThere was a `continue` instead of a `break` statement in the python code for index list creation, causing the `single_link` flag to be ignored. The test cases for this are updated in pycodegen/lbmpy!41.There was a `continue` instead of a `break` statement in the python code for index list creation, causing the `single_link` flag to be ignored. The test cases for this are updated in pycodegen/lbmpy!41.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/84Remove duplicated uint typedef2019-11-06T12:41:39+01:00Michael Kuronmkuron@icp.uni-stuttgart.deRemove duplicated uint typedefRunning the OpenCL test on AMD's ROCm platform results in
```
pystencils_tests/test_opencl.py::test_without_cuda
/usr/lib/python3/dist-packages/pyopencl/cffi_cl.py:1516: CompilerWarning: Built kernel retrieved from cache. Original from...Running the OpenCL test on AMD's ROCm platform results in
```
pystencils_tests/test_opencl.py::test_without_cuda
/usr/lib/python3/dist-packages/pyopencl/cffi_cl.py:1516: CompilerWarning: Built kernel retrieved from cache. Original from-source build had warnings:
Build on <pyopencl.Device 'gfx900' on 'AMD Accelerated Parallel Processing' at 0x34f0f50> succeeded, but said:
In file included from /tmp/comgr-1f94f8/input/CompileCLSource:1:
./pystencils/pystencils/include/opencl_stdint.h:4:27: warning: redefinition of typedef 'uint' is a C11 feature
typedef unsigned int uint;
^
/data/jenkins_workspace/compute-rocm-rel-2.9/out/ubuntu-16.04/16.04/srctf/ocl_lc/drivers/opencl/library/amdgcn/headers/build/lnx64a/B_rel/<stdin>:52:22: note: previous definition is here
typedef unsigned int uint;
```
According to the [specification](https://www.khronos.org/registry/OpenCL/specs/2.2/html/OpenCL_C.html#built-in-scalar-data-types), the `uint` type is part of the OpenCL C builtin types (and has been since version 1.0), so this typedef is not needed. In Nvidia's OpenCL stack, it appears to be built into the compiler, while LLVM (and thus AMD) define it in a [header file](https://github.com/llvm/llvm-project/blob/89de0d8dfbb9a6ff1f8b141ed70b563ecc094878/clang/lib/Headers/opencl-c.h#L55).Stephan SeitzStephan Seitzhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/15implemented derivation of gradient weights via rotation2020-11-25T13:23:50+01:00Markus Holzerimplemented derivation of gradient weights via rotationderive gradient weights of other direction with
already calculated weights of one direction
via rotation and apply them to a field.derive gradient weights of other direction with
already calculated weights of one direction
via rotation and apply them to a field.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/371Various fixes to constants2024-03-28T16:03:38+01:00Frederik HennigVarious fixes to constantsVarious fixes to constants:
- Make `PsConstant` immutable
- Add `interpret_as`/`reinterpret_as` to apply data types to constants
- Add docstrings to `PsConstant`
- Add out-of-bounds checking to constant creation
- Add test cas...Various fixes to constants:
- Make `PsConstant` immutable
- Add `interpret_as`/`reinterpret_as` to apply data types to constants
- Add docstrings to `PsConstant`
- Add out-of-bounds checking to constant creation
- Add test cases
- Remove long-obsolete and completely commented-out test filesFrederik HennigFrederik Hennighttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/370Fix typing of constants2024-03-28T14:36:48+01:00Daniel BauerFix typing of constantsThis is an umbrella MR combining a few small changes:
- Fixes typing of constants.
If a typed `Constant` inside of an untyped `ConstantExpr` was encountered, the typification used to fail (see new test).
- Strengthens `test_typify_int...This is an umbrella MR combining a few small changes:
- Fixes typing of constants.
If a typed `Constant` inside of an untyped `ConstantExpr` was encountered, the typification used to fail (see new test).
- Strengthens `test_typify_integer_binops` now that arbitrary expressions can be deferred.
- Increases the information content of two error messages.
- Fixes a typo.Daniel BauerDaniel Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/369Fix kernel function parameters2024-03-28T13:47:06+01:00Daniel BauerFix kernel function parametersThis MR implements equality and hashing for `PsSymbol` such that the parameters of `KernelFunction`s are unique.
Also improves some error messages.This MR implements equality and hashing for `PsSymbol` such that the parameters of `KernelFunction`s are unique.
Also improves some error messages.Daniel BauerDaniel Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/368Integer functions2024-03-27T17:24:15+01:00Daniel BauerInteger functionsAdds support (freezing, typing, printing) for the following integer functions from `sympyextensions.integer_functions`:
- bit_shift_left
- bit_shift_right
- bitwise_and
- bitwise_or
- bitwise_xor
- int_div
- int_power_of_2
- modulo_floor...Adds support (freezing, typing, printing) for the following integer functions from `sympyextensions.integer_functions`:
- bit_shift_left
- bit_shift_right
- bitwise_and
- bitwise_or
- bitwise_xor
- int_div
- int_power_of_2
- modulo_floor
The following are left for future work because they can be conveniently implemented with an `if` *expression* (the ternary if operator `?:` in C) which is currently not available.
- modulo_ceil
- div_ceil
`div_floor` is also not implemented because to me the semantics of this function are unclear.
Is it supposed to compute $\lfloor \frac ab \rfloor$ (as the name suggests) or the C-like round-to-zero integer division (as the documentation suggests)?
The typifier tries to infer the integer type of the arguments/result and always raises if the type is non-integer.
Note that this can lead to cases in which an exception is raised because the inference fails.
For example `int_div(2, 3)` where both arguments are untyped constants.
This could be improved in the typifier, e.g. by adding type constraints to deferred constants (also left for future work).Daniel BauerDaniel Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/367Improve comment support2024-03-25T15:37:14+01:00Daniel BauerImprove comment supportAdd comment support to `UndefinedSymbolsCollector`.Add comment support to `UndefinedSymbolsCollector`.Daniel BauerDaniel Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/366Increase supported python version2024-01-16T11:56:08+01:00Markus HolzerIncrease supported python versionSupport for Python 3.12Support for Python 3.12Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/365Remove unnecessary files in .toml2024-01-16T11:32:26+01:00Markus HolzerRemove unnecessary files in .tomlIn the .toml file some files are listed that are not existingIn the .toml file some files are listed that are not existinghttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/364Refactor packaging, part I2024-01-15T14:20:27+01:00Frederik HennigRefactor packaging, part IRelates to pycodegen/pystencils#75.
Move all project info to `pyproject.toml`.
Tasks:
- [x] Static Project Info
- [x] Register and run versioneer
- [x] Register Cython extension modules
- [x] Clean up package data files & manifest
...Relates to pycodegen/pystencils#75.
Move all project info to `pyproject.toml`.
Tasks:
- [x] Static Project Info
- [x] Register and run versioneer
- [x] Register Cython extension modules
- [x] Clean up package data files & manifest
- [x] Remove `quicktest` action from `setup.py` and realize quicktests some other way -> introduced `quicktest.py`
Notes:
- The `quicktest` command in `setup.py` uses the `distutils` command interface, but `distutils` is deprecated since Python 3.10. We must find some other way to realize quicktests.Frederik HennigFrederik Hennighttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/363Fix type equality checks2024-01-09T10:18:05+01:00Frederik HennigFix type equality checksUse `is`/`is not` instead of `==` when checking for equality of types. Fixes linter errors that recently appeared in the `flake8` checker.Use `is`/`is not` instead of `==` when checking for equality of types. Fixes linter errors that recently appeared in the `flake8` checker.Frederik HennigFrederik Hennighttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/362Refactor source tree layout2024-01-16T08:50:38+01:00Frederik HennigRefactor source tree layoutRelates to pycodegen/pystencils#75.
- [x] Migrate package to `src` directory
- [x] Migrate tests to `tests` directory and update `pytest` configuration
- [x] Fix various pipelines and CI containers
(`pyproject.toml` migration was mo...Relates to pycodegen/pystencils#75.
- [x] Migrate package to `src` directory
- [x] Migrate tests to `tests` directory and update `pytest` configuration
- [x] Fix various pipelines and CI containers
(`pyproject.toml` migration was moved to pycodegen/pystencils!364)Frederik HennigFrederik Hennighttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/361Fix typo in CustomCodeNode.__eq__2023-12-04T10:47:42+01:00Daniel BauerFix typo in CustomCodeNode.__eq__https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/360Update README.md2023-11-28T09:34:51+01:00Markus HolzerUpdate README.mdhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/359Draft: Loop counter dependent kernels: Vector casts and smaller fixes2024-01-12T12:35:19+01:00Daniel BauerDraft: Loop counter dependent kernels: Vector casts and smaller fixesWe would like to generate code for kernels which contain spatially dependent expressions.
Thus, the expression tree contains loop counter symbols.
Unfortunately, vectorizing these kernels does not currently work.
The goal of this MR is ...We would like to generate code for kernels which contain spatially dependent expressions.
Thus, the expression tree contains loop counter symbols.
Unfortunately, vectorizing these kernels does not currently work.
The goal of this MR is to change that.
It is far, far from being finished but I would appreciate some feedback early on.
With the current state, I was able to generate one of our kernels with vectorization (AVX) enabled and the code runs on my AVX512 machine (the code contains AVX512 instructions...).
This MR includes a very basic test so that you can play around with the new feature if you want:
```
pytest pystencils_tests/test_vectorization.py::test_vectorize_loop_ctr
```
Issues with the current implementation are:
1. The vectorized loop counter uses a different vector width than the remaining code. E.g. for AVX the (f64) vector width is 4 and the loop is vectorized accordingly. However, the vectorized loop counter has 8 lanes.
2. Vector expressions can not be casted to different types.
3. Integer expressions can not be properly vectorized.
4. `create_type('int')`/`BasicType('int')` creates an `int64` but many places assume that `int` is an `int32`. This is relevant here since conversions from `int64` are not available before AVX512 (they require rounding).
The proposed change is to rework the instruction sets slightly.
Instead of "dumb" dictionaries, they get promoted to proper classes.
Every time an instruction is queried, the data type (base type and number of lanes) must be specified.
This way, we can properly handle integers and vectors with less than the maximum bitwidth which is supported by the instruction set.
The latter is e.g. necessary to work with i32x4 vectors on AVX.
Furthermore, type conversion is implemented in the instruction sets.
This obviously changes the interface and has strong implications on how the vectorization is handled throughout the code base.
Therefore, I would appreciate any feedback, whether these changes are in line with the goals of the project and the thoughts behind #46.
Any comments are welcome.Daniel BauerDaniel Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/358Draft: [FIX] Index fields exclusively containing coordinates are dropped by c...2024-01-31T11:48:23+01:00Frederik HennigDraft: [FIX] Index fields exclusively containing coordinates are dropped by code generatorIndex fields that exclusively contain coordinate data (members `x`, `y` and `z`) and that are not explicitly accessed in the kernel assignments are dropped by `pystencils.cpu.create_indexed_kernel` in `cpu/kernelcreation.py`, prev. line ...Index fields that exclusively contain coordinate data (members `x`, `y` and `z`) and that are not explicitly accessed in the kernel assignments are dropped by `pystencils.cpu.create_indexed_kernel` in `cpu/kernelcreation.py`, prev. line 119.
Then in line 128 the list of index fields is empty, and the code generator finds no field containing the coordinate information.
Code generation then aborts.
Is there a reason why index fields are first filtered this way?Frederik HennigFrederik Hennighttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/357Print small integer powers as divisions/multiplications2023-10-13T08:33:59+02:00Daniel BauerPrint small integer powers as divisions/multiplicationsFixes #72.
After a longer discussion we decided to reintroduce the special logic into the printer after it was removed in 939241f2.
The problem is that it is simply impossible to keep Muls unevaluated in cut_loops.
Neither deep_copy nor...Fixes #72.
After a longer discussion we decided to reintroduce the special logic into the printer after it was removed in 939241f2.
The problem is that it is simply impossible to keep Muls unevaluated in cut_loops.
Neither deep_copy nor func(*args) works.
A logic-free printer simply goes against how SymPy works.
We can have it, but first we must switch to a SymPy free ast datastructure.Daniel BauerDaniel Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/356Indexed domain kernel2023-11-14T02:31:58+01:00Markus HolzerIndexed domain kernelThis MR introduces the possibility to introduce sp.IndexedBase objects in the kernel that form an outer loop for indexing the arrays in the inner loopsThis MR introduces the possibility to introduce sp.IndexedBase objects in the kernel that form an outer loop for indexing the arrays in the inner loopsMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/355Add function to prepend pragmas to loops2023-09-29T08:27:16+02:00Frederik HennigAdd function to prepend pragmas to loopsAdd a function to prepend `#pragma` directives to domain loops according to their nesting depth.
Useful for compiler-specific annotations and interactions, especially with less well-known niche compilers (like Fujitsu's ARM-compiler).Add a function to prepend `#pragma` directives to domain loops according to their nesting depth.
Useful for compiler-specific annotations and interactions, especially with less well-known niche compilers (like Fujitsu's ARM-compiler).Frederik HennigFrederik Hennig