From 1ab47fc8dbb9aede2780ea32f1fa45e209cc5c82 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 21 May 2024 13:24:05 +0200 Subject: [PATCH 1/4] [T] Slightly relax ctest's tolerances --- ProcessLib/ThermoRichardsMechanics/Tests.cmake | 2 +- .../MultiMaterial/DP_Ehlers/TM/square_1e1_2_matIDs.prj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ProcessLib/ThermoRichardsMechanics/Tests.cmake b/ProcessLib/ThermoRichardsMechanics/Tests.cmake index 5e31a8e2710..7cd0815d238 100644 --- a/ProcessLib/ThermoRichardsMechanics/Tests.cmake +++ b/ProcessLib/ThermoRichardsMechanics/Tests.cmake @@ -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 diff --git a/Tests/Data/ThermoHydroMechanics/MultiMaterial/DP_Ehlers/TM/square_1e1_2_matIDs.prj b/Tests/Data/ThermoHydroMechanics/MultiMaterial/DP_Ehlers/TM/square_1e1_2_matIDs.prj index 5ae467e4cb9..c8f49134af8 100644 --- a/Tests/Data/ThermoHydroMechanics/MultiMaterial/DP_Ehlers/TM/square_1e1_2_matIDs.prj +++ b/Tests/Data/ThermoHydroMechanics/MultiMaterial/DP_Ehlers/TM/square_1e1_2_matIDs.prj @@ -440,7 +440,7 @@ square_1e1_2_matIDs_t_.*.vtu NodalForces - 3e-12 + 4e-12 0 From e978e7240a72dd1540e51388620e729ac03d7bcc Mon Sep 17 00:00:00 2001 From: Dmitri Naumov Date: Tue, 21 May 2024 13:33:46 +0200 Subject: [PATCH 2/4] [T/TRM] Add scaling to anisotropic tests It seems to avoid some issues after Eigen update with the SparseLU solver crashing. --- .../anisotropic_thermal_expansion/aniso_expansion_x45.prj | 1 + .../anisotropic_thermal_expansion/aniso_expansion_y45.prj | 1 + .../anisotropic_thermal_expansion/aniso_expansion_z45.prj | 1 + 3 files changed, 3 insertions(+) diff --git a/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion_x45.prj b/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion_x45.prj index 600a835f70a..197a999dc95 100644 --- a/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion_x45.prj +++ b/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion_x45.prj @@ -334,6 +334,7 @@ general_linear_solver SparseLU + true diff --git a/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion_y45.prj b/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion_y45.prj index 7b588aefdf2..67d491868b1 100644 --- a/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion_y45.prj +++ b/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion_y45.prj @@ -334,6 +334,7 @@ general_linear_solver SparseLU + true diff --git a/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion_z45.prj b/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion_z45.prj index e1e7f91cddd..3bac70eb79d 100644 --- a/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion_z45.prj +++ b/Tests/Data/ThermoRichardsMechanics/anisotropic_thermal_expansion/aniso_expansion_z45.prj @@ -334,6 +334,7 @@ general_linear_solver SparseLU + true From 8b98bf465977f9a00aa9e9f3efe7ebc737608e44 Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 21 May 2024 14:26:06 +0200 Subject: [PATCH 3/4] [T,CMake] Fix generateInvalidMediaForHT.py call order. The script requries ogs6py which is installed at the end of the cmake configure run. Moved the call after the venv creation. --- CMakeLists.txt | 1 + ProcessLib/HT/Tests.cmake | 18 +---------- scripts/cmake/PythonSetup.cmake | 56 ++++++++++++++++++++++++++------- 3 files changed, 47 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63d265dc27a..2ba12779790 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -221,6 +221,7 @@ include(UnityBuildSettings) if(OGS_USE_PIP) setup_venv() + setup_venv_dependent_ctests() endif() message(STATUS "${_benchmark_run_commands}") diff --git a/ProcessLib/HT/Tests.cmake b/ProcessLib/HT/Tests.cmake index e93012552e9..924e6a12181 100644 --- a/ProcessLib/HT/Tests.cmake +++ b/ProcessLib/HT/Tests.cmake @@ -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) diff --git a/scripts/cmake/PythonSetup.cmake b/scripts/cmake/PythonSetup.cmake index 1c6f02f0abd..bed4a71692f 100644 --- a/scripts/cmake/PythonSetup.cmake +++ b/scripts/cmake/PythonSetup.cmake @@ -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 @@ -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) @@ -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 @@ -147,9 +148,10 @@ function(setup_venv) ) 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 @@ -170,3 +172,35 @@ function(setup_venv) endif() endif() endfunction() + +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() From 5db5d268b522f2dba85153223004965791fbaea1 Mon Sep 17 00:00:00 2001 From: Lars Bilke Date: Tue, 21 May 2024 15:02:20 +0200 Subject: [PATCH 4/4] [CMake] Fix pip error output on venv creation. There are 2 pip install runs and only the second one was evaluated. --- scripts/cmake/PythonSetup.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/cmake/PythonSetup.cmake b/scripts/cmake/PythonSetup.cmake index bed4a71692f..26efb4067e0 100644 --- a/scripts/cmake/PythonSetup.cmake +++ b/scripts/cmake/PythonSetup.cmake @@ -146,6 +146,18 @@ 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 @@ -173,6 +185,7 @@ function(setup_venv) 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(