pystencils merge requestshttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests2019-11-21T20:06:33+01:00https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/89cbackend: short-cut _print_Conditional if condition is a boolean atom2019-11-21T20:06:33+01:00Michael Kuronmkuron@icp.uni-stuttgart.decbackend: short-cut _print_Conditional if condition is a boolean atomWithout this merge request, it prints
```c++
if(True)
{
[...]
}
else
{
[...]
}
```
Note the uppercase `T`, which is not valid C++.Without this merge request, it prints
```c++
if(True)
{
[...]
}
else
{
[...]
}
```
Note the uppercase `T`, which is not valid C++.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/88fix minor regressions introduced with !862019-11-21T20:05:55+01:00Michael Kuronmkuron@icp.uni-stuttgart.defix minor regressions introduced with !86- `DataHandling.array_like` did not preserve staggeredness.
- Printing a staggered `FieldAccess` sometimes threw errors because of `int` vs. `numpy.int64`.
- Accessing an invalid staggered neighbor did not produce a good error message....- `DataHandling.array_like` did not preserve staggeredness.
- Printing a staggered `FieldAccess` sometimes threw errors because of `int` vs. `numpy.int64`.
- Accessing an invalid staggered neighbor did not produce a good error message.
- I had reversed the index convention so that it was inconsistent with the documentation of `create_staggered_kernel`.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/87OpenCL macOS support2019-12-03T13:38:45+01:00Michael Kuronmkuron@icp.uni-stuttgart.deOpenCL macOS supportEither my laptop's GPU (Intel Iris Graphics 550) or Apple's OpenCL implementation does not support double precision. This patch checks all kernel arguments for double precision types, though I guess there is probably some easier way to j...Either my laptop's GPU (Intel Iris Graphics 550) or Apple's OpenCL implementation does not support double precision. This patch checks all kernel arguments for double precision types, though I guess there is probably some easier way to just check the entire AST, but I couldn't figure out how.
Also, `get_local_id` et al. return `size_t` per the OpenCL specification, while CUDA's `threadIdx` et al. return an `int`, so there is a cast needed to silence a conversion warning.Stephan SeitzStephan Seitzhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/86Staggered field access and staggered fields with fluxes to edges/faces2019-12-17T14:52:00+01:00Michael Kuronmkuron@icp.uni-stuttgart.deStaggered field access and staggered fields with fluxes to edges/facesThe first index dimension is always used to identify the staggered point, any further ones can be used to store vectors/tensors at these points. `f.staggered_access("N")` or `f.staggered_access(0, sp.Rational(1, 2)))` is now supported. T...The first index dimension is always used to identify the staggered point, any further ones can be used to store vectors/tensors at these points. `f.staggered_access("N")` or `f.staggered_access(0, sp.Rational(1, 2)))` is now supported. The string representation of the resulting accessor is $`f_{(0,\frac{1}{2})}`$. Furthermore, staggered fields can now have more staggered points than spatial dimensions, i.e. to store fluxes to edge/face neighbors (e.g. `f.staggered_access("NE")`.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/84Remove duplicated uint typedef2019-11-06T12:41:39+01:00Michael Kuronmkuron@icp.uni-stuttgart.deRemove duplicated uint typedefRunning the OpenCL test on AMD's ROCm platform results in
```
pystencils_tests/test_opencl.py::test_without_cuda
/usr/lib/python3/dist-packages/pyopencl/cffi_cl.py:1516: CompilerWarning: Built kernel retrieved from cache. Original from...Running the OpenCL test on AMD's ROCm platform results in
```
pystencils_tests/test_opencl.py::test_without_cuda
/usr/lib/python3/dist-packages/pyopencl/cffi_cl.py:1516: CompilerWarning: Built kernel retrieved from cache. Original from-source build had warnings:
Build on <pyopencl.Device 'gfx900' on 'AMD Accelerated Parallel Processing' at 0x34f0f50> succeeded, but said:
In file included from /tmp/comgr-1f94f8/input/CompileCLSource:1:
./pystencils/pystencils/include/opencl_stdint.h:4:27: warning: redefinition of typedef 'uint' is a C11 feature
typedef unsigned int uint;
^
/data/jenkins_workspace/compute-rocm-rel-2.9/out/ubuntu-16.04/16.04/srctf/ocl_lc/drivers/opencl/library/amdgcn/headers/build/lnx64a/B_rel/<stdin>:52:22: note: previous definition is here
typedef unsigned int uint;
```
According to the [specification](https://www.khronos.org/registry/OpenCL/specs/2.2/html/OpenCL_C.html#built-in-scalar-data-types), the `uint` type is part of the OpenCL C builtin types (and has been since version 1.0), so this typedef is not needed. In Nvidia's OpenCL stack, it appears to be built into the compiler, while LLVM (and thus AMD) define it in a [header file](https://github.com/llvm/llvm-project/blob/89de0d8dfbb9a6ff1f8b141ed70b563ecc094878/clang/lib/Headers/opencl-c.h#L55).Stephan SeitzStephan Seitzhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/83Fix create_cuda_kernel to allow CUSTOM_FIELDS to have a different size2019-11-12T13:49:38+01:00Stephan SeitzFix create_cuda_kernel to allow CUSTOM_FIELDS to have a different sizeThe CPU backend allows Fields with FieldType.CUSTOM to have a differnt spatial_shape. The GPU backend should also.The CPU backend allows Fields with FieldType.CUSTOM to have a differnt spatial_shape. The GPU backend should also.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/82Add Field.itemsize (yields Field.dtype.numpy_dtype.itemsize)2019-10-29T10:31:47+01:00Stephan SeitzAdd Field.itemsize (yields Field.dtype.numpy_dtype.itemsize)https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/81Oops, forgot a return in TextureCachedField.reproducible_hash2019-10-28T13:26:22+01:00Stephan SeitzOops, forgot a return in TextureCachedField.reproducible_hashhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/80Use reproducible hashlib for representing TextureCachedField2019-10-28T12:38:04+01:00Stephan SeitzUse reproducible hashlib for representing TextureCachedFieldTextureCachedField was using `hash(...)` to disambiguate its instances.
However, `hash` is randomized and will hinder reproducible code
generationTextureCachedField was using `hash(...)` to disambiguate its instances.
However, `hash` is randomized and will hinder reproducible code
generationhttps://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/78correctly print RNG nodes2019-10-21T14:05:18+02:00Michael Kuronmkuron@icp.uni-stuttgart.decorrectly print RNG nodesRegular assignments also use `\\leftarrow`. `<-` looks odd in Jupyter because it renders like `< -PhiloxRNG`, where it looks like less than minus.Regular assignments also use `\\leftarrow`. `<-` looks odd in Jupyter because it renders like `< -PhiloxRNG`, where it looks like less than minus.Martin BauerMartin Bauerhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/77Run opencl without pycuda2019-10-21T14:06:35+02:00Stephan SeitzRun opencl without pycudaFix #15
This includes !76.
If anyone wants to use textures on OpenCL, we need to decouple `TextureInterpolatedField` from CUDA.Fix #15
This includes !76.
If anyone wants to use textures on OpenCL, we need to decouple `TextureInterpolatedField` from CUDA.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/76Fix OpenCL with older Sympy and pyopencl versions2019-10-21T14:06:35+02:00Michael Kuronmkuron@icp.uni-stuttgart.deFix OpenCL with older Sympy and pyopencl versionsI'm using sympy and pyopencl from the Ubuntu 18.04 repositories and these changes were required to make the OpenCL tests pass on an Nvidia machine. AMD doesn't work, see #15.I'm using sympy and pyopencl from the Ubuntu 18.04 repositories and these changes were required to make the OpenCL tests pass on an Nvidia machine. AMD doesn't work, see #15.Stephan SeitzStephan Seitzhttps://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/74Add __str__ representation for TextureDeclaration2019-10-21T14:07:20+02:00Stephan SeitzAdd __str__ representation for TextureDeclarationhttps://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/73Bugfix: textures should be implemented as textures without changes2019-10-21T14:07:44+02:00Stephan SeitzBugfix: textures should be implemented as textures without changesFixes a small bug when using textures directly. Textures where different despite having the same hash.Fixes a small bug when using textures directly. Textures where different despite having the same hash.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/72Support complex numbers2023-01-02T23:44:24+01:00Stephan SeitzSupport complex numbersOnly down side in the moment is that `complex<double>` and `complex<float>` must never be mixed in a kernel (real scalars of the other type are mostly ok due to manually implemented templates).
Should work on CPU and GPU.
Another thing...Only down side in the moment is that `complex<double>` and `complex<float>` must never be mixed in a kernel (real scalars of the other type are mostly ok due to manually implemented templates).
Should work on CPU and GPU.
Another thing that this PR changes is that also the `headers` attribute of SymPy Expression is checked to determine necessary headers.https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/71Fix printing of sp.Infinity/sp.NegativeInfinity2019-10-10T21:36:11+02:00Stephan SeitzFix printing of sp.Infinity/sp.NegativeInfinityFor sympy, oo s a number. So pystencils prints a double
INFINITY as INFINITY.0For sympy, oo s a number. So pystencils prints a double
INFINITY as INFINITY.0https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/70Fix error in README.md: pystencils[pyopencl] -> pystencils[opencl]2019-10-09T11:52:53+02:00Stephan SeitzFix error in README.md: pystencils[pyopencl] -> pystencils[opencl]Align `README.md` with `setup.py`Align `README.md` with `setup.py`https://i10git.cs.fau.de/pycodegen/pystencils/-/merge_requests/69Small fixes2019-10-01T15:12:52+02:00Stephan SeitzSmall fixes