From f498ef22dbe1c94b4fac7993b58f8fa677959c03 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <2timothy18@gmail.com> Date: Mon, 4 Nov 2019 23:34:59 -0600 Subject: [PATCH] pass queue through to compute Roe eigensystem for reference --- test/data_for_test.py | 70 ++++++++------------------- test/test_eigensystem.py | 3 +- test/test_weno_flux.py | 3 +- test/weno_reference_implementation.py | 3 +- 4 files changed, 24 insertions(+), 55 deletions(-) diff --git a/test/data_for_test.py b/test/data_for_test.py index 84033f7..8a8f474 100644 --- a/test/data_for_test.py +++ b/test/data_for_test.py @@ -14,7 +14,7 @@ class FluxDataSingle: ndim = 3 dirs = {"x": 1, "y": 2, "z": 3} - def __init__(self, states_str, direction): + def __init__(self, queue, states_str, direction): self.direction = self.dirs[direction] self.dir_internal = self.direction-1 @@ -48,7 +48,7 @@ class FluxDataSingle: self.lam_pointwise = ref.lambda_pointwise( self.states, self.metrics, self.dir_internal) self.R, self.R_inv, self.lam_roe = ref.roe_eigensystem( - self.state_pair, self.frozen_metrics, self.direction) + queue, self.state_pair, self.frozen_metrics, self.direction) self.wavespeeds = ref.wavespeeds(self.lam_pointwise, self.lam_roe) self.char_fluxes_pos, self.char_fluxes_neg = ref.split_char_fluxes( @@ -170,43 +170,25 @@ class FluxDataVector: # }}} - -single_data = {} - -single_data["Case flat:x"] = FluxDataSingle( - states_str="1 1 1 1 5.5,1 1 1 1 5.5", direction="x") -single_data["Case flat:y"] = FluxDataSingle( - states_str="1 1 1 1 5.5,1 1 1 1 5.5", direction="y") -single_data["Case flat:z"] = FluxDataSingle( - states_str="1 1 1 1 5.5,1 1 1 1 5.5", direction="z") - -single_data["Case a:x"] = FluxDataSingle( - states_str="2 4 4 4 20,1 1 1 1 5.5", direction="x") -single_data["Case a:y"] = FluxDataSingle( - states_str="2 4 4 4 20,1 1 1 1 5.5", direction="y") -single_data["Case a:z"] = FluxDataSingle( - states_str="2 4 4 4 20,1 1 1 1 5.5", direction="z") - -single_data["Case b:x"] = FluxDataSingle( - states_str="1 -1 -1 -1 5.5,2 -4 -4 -4 20", direction="x") -single_data["Case b:y"] = FluxDataSingle( - states_str="1 -1 -1 -1 5.5,2 -4 -4 -4 20", direction="y") -single_data["Case b:z"] = FluxDataSingle( - states_str="1 -1 -1 -1 5.5,2 -4 -4 -4 20", direction="z") - -single_data["Case c:x"] = FluxDataSingle( - states_str="2 4 8 12 64,1 1 2 3 11", direction="x") -single_data["Case c:y"] = FluxDataSingle( - states_str="2 8 12 4 64,1 2 3 1 11", direction="y") -single_data["Case c:z"] = FluxDataSingle( - states_str="2 12 4 8 64,1 3 1 2 11", direction="z") - -single_data["Case d:x"] = FluxDataSingle( - states_str="1 -1 -2 -3 11,2 -4 -8 -12 64", direction="x") -single_data["Case d:y"] = FluxDataSingle( - states_str="1 -2 -3 -1 11,2 -8 -12 -4 64", direction="y") -single_data["Case d:z"] = FluxDataSingle( - states_str="1 -3 -1 -2 11,2 -12 -4 -8 64", direction="z") +@pytest.fixture(scope="session", params=[ + ("1 1 1 1 5.5,1 1 1 1 5.5", "x"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "y"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "z"), + ("2 4 4 4 20,1 1 1 1 5.5", "x"), + ("2 4 4 4 20,1 1 1 1 5.5", "y"), + ("2 4 4 4 20,1 1 1 1 5.5", "z"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z"), + ("2 4 8 12 64,1 1 2 3 11", "x"), + ("2 8 12 4 64,1 2 3 1 11", "y"), + ("2 12 4 8 64,1 3 1 2 11", "z"), + ("1 -1 -2 -3 11,2 -4 -8 -12 64", "x"), + ("1 -2 -3 -1 11,2 -8 -12 -4 64", "y"), + ("1 -3 -1 -2 11,2 -12 -4 -8 64", "z") + ]) +def flux_test_data_fixture(request, queue): + return FluxDataSingle(queue, *request.param) vector_data = {} @@ -238,16 +220,6 @@ vector_data["Case a:z"] = FluxDataVector( direction="z") -@pytest.fixture(scope="session", params=[ - "Case flat:x", "Case flat:y", "Case flat:z", - "Case a:x", "Case a:y", "Case a:z", - "Case b:x", "Case b:y", "Case b:z", - "Case c:x", "Case c:y", "Case c:z", - "Case d:x", "Case d:y", "Case d:z"]) -def flux_test_data_fixture(request): - return single_data[request.param] - - @pytest.fixture(scope="session", params=[ "Case flat:x", "Case flat:y", "Case flat:z"]) def cfd_test_data_fixture(request): diff --git a/test/test_eigensystem.py b/test/test_eigensystem.py index 3c48c71..84d03bd 100644 --- a/test/test_eigensystem.py +++ b/test/test_eigensystem.py @@ -13,8 +13,7 @@ import pytest import utilities as u from data_for_test import ( # noqa: F401 - flux_test_data_fixture, - single_data as sd + flux_test_data_fixture ) diff --git a/test/test_weno_flux.py b/test/test_weno_flux.py index f6587c6..4a4d682 100644 --- a/test/test_weno_flux.py +++ b/test/test_weno_flux.py @@ -13,8 +13,7 @@ import pytest import utilities as u from data_for_test import ( # noqa: F401 - flux_test_data_fixture, - single_data as sd + flux_test_data_fixture ) diff --git a/test/weno_reference_implementation.py b/test/weno_reference_implementation.py index 2b18fd7..b4cd3d8 100644 --- a/test/weno_reference_implementation.py +++ b/test/weno_reference_implementation.py @@ -14,7 +14,7 @@ def pointwise_fluxes(states): return np.array([gas.flux(s) for s in states.T]) -def roe_eigensystem(state_pair, frozen_metrics, direction): +def roe_eigensystem(queue, state_pair, frozen_metrics, direction): # FIXME: startup for test suite is pretty slow due to this routine # -- can we speed this up? @@ -22,7 +22,6 @@ def roe_eigensystem(state_pair, frozen_metrics, direction): ndim = frozen_metrics.shape[0] prg = u.get_weno_program_with_root_kernel("roe_eigensystem") - queue = u.get_queue(cl._csc) R_dev = u.empty_array_on_device(queue, nvars, nvars) R_inv_dev = u.empty_array_on_device(queue, nvars, nvars) -- GitLab