Skip to content
Snippets Groups Projects
Commit dcdfff04 authored by Richard Angersbach's avatar Richard Angersbach
Browse files

Parameterize test_reduction.py for different reduction operations

parent ffcd54e0
1 merge request!438Reduction Support
...@@ -3,17 +3,18 @@ import numpy as np ...@@ -3,17 +3,18 @@ import numpy as np
import sympy as sp import sympy as sp
import pystencils as ps import pystencils as ps
from pystencils import AddReducedAssignment from pystencils.sympyextensions import reduced_assign
@pytest.mark.parametrize('dtype', ["float64"]) @pytest.mark.parametrize('dtype', ["float64"])
def test_reduction(dtype): @pytest.mark.parametrize("op", ["+", "-", "*", "min", "max"])
def test_reduction(dtype, op):
x = ps.fields(f'x: {dtype}[1d]') x = ps.fields(f'x: {dtype}[1d]')
w = sp.Symbol("w") w = sp.Symbol("w")
# kernel with reduction assignment # kernel with reduction assignment
reduction_assignment = AddReducedAssignment(w, x.center()) reduction_assignment = reduced_assign(w, op, x.center())
config = ps.CreateKernelConfig(cpu_openmp=True) config = ps.CreateKernelConfig(cpu_openmp=True)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment