mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-21 08:54:08 -06:00
Merge pull request #4736 from akva2/simplify_tuning_tests
simplify cmake code for tuning tests
This commit is contained in:
commit
e89c43e54d
@ -322,6 +322,13 @@ endmacro (tests_hook)
|
||||
# all setup common to the OPM library modules is done here
|
||||
include (OpmLibMain)
|
||||
|
||||
opm_add_test(test_tuning_xxxMBE
|
||||
SOURCES
|
||||
tests/test_tuning_XXXMBE.cpp
|
||||
LIBRARIES
|
||||
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
|
||||
ONLY_COMPILE)
|
||||
|
||||
if (HAVE_OPM_TESTS)
|
||||
include (${CMAKE_CURRENT_SOURCE_DIR}/compareECLFiles.cmake)
|
||||
endif()
|
||||
|
@ -253,7 +253,6 @@ list (APPEND TEST_SOURCE_FILES
|
||||
tests/test_RestartSerialization.cpp
|
||||
tests/test_stoppedwells.cpp
|
||||
tests/test_timer.cpp
|
||||
tests/test_tuning_XXXMBE.cpp
|
||||
tests/test_vfpproperties.cpp
|
||||
tests/test_wellmodel.cpp
|
||||
tests/test_wellprodindexcalculator.cpp
|
||||
|
@ -21,7 +21,7 @@ set(BASE_RESULT_PATH ${PROJECT_BINARY_DIR}/tests/results)
|
||||
# Details:
|
||||
# - This test class simply runs a simulation.
|
||||
function(add_test_runSimulator)
|
||||
set(oneValueArgs CASENAME FILENAME SIMULATOR DIR DIR_PREFIX PROCS CONFIGURATION)
|
||||
set(oneValueArgs CASENAME FILENAME SIMULATOR DIR DIR_PREFIX PROCS CONFIGURATION POST_COMMAND)
|
||||
set(multiValueArgs TEST_ARGS)
|
||||
cmake_parse_arguments(PARAM "$" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
if(NOT PARAM_DIR)
|
||||
@ -29,16 +29,24 @@ function(add_test_runSimulator)
|
||||
endif()
|
||||
set(RESULT_PATH ${BASE_RESULT_PATH}${PARAM_DIR_PREFIX}/${PARAM_SIMULATOR}+${PARAM_CASENAME})
|
||||
set(TEST_ARGS ${PARAM_TEST_ARGS})
|
||||
set(DRIVER_ARGS -i ${OPM_TESTS_ROOT}/${PARAM_DIR}
|
||||
-r ${RESULT_PATH}
|
||||
-b ${PROJECT_BINARY_DIR}/bin
|
||||
-f ${PARAM_FILENAME})
|
||||
if(PARAM_PROCS)
|
||||
list(APPEND DRIVER_ARGS -n ${PARAM_PROCS})
|
||||
endif()
|
||||
if(PARAM_POST_COMMAND)
|
||||
list(APPEND DRIVER_ARGS -p "${PARAM_POST_COMMAND}")
|
||||
endif()
|
||||
opm_add_test(runSimulator/${PARAM_CASENAME} NO_COMPILE
|
||||
EXE_NAME ${PARAM_SIMULATOR}
|
||||
DRIVER_ARGS -i ${OPM_TESTS_ROOT}/${PARAM_DIR}
|
||||
-r ${RESULT_PATH}
|
||||
-b ${PROJECT_BINARY_DIR}/bin
|
||||
-f ${PARAM_FILENAME}
|
||||
-n ${PARAM_PROCS}
|
||||
DRIVER_ARGS ${DRIVER_ARGS}
|
||||
TEST_ARGS ${TEST_ARGS}
|
||||
CONFIGURATION ${PARAM_CONFIGURATION})
|
||||
set_tests_properties(runSimulator/${PARAM_CASENAME} PROPERTIES PROCESSORS ${PARAM_PROCS})
|
||||
if(PARAM_PROCS)
|
||||
set_tests_properties(runSimulator/${PARAM_CASENAME} PROPERTIES PROCESSORS ${PARAM_PROCS})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
###########################################################################
|
||||
@ -278,7 +286,6 @@ opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-test.sh "")
|
||||
add_test_runSimulator(CASENAME norne
|
||||
FILENAME NORNE_ATW2013
|
||||
SIMULATOR flow
|
||||
PROCS 1
|
||||
CONFIGURATION extra)
|
||||
|
||||
add_test_runSimulator(CASENAME norne_parallel
|
||||
@ -288,42 +295,22 @@ add_test_runSimulator(CASENAME norne_parallel
|
||||
PROCS 4
|
||||
CONFIGURATION extra)
|
||||
|
||||
|
||||
# Tests that are run based on simulator results, but not necessarily direct comparison to reference results
|
||||
add_test_runSimulator(CASENAME run_tuning_xxxmbe
|
||||
add_test_runSimulator(CASENAME tuning_xxxmbe
|
||||
FILENAME 01_TUNING_XXXMBE
|
||||
SIMULATOR flow
|
||||
DIR tuning
|
||||
PROCS 1
|
||||
TEST_ARGS --output-extra-convergence-info=iterations --enable-tuning=true)
|
||||
TEST_ARGS --output-extra-convergence-info=iterations --enable-tuning=true
|
||||
POST_COMMAND $<TARGET_FILE:test_tuning_xxxMBE>)
|
||||
|
||||
add_test_runSimulator(CASENAME run_notuning_xxxmbe
|
||||
add_test_runSimulator(CASENAME notuning_xxxmbe
|
||||
FILENAME 01_TUNING_XXXMBE
|
||||
SIMULATOR flow
|
||||
DIR tuning
|
||||
PROCS 1
|
||||
TEST_ARGS --output-extra-convergence-info=iterations --enable-tuning=false)
|
||||
|
||||
|
||||
set_tests_properties(tuning_XXXMBE PROPERTIES DEPENDS "runSimulator/run_tuning_xxxmbe")
|
||||
set_tests_properties(tuning_XXXMBE PROPERTIES WORKING_DIRECTORY "${BASE_RESULT_PATH}/flow+run_tuning_xxxmbe")
|
||||
|
||||
# Workaround to run same test on different simulation results
|
||||
get_target_property(notuning_XXXMBE_cmd test_tuning_XXXMBE LOCATION)
|
||||
if(MPI_FOUND)
|
||||
set(notuning_XXXMBE_cmd ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${notuning_XXXMBE_cmd})
|
||||
endif()
|
||||
|
||||
add_test(
|
||||
NAME notuning_XXXMBE
|
||||
COMMAND ${notuning_XXXMBE_cmd}
|
||||
)
|
||||
set_tests_properties(notuning_XXXMBE PROPERTIES DEPENDS "runSimulator/run_notuning_xxxmbe")
|
||||
set_tests_properties(notuning_XXXMBE PROPERTIES WORKING_DIRECTORY "${BASE_RESULT_PATH}/flow+run_notuning_xxxmbe")
|
||||
set_tests_properties(notuning_XXXMBE PROPERTIES WILL_FAIL TRUE)
|
||||
|
||||
|
||||
TEST_ARGS --output-extra-convergence-info=iterations --enable-tuning=false
|
||||
POST_COMMAND $<TARGET_FILE:test_tuning_xxxMBE>)
|
||||
|
||||
set_tests_properties(runSimulator/notuning_xxxmbe PROPERTIES WILL_FAIL TRUE)
|
||||
|
||||
include (${CMAKE_CURRENT_SOURCE_DIR}/regressionTests.cmake)
|
||||
include (${CMAKE_CURRENT_SOURCE_DIR}/restartTests.cmake)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This simply runs a simulator.
|
||||
# This runs a simulator and optionally a post command in result directory.
|
||||
|
||||
if test $# -eq 0
|
||||
then
|
||||
@ -11,12 +11,15 @@ then
|
||||
echo -e "\t\t -b <path> Path to simulator binary"
|
||||
echo -e "\t\t -f <filename> Deck file name"
|
||||
echo -e "\t\t -e <filename> Simulator binary to use"
|
||||
echo -e "\tOptional options:"
|
||||
echo -e "\t\t -n <procs > Number of MPI processes to use"
|
||||
echo -e "\t\t -p <cmd> Post-command to execute"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OPTIND=1
|
||||
while getopts "i:r:b:f:e:n:" OPT
|
||||
MPI_PROCS=1
|
||||
while getopts "i:r:b:f:e:n:p:" OPT
|
||||
do
|
||||
case "${OPT}" in
|
||||
i) INPUT_DATA_PATH=${OPTARG} ;;
|
||||
@ -25,6 +28,7 @@ do
|
||||
f) FILENAME=${OPTARG} ;;
|
||||
e) EXE_NAME=${OPTARG} ;;
|
||||
n) MPI_PROCS=${OPTARG} ;;
|
||||
p) POST_COMMAND=${OPTARG} ;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND-1))
|
||||
@ -38,3 +42,9 @@ else
|
||||
${BINPATH}/${EXE_NAME} ${TEST_ARGS} --output-dir=${RESULT_PATH} "${INPUT_DATA_PATH}/${FILENAME}.DATA"
|
||||
fi
|
||||
test $? -eq 0 || exit 1
|
||||
|
||||
if test -n "${POST_COMMAND}"
|
||||
then
|
||||
cd $RESULT_PATH
|
||||
${POST_COMMAND}
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user