Skip to content
test.py 1.37 KiB
Newer Older
import logging

from pyopencl.tools import (  # noqa
        pytest_generate_tests_for_pyopencl
        as pytest_generate_tests)

import comparison_fixtures as compare
import setup_fixtures as setup
import fixtures
import device_fixtures as device
def test_matvec(ctx_factory):
    queue = device.get_queue(ctx_factory)
    prg = fixtures.get_weno_program()

    a = setup.random_array(10, 10)
    b = setup.random_array(10)
    c = kernel.mult_mat_vec(queue, prg, alpha=1.0, a=a, b=b)
def test_compute_flux_derivatives(ctx_factory):
    params = setup.FluxDerivativeParams(ndim=3, nvars=5, nx=10, ny=10, nz=10)
    arrays = setup.random_flux_derivative_arrays(params)
    kernel.compute_flux_derivatives(ctx_factory, params, arrays)
Andreas Klöckner's avatar
Andreas Klöckner committed
def test_compute_flux_derivatives_gpu(ctx_factory):
    params = setup.FluxDerivativeParams(ndim=3, nvars=5, nx=10, ny=10, nz=10)
    arrays = setup.random_flux_derivative_arrays_on_device(ctx_factory, params)
    kernel.compute_flux_derivatives_gpu(ctx_factory, params, arrays)
Andreas Klöckner's avatar
Andreas Klöckner committed
# This lets you run 'python test.py test_case(cl._csc)' without pytest.
if __name__ == "__main__":
    if len(sys.argv) > 1:
        exec(sys.argv[1])
    else:
        pytest.main([__file__])