pystencils merge requestshttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests2022-04-28T09:46:38+02:00https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/291Fix test_alignment_of_different_layouts on architectures with 128-bit vectors2022-04-28T09:46:38+02:00Michael Kuronmkuron@icp.uni-stuttgart.deFix test_alignment_of_different_layouts on architectures with 128-bit vectorsThis test previously failed on ARM Neon (and probably also on SSE) because the test checks for 256-bit alignment, but only requests `alignment=True`, which is the maximum required by the hardware (i.e. to `align=32` on AVX, but only `ali...This test previously failed on ARM Neon (and probably also on SSE) because the test checks for 256-bit alignment, but only requests `alignment=True`, which is the maximum required by the hardware (i.e. to `align=32` on AVX, but only `align=16` on SSE/Neon).Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/290Bug fix simplification2022-03-28T10:40:33+02:00Markus HolzerBug fix simplificationMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/289SymPy1.102022-03-21T19:42:55+01:00Markus HolzerSymPy1.10With Sympy 1.10 two small problems have entered pystencils. This MR fixes the problems.
Fixes #59With Sympy 1.10 two small problems have entered pystencils. This MR fixes the problems.
Fixes #59Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/288Fix: AssignmentCollection's `new_filtered` now also finds dependencies in mai...2022-03-25T09:14:17+01:00Frederik HennigFix: AssignmentCollection's `new_filtered` now also finds dependencies in main assignmentsFixes a bug where `AssignmentCollection.new_filtered` would not catch symbol dependencies on LHS symbols of main assignments.Fixes a bug where `AssignmentCollection.new_filtered` would not catch symbol dependencies on LHS symbols of main assignments.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/287Fix: sharedmethodcache didn't preserve docstrings2022-03-25T09:11:34+01:00Frederik HennigFix: sharedmethodcache didn't preserve docstringsAdded the `@wraps` decorator to the recently introduced `sharedmethodcache` to have it preserve docstrings.Added the `@wraps` decorator to the recently introduced `sharedmethodcache` to have it preserve docstrings.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/286Added simplify_by_equality2022-03-16T10:20:12+01:00Frederik HennigAdded simplify_by_equalityAdded a simplification function to simplify expressions using a given equality $`a = b + c`$, by replacing occurences of e.g. $`b + c`$ by $`a`$, or $`a - b`$ by $`c`$.Added a simplification function to simplify expressions using a given equality $`a = b + c`$, by replacing occurences of e.g. $`b + c`$ by $`a`$, or $`a - b`$ by $`c`$.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/285sharedmethodcache2022-03-16T10:20:00+01:00Frederik HennigsharedmethodcacheAdded a per-instance method cache decorator, which can be shared among multiple methods with the same signature.
`sharedmethodcache` allows memoization similarily to `functools.cache`, but for instance methods of classes. The cache dict...Added a per-instance method cache decorator, which can be shared among multiple methods with the same signature.
`sharedmethodcache` allows memoization similarily to `functools.cache`, but for instance methods of classes. The cache dictionary is added as a member to the method's owning instance. Further, multiple methods with the same signature (up to kwargs) may use the same cache dict by specifying the same `cache_id`. This makes sense for methods that produce the same results on identical inputs, but by different computational paths.
This decorator is currently employed in pycodegen/lbmpy!113 by [abstract_equilibrium.py](https://i10git.cs.fau.de/da15siwa/lbmpy/-/blob/zero_centered_storage/lbmpy/equilibrium/abstract_equilibrium.py), but surely, more use cases will follow.
Example:
```
class Fib:
def __init__(self):
self.fib_rec_called = 0
self.fib_iter_called = 0
@sharedmethodcache("fib_cache")
def fib_rec(self, n):
self.fib_rec_called += 1
return 1 if n <= 1 else self.fib_rec(n-1) + self.fib_rec(n-2)
@sharedmethodcache("fib_cache")
def fib_iter(self, n):
self.fib_iter_called += 1
f1, f2 = 0, 1
for i in range(n):
f2 = f1 + f2
f1 = f2 - f1
return f2
>>> fib = Fib()
>>> fib.fib_rec(13)
377
>>> fib.fib_cache
{(1,): 1,
(0,): 1,
(2,): 2,
(3,): 3,
(4,): 5,
(5,): 8,
(6,): 13,
(7,): 21,
(8,): 34,
(9,): 55,
(10,): 89,
(11,): 144,
(12,): 233,
(13,): 377}
>>> fib.fib_rec_called
14
>>> fib.fib_iter(11)
144
>>> fib.fib_iter_called
0
```https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/284Fvm testcase with fluctuations and reactions2022-01-10T15:10:04+01:00itischlerFvm testcase with fluctuations and reactionsAdded a fluctuation testcase and a reaction testcase to the FVM.
Fixes #36Added a fluctuation testcase and a reaction testcase to the FVM.
Fixes #36Michael Kuronmkuron@icp.uni-stuttgart.deMichael Kuronmkuron@icp.uni-stuttgart.dehttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/282Fix RoundOff problems2021-12-21T11:12:54+01:00Markus HolzerFix RoundOff problemsWhen printing Rationals with pystencils at the moment the number of digits which will be printed is only 15. This is not enough for DP and thus Error is introduced in the printed code...
The reason for this is the following line:
`str(e...When printing Rationals with pystencils at the moment the number of digits which will be printed is only 15. This is not enough for DP and thus Error is introduced in the printed code...
The reason for this is the following line:
`str(expr.evalf().num)`
Here it is important to know what is happening. First of all the Rational is evaluated with Sympy with 15 digits, because SymPy defaults to 15 digits when using `evalf`:
https://docs.sympy.org/latest/modules/evalf.html
but the story continues: `.num` is not a SymPy function !!!!
This comes from `mpmath` so the Rational is converted to an `sp.Float` and then to a `mpmath.ctx_mp_python.mpf`. And yet again `mpmath` provides also a notion of precision. This could be set with `mpmath.mp.dps = 30` for example. However, why should this be done in that way here anyway?
In this MR the `.num` function is removed and all `evalf` functions in `pystencils` are set to `evalf(17)`.
Note here that the `SymPy` printer on the other hand knows very well which precision it needs to provide. Thus when using a float inside the Assignment SymPy prints this correctly.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/281Adapt CI to updated riscv64 dockerfile2021-12-04T10:30:38+01:00Michael Kuronmkuron@icp.uni-stuttgart.deAdapt CI to updated riscv64 dockerfilehttps://i10git.cs.fau.de/pycodegen/pycodegen/-/commit/99a77506972607cc315bacbd63dfcaa4b8112cda updated Clang from 13-dev to 13.0.0, switched from Debian sid to Ubuntu 21.10, and updated from version 7 to [version 10](https://github.com/s...https://i10git.cs.fau.de/pycodegen/pycodegen/-/commit/99a77506972607cc315bacbd63dfcaa4b8112cda updated Clang from 13-dev to 13.0.0, switched from Debian sid to Ubuntu 21.10, and updated from version 7 to [version 10](https://github.com/sifive/qemu/tree/rvv-1.0-upstream-v10) of the RVV QEMU patch. Now the vector extension is no longer marked as experimental (`x-`).Michael Kuronmkuron@icp.uni-stuttgart.deMichael Kuronmkuron@icp.uni-stuttgart.dehttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/280Fixed test for sliced iteration with buffer to use dynamic field sizes2021-11-28T16:19:50+01:00Frederik HennigFixed test for sliced iteration with buffer to use dynamic field sizesOtherwise the test did not fail as it should when float-division is used in indexing.Otherwise the test did not fail as it should when float-division is used in indexing.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/279Removed kerncraft2021-11-25T12:34:57+01:00Markus HolzerRemoved kerncraftKerncraft was not validated in pystencils and is at the moment not further maintained. Thus we remove it for now from pystencils.
Fixes #44Kerncraft was not validated in pystencils and is at the moment not further maintained. Thus we remove it for now from pystencils.
Fixes #44Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/278Removed OpenCL2021-11-22T21:22:54+01:00Markus HolzerRemoved OpenCLThis MR removes OpenCL from pystencilsThis MR removes OpenCL from pystencilsMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/277create_staggered_kernel: ignore inapplicable CreateKernelConfig defaults2021-11-25T12:39:39+01:00Michael Kuronmkuron@icp.uni-stuttgart.decreate_staggered_kernel: ignore inapplicable CreateKernelConfig defaultsI think this was a regression introduced in !261.I think this was a regression introduced in !261.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/276Remove LLVM2021-11-22T15:29:45+01:00Markus HolzerRemove LLVMThis MR removes the LLVM backend from pystencilsThis MR removes the LLVM backend from pystencilsMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/274Fixed integer square root2021-11-17T15:50:41+01:00Markus HolzerFixed integer square rootInteger square roots must be detected as float32 if the simulation is setup for SP.Integer square roots must be detected as float32 if the simulation is setup for SP.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/273Remove interpolator2021-11-17T15:51:55+01:00Markus HolzerRemove interpolatorThe interpolator functionality of pystencils is not used for a long time and it is rather messy.
It will be removed with this MR.The interpolator functionality of pystencils is not used for a long time and it is rather messy.
It will be removed with this MR.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/272Testing2021-11-11T08:09:08+01:00Markus HolzerTestingFixes race condition in the cpu jit. Clean parallel datahandling test cases and tutorial notebook.Fixes race condition in the cpu jit. Clean parallel datahandling test cases and tutorial notebook.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/271Kernel decorator fix2021-11-05T11:06:46+01:00Jan HönigKernel decorator fixI have introduced a change to the kernel decorator, which was completely wrong. Now I reintroduced the kernel decorator and introduced a `kernel_config` decorator, which receives a `CreateKernelConfig`, which is also returned together wi...I have introduced a change to the kernel decorator, which was completely wrong. Now I reintroduced the kernel decorator and introduced a `kernel_config` decorator, which receives a `CreateKernelConfig`, which is also returned together with the list of assignments as a dict. The dict has to be unrolled for `create_kernel`. The `kernel_config` decorator updates the name of the function inside the config.Jan HönigJan Hönighttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/269Fix printing2021-11-05T10:39:09+01:00Markus HolzerFix printingThe latex printer of the field class is a bit off at the moment. This MR should fix itThe latex printer of the field class is a bit off at the moment. This MR should fix itMarkus HolzerMarkus Holzer