diff --git a/lbmpy/methods/centeredcumulant/centeredcumulantmethod.py b/lbmpy/methods/centeredcumulant/centeredcumulantmethod.py index 0c7e59dbb9c75793edff202ef5b32c97afcd17cf..cf70043f8d414e52a65076f87cee2c7e5aaf885c 100644 --- a/lbmpy/methods/centeredcumulant/centeredcumulantmethod.py +++ b/lbmpy/methods/centeredcumulant/centeredcumulantmethod.py @@ -368,8 +368,8 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod): lower_order_equilibrium = [info.equilibrium_value for info in lower_order_relaxation_infos] lower_order_moment_collision_eqs = relax_lower_order_central_moments( - lower_order_moments, lower_order_moment_symbols, - lower_order_relaxation_rates, lower_order_equilibrium) + lower_order_moments, tuple(lower_order_moment_symbols), + tuple(lower_order_relaxation_rates), tuple(lower_order_equilibrium)) # 5) Add relaxation rules for higher-order, polynomial cumulants poly_relaxation_infos = [cumulant_to_relaxation_info_dict[c] for c in higher_order_polynomials] @@ -383,8 +383,8 @@ class CenteredCumulantBasedLbMethod(AbstractLbMethod): galilean_correction_terms = None cumulant_collision_eqs = relax_polynomial_cumulants( - monomial_cumulants, higher_order_polynomials, - poly_relaxation_rates, poly_equilibrium, + tuple(monomial_cumulants), tuple(higher_order_polynomials), + tuple(poly_relaxation_rates), tuple(poly_equilibrium), pre_simplification, galilean_correction_terms=galilean_correction_terms) diff --git a/lbmpy_tests/centeredcumulant/test_equilibrium.py b/lbmpy_tests/centeredcumulant/test_equilibrium.py index 716ea6cc63ce365c73f5cfd0a56c88ec3db6c8ab..c04de758c3f7bd68a584a4dd2b01ea5f75f6767c 100644 --- a/lbmpy_tests/centeredcumulant/test_equilibrium.py +++ b/lbmpy_tests/centeredcumulant/test_equilibrium.py @@ -50,7 +50,7 @@ def test_equilibrium_pdfs(stencil_name, cm_transform): if ref_equilibrium is None: raw_moments = list(extract_monomials(c_lb_method.cumulants, dim=dim)) ref_equilibrium = generate_equilibrium_by_matching_moments( - stencil, raw_moments, rho=rho, u=u, c_s_sq=sp.Rational(1, 3), order=2*dim) + stencil, tuple(raw_moments), rho=rho, u=u, c_s_sq=sp.Rational(1, 3), order=2*dim) reference_equilibria[stencil_name] = ref_equilibrium for i in range(q): diff --git a/lbmpy_tests/full_scenarios/schaefer_turek/scenario_schaefer_turek.py b/lbmpy_tests/full_scenarios/schaefer_turek/scenario_schaefer_turek.py index f84fa790364748a43e05f595ac9e3e417f98675d..514045ce797a9e935d82380a3453d953f2402093 100644 --- a/lbmpy_tests/full_scenarios/schaefer_turek/scenario_schaefer_turek.py +++ b/lbmpy_tests/full_scenarios/schaefer_turek/scenario_schaefer_turek.py @@ -8,7 +8,9 @@ a cylinder. In Flow simulation with high-performance computers II (pp. 547-566). import warnings import numpy as np +import pytest +from pystencils.backends.simd_instruction_sets import get_supported_instruction_sets from lbmpy.boundaries.boundaryconditions import NoSlip from lbmpy.geometry import get_pipe_velocity_field from lbmpy.relaxationrates import relaxation_rate_from_lattice_viscosity @@ -146,8 +148,9 @@ def long_run(steady=True, **kwargs): plt.show() +@pytest.mark.skipif(not get_supported_instruction_sets(), reason='cannot detect CPU instruction set') def test_schaefer_turek(): - opt = {'vectorization': {'instruction_set': 'avx', 'assume_aligned': True}, 'openmp': 2} + opt = {'vectorization': {'instruction_set': get_supported_instruction_sets()[-1], 'assume_aligned': True}, 'openmp': 2} sc_2d_1 = schaefer_turek_2d(30, max_lattice_velocity=0.08, optimization=opt) sc_2d_1.run(30000) result = evaluate_static_quantities(sc_2d_1) diff --git a/lbmpy_tests/test_geometry_setup_serial.py b/lbmpy_tests/test_geometry_setup_serial.py index 3ef30ff912928098987b1ad995a45f00960307d8..c68ba86496f62a91739022e6c45d3c7c3e06b331 100644 --- a/lbmpy_tests/test_geometry_setup_serial.py +++ b/lbmpy_tests/test_geometry_setup_serial.py @@ -1,6 +1,7 @@ import os import numpy as np +import pytest from lbmpy.boundaries import NoSlip from lbmpy.geometry import add_black_and_white_image, add_pipe_walls @@ -49,6 +50,7 @@ def get_test_image_path(): def test_image(): + pytest.importorskip('scipy.ndimage') sc = LatticeBoltzmannStep(domain_size=(50, 40), method='srt', relaxation_rate=1.9, optimization={}) add_black_and_white_image(sc.boundary_handling, get_test_image_path(), keep_aspect_ratio=True) diff --git a/lbmpy_tests/test_postprocessing.py b/lbmpy_tests/test_postprocessing.py index a72cd3518a97b72f7246ef7b997f738298e21c1c..df1fb4c86f492d0142bba4596474fac93dc00feb 100644 --- a/lbmpy_tests/test_postprocessing.py +++ b/lbmpy_tests/test_postprocessing.py @@ -1,9 +1,12 @@ import numpy as np +import pytest from lbmpy.postprocessing import scalar_field_interpolator, vector_field_interpolator def test_interpolation(): + pytest.importorskip('scipy.ndimage') + scalar_arr = np.arange(0, 3*3).reshape(3, 3) scalar_ip = scalar_field_interpolator(scalar_arr) np.testing.assert_equal(scalar_ip([[1, 1.5], [0.5, 1]]), [2.5, 0.5]) diff --git a/lbmpy_tests/test_vectorization.py b/lbmpy_tests/test_vectorization.py index 74394552b52481ba1493bd9eec8f432b7be70c13..03d09fe308a82819467554b764f181c73fe72c24 100644 --- a/lbmpy_tests/test_vectorization.py +++ b/lbmpy_tests/test_vectorization.py @@ -1,9 +1,11 @@ import numpy as np import pytest +from pystencils.backends.simd_instruction_sets import get_supported_instruction_sets from lbmpy.scenarios import create_lid_driven_cavity +@pytest.mark.skipif(not get_supported_instruction_sets(), reason='cannot detect CPU instruction set') def test_lbm_vectorization_short(): print("Computing reference solutions") size1 = (64, 32) @@ -13,7 +15,7 @@ def test_lbm_vectorization_short(): ldc1_ref.run(10) ldc1 = create_lid_driven_cavity(size1, relaxation_rate=relaxation_rate, - optimization={'vectorization': {'instruction_set': 'avx', + optimization={'vectorization': {'instruction_set': get_supported_instruction_sets()[-1], 'assume_aligned': True, 'nontemporal': True, 'assume_inner_stride_one': True, @@ -23,7 +25,7 @@ def test_lbm_vectorization_short(): ldc1.run(10) -@pytest.mark.parametrize('instruction_set', ['sse', 'avx']) +@pytest.mark.parametrize('instruction_set', get_supported_instruction_sets()) @pytest.mark.parametrize('aligned_and_padding', [[False, False], [True, False], [True, True]]) @pytest.mark.parametrize('nontemporal', [False, True]) @pytest.mark.parametrize('double_precision', [False, True])