Skip to content

Commit

Permalink
Merge branch 'UpdateCtestsForUbuntuPerf' into 'master'
Browse files Browse the repository at this point in the history
Update ctests for ubuntu perf

See merge request ogs/ogs!5005
  • Loading branch information
endJunction committed May 21, 2024
2 parents 956e3c4 + 5db5d26 commit 9ff2068
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 30 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ include(UnityBuildSettings)

if(OGS_USE_PIP)
setup_venv()
setup_venv_dependent_ctests()
endif()

message(STATUS "${_benchmark_run_commands}")
Expand Down
18 changes: 1 addition & 17 deletions ProcessLib/HT/Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -357,23 +357,7 @@ AddTest(
ThermalConvection_ts_1_t_0.000000_expected.vtu ThermalConvection_ts_1_t_0.000000.vtu darcy_velocity darcy_velocity 1e-8 1e-13
)

if(NOT OGS_USE_MPI AND OGS_BUILD_TESTING AND OGS_USE_PIP)
execute_process(COMMAND ${Python_EXECUTABLE}
${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles/generateInvalidMediaForHT.py
WORKING_DIRECTORY ${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles)
file(GLOB HT_INVALID_PRJ_FILES ${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles/*.prj)
foreach(ht_invalid_prj_file ${HT_INVALID_PRJ_FILES})
string(REPLACE ${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles/HT "invalid" ht_invalid_prj_file_short ${ht_invalid_prj_file})
AddTest(
NAME HT_${ht_invalid_prj_file_short}
PATH Parabolic/HT/InvalidProjectFiles
EXECUTABLE ogs
EXECUTABLE_ARGS ${ht_invalid_prj_file}
RUNTIME 1
)
set_tests_properties(ogs-HT_${ht_invalid_prj_file_short} PROPERTIES WILL_FAIL TRUE)
endforeach()
endif()
# generateInvalidMediaForHT.py logic moved to PythonSetup.cmake

if (NOT (OGS_USE_MPI))
OgsTest(PROJECTFILE Parabolic/HT/SimpleSynthetics/deactivated_subdomain/HT_DeactivatedSubdomain.prj)
Expand Down
2 changes: 1 addition & 1 deletion ProcessLib/ThermoRichardsMechanics/Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ AddTest(
expected_pointheatsource_quadratic-mesh_ts_10_t_50000.000000.vtu PointHeatSource_ts_10_t_50000.000000.vtu NodalForces NodalForces 3.6e2 0
# submesh residuum output quarter_002_2nd_r_gt_2
PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu displacement displacement 1e-15 0
PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu pressure pressure 8e-8 0
PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu pressure pressure 8.2e-8 0
PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu temperature temperature 1.2e-13 0
PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu epsilon epsilon 1e-15 0
PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu PointHeatSource_quarter_002_2nd_r_gt_2_ts_10_t_50000.000000.vtu sigma sigma 7e-8 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@
<vtkdiff>
<regex>square_1e1_2_matIDs_t_.*.vtu</regex>
<field>NodalForces</field>
<absolute_tolerance>3e-12</absolute_tolerance>
<absolute_tolerance>4e-12</absolute_tolerance>
<relative_tolerance>0</relative_tolerance>
</vtkdiff>
<vtkdiff>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
<name>general_linear_solver</name>
<eigen>
<solver_type>SparseLU</solver_type>
<scaling>true</scaling>
</eigen>
</linear_solver>
</linear_solvers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
<name>general_linear_solver</name>
<eigen>
<solver_type>SparseLU</solver_type>
<scaling>true</scaling>
</eigen>
</linear_solver>
</linear_solvers>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
<name>general_linear_solver</name>
<eigen>
<solver_type>SparseLU</solver_type>
<scaling>true</scaling>
</eigen>
</linear_solver>
</linear_solvers>
Expand Down
69 changes: 58 additions & 11 deletions scripts/cmake/PythonSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ if(OGS_USE_PIP)
execute_process(
COMMAND
${CMAKE_COMMAND} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR}
-Dpython_version=${ogs.minimum_version.python}
-P
-Dpython_version=${ogs.minimum_version.python} -P
${PROJECT_SOURCE_DIR}/scripts/cmake/PythonCreateVirtualEnv.cmake
WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMAND_ECHO STDOUT
ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE
Expand Down Expand Up @@ -65,8 +64,8 @@ if(NOT OGS_BUILD_WHEEL)
endif()

find_package(
Python ${ogs.minimum_version.python}
COMPONENTS ${_python_componets} REQUIRED
Python ${ogs.minimum_version.python} COMPONENTS ${_python_componets}
REQUIRED
)

if(OGS_USE_PIP)
Expand All @@ -93,10 +92,12 @@ if(OGS_USE_PIP)
file(STRINGS Tests/Data/requirements-dev.txt _requirements_dev)
list(APPEND OGS_PYTHON_PACKAGES ${_requirements} ${_requirements_dev})

list(APPEND OGS_PYTHON_PACKAGES
"snakemake==${ogs.minimum_version.snakemake}"
"pulp==2.7.0" # https://github.com/snakemake/snakemake/issues/2607
"setuptools" # https://github.com/glenfant/stopit/issues/32
list(
APPEND
OGS_PYTHON_PACKAGES
"snakemake==${ogs.minimum_version.snakemake}"
"pulp==2.7.0" # https://github.com/snakemake/snakemake/issues/2607
"setuptools" # https://github.com/glenfant/stopit/issues/32
)
set(SNAKEMAKE ${LOCAL_VIRTUALENV_BIN_DIR}/snakemake CACHE FILEPATH ""
FORCE
Expand Down Expand Up @@ -145,11 +146,24 @@ function(setup_venv)
OUTPUT_VARIABLE _out
ERROR_VARIABLE _err
)
if(${_return_code} EQUAL 0)
set(_OGS_PYTHON_PACKAGES_SHA1 "${_ogs_python_packages_sha1}"
CACHE INTERNAL ""
)
message(STATUS "${_out}")
else()
message(
FATAL_ERROR
"Installation of Python packages via pip failed!\n"
"To disable pip set OGS_USE_PIP=OFF.\n\n${_out}\n${_err}"
)
endif()
if(DEFINED ENV{CI} AND UNIX AND NOT APPLE)
execute_process(
COMMAND ${_apple_env} ${LOCAL_VIRTUALENV_BIN_DIR}/pip install
--force-reinstall
-r ${PROJECT_SOURCE_DIR}/Tests/Data/requirements-gmsh-nox.txt
COMMAND
${_apple_env} ${LOCAL_VIRTUALENV_BIN_DIR}/pip install
--force-reinstall -r
${PROJECT_SOURCE_DIR}/Tests/Data/requirements-gmsh-nox.txt
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
RESULT_VARIABLE _return_code
OUTPUT_VARIABLE _out
Expand All @@ -170,3 +184,36 @@ function(setup_venv)
endif()
endif()
endfunction()

# Sets up ctest which are dependent on the virtual env, e.g. using ogs6py
function(setup_venv_dependent_ctests)
if(NOT OGS_USE_MPI AND OGS_BUILD_TESTING AND OGS_BUILD_PROCESS_HT)
execute_process(
COMMAND
${Python_EXECUTABLE}
${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles/generateInvalidMediaForHT.py
WORKING_DIRECTORY
${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles
)
file(GLOB HT_INVALID_PRJ_FILES
${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles/*.prj
)
foreach(ht_invalid_prj_file ${HT_INVALID_PRJ_FILES})
string(
REPLACE ${Data_SOURCE_DIR}/Parabolic/HT/InvalidProjectFiles/HT
"invalid" ht_invalid_prj_file_short
${ht_invalid_prj_file}
)
AddTest(
NAME HT_${ht_invalid_prj_file_short}
PATH Parabolic/HT/InvalidProjectFiles
EXECUTABLE ogs
EXECUTABLE_ARGS ${ht_invalid_prj_file}
RUNTIME 1
)
set_tests_properties(
ogs-HT_${ht_invalid_prj_file_short} PROPERTIES WILL_FAIL TRUE
)
endforeach()
endif()
endfunction()

0 comments on commit 9ff2068

Please sign in to comment.