From 52e67bc6f1a65e362baa3f30ecbbb8e16872b2e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6nig?= <jan.hoenig@fau.de> Date: Tue, 8 Feb 2022 14:40:09 +0100 Subject: [PATCH] Fix RNG test cases --- pystencils/backends/cbackend.py | 2 +- pystencils_tests/test_conditional_vec.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pystencils/backends/cbackend.py b/pystencils/backends/cbackend.py index b631f0a8a..03ab76ea9 100644 --- a/pystencils/backends/cbackend.py +++ b/pystencils/backends/cbackend.py @@ -611,7 +611,7 @@ class VectorizedCustomSympyPrinter(CustomSympyPrinter): basic_data_type = data_type.base_type symbol = self._print(expr) if basic_data_type != expr.dtype: - symbol = f'(({basic_data_type.data_type})({symbol}))' + symbol = f'(({basic_data_type})({symbol}))' instruction = 'makeVecConst' if basic_data_type.is_bool(): diff --git a/pystencils_tests/test_conditional_vec.py b/pystencils_tests/test_conditional_vec.py index 2d8193a46..c633f5058 100644 --- a/pystencils_tests/test_conditional_vec.py +++ b/pystencils_tests/test_conditional_vec.py @@ -86,7 +86,7 @@ def test_boolean_before_loop(): ast = ps.create_kernel(a, cpu_vectorize_info={'instruction_set': supported_instruction_sets[-1]}) kernel = ast.compile() kernel(f=f_arr, g=g_arr, t2=1.0) - print(g) + # print(g) np.testing.assert_array_equal(g_arr, 1.0) kernel(f=f_arr, g=g_arr, t2=-1.0) np.testing.assert_array_equal(g_arr, 42.0) @@ -102,8 +102,7 @@ def test_vec_maskstore(instruction_set, dtype): c = [Conditional(data.center() < 1.0, Block([SympyAssignment(data.center(), 2.0)]))] assignmets = NodeCollection(c) - ast = ps.create_kernel(assignmets, target=Target.CPU, - cpu_vectorize_info={'instruction_set': instruction_set}) + ast = ps.create_kernel(assignmets, target=Target.CPU, cpu_vectorize_info={'instruction_set': instruction_set}) kernel = ast.compile() kernel(data=data_arr) np.testing.assert_equal(data_arr[:3, :], 2.0) -- GitLab