From d480bbc6ccb6a9d4200a8756cf985ad81501614f Mon Sep 17 00:00:00 2001 From: JM Etancelin <jean-matthieu.etancelin@univ-pau.fr> Date: Tue, 29 Mar 2022 11:24:46 +0200 Subject: [PATCH] fix test --- ci/scripts/test.sh | 1 + hysop/core/tests/test_checkpoint.sh | 8 ++++---- hysop/operator/tests/test_custom.py | 15 +++++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ci/scripts/test.sh b/ci/scripts/test.sh index b94e3b219..532111c3f 100755 --- a/ci/scripts/test.sh +++ b/ci/scripts/test.sh @@ -136,6 +136,7 @@ if [ "$RUN_TESTS" = true ]; then hysop_test "operator/tests/test_directional_diffusion.py" hysop_test "operator/tests/test_directional_stretching.py" hysop_test "operator/tests/test_custom_symbolic.py" + hysop_test "operator/tests/test_custom.py" hysop_test "operator/tests/test_spectral_derivative.py" hysop_test "operator/tests/test_spectral_curl.py" hysop_test "operator/tests/test_diffusion.py" diff --git a/hysop/core/tests/test_checkpoint.sh b/hysop/core/tests/test_checkpoint.sh index 357890653..0c240c96d 100755 --- a/hysop/core/tests/test_checkpoint.sh +++ b/hysop/core/tests/test_checkpoint.sh @@ -44,8 +44,8 @@ if [[ ! -f "${EXAMPLE_FILE}" ]]; then fi echo ' Running simulations...' -${PYTHON_EXECUTABLE} "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -S "${TEST_DIR}/checkpoint0.tar" --dump-dir "${TEST_DIR}/run0" --checkpoint-dump-time 0.05 --checkpoint-dump-freq 0 -${PYTHON_EXECUTABLE} "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -S "${TEST_DIR}/checkpoint1.tar" --dump-dir "${TEST_DIR}/run1" --checkpoint-dump-time 0.05 --checkpoint-dump-freq 0 +${MPIRUN_EXECUTABLE} ${MPIRUN_TASKS_OPTION} 1 ${PYTHON_EXECUTABLE} "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -S "${TEST_DIR}/checkpoint0.tar" --dump-dir "${TEST_DIR}/run0" --checkpoint-dump-time 0.05 --checkpoint-dump-freq 0 +${MPIRUN_EXECUTABLE} ${MPIRUN_TASKS_OPTION} 1 ${PYTHON_EXECUTABLE} "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -S "${TEST_DIR}/checkpoint1.tar" --dump-dir "${TEST_DIR}/run1" --checkpoint-dump-time 0.05 --checkpoint-dump-freq 0 echo ' Comparing solutions...' echo " >debug dumps match" @@ -58,8 +58,8 @@ done echo echo ' Running simulations from checkpoints...' -${PYTHON_EXECUTABLE} "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -L "${TEST_DIR}/checkpoint0.tar" --dump-dir "${TEST_DIR}/run2" -${PYTHON_EXECUTABLE} "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -L "${TEST_DIR}/checkpoint1.tar" --dump-dir "${TEST_DIR}/run3" +${MPIRUN_EXECUTABLE} ${MPIRUN_TASKS_OPTION} 1 ${PYTHON_EXECUTABLE} "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -L "${TEST_DIR}/checkpoint0.tar" --dump-dir "${TEST_DIR}/run2" +${MPIRUN_EXECUTABLE} ${MPIRUN_TASKS_OPTION} 1 ${PYTHON_EXECUTABLE} "${EXAMPLE_FILE}" ${COMMON_OPTIONS} -L "${TEST_DIR}/checkpoint1.tar" --dump-dir "${TEST_DIR}/run3" echo ' Comparing solutions...' compare_files "${TEST_DIR}/run2/dump/run.txt" "${TEST_DIR}/run3/dump/run.txt" diff --git a/hysop/operator/tests/test_custom.py b/hysop/operator/tests/test_custom.py index c1a93cd2a..31263a3ec 100644 --- a/hysop/operator/tests/test_custom.py +++ b/hysop/operator/tests/test_custom.py @@ -44,12 +44,9 @@ class TestCustom(object): for _ in range(1, 6): data[...] += (x**2)*npw.sin(y)*npw.exp(z*_) - @staticmethod - def __analytic_python(F): - (x, y, z) = F.compute_mesh_coords - F.data[0][...] = (x**2)*npw.sin(y)*npw.exp(z) - for _ in range(1, 6): - F.data[0][...] += (x**2)*npw.sin(y)*npw.exp(z*_) + @staticmethod + def __analytic_python(F): + TestCustom.__analytic_init(F.data[0], F.compute_mesh_coords, 0) __analytic_opencl = """ int3 i_xyz = get_Fi_xyz(i); @@ -163,6 +160,12 @@ class TestCustom(object): msg = 'Test failed for {} on component {} for implementation {}.'.format(iname, i, impl) raise RuntimeError(msg) + def test(self): + self._test(3, HYSOP_REAL) + + def perform_tests(self): + self.test() + if __name__ == '__main__': TestCustom.setup_class(enable_extra_tests=False, -- GitLab