pystencils merge requestshttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests2019-12-18T21:14:57+01:00https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/110Update AssignmentCollection.__repr__2019-12-18T21:14:57+01:00Stephan SeitzUpdate AssignmentCollection.__repr__`Assignment Collection for y[0,0,0]` is usually not very helpful.
New representation:
```
In [6]: forward_assignments = pystencils.AssignmentCollection({
...: z[0, 0]: x[0, 0] * sympy.log(x[0, 0] * y[0, 0]),
...: ...`Assignment Collection for y[0,0,0]` is usually not very helpful.
New representation:
```
In [6]: forward_assignments = pystencils.AssignmentCollection({
...: z[0, 0]: x[0, 0] * sympy.log(x[0, 0] * y[0, 0]),
...: y[0,0] : x[1,1] +1
...: })
In [7]: forward_assignments
Out[7]: AssignmentCollection: z_C, y_C <- f(x_C, x_NE)
```https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/109FiniteDifferenceStaggeredStencilDerivation must be applied to field access2019-12-18T21:15:21+01:00Michael Kuronmkuron@icp.uni-stuttgart.deFiniteDifferenceStaggeredStencilDerivation must be applied to field accessotherwise the index gets lost.
Also, fix the staggered field access prettyprinter. It was correct after !86 but printed wrong indices after !92. I have now added a test.otherwise the index gets lost.
Also, fix the staggered field access prettyprinter. It was correct after !86 but printed wrong indices after !92. I have now added a test.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/108AssignmentCollection.__bool__2019-12-17T13:30:15+01:00Stephan SeitzAssignmentCollection.__bool__`AssignmentCollection` can be used in many cases where you could also use
a `List[Assignment]`. With `AssignmentCollection.__bool__`, an empty
AssignmentCollection is falsy and a non-empty one truthy.
So you can `assert assignments,...`AssignmentCollection` can be used in many cases where you could also use
a `List[Assignment]`. With `AssignmentCollection.__bool__`, an empty
AssignmentCollection is falsy and a non-empty one truthy.
So you can `assert assignments, 'must not be emtpy'`https://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.pyhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/106WIP: Cuda autotune2020-10-07T13:04:35+02:00Stephan SeitzWIP: Cuda autotuneThis PR introduces ~~two~~ one change~~s~~:
- ~~rotate (32,1,1) depending on field strides to fastest dimension. So (1,1,32) for c-layout and (32,1,1) for fortran layout. So pystencils will be fast also for c-layout (this will always be...This PR introduces ~~two~~ one change~~s~~:
- ~~rotate (32,1,1) depending on field strides to fastest dimension. So (1,1,32) for c-layout and (32,1,1) for fortran layout. So pystencils will be fast also for c-layout (this will always be performed)~~
- auto-tune the block dimensions to whatevers is fastest for a specific kernel on localhost. On first kernel call different layouts are tried and the kernel will be called henceforth with the fastest configuration (disk_cached). This could be intersting for OpenCL where we don't know which launch config is the fastest (on OpenCL the runtime can alternatively give a hint on that).
One drawback: the test calls are only correct if input and output fields do not overlap (so no in-place kernels).https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/105Fix FiniteDifferenceStaggeredStencilDerivation on Sympy 1.12019-12-16T15:05:39+01:00Michael Kuronmkuron@icp.uni-stuttgart.deFix FiniteDifferenceStaggeredStencilDerivation on Sympy 1.1I broke it in !104I broke it in !104Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/104Minor improvements to FiniteDifferenceStaggeredStencilDerivation2019-12-06T20:20:51+01:00Michael Kuronmkuron@icp.uni-stuttgart.deMinor improvements to FiniteDifferenceStaggeredStencilDerivationMartin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/103Fix printing for Functions without name2019-12-05T13:17:02+01:00Stephan SeitzFix printing for Functions without nameThis fixes test for LLVM GPU using pointer_arith_funcThis fixes test for LLVM GPU using pointer_arith_funchttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/102Fix OpenCL for CUDA OpenCL by avoid int(...) constructor2019-12-05T13:17:16+01:00Stephan SeitzFix OpenCL for CUDA OpenCL by avoid int(...) constructorPrefer c-style cast instead.Prefer c-style cast instead.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/101WIP: Add csqrt, cpow to cuda_complex.hpp2021-11-22T15:41:05+01:00Stephan SeitzWIP: Add csqrt, cpow to cuda_complex.hppApparently, I'm using here a feature of a more recent C++ verion.
Specializing `cpow(T)` to `cpow(complex<T>)`Apparently, I'm using here a feature of a more recent C++ verion.
Specializing `cpow(T)` to `cpow(complex<T>)`https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/100Fix Opencl and LLVM GPU tests2019-12-05T11:02:49+01:00Stephan SeitzFix Opencl and LLVM GPU testsFix tests for LLVM GPU and OpenCL
- !96 made it impossible to print functions without names (only important for LLVM GPU test)
- !87 made it impossible to run OpenCL kernels on CUDA OpenCL `int(...)`. is not a valid cast for it
- Sy...Fix tests for LLVM GPU and OpenCL
- !96 made it impossible to print functions without names (only important for LLVM GPU test)
- !87 made it impossible to run OpenCL kernels on CUDA OpenCL `int(...)`. is not a valid cast for it
- SymPy moved `sympy.boolalg` to `sympy.logic.boolalg`https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/99finite difference stencil derivation for staggered positions2019-12-04T11:05:30+01:00Michael Kuronmkuron@icp.uni-stuttgart.definite difference stencil derivation for staggered positionsMartin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/98WIP: Graph datahandling2020-01-28T14:24:04+01:00Stephan SeitzWIP: Graph datahandlingThis is the draft for a data handling that (optionally) forwards all calls to SerialDatahandling.
All calls and data transfers get recorded for the creation of an execution graph.
Needs to be changed after the breaking changes in dat...This is the draft for a data handling that (optionally) forwards all calls to SerialDatahandling.
All calls and data transfers get recorded for the creation of an execution graph.
Needs to be changed after the breaking changes in datahandling.
Needs a tiny change in lbmpy:
Instead of using `TimeLoop(...)` for time loop creation a custom function is used.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/97WIP: Add assumptions based on cast_func.args[0]2021-11-22T15:32:23+01:00Stephan SeitzWIP: Add assumptions based on cast_func.args[0]This enables cast_func(1.f, create_type('double')).positive == TrueThis enables cast_func(1.f, create_type('double')).positive == Truehttps://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/95Auto for assignments2019-12-04T10:58:44+01:00Stephan SeitzAuto for assignmentsI had problems to teach pystencils C's weird type system for complex numbers with `auto` everything was working fine.I had problems to teach pystencils C's weird type system for complex numbers with `auto` everything was working fine.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/94Add __getnewargs__ to TypedImaginaryUnit2019-11-30T00:38:52+01:00Stephan SeitzAdd __getnewargs__ to TypedImaginaryUnitThere was a problem when pickling TypedImaginaryUnit since it was using the __getnewargs__ of TypedSymbol.There was a problem when pickling TypedImaginaryUnit since it was using the __getnewargs__ of TypedSymbol.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/93Reimplement create_staggered_kernel2020-01-14T15:46:47+01:00Michael Kuronmkuron@icp.uni-stuttgart.deReimplement create_staggered_kernel`create_staggered_kernel` now takes a list of assignments to staggered fields and otherwise behaves like `create_kernel`. I have included a diffusion equation test case in both D2Q5 and D2Q9. Putting vectorial/tensorial quantities on the...`create_staggered_kernel` now takes a list of assignments to staggered fields and otherwise behaves like `create_kernel`. I have included a diffusion equation test case in both D2Q5 and D2Q9. Putting vectorial/tensorial quantities on the staggered points also works.
This merge requests break API compatibility with the previous `create_staggered_kernel`.
Fixes #16. My next step is to implement automatic FV discretization.
Build of dependent projects (pygrandchem, pystencils_walberla) passes as per https://i10git.cs.fau.de/pycodegen/pycodegen/merge_requests/6.
Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/92More staggered grid improvements2019-12-17T14:52:00+01:00Michael Kuronmkuron@icp.uni-stuttgart.deMore staggered grid improvements- Fix access to directions with mixed signs (`NW`, `(-1/2, 1/2)` and the like). They were previously mapped to the wrong cell.
- When storing fluxes on a staggered grid, the usual sign convention is that
fluxes point outward from the c...- Fix access to directions with mixed signs (`NW`, `(-1/2, 1/2)` and the like). They were previously mapped to the wrong cell.
- When storing fluxes on a staggered grid, the usual sign convention is that
fluxes point outward from the cell. Previously, we did not consistently respect that
(`staggered_access("E")` would return the same thing as `staggered_access("W")`
did when called from the eastern-next cell). Now, when a field is declared
as `STAGGERED_FLUX`, it returns an accessor with a prefactor of -1 in that
case. The previous behavior where sign is not reversed is still useful when
e.g. storing sums (e.g. mean values) instead of differenes (e.g. finite
difference fluxes) on the staggered grid.
- `staggered_vector_access` returns a vector/tensor full of `Access` objects corresponding to the shape (`index_shape[1:]`) of the staggered fieldMartin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/91Avoid `hash()` in Field.hashable_contents2019-11-21T20:27:55+01:00Stephan SeitzAvoid `hash()` in Field.hashable_contentshash should not be used in hashable_contents because even if we will use
a deterministic hash function we will end up non-deterministic since
hash is initialized with a random seed.hash should not be used in hashable_contents because even if we will use
a deterministic hash function we will end up non-deterministic since
hash is initialized with a random seed.