Skip to content
Snippets Groups Projects
Commit b789f010 authored by Martin Bauer's avatar Martin Bauer
Browse files

Random number generation support for pystencils

- counter-based philox RNG: counter/key is filled with cell coordinate
  and optional external parameters like block position and time step
- works on CPU and GPU - on CPU only for non-vectorized versions

- introduced more flexible "CustomCodeNode" that can inject
  backend-specific hand-written code
parent b41dc352
No related branches found
No related tags found
No related merge requests found
import numpy as np import numpy as np
import sympy as sp import sympy as sp
from pystencils import TypedSymbol, create_indexed_kernel, Assignment from pystencils import TypedSymbol, create_indexed_kernel, Assignment
from pystencils.backends.cbackend import CustomCppCode from pystencils.backends.cbackend import CustomCodeNode
from pystencils.boundaries import BoundaryHandling from pystencils.boundaries import BoundaryHandling
from pystencils.boundaries.boundaryhandling import BoundaryOffsetInfo from pystencils.boundaries.boundaryhandling import BoundaryOffsetInfo
from pystencils.stencils import inverse_direction from pystencils.stencils import inverse_direction
...@@ -76,7 +76,7 @@ class LatticeBoltzmannBoundaryHandling(BoundaryHandling): ...@@ -76,7 +76,7 @@ class LatticeBoltzmannBoundaryHandling(BoundaryHandling):
boundary_obj, target=self._target, openmp=self._openmp) boundary_obj, target=self._target, openmp=self._openmp)
class LbmWeightInfo(CustomCppCode): class LbmWeightInfo(CustomCodeNode):
# --------------------------- Functions to be used by boundaries -------------------------- # --------------------------- Functions to be used by boundaries --------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment