Skip to content
Snippets Groups Projects
Commit 1593e3f2 authored by Markus Holzer's avatar Markus Holzer
Browse files

Fixed vec any test case

parent efeb0e05
No related branches found
No related tags found
1 merge request!226Fix field size
......@@ -5,6 +5,7 @@ import pytest
import pystencils as ps
from pystencils.astnodes import Block, Conditional
from pystencils.backends.simd_instruction_sets import get_supported_instruction_sets
from pystencils.backends.x86_instruction_sets import get_vector_instruction_set_x86
from pystencils.cpu.vectorization import vec_all, vec_any
......@@ -13,7 +14,7 @@ from pystencils.cpu.vectorization import vec_all, vec_any
def test_vec_any():
data_arr = np.zeros((15, 15))
data_arr[3:9, 2:7] = 1.0
data_arr[3:9, 1] = 1.0
data = ps.fields("data: double[2D]", data=data_arr)
c = [
......@@ -22,11 +23,15 @@ def test_vec_any():
ps.Assignment(data.center(), 2.0)
]))
]
instruction_set = get_supported_instruction_sets()[-1]
ast = ps.create_kernel(c, target='cpu',
cpu_vectorize_info={'instruction_set': get_supported_instruction_sets()[-1]})
cpu_vectorize_info={'instruction_set': instruction_set})
kernel = ast.compile()
kernel(data=data_arr)
np.testing.assert_equal(data_arr[3:9, 0:8], 2.0)
width = get_vector_instruction_set_x86(instruction_set=instruction_set)['width']
np.testing.assert_equal(data_arr[3:9, 0:width], 2.0)
@pytest.mark.skipif(not get_supported_instruction_sets(), reason='cannot detect CPU instruction set')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment