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

Debug checking

parent 0834b5c9
No related branches found
No related tags found
No related merge requests found
Pipeline #37515 failed
......@@ -62,19 +62,20 @@ def test_vectorized_abs(instruction_set, dtype):
@pytest.mark.parametrize('instruction_set', supported_instruction_sets)
def test_strided(instruction_set, dtype):
npdtype = np.float64 if dtype == 'double' else np.float32
type_string = "float64" if dtype == 'double' else "float32"
f, g = ps.fields(f"f, g : float{64 if dtype=='double' else 32}[2D]")
f, g = ps.fields(f"f, g : {type_string}[2D]")
update_rule = [ps.Assignment(g[0, 0], f[0, 0] + f[-1, 0] + f[1, 0] + f[0, 1] + f[0, -1] + 42.0)]
if 'storeS' not in get_vector_instruction_set(dtype, instruction_set) and instruction_set not in ['avx512', 'rvv'] and not instruction_set.startswith('sve'):
with pytest.warns(UserWarning) as warn:
config = pystencils.config.CreateKernelConfig(cpu_vectorize_info={'instruction_set': instruction_set},
default_number_float=npdtype)
default_number_float=type_string)
ast = ps.create_kernel(update_rule, config=config)
assert 'Could not vectorize loop' in warn[0].message.args[0]
else:
with pytest.warns(None) as warn:
config = pystencils.config.CreateKernelConfig(cpu_vectorize_info={'instruction_set': instruction_set},
default_number_float=npdtype)
default_number_float=type_string)
ast = ps.create_kernel(update_rule, config=config)
assert len(warn) == 0
......@@ -83,6 +84,8 @@ def test_strided(instruction_set, dtype):
ref_func = ps.create_kernel(update_rule).compile()
arr = np.random.random((23 + 2, 17 + 2)).astype(npdtype)
print("sum arr: ", np.sum(arr))
# print("arr type: ", arr.dtype)
dst = np.zeros_like(arr, dtype=npdtype)
ref = np.zeros_like(arr, dtype=npdtype)
......@@ -92,8 +95,8 @@ def test_strided(instruction_set, dtype):
# print(dst)
# print(ref)
print(np.sum(dst))
print(np.sum(ref))
print("dst sum: ", np.sum(dst))
print("reference sum: ", np.sum(ref))
np.testing.assert_almost_equal(dst, ref, 13 if dtype == 'double' else 5)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment