Skip to content
Snippets Groups Projects
Commit 020315cf authored by Stephan Seitz's avatar Stephan Seitz
Browse files

Actually test GPU in test_boundary_handling.test_simple

Was only allocating buffers for GPU but then doing boundary handling on
CPU
parent 02255260
1 merge request!25Actually test GPU in test_boundary_handling.test_simple
import numpy as np import numpy as np
import pytest import pytest
from lbmpy.boundaries import UBB, NeumannByCopy, NoSlip, StreamInConstant from lbmpy.boundaries import UBB, NeumannByCopy, NoSlip, StreamInConstant
...@@ -10,15 +9,24 @@ from lbmpy.lbstep import LatticeBoltzmannStep ...@@ -10,15 +9,24 @@ from lbmpy.lbstep import LatticeBoltzmannStep
from pystencils import create_data_handling, make_slice from pystencils import create_data_handling, make_slice
@pytest.mark.parametrize("gpu", [True, False]) @pytest.mark.parametrize("target", ['cpu', 'gpu', 'opencl'])
def test_simple(gpu): def test_simple(target):
import pytest if target == 'gpu':
pytest.importorskip('pycuda') import pytest
dh = create_data_handling((10, 5), parallel=False) pytest.importorskip('pycuda')
dh.add_array('pdfs', values_per_cell=9, cpu=True, gpu=gpu) elif target == 'opencl':
lb_func = create_lb_function(stencil='D2Q9', compressible=False, relaxation_rate=1.8) import pytest
pytest.importorskip('pyopencl')
bh = LatticeBoltzmannBoundaryHandling(lb_func.method, dh, 'pdfs') import pystencils.opencl.autoinit
dh = create_data_handling((10, 5), parallel=False, default_target=target)
dh.add_array('pdfs', values_per_cell=9, cpu=True, gpu=target!='cpu')
lb_func = create_lb_function(stencil='D2Q9',
compressible=False,
relaxation_rate=1.8,
optimization={'target': target})
bh = LatticeBoltzmannBoundaryHandling(lb_func.method, dh, 'pdfs', target=target)
wall = NoSlip() wall = NoSlip()
moving_wall = UBB((0.001, 0)) moving_wall = UBB((0.001, 0))
......
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