Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (19)
...@@ -34,6 +34,29 @@ tests-and-coverage: ...@@ -34,6 +34,29 @@ tests-and-coverage:
cobertura: coverage.xml cobertura: coverage.xml
junit: report.xml junit: report.xml
# pipeline with latest python version
latest-python:
stage: test
except:
variables:
- $ENABLE_NIGHTLY_BUILDS
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/latest_python
script:
- env
- pip list
- export NUM_CORES=$(nproc --all)
- mkdir -p ~/.config/matplotlib
- echo "backend:template" > ~/.config/matplotlib/matplotlibrc
- mkdir public
- py.test -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml
tags:
- docker
- AVX
artifacts:
when: always
reports:
junit: report.xml
# Nightly test - runs "long run" jobs only # Nightly test - runs "long run" jobs only
test-longrun: test-longrun:
stage: test stage: test
...@@ -80,11 +103,20 @@ ubuntu: ...@@ -80,11 +103,20 @@ ubuntu:
variables: variables:
- $ENABLE_NIGHTLY_BUILDS - $ENABLE_NIGHTLY_BUILDS
image: i10git.cs.fau.de:5005/pycodegen/pycodegen/ubuntu image: i10git.cs.fau.de:5005/pycodegen/pycodegen/ubuntu
before_script:
- apt-get -y remove python3-sympy
- ln -s /usr/include/locale.h /usr/include/xlocale.h
script: script:
- export NUM_CORES=$(nproc --all)
- pip3 install `grep -Eo 'sympy[>=]+[0-9\.]+' setup.py | sed 's/>/=/g'`
- pip3 install `grep -Eo 'numpy[>=]+[0-9\.]+' setup.py | sed 's/>/=/g'`
- pip3 install matplotlib
- mkdir -p ~/.config/matplotlib - mkdir -p ~/.config/matplotlib
- echo "backend:template" > ~/.config/matplotlib/matplotlibrc - echo "backend:template" > ~/.config/matplotlib/matplotlibrc
- sed -i 's/--doctest-modules //g' pytest.ini - sed -i 's/--doctest-modules //g' pytest.ini
- pytest-3 -v -m "not longrun" --junitxml=report.xml - env
- pip3 list
- pytest-3 -v -n $NUM_CORES -m "not longrun" --junitxml=report.xml
tags: tags:
- docker - docker
- cuda11 - cuda11
......
...@@ -3,10 +3,8 @@ from subprocess import CalledProcessError ...@@ -3,10 +3,8 @@ from subprocess import CalledProcessError
import pytest import pytest
import sympy import sympy
import pycuda.driver
import pystencils import pystencils
import pystencils.cpu.cpujit import pystencils.cpu.cpujit
import pystencils.gpucuda.cudajit
from pystencils.backends.cbackend import CBackend from pystencils.backends.cbackend import CBackend
from pystencils.backends.cuda_backend import CudaBackend from pystencils.backends.cuda_backend import CudaBackend
...@@ -40,6 +38,7 @@ def test_custom_backends_cpu(): ...@@ -40,6 +38,7 @@ def test_custom_backends_cpu():
def test_custom_backends_gpu(): def test_custom_backends_gpu():
pytest.importorskip('pycuda') pytest.importorskip('pycuda')
import pycuda.driver import pycuda.driver
import pystencils.gpucuda.cudajit
z, x, y = pystencils.fields("z, y, x: [2d]") z, x, y = pystencils.fields("z, y, x: [2d]")
......
...@@ -365,6 +365,7 @@ def test_load_data(): ...@@ -365,6 +365,7 @@ def test_load_data():
def test_array_handler(target): def test_array_handler(target):
size = (2, 2) size = (2, 2)
if target == 'gpu': if target == 'gpu':
pytest.importorskip('pycuda')
array_handler = PyCudaArrayHandler() array_handler = PyCudaArrayHandler()
if target == 'opencl': if target == 'opencl':
pytest.importorskip('pyopencl') pytest.importorskip('pyopencl')
......
import pytest
import sympy as sp import sympy as sp
import pystencils as ps import pystencils as ps
...@@ -6,6 +7,7 @@ from pystencils.fast_approximation import ( ...@@ -6,6 +7,7 @@ from pystencils.fast_approximation import (
def test_fast_sqrt(): def test_fast_sqrt():
pytest.importorskip('pycuda')
f, g = ps.fields("f, g: double[2D]") f, g = ps.fields("f, g: double[2D]")
expr = sp.sqrt(f[0, 0] + f[1, 0]) expr = sp.sqrt(f[0, 0] + f[1, 0])
...@@ -28,6 +30,7 @@ def test_fast_sqrt(): ...@@ -28,6 +30,7 @@ def test_fast_sqrt():
def test_fast_divisions(): def test_fast_divisions():
pytest.importorskip('pycuda')
f, g = ps.fields("f, g: double[2D]") f, g = ps.fields("f, g: double[2D]")
expr = f[0, 0] / f[1, 0] expr = f[0, 0] / f[1, 0]
assert len(insert_fast_divisions(expr).atoms(fast_division)) == 1 assert len(insert_fast_divisions(expr).atoms(fast_division)) == 1
......
...@@ -2,6 +2,7 @@ import pystencils as ps ...@@ -2,6 +2,7 @@ import pystencils as ps
import sympy as sp import sympy as sp
from pystencils.stencil import coefficient_list, plot_expression from pystencils.stencil import coefficient_list, plot_expression
import pystencils.plot as plt
def test_coefficient_list(): def test_coefficient_list():
...@@ -9,7 +10,8 @@ def test_coefficient_list(): ...@@ -9,7 +10,8 @@ def test_coefficient_list():
expr = 2 * f[1] + 3 * f[-1] expr = 2 * f[1] + 3 * f[-1]
coff = coefficient_list(expr) coff = coefficient_list(expr)
assert coff == [3, 0, 2] assert coff == [3, 0, 2]
plot_expression(expr, matrix_form=True) figure = plt.figure()
plot_expression(expr, matrix_form=True, figure=figure)
f = ps.fields("f: double[3D]") f = ps.fields("f: double[3D]")
expr = 2 * f[1, 0, 0] + 3 * f[0, -1, 0] expr = 2 * f[1, 0, 0] + 3 * f[0, -1, 0]
...@@ -22,9 +24,11 @@ def test_coefficient_list(): ...@@ -22,9 +24,11 @@ def test_coefficient_list():
# in 3D plot only works if there are entries on every of the three 2D planes. In the above examples z-1 was empty # in 3D plot only works if there are entries on every of the three 2D planes. In the above examples z-1 was empty
expr = 2 * f[1, 0, 0] + 1 * f[0, -1, 0] + 1 * f[0, 0, 1] + f[0, 0, -1] expr = 2 * f[1, 0, 0] + 1 * f[0, -1, 0] + 1 * f[0, 0, 1] + f[0, 0, -1]
plot_expression(expr) figure = plt.figure()
plot_expression(expr, figure=figure)
def test_plot_expression(): def test_plot_expression():
f = ps.fields("f: double[2D]") f = ps.fields("f: double[2D]")
plot_expression(2 * f[1, 0] + 3 * f[0, -1], matrix_form=True) figure = plt.figure()
plot_expression(2 * f[1, 0] + 3 * f[0, -1], matrix_form=True, figure=figure)
...@@ -85,7 +85,7 @@ setuptools.setup(name='pystencils', ...@@ -85,7 +85,7 @@ setuptools.setup(name='pystencils',
author_email='martin.bauer@fau.de', author_email='martin.bauer@fau.de',
url='https://i10git.cs.fau.de/pycodegen/pystencils/', url='https://i10git.cs.fau.de/pycodegen/pystencils/',
packages=['pystencils'] + ['pystencils.' + s for s in setuptools.find_packages('pystencils')], packages=['pystencils'] + ['pystencils.' + s for s in setuptools.find_packages('pystencils')],
install_requires=['sympy>=1.1', 'numpy', 'appdirs', 'joblib'], install_requires=['sympy>=1.2', 'numpy>=1.11.0', 'appdirs', 'joblib'],
package_data={'pystencils': ['include/*.h', package_data={'pystencils': ['include/*.h',
'backends/cuda_known_functions.txt', 'backends/cuda_known_functions.txt',
'backends/opencl1.1_known_functions.txt', 'backends/opencl1.1_known_functions.txt',
......