Skip to content
Snippets Groups Projects
Commit 01a56d31 authored by Michael Kuron's avatar Michael Kuron :mortar_board:
Browse files

skip tests with unmet dependencies

parent 3078eb30
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,7 @@ collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/autodiff.py")] ...@@ -44,7 +44,7 @@ collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/autodiff.py")]
try: try:
import pycuda import pycuda
except ImportError: except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/pystencils_tests/test_cudagpu.py")] collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_cudagpu.py")]
add_path_to_ignore('pystencils/gpucuda') add_path_to_ignore('pystencils/gpucuda')
try: try:
...@@ -73,7 +73,22 @@ try: ...@@ -73,7 +73,22 @@ try:
import blitzdb import blitzdb
except ImportError: except ImportError:
add_path_to_ignore('pystencils/runhelper') add_path_to_ignore('pystencils/runhelper')
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils_tests/test_parameterstudy.py")]
try:
import islpy
except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/integer_set_analysis.py")]
try:
import graphviz
except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/backends/dot.py")]
try:
import pyevtk
except ImportError:
collect_ignore += [os.path.join(SCRIPT_FOLDER, "pystencils/datahandling/vtk.py")]
collect_ignore += [os.path.join(SCRIPT_FOLDER, 'setup.py')] collect_ignore += [os.path.join(SCRIPT_FOLDER, 'setup.py')]
...@@ -131,7 +146,7 @@ class IPyNbFile(pytest.File): ...@@ -131,7 +146,7 @@ class IPyNbFile(pytest.File):
exporter.exclude_markdown = True exporter.exclude_markdown = True
exporter.exclude_input_prompt = True exporter.exclude_input_prompt = True
notebook_contents = self.fspath.open() notebook_contents = self.fspath.open(encoding='utf-8')
with warnings.catch_warnings(): with warnings.catch_warnings():
warnings.filterwarnings("ignore", "IPython.core.inputsplitter is deprecated") warnings.filterwarnings("ignore", "IPython.core.inputsplitter is deprecated")
......
...@@ -79,14 +79,14 @@ def create_kernel(assignments, ...@@ -79,14 +79,14 @@ def create_kernel(assignments,
[0., 0., 0., 0., 0.]]) [0., 0., 0., 0., 0.]])
""" """
# ---- Normalizing parameters # ---- Normalizing parameters
if isinstance(assignments, Assignment):
assignments = [assignments]
assert assignments, "Assignments must not be empty!" assert assignments, "Assignments must not be empty!"
split_groups = () split_groups = ()
if isinstance(assignments, AssignmentCollection): if isinstance(assignments, AssignmentCollection):
if 'split_groups' in assignments.simplification_hints: if 'split_groups' in assignments.simplification_hints:
split_groups = assignments.simplification_hints['split_groups'] split_groups = assignments.simplification_hints['split_groups']
assignments = assignments.all_assignments assignments = assignments.all_assignments
if isinstance(assignments, Assignment):
assignments = [assignments]
# ---- Creating ast # ---- Creating ast
if target == 'cpu': if target == 'cpu':
......
from subprocess import CalledProcessError from subprocess import CalledProcessError
import pycuda.driver
import pytest import pytest
import sympy import sympy
...@@ -25,7 +24,7 @@ class ScreamingGpuBackend(CudaBackend): ...@@ -25,7 +24,7 @@ class ScreamingGpuBackend(CudaBackend):
return normal_code.upper() return normal_code.upper()
def test_custom_backends(): def test_custom_backends_cpu():
z, x, y = pystencils.fields("z, y, x: [2d]") z, x, y = pystencils.fields("z, y, x: [2d]")
normal_assignments = pystencils.AssignmentCollection([pystencils.Assignment( normal_assignments = pystencils.AssignmentCollection([pystencils.Assignment(
...@@ -36,6 +35,16 @@ def test_custom_backends(): ...@@ -36,6 +35,16 @@ def test_custom_backends():
with pytest.raises(CalledProcessError): with pytest.raises(CalledProcessError):
pystencils.cpu.cpujit.make_python_function(ast, custom_backend=ScreamingBackend()) pystencils.cpu.cpujit.make_python_function(ast, custom_backend=ScreamingBackend())
def test_custom_backends_gpu():
pytest.importorskip('pycuda')
import pycuda.driver
z, x, y = pystencils.fields("z, y, x: [2d]")
normal_assignments = pystencils.AssignmentCollection([pystencils.Assignment(
z[0, 0], x[0, 0] * sympy.log(x[0, 0] * y[0, 0]))], [])
ast = pystencils.create_kernel(normal_assignments, target='gpu') ast = pystencils.create_kernel(normal_assignments, target='gpu')
print(pystencils.show_code(ast, ScreamingGpuBackend())) print(pystencils.show_code(ast, ScreamingGpuBackend()))
with pytest.raises(pycuda.driver.CompileError): with pytest.raises(pycuda.driver.CompileError):
......
...@@ -11,8 +11,6 @@ import itertools ...@@ -11,8 +11,6 @@ import itertools
from os.path import dirname, join from os.path import dirname, join
import numpy as np import numpy as np
import pycuda.autoinit # NOQA
import pycuda.gpuarray as gpuarray
import pytest import pytest
import sympy import sympy
...@@ -112,6 +110,9 @@ def test_rotate_interpolation(address_mode): ...@@ -112,6 +110,9 @@ def test_rotate_interpolation(address_mode):
@pytest.mark.parametrize('address_mode', ['border', 'wrap', 'clamp', 'mirror']) @pytest.mark.parametrize('address_mode', ['border', 'wrap', 'clamp', 'mirror'])
def test_rotate_interpolation_gpu(address_mode): def test_rotate_interpolation_gpu(address_mode):
pytest.importorskip('pycuda')
import pycuda.autoinit # NOQA
import pycuda.gpuarray as gpuarray
rotation_angle = sympy.pi / 5 rotation_angle = sympy.pi / 5
scale = 1 scale = 1
...@@ -156,6 +157,9 @@ def test_rotate_interpolation_gpu(address_mode): ...@@ -156,6 +157,9 @@ def test_rotate_interpolation_gpu(address_mode):
@pytest.mark.parametrize('address_mode', ['border', 'wrap', 'clamp', 'mirror']) @pytest.mark.parametrize('address_mode', ['border', 'wrap', 'clamp', 'mirror'])
def test_shift_interpolation_gpu(address_mode): def test_shift_interpolation_gpu(address_mode):
pytest.importorskip('pycuda')
import pycuda.autoinit # NOQA
import pycuda.gpuarray as gpuarray
rotation_angle = 0 # sympy.pi / 5 rotation_angle = 0 # sympy.pi / 5
scale = 1 scale = 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment