pystencils merge requestshttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests2021-10-26T09:55:30+02:00https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/264Clean up and Bug Fixes2021-10-26T09:55:30+02:00Markus HolzerClean up and Bug FixesFixes #38
Further changes:
- Third party warnings are suppressed now as they just polluted the warning summary in pystencils.
- Removing the math optimisations as they are not used in pystencils. An Issue is created to reintroduce them...Fixes #38
Further changes:
- Third party warnings are suppressed now as they just polluted the warning summary in pystencils.
- Removing the math optimisations as they are not used in pystencils. An Issue is created to reintroduce them again in a clean way in the future
- Removing the joblib workaround as joblib is a hard dependency of pystencils
- Fixing SymPy 1.9 as maximum version
- Removing sympy.multiply_elementwise due to https://github.com/sympy/sympy/issues/22353. A workaround with NumPy is introduced which seems to be way more robust because NumPy has a more static API
- Introducing more extra requires, which are needed to have all features of pystencils
- Minor cleanup of some test cases and the datahandlingMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/265Fix deepcopy issue with Sympy 1.92023-06-01T22:17:18+02:00Michael Kuronmkuron@icp.uni-stuttgart.deFix deepcopy issue with Sympy 1.9Fixes https://i10git.cs.fau.de/pycodegen/pystencils/-/issues/40. Caused by https://github.com/sympy/sympy/pull/21260.Fixes https://i10git.cs.fau.de/pycodegen/pystencils/-/issues/40. Caused by https://github.com/sympy/sympy/pull/21260.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/266Vectorisation bug2021-11-09T11:21:00+01:00Markus HolzerVectorisation bugFixes #41Fixes #41Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/267Small clean up2021-11-02T21:51:26+01:00Markus HolzerSmall clean upsmall clean upsmall clean upMarkus HolzerMarkus Holzerhttps://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 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/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/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/268Introduce default assignment simplifications2021-11-19T13:35:42+01:00Markus HolzerIntroduce default assignment simplificationsThere are many simplifications in pystencils that are usually not applied. They can be applied now by using a simple argument in the configuration.
Fixes #39There are many simplifications in pystencils that are usually not applied. They can be applied now by using a simple argument in the configuration.
Fixes #39Markus 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/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/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/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/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/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/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/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/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/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`$.