Skip to content
Snippets Groups Projects
Commit 4fa9ced3 authored by Michael Kuron's avatar Michael Kuron :mortar_board:
Browse files

check for warning when vectorizing without stride-one

parent 68f909ee
No related branches found
No related tags found
No related merge requests found
Pipeline #32349 failed
......@@ -9,7 +9,7 @@ from lbmpy.moments import is_bulk_moment, is_shear_moment, get_order
from pystencils.rng import PhiloxTwoDoubles
import pytest
from pystencils.backends.simd_instruction_sets import get_supported_instruction_sets
from pystencils.backends.simd_instruction_sets import get_supported_instruction_sets, get_vector_instruction_set
def single_component_maxwell(x1, x2, kT, mass):
......@@ -58,7 +58,7 @@ def add_pressure_output_to_collision_rule(collision_rule, pressure_field):
collision_rule.main_assignments = collision_rule.main_assignments + pressure_ouput
def get_fluctuating_lb(size=None, kT=None, omega_shear=None, omega_bulk=None, omega_odd=None, omega_even=None, rho_0=None, target=None, cpu_vectorize_info=None):
def get_fluctuating_lb(size=None, kT=None, omega_shear=None, omega_bulk=None, omega_odd=None, omega_even=None, rho_0=None, target=None):
# Parameters
stencil = get_stencil('D3Q19')
......@@ -85,8 +85,7 @@ def get_fluctuating_lb(size=None, kT=None, omega_shear=None, omega_bulk=None, om
collision_rule = create_lb_collision_rule(
method,
fluctuating={
'temperature': kT,
'rng_node': PhiloxTwoDoubles,
'temperature': kT
},
optimization={'cse_global': True}
)
......@@ -103,7 +102,7 @@ def get_fluctuating_lb(size=None, kT=None, omega_shear=None, omega_bulk=None, om
{'density': rho, 'velocity': u})
opts = {'cpu_openmp': True,
'cpu_vectorize_info': cpu_vectorize_info,
'cpu_vectorize_info': None,
'target': dh.default_target}
# Compile kernels
......@@ -248,6 +247,7 @@ def test_point_force(target="cpu"):
dh.cpu_arrays["force"][force_pos[0],
force_pos[1], force_pos[2]] = np.zeros(3)
@pytest.mark.skipif(not get_supported_instruction_sets(), reason="No vector instruction sets supported")
@pytest.mark.parametrize('assume_aligned', (True, False))
@pytest.mark.parametrize('assume_inner_stride_one', (True, False))
......@@ -274,14 +274,22 @@ def test_vectorization(assume_aligned, assume_inner_stride_one, assume_sufficien
compressible=True,
kernel_type='collide_only')
instruction_set = get_supported_instruction_sets()[-1]
opts = {'cpu_openmp': False,
'cpu_vectorize_info': {
'instruction_set': get_supported_instruction_sets()[0],
'instruction_set': instruction_set,
'assume_aligned': assume_aligned,
'assume_inner_stride_one': assume_inner_stride_one,
'assume_sufficient_line_padding': assume_sufficient_line_padding,
},
'target': 'cpu'}
code = ps.create_kernel(collision, **opts)
if not assume_inner_stride_one and 'storeS' not in get_vector_instruction_set('double', instruction_set):
with pytest.warns(UserWarning) as warn:
code = ps.create_kernel(collision, **opts)
assert 'Could not vectorize loop' in warn[0].message.args[0]
else:
with pytest.warns(None) as warn:
code = ps.create_kernel(collision, **opts)
assert len(warn) == 0
code.compile()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment