pystencils merge requestshttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests2020-01-30T10:18:28+01:00https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/139Use `rich` for syntax highlighting of `show_code` also in terminal2020-01-30T10:18:28+01:00Stephan SeitzUse `rich` for syntax highlighting of `show_code` also in terminalStill works as usual in Jupyter notebooks and in terminal if `rich` is not installed.![Screenshot_20200130_100924](/uploads/5876a0aab841c4a2d736777cac4535f6/Screenshot_20200130_100924.png)Still works as usual in Jupyter notebooks and in terminal if `rich` is not installed.![Screenshot_20200130_100924](/uploads/5876a0aab841c4a2d736777cac4535f6/Screenshot_20200130_100924.png)https://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/137Add assertion that headers follow the pattern /"..."/ or /<...>/2020-01-24T12:19:42+01:00Stephan SeitzAdd assertion that headers follow the pattern /"..."/ or /<...>/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/135CI: Replace minimal-ubuntu job with ubuntu2020-01-23T18:35:24+01:00Michael Kuronmkuron@icp.uni-stuttgart.deCI: Replace minimal-ubuntu job with ubuntuThe case of testing that pystencils does not depend on any optional dependencies is still fulfilled by the minimal_conda image.
Depends on https://i10git.cs.fau.de/pycodegen/pycodegen/merge_requests/9.
Fixes https://i10git.cs.fau.de/...The case of testing that pystencils does not depend on any optional dependencies is still fulfilled by the minimal_conda image.
Depends on https://i10git.cs.fau.de/pycodegen/pycodegen/merge_requests/9.
Fixes https://i10git.cs.fau.de/pycodegen/pystencils/issues/19.Stephan SeitzStephan Seitzhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/134cuda.TextureReference.set_array(tex_ref, cu_array) -> tex_ref.set_array(cu_ar...2020-02-22T11:23:26+01:00Stephan Seitzcuda.TextureReference.set_array(tex_ref, cu_array) -> tex_ref.set_array(cu_array)I missed that this is actually a member function. Better call it
directly to make it also work with `cuda.SurfaceReference`.I missed that this is actually a member function. Better call it
directly to make it also work with `cuda.SurfaceReference`.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/133Allow vector assignments2020-01-21T22:04:08+01:00Stephan SeitzAllow vector assignments```python
>>>import pystencils as ps
>>>import sympy as sp
>>>a, b, c = sp.symbols("a b c")
>>>ps.Assignment(sp.Matrix([a,b,c]), sp.Matrix([1,2,3]))
(Assignment(a, 1), Assignment(b, 2), Assignment(c, 3))
```
Fixes #17```python
>>>import pystencils as ps
>>>import sympy as sp
>>>a, b, c = sp.symbols("a b c")
>>>ps.Assignment(sp.Matrix([a,b,c]), sp.Matrix([1,2,3]))
(Assignment(a, 1), Assignment(b, 2), Assignment(c, 3))
```
Fixes #17https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/132let show_code display/print code2020-01-21T22:02:07+01:00Stephan Seitzlet show_code display/print code- `get_code_obj` will keep the previous behavior of `show_code`
- `get_code_str` will be equivalent to previous `str(show_code(...))`
Fixes #6- `get_code_obj` will keep the previous behavior of `show_code`
- `get_code_str` will be equivalent to previous `str(show_code(...))`
Fixes #6https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/131Print actual block contents in Conditional.{__repr__,__str__}2020-01-17T16:55:16+01:00Stephan SeitzPrint actual block contents in Conditional.{__repr__,__str__}https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/130Fix bug related to ParallelDataHandling2020-01-17T16:55:58+01:00Stephan SeitzFix bug related to ParallelDataHandling```python
def to_gpu(gpu_version, cpu_version):
gpu_version = gpu_version.boundary_object_to_index_list
cpu_version = cpu_version.boundary_object_to_index_list
> if isinstance(self.data_handling, ParallelDataHa...```python
def to_gpu(gpu_version, cpu_version):
gpu_version = gpu_version.boundary_object_to_index_list
cpu_version = cpu_version.boundary_object_to_index_list
> if isinstance(self.data_handling, ParallelDataHandling):
E TypeError: isinstance() arg 2 must be a type or tuple of types
../pystencils/pystencils/boundaries/boundaryhandling.py:102: TypeError
```
None is not a type! ParallelDataHandling is None if `waLBerla` is not
installedhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/129Interpolation refactoring2020-01-23T16:46:04+01:00Stephan SeitzInterpolation refactoringThis is among other small things a refactoring of the interpolation
- Make textures less special (now subclasses of interpolator)
- Remove `TextureCache`
- (Ab-) use finite differences to enable spatial derivatives of interpolators
- en...This is among other small things a refactoring of the interpolation
- Make textures less special (now subclasses of interpolator)
- Remove `TextureCache`
- (Ab-) use finite differences to enable spatial derivatives of interpolators
- enable code to use https://github.com/theHamsta/CubicInterpolationCUDA (not included into pystencils, not even as a submodule)
I can use it to transform Lenna and get gradients with Torch wrt. to image content, x-translation, y-translation
![Screenshot_20200115_182600](/uploads/32b95089b2a0d15008750db21980ed54/Screenshot_20200115_182600.png)
Also a nice image lenna
![transformed](/uploads/afb63a546751caf4a0316118afda50ef/transformed.png)https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/128Fix FiniteDifferenceStencilDerivation.rotate_weights_and_apply2020-01-17T16:55:40+01:00Stephan SeitzFix FiniteDifferenceStencilDerivation.rotate_weights_and_applyRecent Numpy version do not support conversion from arbitrary iterables if they have the attribute shape.
The FiniteDifferncesNotebook fails on my machine since to `shape` (3,3,3) and sequence of length 27 don't fit together.
I guess...Recent Numpy version do not support conversion from arbitrary iterables if they have the attribute shape.
The FiniteDifferncesNotebook fails on my machine since to `shape` (3,3,3) and sequence of length 27 don't fit together.
I guess that recent Numpy will deprecated construction from arbitray sequences (only list and tuple, and objects with `__array__` are allowed).https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/127Correctly print sp.Abs in generated code2020-02-03T13:28:20+01:00Michael Kuronmkuron@icp.uni-stuttgart.deCorrectly print sp.Abs in generated codeAnother issue reported by @alexander.reinauer.Another issue reported by @alexander.reinauer.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/126Fix failing interpolation tests on newer sympy versions2020-01-16T10:57:24+01:00Stephan SeitzFix failing interpolation tests on newer sympy versionsSome tests where failing on newer SymPy versions due two reasons:
- fmod was where it should be % (fix in code), affect mirror boundary handling for interpolation
- in rotation test: `mirror` and `wrap` boundary handling was failing due...Some tests where failing on newer SymPy versions due two reasons:
- fmod was where it should be % (fix in code), affect mirror boundary handling for interpolation
- in rotation test: `mirror` and `wrap` boundary handling was failing due two complex conjugate (mark test as xfail)https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/125Fix {PyCuda,PyOpenCl}ArrayHandler.{zeros,ones,randn}2020-01-15T20:42:01+01:00Stephan SeitzFix {PyCuda,PyOpenCl}ArrayHandler.{zeros,ones,randn}https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/124Add dtype to DataHandling.add_arrays2020-01-15T13:32:17+01:00Stephan SeitzAdd dtype to DataHandling.add_arrayshttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/123Make create_staggered_kernel work with OpenMP2020-01-14T15:54:40+01:00Michael Kuronmkuron@icp.uni-stuttgart.deMake create_staggered_kernel work with OpenMPIssue reported bey @alexander.reinauer. I broke this in !93.Issue reported bey @alexander.reinauer. I broke this in !93.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/122SerialDataHandling: synchronization_function for tensor fields2020-01-16T10:57:16+01:00Michael Kuronmkuron@icp.uni-stuttgart.deSerialDataHandling: synchronization_function for tensor fieldsIt already worked on the CPU, just needed to remove the check. On the GPU, we use `itertools.product` to create the nested loop needed.It already worked on the CPU, just needed to remove the check. On the GPU, we use `itertools.product` to create the nested loop needed.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/121Automatic Finite Volume and Volume-of-Fluid discretization2020-01-14T14:08:05+01:00Michael Kuronmkuron@icp.uni-stuttgart.deAutomatic Finite Volume and Volume-of-Fluid discretizationI don't yet have a good test for volume-of-fluid and the source term, but @alexander.reinauer requested the code because he needs it now. I'll add the missing tests at some later point.I don't yet have a good test for volume-of-fluid and the source term, but @alexander.reinauer requested the code because he needs it now. I'll add the missing tests at some later point.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/120Add DataHandling.add_arrays2020-01-14T14:09:15+01:00Stephan SeitzAdd DataHandling.add_arraysThis adds a function for lazy people who want to write
```python
dh = create_data_handling((20, 30))
x, y, z = dh.add_arrays('x, y(9), z')
```
instead of
```python
dh = create_data_handling((20, 30))
dh.add_array('x')
dh.a...This adds a function for lazy people who want to write
```python
dh = create_data_handling((20, 30))
x, y, z = dh.add_arrays('x, y(9), z')
```
instead of
```python
dh = create_data_handling((20, 30))
dh.add_array('x')
dh.add_array('y', values_per_cell=9)
dh.add_array('z')
```
because in most cases you want to use more than one array.