pystencils issueshttps://i10git.cs.fau.de/pycodegen/pystencils/-/issues2021-11-29T10:21:20+01:00https://i10git.cs.fau.de/pycodegen/pystencils/-/issues/51Installing Pystencils2021-11-29T10:21:20+01:00Markus HolzerInstalling PystencilsFrom time to time problems arise when installing `pystencils`. The latest problem for example was that `pip` was not installed in a new `conda` environment and then for compiling the boundary C-File was linked with the wrong python version. Problems like these should be collected in an FAQ file or something similar.
Just by comparing with `NumPy` there is quite a long install prerequisite file although the installation of `NumPy` is really straightforward. Something like this I already imagine for `pystencils`:
https://numpy.org/install/From time to time problems arise when installing `pystencils`. The latest problem for example was that `pip` was not installed in a new `conda` environment and then for compiling the boundary C-File was linked with the wrong python version. Problems like these should be collected in an FAQ file or something similar.
Just by comparing with `NumPy` there is quite a long install prerequisite file although the installation of `NumPy` is really straightforward. Something like this I already imagine for `pystencils`:
https://numpy.org/install/Markus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/issues/42Logging2021-11-19T15:53:54+01:00Markus HolzerLoggingPython provides very good logging functionality which should be used in pystencils. For example problems in the type-system could be logged on a debug level. Oftentimes it is necessary to add print statements in a debug session to see which expressions are cast to which type etc. This could always be logged on a debug level so we can just always see what happens in the back.
https://docs.python.org/3/howto/logging.htmlPython provides very good logging functionality which should be used in pystencils. For example problems in the type-system could be logged on a debug level. Oftentimes it is necessary to add print statements in a debug session to see which expressions are cast to which type etc. This could always be logged on a debug level so we can just always see what happens in the back.
https://docs.python.org/3/howto/logging.htmlMarkus HolzerMarkus Holzerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/issues/33Optimisation of numerical conditioning2021-10-14T22:56:04+02:00Markus HolzerOptimisation of numerical conditioningNumerical conditioning is very important, especially when using single precision. There are several cases that have been shown in the literature where this plays an important role. First storing only the deviation from the equilibrium of the particle distributions of a lattice Boltzmann simulation instead of storing the equilibrium. Second in the advanced lattice Boltzmann methods like the cumulant LBM where it was shown that numerical conditioning is an extremely important task to get a stable simulation.
This task is very tedious and complicated. However, a starting point could be to look at [pyinterval](https://pypi.org/project/pyinterval/) and investigate the error which comes from certain operations. This could lead to knowledge on minimizing errors arising from numerical methods.Numerical conditioning is very important, especially when using single precision. There are several cases that have been shown in the literature where this plays an important role. First storing only the deviation from the equilibrium of the particle distributions of a lattice Boltzmann simulation instead of storing the equilibrium. Second in the advanced lattice Boltzmann methods like the cumulant LBM where it was shown that numerical conditioning is an extremely important task to get a stable simulation.
This task is very tedious and complicated. However, a starting point could be to look at [pyinterval](https://pypi.org/project/pyinterval/) and investigate the error which comes from certain operations. This could lead to knowledge on minimizing errors arising from numerical methods.https://i10git.cs.fau.de/pycodegen/pystencils/-/issues/29Aligned GPU Array2020-12-10T10:40:02+01:00Markus HolzerAligned GPU ArrayAt the moment only aligned CPU arrays exist. For GPU arrays it should also be possible to pass the alignment and create an array of which.
Possible implementation:
```
base_array = gpuarray.GPUArray((array.size + 8), dtype=array.dtype)
gpu_array = gpuarray.GPUArray(
shape=tuple(array.shape),
dtype=array.dtype,
base=base_array,
gpudata=int(base_array.gpudata) + 24,
strides=tuple(gpuarray._compact_strides(array)),)
```At the moment only aligned CPU arrays exist. For GPU arrays it should also be possible to pass the alignment and create an array of which.
Possible implementation:
```
base_array = gpuarray.GPUArray((array.size + 8), dtype=array.dtype)
gpu_array = gpuarray.GPUArray(
shape=tuple(array.shape),
dtype=array.dtype,
base=base_array,
gpudata=int(base_array.gpudata) + 24,
strides=tuple(gpuarray._compact_strides(array)),)
```