Skip to content
Snippets Groups Projects

Reduction Support

Merged Richard Angersbach requested to merge rangersbach/reductions into v2.0-dev
Compare and Show latest version
1 file
+ 3
6
Preferences
Compare changes
import pytest
import numpy as np
try:
import cupy as cp
except ImportError:
pass
import pystencils as ps
from pystencils.sympyextensions import reduction_assignment_from_str
@@ -35,7 +30,6 @@ def get_reduction_assign_ast(dtype, op, config):
@pytest.mark.parametrize('dtype', ["float64", "float32"])
@pytest.mark.parametrize("op", ["+", "-", "*", "min", "max"])
def test_reduction_cpu(instruction_set, dtype, op):
vectorize_info = {'instruction_set': instruction_set, 'assume_inner_stride_one': True}
config = ps.CreateKernelConfig(target=ps.Target.CPU, cpu_openmp=True, cpu_vectorize_info=vectorize_info)
@@ -54,6 +48,9 @@ def test_reduction_cpu(instruction_set, dtype, op):
@pytest.mark.parametrize('dtype', ["float64", "float32"])
@pytest.mark.parametrize("op", ["+", "-", "*", "min", "max"])
def test_reduction_gpu(dtype, op):
pytest.importorskip('cupy')
import cupy as cp
config = ps.CreateKernelConfig(target=ps.Target.GPU)
ast_reduction = get_reduction_assign_ast(dtype, op, config)