pystencils merge requestshttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests2022-10-10T22:32:05+02:00https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/304Upgrade maximum supported SymPy version to 1.11.12022-10-10T22:32:05+02:00Markus HolzerUpgrade maximum supported SymPy version to 1.11.1Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/300Fix nontemporal stores on non-x86 for fields with variable size2022-10-10T22:31:57+02:00Michael Kuronmkuron@icp.uni-stuttgart.deFix nontemporal stores on non-x86 for fields with variable sizeFix the issue discussed in https://i10git.cs.fau.de/walberla/walberla/-/merge_requests/553#note_19202Fix the issue discussed in https://i10git.cs.fau.de/walberla/walberla/-/merge_requests/553#note_19202Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/303Fix Regression from !3002022-10-10T22:31:56+02:00Markus HolzerFix Regression from !300In !300 all written field sizes are added to the SympyAssignment as unknown parameters. This solves the problem that all field sizes need to be passed as arguments when using NT stores with non-x86 architectures. However, it introduces t...In !300 all written field sizes are added to the SympyAssignment as unknown parameters. This solves the problem that all field sizes need to be passed as arguments when using NT stores with non-x86 architectures. However, it introduces two problems.
1. In all other cases these parameters are not used. Thus waLBerla fails in some cases when compiled with -Wall. Other than that it is not nice either to pass unused parameters.
2. For the GPU code generation problems arose with the usage of `get_parameters` in waLBerla:
https://i10git.cs.fau.de/pycodegen/pystencils/-/blob/master/pystencils/astnodes.py#L244
Overall it seems that the easiest way to fix the problem is to only pass the additional size arguments when needed and in no other cases.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/301Fix: `recursive_collect` now fails silently2022-07-28T15:52:03+02:00Frederik HennigFix: `recursive_collect` now fails silently`recursive_collect` used to throw an exception when an expression could not be written as a polynomial in the given symbols.
Now, it just fails quietly and returns the input expression unsimplified.`recursive_collect` used to throw an exception when an expression could not be written as a polynomial in the given symbols.
Now, it just fails quietly and returns the input expression unsimplified.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/297Compatibility with latest RISCV64 and ARM CI image2022-07-02T16:37:48+02:00Michael Kuronmkuron@icp.uni-stuttgart.deCompatibility with latest RISCV64 and ARM CI imageFollow-up to 1022af9835d84740bec3fb5c8136f19a21d78595 after upgrading to the latest compilers. ARM SVE also appears stable on latest Clang without weird workarounds now.
Depends on https://i10git.cs.fau.de/pycodegen/pycodegen/-/merge_re...Follow-up to 1022af9835d84740bec3fb5c8136f19a21d78595 after upgrading to the latest compilers. ARM SVE also appears stable on latest Clang without weird workarounds now.
Depends on https://i10git.cs.fau.de/pycodegen/pycodegen/-/merge_requests/15Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/299Fix longruns2022-07-02T14:43:56+02:00Markus HolzerFix longrunsFixes pystencils longrun and integration pipeline and creates new pipeline dedicated to longrunsFixes pystencils longrun and integration pipeline and creates new pipeline dedicated to longrunsMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/296Gpu block size2022-07-01T12:12:41+02:00Markus HolzerGpu block sizeIf the Assignments act on 2D fields but 3 GPU indexing parameters are provided, an error occurs. With this MR the third parameter is fixed to 1If the Assignments act on 2D fields but 3 GPU indexing parameters are provided, an error occurs. With this MR the third parameter is fixed to 1Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/298Fix: Version string test case2022-07-01T11:08:13+02:00Markus HolzerFix: Version string test caseMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/293Revisions2022-05-25T10:19:33+02:00Markus HolzerRevisionsRevisions for !292Revisions for !292Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/295Revision32022-05-23T17:28:23+02:00Markus HolzerRevision3More revisions due to !292More revisions due to !292Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/294Revision22022-05-23T14:33:55+02:00Markus HolzerRevision2More revisions for !292More revisions for !292Markus HolzerMarkus Holzerhttps://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/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/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/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 Holzer