pystencils merge requestshttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests2019-10-21T14:06:59+02:00https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/75Add option to omit globals when printing C code2019-10-21T14:06:59+02:00Stephan SeitzAdd option to omit globals when printing C codeRight know, needed globals are always printed. But this is not always desired, e.g. when printing multiple functions and all globals should be on top of file.Right know, needed globals are always printed. But this is not always desired, e.g. when printing multiple functions and all globals should be on top of file.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/96Add own implementation for printing an unknown function2019-12-03T13:38:45+01:00Stephan SeitzAdd own implementation for printing an unknown functionUsing the SymPy implementation for printing a `sympy.Function` has some issues:
- you cannot use `cast_func` as an argument -> SymPy prints
`cast_func(2,float)
- typed numbers are not typed any more -> e.g. pow(x, 0.25) instead o...Using the SymPy implementation for printing a `sympy.Function` has some issues:
- you cannot use `cast_func` as an argument -> SymPy prints
`cast_func(2,float)
- typed numbers are not typed any more -> e.g. pow(x, 0.25) instead of
pow(x, 0.25f)
Maybe a disadvantage or an advantage:
- arbitrary Functions: sympy.Function('my_function') are now allowed.
Would have prevented commits like:
Fix: type of sqrt(int) was int not floating point typehttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/41Add pyhtml to tests and artifacts2019-09-02T13:42:18+02:00Stephan SeitzAdd pyhtml to tests and artifactsI think this should suffice to produce the artifacts.
But `pytest-html` and `ansi2html` need to be added to the docker images.I think this should suffice to produce the artifacts.
But `pytest-html` and `ansi2html` need to be added to the docker images.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/45Add PyPI badge2019-09-02T13:40:44+02:00Stephan SeitzAdd PyPI badgeBadge with current PyPI version and link to the PyPI page.Badge with current PyPI version and link to the PyPI page.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/21Add RELEASE-VERSION to .gitignore2019-08-06T22:04:11+02:00Stephan SeitzAdd RELEASE-VERSION to .gitignorehttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/138Add remaining parameters from DataHandling.add_array to DataHandling.add_arrays2020-02-11T20:15:54+01:00Stephan SeitzAdd remaining parameters from DataHandling.add_array to DataHandling.add_arrayshttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/79Add sympy to known_third_party in .isort.cfg2019-10-28T11:33:12+01:00Stephan SeitzAdd sympy to known_third_party in .isort.cfgI have installed the newest master of SymPy as editable package.
So `isort` thinks it's one of our libraries.
With this config SymPy is declared as a third party dependency.I have installed the newest master of SymPy as editable package.
So `isort` thinks it's one of our libraries.
With this config SymPy is declared as a third party dependency.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/136Add typeannotations and docstring for KernelWrapper2020-01-21T21:59:42+01:00Stephan SeitzAdd typeannotations and docstring for KernelWrapperhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/207add_subexpressions_for_constants and new_filtered fix2021-01-29T15:42:40+01:00Frederik Hennigadd_subexpressions_for_constants and new_filtered fixTwo small patches:
- Added a function `add_subexpressions_for_constants` to `pystencils.simp`. This function extracts numerical constants like `2` or `1/3` from equations. This is helpful because SymPy does not exclude common factors fr...Two small patches:
- Added a function `add_subexpressions_for_constants` to `pystencils.simp`. This function extracts numerical constants like `2` or `1/3` from equations. This is helpful because SymPy does not exclude common factors from sums if they are not symbols. Excluding them this way can reduce the number of multiplications. In some cases, additional common subexpressions can also be found.
- Changed `AssignmentCollection.new_filtered` to use `self.copy` to preserve other members of the assignment collection.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/156add_types: only re-enable double-write check if it was previously enabled2020-06-15T20:57:20+02:00Michael Kuronmkuron@icp.uni-stuttgart.deadd_types: only re-enable double-write check if it was previously enabledOtherwise you can't generate certain boundary kernels that contain conditionals.Otherwise you can't generate certain boundary kernels that contain conditionals.Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/147Added guard around import to avoid failing when walberla is there but no pyth...2020-02-21T15:15:39+01:00Christoph RettingerAdded guard around import to avoid failing when walberla is there but no python module is builtStephan SeitzStephan Seitzhttps://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/197Added version number to pystencils2021-01-26T08:44:01+01:00Markus HolzerAdded version number to pystencilsPystencils should have a `__version__` attributePystencils should have a `__version__` attributeMichael Kuronmkuron@icp.uni-stuttgart.deMichael Kuronmkuron@icp.uni-stuttgart.dehttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/34Address #13: Use sympy.codegen.rewriting.optimize2019-09-23T10:55:13+02:00Stephan SeitzAddress #13: Use sympy.codegen.rewriting.optimizeIt's really comfortable to write optimizations in terms of `sympy.codegen.rewrite.RewriteOptim`:
```python
# Evaluates all constant terms
evaluate_constant_terms = ReplaceOptim(
lambda e: hasattr(e, 'is_constant') a...It's really comfortable to write optimizations in terms of `sympy.codegen.rewrite.RewriteOptim`:
```python
# Evaluates all constant terms
evaluate_constant_terms = ReplaceOptim(
lambda e: hasattr(e, 'is_constant') and e.is_constant,
lambda p: p.evalf()
)
```
This PR adds a parameter `sympy_optimizations` to the `create_*_kernel` functions that applies the list of optimizations to the assignments before creating the AST.
`sympy.codegen.rewrite` already has some optimizations. Some similar to the optimizations of pystencils.
For example `create_expand_pow_optimization(limit)` is really similar to the logic in `CustomSympyPrinter._print_Pow`.
See #13
Problem: old versions of sympy (e.g. from ubuntu CI) don't have `sympy.codegen.rewrite`. The optimizations are skipped in that case. `test_and_coverage` applies all optimizations.
We could also try to implement a fma-optimization (fused-multipy add) with that and `sympy.Wild`.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/1Address of SymPy-Function `address_of`2019-07-10T16:14:26+02:00Stephan SeitzAddress of SymPy-Function `address_of`Some CUDA functions (like `atomic_add`) require pointers to data. This PR adds a SymPy function representing the C address-of operator (`&`).
I tried to trigger cse to show a problem related to this function (dummy variables were not ...Some CUDA functions (like `atomic_add`) require pointers to data. This PR adds a SymPy function representing the C address-of operator (`&`).
I tried to trigger cse to show a problem related to this function (dummy variables were not typed correctly as pointer). I'll include the fix in a follow-up PR.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/258Advanced Subexpression Insertion2021-07-28T22:10:01+02:00Frederik HennigAdvanced Subexpression InsertionMoved a few methods for elimination of selected subexpressions from lbmpy to pystencils. Helpful to control the granularity of common subexpression elimination, expression tree cleanup, and potentially to simplify equations by substituti...Moved a few methods for elimination of selected subexpressions from lbmpy to pystencils. Helpful to control the granularity of common subexpression elimination, expression tree cleanup, and potentially to simplify equations by substituting constant or zero subexpressions.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/30AES-NI Random Number Generator2019-09-02T10:21:21+02:00Michael Kuronmkuron@icp.uni-stuttgart.deAES-NI Random Number GeneratorI was looking at how to vectorize the Philox RNG yesterday. Before I knew it, I had implemented a working RNG using AES-NI instructions :nerd: ... Not entirely what I had intended to do, but it might still be useful to someone and should...I was looking at how to vectorize the Philox RNG yesterday. Before I knew it, I had implemented a working RNG using AES-NI instructions :nerd: ... Not entirely what I had intended to do, but it might still be useful to someone and should be similarly fast as a vectorized Philox.
There is one place that could be optimized because I fall back to scalar instructions: I failed to reimplement `_mm_cvtepu64_pd` (the solution from https://stackoverflow.com/a/41148578 produces incorrect results in the least-significant half of the mantissa). Perhaps someone else can try to fix that.
I did not integrate this with the `vector_instruction_set` parameter of the code generation. Perhaps you can do that, @bauer. It needs support for SSE2 and AES instructions (which look like SSE2 instructions, but their availability is determined by a separate CPUID flag). It will also make use of `_mm_cvtepu32_ps` and `_mm_cvtepu64_pd` from AVX512 if available (these are 128-bit instructions that actually look like SSE2 instructions).Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/46AES-NI vectorization improvements2019-09-17T09:08:05+02:00Michael Kuronmkuron@icp.uni-stuttgart.deAES-NI vectorization improvements!30 didn't implement an SSE-vectorized `_mm_cvtepu64_pd` equivalent because the [stackoverflow](https://stackoverflow.com/a/41148578) solution didn't work. That turned out to be due to a bad optimization in GCC 5+ in fast-math mode. None...!30 didn't implement an SSE-vectorized `_mm_cvtepu64_pd` equivalent because the [stackoverflow](https://stackoverflow.com/a/41148578) solution didn't work. That turned out to be due to a bad optimization in GCC 5+ in fast-math mode. None of the other compilers (Clang, Intel, MSVC) have that issue, so we just disable fast-math for that function.
Also, we now use fused multiply-add if available.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/181Allow **kernel_creation_args in create_boundary_kernel2020-10-30T10:47:29+01:00Stephan SeitzAllow **kernel_creation_args in create_boundary_kernelhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/107Allow `CUSTOM_FIELD`s to have a different size in transformations.py2019-12-17T13:16:06+01:00Stephan SeitzAllow `CUSTOM_FIELD`s to have a different size in transformations.py