Skip to content
Snippets Groups Projects
Commit 578dc7c4 authored by Timothy A. Smith's avatar Timothy A. Smith
Browse files

move random_array to new file setup_fixtures.py

parent 1559021f
No related branches found
No related tags found
1 merge request!8Test refactoring
...@@ -92,9 +92,6 @@ def f_array(queue, *shape): ...@@ -92,9 +92,6 @@ def f_array(queue, *shape):
ary = np.random.random_sample(shape).astype(np.float32).copy(order="F") ary = np.random.random_sample(shape).astype(np.float32).copy(order="F")
return cl.array.to_device(queue, ary) return cl.array.to_device(queue, ary)
def random_array(*args):
return np.random.random_sample(args).astype(np.float32).copy(order="F")
def mult_mat_vec(ctx_factory, alpha, a, b): def mult_mat_vec(ctx_factory, alpha, a, b):
queue = get_queue(ctx_factory) queue = get_queue(ctx_factory)
......
import numpy as np
def random_array(*shape):
return np.random.random_sample(shape).astype(np.float32).copy(order="F")
...@@ -16,17 +16,18 @@ from pyopencl.tools import ( # noqa ...@@ -16,17 +16,18 @@ from pyopencl.tools import ( # noqa
import fixtures import fixtures
import comparison_fixtures as compare import comparison_fixtures as compare
import setup_fixtures as setup
def test_matvec(ctx_factory): def test_matvec(ctx_factory):
a = fixtures.random_array(10, 10) a = setup.random_array(10, 10)
b = fixtures.random_array(10) b = setup.random_array(10)
c = fixtures.mult_mat_vec(ctx_factory, a=a, b=b, alpha=1.0) c = fixtures.mult_mat_vec(ctx_factory, a=a, b=b, alpha=1.0)
compare.arrays(a@b, c) compare.arrays(a@b, c)
@pytest.mark.skip("slow") #@pytest.mark.skip("slow")
def test_compute_flux_derivatives(ctx_factory): def test_compute_flux_derivatives(ctx_factory):
logging.basicConfig(level="INFO") logging.basicConfig(level="INFO")
...@@ -36,10 +37,10 @@ def test_compute_flux_derivatives(ctx_factory): ...@@ -36,10 +37,10 @@ def test_compute_flux_derivatives(ctx_factory):
ny = 10 ny = 10
nz = 10 nz = 10
states = fixtures.random_array(nvars, nx+6, ny+6, nz+6) states = setup.random_array(nvars, nx+6, ny+6, nz+6)
fluxes = fixtures.random_array(nvars, ndim, nx+6, ny+6, nz+6) fluxes = setup.random_array(nvars, ndim, nx+6, ny+6, nz+6)
metrics = fixtures.random_array(ndim, ndim, nx+6, ny+6, nz+6) metrics = setup.random_array(ndim, ndim, nx+6, ny+6, nz+6)
metric_jacobians = fixtures.random_array(nx+6, ny+6, nz+6) metric_jacobians = setup.random_array(nx+6, ny+6, nz+6)
fixtures.compute_flux_derivatives(ctx_factory, fixtures.compute_flux_derivatives(ctx_factory,
nvars=nvars, ndim=ndim, nx=nx, ny=ny, nz=nz, nvars=nvars, ndim=ndim, nx=nx, ny=ny, nz=nz,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment