Skip to content
Snippets Groups Projects
Commit ca1b544b authored by Helen Schottenhamml's avatar Helen Schottenhamml
Browse files

Merge branch 'fix_lbstep_segfault' into 'master'

[BugFix] Segfault LBStep

Closes #43

See merge request pycodegen/lbmpy!167
parents b175fb7b 07e46f01
Branches
Tags
1 merge request!167[BugFix] Segfault LBStep
Pipeline #65428 passed with stages
in 27 minutes and 29 seconds
This diff is collapsed.
......@@ -49,6 +49,9 @@ class LatticeBoltzmannStep:
default_target=target,
parallel=False)
if lbm_config:
method_parameters['stencil'] = lbm_config.stencil
if 'stencil' not in method_parameters:
method_parameters['stencil'] = LBStencil(Stencil.D2Q9) \
if data_handling.dim == 2 else LBStencil(Stencil.D3Q27)
......
......@@ -5,8 +5,9 @@ import pytest
from pystencils import Backend, Target, CreateKernelConfig
from lbmpy.creationfunctions import LBMConfig, LBMOptimisation
from lbmpy.enums import Method, Stencil
from lbmpy.scenarios import create_channel
from lbmpy.enums import Method
from lbmpy.stencils import LBStencil
def run_equivalence_test(domain_size, lbm_config, lbm_opt, config, time_steps=13):
......@@ -33,12 +34,14 @@ def run_equivalence_test(domain_size, lbm_config, lbm_opt, config, time_steps=13
def test_force_driven_channel_short(scenario):
pytest.importorskip("cupy")
ds = scenario[0]
stencil = LBStencil(Stencil.D2Q9) if len(ds) == 2 else LBStencil(Stencil.D3Q27)
method = scenario[1]
compressible = scenario[2]
block_size = scenario[3]
field_layout = scenario[4]
lbm_config = LBMConfig(method=method, compressible=compressible, relaxation_rates=[1.95, 1.9, 1.92, 1.92])
lbm_config = LBMConfig(stencil=stencil, method=method,
compressible=compressible, relaxation_rates=[1.95, 1.9, 1.92, 1.92])
lbm_opt = LBMOptimisation(field_layout=field_layout)
# Different methods
......
......@@ -3,8 +3,9 @@ import pytest
import pystencils as ps
from lbmpy.creationfunctions import create_lb_function, LBMConfig
from lbmpy.enums import Method
from lbmpy.enums import Method, Stencil
from lbmpy.scenarios import create_lid_driven_cavity
from lbmpy.stencils import LBStencil
@pytest.mark.parametrize('double_precision', [False, True])
......@@ -28,7 +29,8 @@ def test_creation(double_precision, method_enum):
@pytest.mark.parametrize('double_precision', [False, True])
@pytest.mark.parametrize('method_enum', [Method.SRT, Method.CENTRAL_MOMENT, Method.CUMULANT])
def test_scenario(method_enum, double_precision):
lbm_config = LBMConfig(method=method_enum, relaxation_rate=1.45, compressible=True)
lbm_config = LBMConfig(stencil=LBStencil(Stencil.D3Q27), method=method_enum,
relaxation_rate=1.45, compressible=True)
config = ps.CreateKernelConfig(data_type="float64" if double_precision else "float32",
default_number_float="float64" if double_precision else "float32")
sc = create_lid_driven_cavity((16, 16, 8), lbm_config=lbm_config, config=config)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment