diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a3b3e261819..4913764ca69 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,7 @@ "build": { "dockerfile": "Dockerfile", "args": { - "GEOS_TPL_TAG": "250-92" + "GEOS_TPL_TAG": "248-93" } }, "runArgs": [ diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 67db006ae2c..cec099fc030 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -231,7 +231,7 @@ jobs: ENABLE_HYPRE_DEVICE: CUDA ENABLE_HYPRE: ON ENABLE_TRILINOS: OFF - RUNS_ON: Runner_4core_16GB + RUNS_ON: Runner_8core_32GB - name: Ubuntu CUDA (20.04, clang 10.0.0 + gcc 9.4.0, open-mpi 4.0.3, cuda-11.8.89) BUILD_AND_TEST_CLI_ARGS: "--no-run-unit-tests --no-install-schema" diff --git a/integratedTests b/integratedTests index d2ad8efd778..87de6282c94 160000 --- a/integratedTests +++ b/integratedTests @@ -1 +1 @@ -Subproject commit d2ad8efd778dc1ffab62e1fe229f4d2fdad7a4e6 +Subproject commit 87de6282c940aac411b1b0d960f4055b28a3442f diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 018c7e22e8a..5d50f8ef09f 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -9,6 +9,9 @@ echo "Running CLI ${SCRIPT_NAME} $@" echo "running nproc" nproc +# docs.docker.com/config/containers/resource_constraints +# Inside the container, tools like free report the host's available swap, not what's available inside the container. +# Don't rely on the output of free or similar tools to determine whether swap is present. echo "running free -m" free -m diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index abd2bb1e1fb..847adc5a11f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,7 +22,8 @@ else() endif() set( CMAKE_ENABLE_EXPORTS ON ) -#set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time") +# populated by `geos_add_test` (private list of all geos tests, keep in sync with the macro definition) +set_property( GLOBAL PROPERTY geos_tests_exe_list ) ################################ # Include blt @@ -32,27 +33,27 @@ include( cmake/blt/SetupBLT.cmake ) set( BLT_SOURCE_DIR ${PROJECT_SOURCE_DIR}/cmake/blt/ ) # use, i.e. don't skip the full RPATH for the build tree -set(CMAKE_SKIP_BUILD_RPATH FALSE) +set( CMAKE_SKIP_BUILD_RPATH FALSE ) # when building, don't use the install RPATH already # (but later on when installing) -set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) -set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") -set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") +set( CMAKE_BUILD_WITH_INSTALL_RPATH FALSE ) +set( CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" ) +set( CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" ) # add the automatically determined parts of the RPATH # which point to directories outside the build tree to the install RPATH -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +set( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE ) # the RPATH to be used when installing, but only if it's not a system directory list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) if("${isSystemDir}" STREQUAL "-1") - set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + set( CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" ) endif() # Removes -pthread from BLT CUDA libraries lists if( ENABLE_CUDA ) - set( _cuda_libraries ) + unset( _cuda_libraries ) foreach( _lib ${BLT_CUDA_LIBRARIES} ) if( "${_lib}" STREQUAL "-pthread" ) list( APPEND _cuda_libraries "-lpthread" ) @@ -81,7 +82,7 @@ add_subdirectory( thirdparty ) ################################ # Add components ################################ -set( externalComponentsLinkList "" ) +unset( externalComponentsLinkList ) add_subdirectory( coreComponents ) add_subdirectory( externalComponents ) add_subdirectory( main ) @@ -116,28 +117,28 @@ include( cmake/GeosxConfig.cmake ) ################################ # Add main ################################ -set( extraComponentsLinkList "" ) +unset( extraComponentsLinkList ) if( ENABLE_OPENMP ) - set( extraComponentsLinkList ${extraComponentsLinkList} openmp ) + list( APPEND extraComponentsLinkList openmp ) endif() if( ENABLE_CUDA ) - set( extraComponentsLinkList ${extraComponentsLinkList} cuda ) + list( APPEND extraComponentsLinkList cuda ) endif() if( ENABLE_CUDA_NVTOOLSEXT ) - set( extraComponentsLinkList ${extraComponentsLinkList} CUDA::nvToolsExt ) + list( APPEND extraComponentsLinkList CUDA::nvToolsExt ) endif() if( ENABLE_HIP ) - set( extraComponentsLinkList ${extraComponentsLinkList} blt::hip ) + list( APPEND extraComponentsLinkList blt::hip ) endif() if ( GEOSX_BUILD_SHARED_LIBS ) - set( extraComponentsLinkList ${extraComponentsLinkList} geosx_core ) + list( APPEND extraComponentsLinkList geosx_core ) else() - set( extraComponentsLinkList ${extraComponentsLinkList} ${geosx_core_libs} ) + list( APPEND extraComponentsLinkList ${geosx_core_libs} ) endif() blt_add_executable( NAME geosx @@ -220,7 +221,7 @@ add_custom_target( geosx_generate_install_schema COMMENT "Generating XML schema to install" ) -if (NOT GEOSX_INSTALL_SCHEMA) +if( NOT GEOSX_INSTALL_SCHEMA ) set_target_properties(geosx_generate_install_schema PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1) endif() @@ -236,3 +237,10 @@ if( EXISTS "${CMAKE_SOURCE_DIR}/../integratedTests/CMakeLists.txt") else() message( "Could not find the integratedTests submodule" ) endif() + +# the following adds a `build_test` CMake target such that running `$ make build_test test` +# builds the unit tests before running them +get_property( tmp GLOBAL PROPERTY geos_tests_exe_list ) +add_custom_target( build_test COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS ${tmp} ) + +message( DEBUG "geos_tests: ${tmp} " ) diff --git a/src/cmake/GeosxMacros.cmake b/src/cmake/GeosxMacros.cmake index dc46f716353..81264a61c57 100644 --- a/src/cmake/GeosxMacros.cmake +++ b/src/cmake/GeosxMacros.cmake @@ -31,7 +31,7 @@ macro( geosx_add_code_checks ) if( NOT DEFINED arg_EXCLUDES ) set( _sources ${_all_sources} ) else() - set( _sources ) + unset( _sources ) foreach( _source ${_all_sources} ) set( _to_be_excluded FALSE ) foreach( _exclude ${arg_EXCLUDES} ) @@ -54,3 +54,38 @@ macro( geosx_add_code_checks ) endif() endmacro( geosx_add_code_checks ) + +##------------------------------------------------------------------------------ +## geos_add_test( NAME [name] +## COMMAND [command] +## EXECUTABLE [executable] ) +## +## Adds a test to the project, remaining arguments are forwarded to `blt_add_test` +## As a side effect, uses and populates a global property named `geos_tests_exe_list` +## initialized in `src/CMakeLists.txt`. +##------------------------------------------------------------------------------ +macro( geos_add_test ) + + set( options ) + set( singleValueArgs NAME EXECUTABLE ) + set( multiValueArgs COMMAND ) + + # Parse the arguments to the macro + cmake_parse_arguments( arg + "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} ) + + if( NOT arg_EXECUTABLE ) + list( GET arg_COMMAND 0 _test_executable ) + set( arg_EXECUTABLE ${_test_executable} ) + endif() + + get_property( tmp GLOBAL PROPERTY geos_tests_exe_list ) + list( APPEND tmp ${arg_EXECUTABLE} ) + set_property( GLOBAL PROPERTY geos_tests_exe_list "${tmp}" ) + + message( DEBUG "arg_NAME=${arg_NAME} arg_EXECUTABLE=${arg_EXECUTABLE} arg_COMMAND=${arg_COMMAND} ARGN=${ARGN}" ) # debug + + blt_add_test( NAME ${arg_NAME} + COMMAND ${arg_COMMAND} ${ARGN} ) + +endmacro( geos_add_test ) diff --git a/src/coreComponents/CMakeLists.txt b/src/coreComponents/CMakeLists.txt index 8e02766ffdd..2de7ccd0068 100644 --- a/src/coreComponents/CMakeLists.txt +++ b/src/coreComponents/CMakeLists.txt @@ -17,29 +17,28 @@ set( subdirs physicsSolvers events mainInterface - python - ) + python ) -set( parallelDeps "" ) +unset( parallelDeps ) if ( ENABLE_OPENMP ) - set( parallelDeps ${parallelDeps} openmp ) + list( APPEND parallelDeps openmp ) endif() if ( ENABLE_CUDA ) - set( parallelDeps ${parallelDeps} cuda ) + list( APPEND parallelDeps cuda ) endif() if( ENABLE_CUDA_NVTOOLSEXT ) - set( parallelDeps ${parallelDeps} CUDA::nvToolsExt ) + list( APPEND parallelDeps CUDA::nvToolsExt ) endif() if( ENABLE_HIP ) - set( parallelDeps ${parallelDeps} blt::hip ) + list( APPEND parallelDeps blt::hip ) endif() if( ENABLE_MPI ) - set( parallelDeps ${parallelDeps} mpi ) + list( APPEND parallelDeps mpi ) endif() if ( GEOSX_BUILD_OBJ_LIBS ) @@ -76,8 +75,7 @@ if( GEOSX_BUILD_SHARED_LIBS AND GEOSX_BUILD_OBJ_LIBS ) blt_add_library ( NAME geosx_core SOURCES dummy.cpp DEPENDS_ON mainInterface physicsSolvers - SHARED TRUE - ) + SHARED TRUE ) elseif( GEOSX_BUILD_SHARED_LIBS AND NOT GEOSX_BUILD_OBJ_LIBS ) message( "Building shared geosx_core library with static coreComponents, executables link to geosx_core" ) @@ -85,8 +83,7 @@ elseif( GEOSX_BUILD_SHARED_LIBS AND NOT GEOSX_BUILD_OBJ_LIBS ) SOURCE_LIBS ${coreLibs} LIB_TYPE SHARED LINK_PREPEND ${GEOSX_LINK_PREPEND_FLAG} - LINK_POSTPEND ${GEOSX_LINK_POSTPEND_FLAG} - ) + LINK_POSTPEND ${GEOSX_LINK_POSTPEND_FLAG} ) elseif( NOT GEOSX_BUILD_SHARED_LIBS AND GEOSX_BUILD_OBJ_LIBS ) message( "Building object coreComponents, executables link to coreComponents" ) diff --git a/src/coreComponents/codingUtilities/tests/CMakeLists.txt b/src/coreComponents/codingUtilities/tests/CMakeLists.txt index 448203c2338..f70776694a0 100644 --- a/src/coreComponents/codingUtilities/tests/CMakeLists.txt +++ b/src/coreComponents/codingUtilities/tests/CMakeLists.txt @@ -1,18 +1,12 @@ -# # Specify list of tests -# - set( testSources testGeosxTraits.cpp testStringUtilities.cpp - testParsing.cpp - ) + testParsing.cpp ) -set(dependencyList gtest codingUtilities ${parallelDeps} ) +set( dependencyList gtest codingUtilities ${parallelDeps} ) -# # Add gtest C++ based tests -# foreach( test ${testSources} ) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} @@ -20,8 +14,7 @@ foreach( test ${testSources} ) OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() diff --git a/src/coreComponents/common/CMakeLists.txt b/src/coreComponents/common/CMakeLists.txt index 8a69392574c..f555696f508 100644 --- a/src/coreComponents/common/CMakeLists.txt +++ b/src/coreComponents/common/CMakeLists.txt @@ -49,22 +49,22 @@ set( common_sources set( dependencyList ${parallelDeps} lvarray pugixml::pugixml RAJA chai conduit::conduit fmt::fmt ) if ( ENABLE_MKL ) - set( dependencyList ${dependencyList} mkl ) + list( APPEND dependencyList mkl ) endif() if( ENABLE_CALIPER ) - set( dependencyList ${dependencyList} caliper ) + list( APPEND dependencyList caliper ) endif() if( ENABLE_CALIPER ) - set( dependencyList ${dependencyList} caliper ) + list( APPEND dependencyList caliper ) if (TARGET adiak::adiak) - set( dependencyList ${dependencyList} adiak::adiak ) + list( APPEND dependencyList adiak::adiak ) endif() if (TARGET adiak) - set( dependencyList ${dependencyList} adiak ) + list( APPEND dependencyList adiak ) endif() endif() diff --git a/src/coreComponents/common/unitTests/CMakeLists.txt b/src/coreComponents/common/unitTests/CMakeLists.txt index 88f0cb14e05..0367171706e 100644 --- a/src/coreComponents/common/unitTests/CMakeLists.txt +++ b/src/coreComponents/common/unitTests/CMakeLists.txt @@ -1,13 +1,9 @@ -# # Specify list of tests -# - -set(gtest_geosx_tests - testDataTypes.cpp - testFixedSizeDeque.cpp - testTypeDispatch.cpp - testLifoStorage.cpp - ) +set( gtest_geosx_tests + testDataTypes.cpp + testFixedSizeDeque.cpp + testTypeDispatch.cpp + testLifoStorage.cpp ) if ( ENABLE_CALIPER ) list( APPEND gtest_geosx_tests @@ -15,19 +11,16 @@ if ( ENABLE_CALIPER ) endif() set( dependencyList ${parallelDeps} common hdf5 gtest ) -# + # Add gtest C++ based tests -# foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() diff --git a/src/coreComponents/constitutive/CMakeLists.txt b/src/coreComponents/constitutive/CMakeLists.txt index 4451a0d8ed3..5dc7e5520cd 100644 --- a/src/coreComponents/constitutive/CMakeLists.txt +++ b/src/coreComponents/constitutive/CMakeLists.txt @@ -294,7 +294,7 @@ if( ENABLE_PVTPackage ) add_subdirectory( PVTPackage ) - set( dependencyList ${dependencyList} PVTPackage ) + list( APPEND dependencyList PVTPackage ) endif() blt_add_library( NAME constitutive diff --git a/src/coreComponents/constitutive/unitTests/CMakeLists.txt b/src/coreComponents/constitutive/unitTests/CMakeLists.txt index ed910dc46b7..9c50765fa2c 100644 --- a/src/coreComponents/constitutive/unitTests/CMakeLists.txt +++ b/src/coreComponents/constitutive/unitTests/CMakeLists.txt @@ -1,7 +1,4 @@ -# # Specify list of tests -# - set( gtest_geosx_tests testCompositionalProperties.cpp testDamageUtilities.cpp @@ -13,28 +10,23 @@ set( gtest_geosx_tests testParticleFluidEnums.cpp testPropertyConversions.cpp testCubicEOS.cpp - testRachfordRice.cpp - ) + testRachfordRice.cpp ) set( dependencyList gtest constitutive ${parallelDeps} ) if( ENABLE_CUDA_NVTOOLSEXT ) - set( dependencyList ${dependencyList} CUDA::nvToolsExt ) + list( APPEND dependencyList CUDA::nvToolsExt ) endif() -# # Add gtest C++ based tests -# foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() diff --git a/src/coreComponents/dataRepository/CMakeLists.txt b/src/coreComponents/dataRepository/CMakeLists.txt index 8290a0c18f5..bea120432a7 100644 --- a/src/coreComponents/dataRepository/CMakeLists.txt +++ b/src/coreComponents/dataRepository/CMakeLists.txt @@ -1,6 +1,4 @@ -# # Specify all headers -# set( dataRepository_headers BufferOps.hpp BufferOpsDevice.hpp @@ -24,12 +22,9 @@ set( dataRepository_headers xmlWrapper.hpp DataContext.hpp GroupContext.hpp - WrapperContext.hpp - ) + WrapperContext.hpp ) -# # Specify all sources -# set( dataRepository_sources BufferOpsDevice.cpp ConduitRestart.cpp @@ -40,19 +35,18 @@ set( dataRepository_sources xmlWrapper.cpp DataContext.cpp GroupContext.cpp - WrapperContext.cpp - ) + WrapperContext.cpp ) set( dependencyList ${parallelDeps} codingUtilities ) if( ENABLE_PYGEOSX ) list( APPEND dataRepository_headers - python/PyGroup.hpp - python/PyGroupType.hpp - python/PyWrapper.hpp ) + python/PyGroup.hpp + python/PyGroupType.hpp + python/PyWrapper.hpp ) list( APPEND dataRepository_sources - python/PyGroup.cpp - python/PyWrapper.cpp ) + python/PyGroup.cpp + python/PyWrapper.cpp ) list( APPEND dependencyList Python3::Python pylvarray ) endif() @@ -61,8 +55,7 @@ blt_add_library( NAME dataRepository SOURCES ${dataRepository_sources} HEADERS ${dataRepository_headers} DEPENDS_ON ${dependencyList} - OBJECT ${GEOSX_BUILD_OBJ_LIBS} - ) + OBJECT ${GEOSX_BUILD_OBJ_LIBS} ) target_include_directories( dataRepository PUBLIC ${CMAKE_SOURCE_DIR}/coreComponents ) diff --git a/src/coreComponents/dataRepository/unitTests/CMakeLists.txt b/src/coreComponents/dataRepository/unitTests/CMakeLists.txt index ff2eb604de6..14386e0b842 100644 --- a/src/coreComponents/dataRepository/unitTests/CMakeLists.txt +++ b/src/coreComponents/dataRepository/unitTests/CMakeLists.txt @@ -1,31 +1,24 @@ -# # Specify list of tests -# - set( dataRepository_tests testDefaultValue.cpp testWrapper.cpp testXmlWrapper.cpp - testBufferOps.cpp - ) + testBufferOps.cpp ) set( dependencyList ${parallelDeps} gtest dataRepository ) if( ENABLE_CUDA_NVTOOLSEXT ) - set( dependencyList ${dependencyList} CUDA::nvToolsExt ) + list( APPEND dependencyList CUDA::nvToolsExt ) endif() -# # Add gtest C++ based tests -# foreach(test ${dataRepository_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() diff --git a/src/coreComponents/denseLinearAlgebra/CMakeLists.txt b/src/coreComponents/denseLinearAlgebra/CMakeLists.txt index 42365b71f08..9077e6f68d2 100644 --- a/src/coreComponents/denseLinearAlgebra/CMakeLists.txt +++ b/src/coreComponents/denseLinearAlgebra/CMakeLists.txt @@ -1,17 +1,12 @@ -# # Specify all headers -# set( denseLinearAlgebra_headers common/layouts.hpp interfaces/blaslapack/BlasLapackFunctions.h - interfaces/blaslapack/BlasLapackLA.hpp - ) -# + interfaces/blaslapack/BlasLapackLA.hpp ) + # Specify all sources -# set( denseLinearAlgebra_sources - interfaces/blaslapack/BlasLapackLA.cpp - ) + interfaces/blaslapack/BlasLapackLA.cpp ) set( dependencyList codingUtilities blas lapack ${parallelDeps} ) @@ -19,8 +14,7 @@ blt_add_library( NAME denseLinearAlgebra SOURCES ${denseLinearAlgebra_sources} HEADERS ${denseLinearAlgebra_headers} DEPENDS_ON ${dependencyList} - OBJECT ${GEOSX_BUILD_OBJ_LIBS} - ) + OBJECT ${GEOSX_BUILD_OBJ_LIBS} ) target_include_directories( denseLinearAlgebra PUBLIC ${CMAKE_CURRENT_LIST_DIR} ) diff --git a/src/coreComponents/denseLinearAlgebra/unitTests/CMakeLists.txt b/src/coreComponents/denseLinearAlgebra/unitTests/CMakeLists.txt index 5ec6ee30511..1b7d0eefb3d 100644 --- a/src/coreComponents/denseLinearAlgebra/unitTests/CMakeLists.txt +++ b/src/coreComponents/denseLinearAlgebra/unitTests/CMakeLists.txt @@ -1,18 +1,18 @@ set( serial_tests - BlasLapack ) + testBlasLapack.cpp ) set( dependencyList gtest denseLinearAlgebra ) if ( ENABLE_CUDA ) - set( dependencyList ${dependencyList} cuda ) + list( APPEND dependencyList cuda ) endif() -foreach(test_name ${serial_tests}) - set( exec_name test${test_name} ) - blt_add_executable( NAME ${exec_name} - SOURCES ${exec_name}.cpp +foreach(test ${serial_tests}) + get_filename_component( test_name ${test} NAME_WE ) + blt_add_executable( NAME ${test_name} + SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME testDenseLinearAlgebra_${test_name} - COMMAND ${exec_name} ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() diff --git a/src/coreComponents/fileIO/CMakeLists.txt b/src/coreComponents/fileIO/CMakeLists.txt index e99ee3bad42..2d7fe04730c 100644 --- a/src/coreComponents/fileIO/CMakeLists.txt +++ b/src/coreComponents/fileIO/CMakeLists.txt @@ -1,6 +1,4 @@ -# # Specify all headers -# set( fileIO_headers Outputs/BlueprintOutput.hpp Outputs/OutputBase.hpp @@ -14,12 +12,9 @@ set( fileIO_headers timeHistory/BufferedHistoryIO.hpp timeHistory/PackCollection.hpp timeHistory/HDFHistoryIO.hpp - timeHistory/HistoryCollection.hpp - ) + timeHistory/HistoryCollection.hpp ) -# # Specify all sources -# set( fileIO_sources Outputs/BlueprintOutput.cpp Outputs/OutputBase.cpp @@ -31,34 +26,31 @@ set( fileIO_sources timeHistory/HDFFile.cpp timeHistory/HistoryCollectionBase.cpp timeHistory/PackCollection.cpp - timeHistory/HDFHistoryIO.cpp - ) + timeHistory/HDFHistoryIO.cpp ) set( dependencyList ${parallelDeps} mesh constitutive hdf5 ) if( ENABLE_PYGEOSX ) list( APPEND fileIO_headers python/PyHistoryCollectionType.hpp python/PyHistoryOutputType.hpp - python/PyVTKOutputType.hpp - ) + python/PyVTKOutputType.hpp ) list( APPEND fileIO_sources python/PyHistoryCollection.cpp python/PyHistoryOutput.cpp - python/PyVTKOutput.cpp - ) + python/PyVTKOutput.cpp ) list( APPEND dependencyList Python3::Python pylvarray ) endif() if( ENABLE_MPI ) add_subdirectory( coupling/hdf5_interface ) - set( dependencyList ${dependencyList} mpi hdf5_interface ) + list( APPEND dependencyList mpi hdf5_interface ) list( APPEND fileIO_headers coupling/ChomboCoupler.hpp Outputs/ChomboIO.hpp ) list( APPEND fileIO_sources coupling/ChomboCoupler.cpp Outputs/ChomboIO.cpp ) endif() if( ENABLE_SILO ) - set( dependencyList ${dependencyList} silo ) + list( APPEND dependencyList silo ) list( APPEND fileIO_headers silo/SiloFile.hpp Outputs/SiloOutput.hpp ) @@ -84,15 +76,14 @@ if( ENABLE_VTK ) endif() if( ENABLE_CUDA_NVTOOLSEXT ) - set( dependencyList ${dependencyList} CUDA::nvToolsExt ) + list( APPEND dependencyList CUDA::nvToolsExt ) endif() blt_add_library( NAME fileIO SOURCES ${fileIO_sources} HEADERS ${fileIO_headers} DEPENDS_ON ${dependencyList} - OBJECT ${GEOSX_BUILD_OBJ_LIBS} - ) + OBJECT ${GEOSX_BUILD_OBJ_LIBS} ) target_include_directories( fileIO PUBLIC ${CMAKE_SOURCE_DIR}/coreComponents ) diff --git a/src/coreComponents/finiteElement/unitTests/CMakeLists.txt b/src/coreComponents/finiteElement/unitTests/CMakeLists.txt index e22fd94ea6f..a8f044271be 100644 --- a/src/coreComponents/finiteElement/unitTests/CMakeLists.txt +++ b/src/coreComponents/finiteElement/unitTests/CMakeLists.txt @@ -1,7 +1,4 @@ -# # Specify list of tests -# - set(testSources testFiniteElementBase.cpp testH1_QuadrilateralFace_Lagrange1_GaussLegendre2.cpp @@ -11,18 +8,15 @@ set(testSources testH1_Pyramid_Lagrange1_Gauss5.cpp testH1_TriangleFace_Lagrange1_Gauss1.cpp testQ3_Hexahedron_Lagrange_GaussLobatto.cpp - testQ5_Hexahedron_Lagrange_GaussLobatto.cpp - ) + testQ5_Hexahedron_Lagrange_GaussLobatto.cpp ) set( dependencyList gtest finiteElement ${parallelDeps} ) if( ENABLE_CUDA_NVTOOLSEXT ) - set( dependencyList ${dependencyList} CUDA::nvToolsExt ) + list( APPEND dependencyList CUDA::nvToolsExt ) endif() -# # Add gtest C++ based tests -# foreach(test ${testSources}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} @@ -30,9 +24,8 @@ foreach(test ${testSources}) OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) if( ( NOT ${ENABLE_CUDA} ) AND ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" ) ) set_target_properties(${test_name} PROPERTIES COMPILE_FLAGS "-Wno-everything") @@ -41,6 +34,6 @@ foreach(test ${testSources}) endforeach() if ( ENABLE_CUDA ) -#blt_add_target_compile_flags( TO testShapeFunctionKernel -# FLAGS "--maxrregcount=64") +# blt_add_target_compile_flags( TO testShapeFunctionKernel +# FLAGS "--maxrregcount=64") endif() diff --git a/src/coreComponents/functions/CMakeLists.txt b/src/coreComponents/functions/CMakeLists.txt index 55de8ae2f18..8ad064d8df8 100644 --- a/src/coreComponents/functions/CMakeLists.txt +++ b/src/coreComponents/functions/CMakeLists.txt @@ -30,7 +30,7 @@ endif() set( dependencyList ${parallelDeps} codingUtilities dataRepository ) if( ENABLE_MATHPRESSO ) - set( dependencyList ${dependencyList} mathpresso ) + list( APPEND dependencyList mathpresso ) endif() blt_add_library( NAME functions diff --git a/src/coreComponents/functions/unitTests/CMakeLists.txt b/src/coreComponents/functions/unitTests/CMakeLists.txt index 32461b62344..c532b4eac94 100644 --- a/src/coreComponents/functions/unitTests/CMakeLists.txt +++ b/src/coreComponents/functions/unitTests/CMakeLists.txt @@ -1,33 +1,25 @@ -# # Specify list of tests -# - set( gtest_geosx_tests - testFunctions.cpp - ) + testFunctions.cpp ) set( dependencyList ${parallelDeps} gtest functions ) # if ( GEOSX_BUILD_SHARED_LIBS ) -# set (dependencyList ${dependencyList} geosx_core ) +# list( APPEND dependencyList geosx_core ) # else() -# set (dependencyList ${dependencyList} ${geosx_core_libs} ) +# list( APPEND dependencyList ${geosx_core_libs} ) # endif() -# # Add gtest C++ based tests -# foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() diff --git a/src/coreComponents/linearAlgebra/CMakeLists.txt b/src/coreComponents/linearAlgebra/CMakeLists.txt index 271cb233b3c..8e86dbfdd05 100644 --- a/src/coreComponents/linearAlgebra/CMakeLists.txt +++ b/src/coreComponents/linearAlgebra/CMakeLists.txt @@ -1,6 +1,4 @@ -# # Specify all headers -# set( linearAlgebra_headers DofManager.hpp DofManagerHelpers.hpp @@ -36,12 +34,9 @@ set( linearAlgebra_headers utilities/LinearSolverResult.hpp utilities/NormalOperator.hpp utilities/ReverseCutHillMcKeeOrdering.hpp - utilities/TransposeOperator.hpp - ) + utilities/TransposeOperator.hpp ) -# # Specify all sources -# set( linearAlgebra_sources DofManager.cpp solvers/BicgstabSolver.cpp @@ -50,8 +45,7 @@ set( linearAlgebra_sources solvers/GmresSolver.cpp solvers/KrylovSolver.cpp solvers/SeparateComponentPreconditioner.cpp - utilities/ReverseCutHillMcKeeOrdering.cpp - ) + utilities/ReverseCutHillMcKeeOrdering.cpp ) set( dependencyList ${parallelDeps} mesh denseLinearAlgebra ) @@ -115,8 +109,7 @@ if( ENABLE_HYPRE ) interfaces/hypre/mgrStrategies/SolidMechanicsEmbeddedFractures.hpp interfaces/hypre/mgrStrategies/ThermalCompositionalMultiphaseFVM.hpp interfaces/hypre/mgrStrategies/ThermalMultiphasePoromechanics.hpp - interfaces/hypre/mgrStrategies/ThermalSinglePhasePoromechanics.hpp - ) + interfaces/hypre/mgrStrategies/ThermalSinglePhasePoromechanics.hpp ) list( APPEND linearAlgebra_sources interfaces/hypre/HypreExport.cpp interfaces/hypre/HypreInterface.cpp @@ -126,8 +119,7 @@ if( ENABLE_HYPRE ) interfaces/hypre/HyprePreconditioner.cpp interfaces/hypre/HypreSolver.cpp interfaces/hypre/HypreUtils.cpp - interfaces/hypre/HypreVector.cpp - ) + interfaces/hypre/HypreVector.cpp ) list( APPEND dependencyList hypre umpire ) @@ -142,8 +134,7 @@ if( ENABLE_PETSC ) interfaces/petsc/PetscPreconditioner.hpp interfaces/petsc/PetscSolver.hpp interfaces/petsc/PetscUtils.hpp - interfaces/petsc/PetscVector.hpp - ) + interfaces/petsc/PetscVector.hpp ) list( APPEND linearAlgebra_sources interfaces/petsc/PetscExport.cpp @@ -151,8 +142,7 @@ if( ENABLE_PETSC ) interfaces/petsc/PetscMatrix.cpp interfaces/petsc/PetscPreconditioner.cpp interfaces/petsc/PetscSolver.cpp - interfaces/petsc/PetscVector.cpp - ) + interfaces/petsc/PetscVector.cpp ) list( APPEND dependencyList petsc ) diff --git a/src/coreComponents/linearAlgebra/unitTests/CMakeLists.txt b/src/coreComponents/linearAlgebra/unitTests/CMakeLists.txt index e33bec1748e..39de3a6a8b1 100644 --- a/src/coreComponents/linearAlgebra/unitTests/CMakeLists.txt +++ b/src/coreComponents/linearAlgebra/unitTests/CMakeLists.txt @@ -1,40 +1,40 @@ set( serial_tests - LinearSolverParametersEnums - ComponentMask ) + testLinearSolverParametersEnums.cpp + testComponentMask.cpp ) set( parallel_tests - Matrices - Vectors - ExternalSolvers - KrylovSolvers - ReverseCutHillMcKeeOrdering ) + testMatrices.cpp + testVectors.cpp + testExternalSolvers.cpp + testKrylovSolvers.cpp + testReverseCutHillMcKeeOrdering.cpp ) set( nranks 2 ) set( dependencyList gtest linearAlgebra ${parallelDeps} ) -foreach(test_name ${serial_tests}) - set( exec_name test${test_name} ) - blt_add_executable( NAME ${exec_name} - SOURCES ${exec_name}.cpp +foreach(test ${serial_tests}) + get_filename_component( test_name ${test} NAME_WE ) + blt_add_executable( NAME ${test_name} + SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME testLinearAlgebra_${test_name} - COMMAND ${exec_name} ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() -foreach(test_name ${parallel_tests}) - set( exec_name test${test_name} ) - blt_add_executable( NAME ${exec_name} - SOURCES ${exec_name}.cpp +foreach(test ${parallel_tests}) + get_filename_component( test_name ${test} NAME_WE ) + blt_add_executable( NAME ${test_name} + SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} DEPENDS_ON ${dependencyList} ) if ( ENABLE_MPI ) - blt_add_test( NAME testLinearAlgebra_${test_name} - COMMAND ${exec_name} -x ${nranks} - NUM_MPI_TASKS ${nranks} ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} -x ${nranks} + NUM_MPI_TASKS ${nranks} ) else() - blt_add_test( NAME testLinearAlgebra_${test_name} - COMMAND ${exec_name} ) + geos_add_test( NAME _${test_name} + COMMAND ${test_name} ) endif() endforeach() diff --git a/src/coreComponents/mesh/CMakeLists.txt b/src/coreComponents/mesh/CMakeLists.txt index 4308abd6bbb..32c815d0c34 100644 --- a/src/coreComponents/mesh/CMakeLists.txt +++ b/src/coreComponents/mesh/CMakeLists.txt @@ -80,8 +80,7 @@ set( mesh_headers utilities/CIcomputationKernel.hpp utilities/ComputationalGeometry.hpp utilities/MeshMapUtilities.hpp - utilities/StructuredGridUtilities.hpp - ) + utilities/StructuredGridUtilities.hpp ) # Specify all sources set( mesh_sources @@ -146,8 +145,7 @@ set( mesh_sources simpleGeometricObjects/SimpleGeometricObjectBase.cpp simpleGeometricObjects/PlanarGeometricObject.cpp simpleGeometricObjects/ThickPlane.cpp - utilities/ComputationalGeometry.cpp - ) + utilities/ComputationalGeometry.cpp ) set( dependencyList ${parallelDeps} schema dataRepository constitutive finiteElement parmetis metis ) @@ -158,33 +156,30 @@ if( ENABLE_VTK ) generators/VTKFaceBlockUtilities.hpp generators/VTKMeshGenerator.hpp generators/VTKMeshGeneratorTools.hpp - generators/VTKUtilities.hpp - ) + generators/VTKUtilities.hpp ) set( mesh_sources ${mesh_sources} generators/CollocatedNodes.cpp generators/VTKFaceBlockUtilities.cpp generators/VTKMeshGenerator.cpp generators/VTKMeshGeneratorTools.cpp - generators/VTKUtilities.cpp - ) - set( dependencyList ${dependencyList} VTK::IOLegacy VTK::FiltersParallelDIY2 ) + generators/VTKUtilities.cpp ) + list( APPEND dependencyList VTK::IOLegacy VTK::FiltersParallelDIY2 ) if( ENABLE_MPI ) - set( dependencyList ${dependencyList} VTK::IOParallelXML VTK::ParallelMPI ) + list( APPEND dependencyList VTK::IOParallelXML VTK::ParallelMPI ) endif() endif() if( ENABLE_SCOTCH ) set( mesh_headers ${mesh_headers} generators/PTScotchInterface.hpp ) set( mesh_sources ${mesh_sources} generators/PTScotchInterface.cpp ) - set( dependencyList ${dependencyList} ptscotch ) + list( APPEND dependencyList ptscotch ) endif() blt_add_library( NAME mesh SOURCES ${mesh_sources} HEADERS ${mesh_headers} DEPENDS_ON ${dependencyList} - OBJECT ${GEOSX_BUILD_OBJ_LIBS} - ) + OBJECT ${GEOSX_BUILD_OBJ_LIBS} ) target_include_directories( mesh PUBLIC ${CMAKE_SOURCE_DIR}/coreComponents ) diff --git a/src/coreComponents/mesh/FaceElementSubRegion.cpp b/src/coreComponents/mesh/FaceElementSubRegion.cpp index f2034fa9c5f..894071a752c 100644 --- a/src/coreComponents/mesh/FaceElementSubRegion.cpp +++ b/src/coreComponents/mesh/FaceElementSubRegion.cpp @@ -371,7 +371,6 @@ void fixNeighborMappingsInconsistency( string const & fractureName, { { localIndex const num2dElems = elem2dToFaces.size(); - GEOS_ASSERT_EQ( elem2dToElems3d.size(), num2dElems ); for( int e2d = 0; e2d < num2dElems; ++e2d ) { std::set< localIndex > const sizes{ diff --git a/src/coreComponents/mesh/generators/CellBlockManager.cpp b/src/coreComponents/mesh/generators/CellBlockManager.cpp index 2eebe95394b..356bd937d18 100644 --- a/src/coreComponents/mesh/generators/CellBlockManager.cpp +++ b/src/coreComponents/mesh/generators/CellBlockManager.cpp @@ -258,7 +258,8 @@ struct FaceBuilder }; } - /// A map from the lowest node index in each face to a list of duplicate faces. + /// An array of size numNodes that lists for each node the (possibly duplicate) + /// faces for which the node has lowest index. ArrayOfArrays< NodesAndElementOfFace > lowestNodeToFaces; /// Contains the entire node list of each duplicate face. @@ -267,7 +268,7 @@ struct FaceBuilder /** * @brief Fills the face to nodes map and face to element maps - * @param [in] lowestNodeToFaces and array of size numNodes of arrays of NodesAndElementOfFace associated with each node. + * @param [in] lowestNodeToFaces an array of size numNodes of arrays of NodesAndElementOfFace associated with each node. * @param [in] uniqueFaceOffsets an array containing the unique ID of the first face associated with each node. * @param [inout] faceToCells the face to element map. * @param [inout] faceToNodes the face to node map. @@ -292,8 +293,7 @@ void populateFaceMaps( Group const & cellBlocks, GEOS_ERROR_IF_NE( faceToBlocks.size( 1 ), 2 ); // loop over all the nodes. - forAll< parallelHostPolicy >( numNodes, [ numNodes, - uniqueFaceOffsets, + forAll< parallelHostPolicy >( numNodes, [ uniqueFaceOffsets, lowestNodeToFaces, faceToNodes, faceToCells, @@ -309,8 +309,6 @@ void populateFaceMaps( Group const & cellBlocks, NodesAndElementOfFace const & f0 = *first; CellBlock const & cb = cellBlocks.getGroup< CellBlock >( f0.blockIndex ); localIndex const numNodesInFace = cb.getFaceNodes( f0.cellIndex, f0.faceNumber, nodesInFace ); - GEOS_ASSERT_EQ( numNodesInFace, numNodes ); - GEOS_UNUSED_VAR( numNodes ); for( localIndex i = 0; i < numNodesInFace; ++i ) { @@ -341,7 +339,7 @@ void populateFaceMaps( Group const & cellBlocks, /** * @brief Resize the face maps - * @param [in] lowestNodeToFaces and array of size numNodes of arrays of NodesAndElementOfFace associated with each node. + * @param [in] lowestNodeToFaces an array of size numNodes of arrays of NodesAndElementOfFace associated with each node. * @param [in] uniqueFaceOffsets an containing the unique face IDs for each node in lowestNodeToFaces. * @param [out] faceToNodeMap the map from faces to nodes. This function resizes the array appropriately. * @param [out] faceToCellMap the map from faces to elements. This function resizes the array appropriately. @@ -386,7 +384,7 @@ void resizeFaceMaps( FaceBuilder const & faceBuilder, /** * @brief Populate the lowestNodeToFaces map. - * @param [in] numNodes Number of nodes + * @param [in] numNodes Number of nodes on the partition. * @param [in] cellBlocks The cell blocks on which we need to operate. * * For each face of each element of each cell blocks, @@ -395,6 +393,14 @@ void resizeFaceMaps( FaceBuilder const & faceBuilder, * The key of this mapping is the lowest node index of the face. * E.g. faces {3, 5, 6, 2} and {4, 2, 9, 7} will both be stored in "bucket" of node 2. * Also, bucket of faces information are sorted (@see NodesAndElementOfFace) to make specific computations possible. + * + * If we note \a count the number of faces for which a given node is + * the node of lowest index, at the end, \a lowestNodeToFaces is an + * array of size \p numNodes of arrays of variable sizes \a count. + * + * \remark Faces at the interface of two elements are duplicated and + * stored from each element with a unique \a duplicateFaceIndex index. + * */ FaceBuilder createLowestNodeToFaces( localIndex const numNodes, const Group & cellBlocks ) { @@ -448,13 +454,23 @@ FaceBuilder createLowestNodeToFaces( localIndex const numNodes, const Group & ce localIndex nodesInFace[ CellBlockManager::maxNodesPerFace() ]; for( localIndex faceNum = 0; faceNum < numFacesPerElement; ++faceNum ) { + // Computation of a unique face index for each face + // (including the duplicate faces at the interface of 2 + // elements) localIndex const duplicateFaceIndex = prevFaceOffset + elemID * numFacesPerElement + faceNum; + // Get indices of the nodes on the face and sort theses indices localIndex const numNodesInFace = cb.getFaceNodes( elemID, faceNum, nodesInFace ); std::sort( nodesInFace, nodesInFace + numNodesInFace ); + // Add the current face to the array of the duplicate faces + // (list of all the element faces so a boundary face is + // listed once, a face at the interface of 2 elements is + // added twice, once from each elemennt to which the face + // belongs) duplicateFaces.appendToArray( duplicateFaceIndex, nodesInFace, nodesInFace + numNodesInFace ); + // Add the face to the array of faces of its lowest node (\a nodesInFace[0]) lowestNodeToFaces.emplaceBackAtomic< parallelHostAtomic >( nodesInFace[ 0 ], duplicateFaceIndex, elemID, @@ -508,7 +524,7 @@ FaceBuilder createLowestNodeToFaces( localIndex const numNodes, const Group & ce /** * @brief Filling the elements to faces maps in the cell blocks. - * @param lowestNodeToFaces The lowest node to faces information array. + * @param lowestNodeToFaces The array of size numNodes of arrays of (duplicate) faces for which the node has lowest index. * @param uniqueFaceOffsets The unique face offsets. * @param cellBlocks The cell blocks for which we need to compute the element to faces mappings. * diff --git a/src/coreComponents/mesh/generators/CellBlockManager.hpp b/src/coreComponents/mesh/generators/CellBlockManager.hpp index 46dae25d324..517e7f61f0f 100644 --- a/src/coreComponents/mesh/generators/CellBlockManager.hpp +++ b/src/coreComponents/mesh/generators/CellBlockManager.hpp @@ -104,11 +104,12 @@ class CellBlockManager : public CellBlockManagerABC /** * @brief Defines the number of nodes and resizes some underlying arrays appropriately. - * @param[in] numNodes The number of nodes. + * @param[in] numNodes The number of nodes on the MPI rank (that is per domain). + * Nodes are not duplicated along subregion interfaces. * * The nodes coordinates and nodes local to global mappings get resized to @p numNodes. */ - void setNumNodes( localIndex numNodes ); // TODO Improve doc. Is it per domain, are there duplicated nodes because of subregions? + void setNumNodes( localIndex numNodes ); void generateHighOrderMaps( localIndex const order, globalIndex const maxVertexGlobalID, diff --git a/src/coreComponents/mesh/unitTests/CMakeLists.txt b/src/coreComponents/mesh/unitTests/CMakeLists.txt index 2b69f01cf39..c017bec6962 100644 --- a/src/coreComponents/mesh/unitTests/CMakeLists.txt +++ b/src/coreComponents/mesh/unitTests/CMakeLists.txt @@ -1,26 +1,19 @@ -# # Specify list of tests -# - set( mesh_tests testMeshObjectPath.cpp testComputationalGeometry.cpp - testGeometricObjects.cpp - ) + testGeometricObjects.cpp ) set( dependencyList gtest mesh ${parallelDeps} ) -# # Add gtest C++ based tests -# foreach(test ${mesh_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() diff --git a/src/coreComponents/physicsSolvers/CMakeLists.txt b/src/coreComponents/physicsSolvers/CMakeLists.txt index 172e44dccde..547cce5990c 100644 --- a/src/coreComponents/physicsSolvers/CMakeLists.txt +++ b/src/coreComponents/physicsSolvers/CMakeLists.txt @@ -1,6 +1,4 @@ -# # Specify solver headers -# set( physicsSolvers_headers LinearSolverParameters.hpp NonlinearSolverParameters.hpp @@ -139,12 +137,9 @@ set( physicsSolvers_headers wavePropagation/AcousticFirstOrderWaveEquationSEM.hpp wavePropagation/AcousticFirstOrderWaveEquationSEMKernel.hpp wavePropagation/AcousticVTIWaveEquationSEM.hpp - wavePropagation/AcousticVTIWaveEquationSEMKernel.hpp - ) + wavePropagation/AcousticVTIWaveEquationSEMKernel.hpp ) -# # Specify solver sources -# set( physicsSolvers_sources LinearSolverParameters.cpp NonlinearSolverParameters.cpp @@ -204,8 +199,7 @@ set( physicsSolvers_sources wavePropagation/ElasticWaveEquationSEM.cpp wavePropagation/ElasticFirstOrderWaveEquationSEM.cpp wavePropagation/AcousticFirstOrderWaveEquationSEM.cpp - wavePropagation/AcousticVTIWaveEquationSEM.cpp - ) + wavePropagation/AcousticVTIWaveEquationSEM.cpp ) include( solidMechanics/kernels/SolidMechanicsKernels.cmake) include( multiphysics/poromechanicsKernels/PoromechanicsKernels.cmake) @@ -224,8 +218,7 @@ blt_add_library( NAME physicsSolvers SOURCES ${physicsSolvers_sources} HEADERS ${physicsSolvers_headers} DEPENDS_ON ${dependencyList} ${externalComponentDeps} - OBJECT ${GEOSX_BUILD_OBJ_LIBS} - ) + OBJECT ${GEOSX_BUILD_OBJ_LIBS} ) target_include_directories( physicsSolvers PUBLIC ${CMAKE_SOURCE_DIR}/coreComponents ) if( externalComponentDeps ) diff --git a/src/coreComponents/unitTests/CMakeLists.txt b/src/coreComponents/unitTests/CMakeLists.txt index c36ec70d92a..ad8e50cf3fa 100644 --- a/src/coreComponents/unitTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/CMakeLists.txt @@ -1,3 +1,4 @@ +add_subdirectory( toolchain ) add_subdirectory( xmlTests ) add_subdirectory( virtualElementTests ) add_subdirectory( linearAlgebraTests ) diff --git a/src/coreComponents/unitTests/constitutiveTests/CMakeLists.txt b/src/coreComponents/unitTests/constitutiveTests/CMakeLists.txt index e6e90f1b145..408bc222462 100644 --- a/src/coreComponents/unitTests/constitutiveTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/constitutiveTests/CMakeLists.txt @@ -1,13 +1,9 @@ -# # Specify list of tests -# - set( gtest_geosx_tests testDamage.cpp testRelPerm.cpp testRelPermHysteresis.cpp - testCapillaryPressure.cpp - ) + testCapillaryPressure.cpp ) set( gtest_triaxial_xmls testTriaxial_druckerPragerExtended.xml @@ -19,13 +15,11 @@ set( gtest_triaxial_xmls testTriaxial_delftEggLoadPathDryUseLinear.xml testTriaxial_delftEggLoadPathWetUseLinear.xml testTriaxial_delftEggCase1.xml - testTriaxial_delftEggCase2.xml - ) + testTriaxial_delftEggCase2.xml ) set( gtest_pvt_xmls testPVT.xml - testPVT_PhaseComposition.xml - ) + testPVT_PhaseComposition.xml ) set( gtest_reactivefluid_xmls testReactiveFluid.xml ) @@ -33,9 +27,9 @@ set( gtest_reactivefluid_xmls set( dependencyList ${parallelDeps} gtest ) if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core ) + list( APPEND dependencyList geosx_core ) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() if( ENABLE_PVTPackage ) @@ -43,74 +37,55 @@ if( ENABLE_PVTPackage ) testMultiFluid.cpp testCO2BrinePVTModels.cpp ) - set( dependencyList ${dependencyList} PVTPackage ) + list( APPEND dependencyList PVTPackage ) endif() -# # Add gtest C++ based tests -# foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} - SOURCES ${test} - OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + SOURCES ${test} + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() -# # Add triaxial xml based tests -# - blt_add_executable( NAME testTriaxial SOURCES testTriaxial.cpp OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} "-lz" - ) + DEPENDS_ON ${dependencyList} "-lz" ) foreach(test ${gtest_triaxial_xmls}) get_filename_component( test_name ${test} NAME_WE ) - blt_add_test( NAME ${test_name} - COMMAND testTriaxial -i ${CMAKE_CURRENT_LIST_DIR}/${test} - ) + geos_add_test( NAME ${test_name} + COMMAND testTriaxial -i ${CMAKE_CURRENT_LIST_DIR}/${test} ) endforeach() -# # Add pvtdriver xml based tests -# - blt_add_executable( NAME testPVT SOURCES testPVT.cpp OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} "-lz" - ) + DEPENDS_ON ${dependencyList} "-lz" ) foreach(test ${gtest_pvt_xmls}) get_filename_component( test_name ${test} NAME_WE ) - blt_add_test( NAME ${test_name} - COMMAND testPVT -i ${CMAKE_CURRENT_LIST_DIR}/${test} - ) + geos_add_test( NAME ${test_name} + COMMAND testPVT -i ${CMAKE_CURRENT_LIST_DIR}/${test} ) endforeach() -# # Add reactivefluiddriver xml based tests -# - blt_add_executable( NAME testReactiveFluid SOURCES testReactiveFluid.cpp OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} "-lz" - ) + DEPENDS_ON ${dependencyList} "-lz" ) foreach(test ${gtest_reactivefluid_xmls}) get_filename_component( test_name ${test} NAME_WE ) - blt_add_test( NAME ${test_name} - COMMAND testReactiveFluid -i ${CMAKE_CURRENT_LIST_DIR}/${test} - ) + geos_add_test( NAME ${test_name} + COMMAND testReactiveFluid -i ${CMAKE_CURRENT_LIST_DIR}/${test} ) endforeach() \ No newline at end of file diff --git a/src/coreComponents/unitTests/dataRepositoryTests/CMakeLists.txt b/src/coreComponents/unitTests/dataRepositoryTests/CMakeLists.txt index 1a89fe2344d..b62cfdd3a66 100644 --- a/src/coreComponents/unitTests/dataRepositoryTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/dataRepositoryTests/CMakeLists.txt @@ -1,35 +1,28 @@ -# # Specify list of tests -# - set( dataRepository_tests testObjectCatalog.cpp testRestartBasic.cpp testRestartExtended.cpp testPacking.cpp testWrapperHelpers.cpp - testGroupPath.cpp - ) + testGroupPath.cpp ) set( dependencyList ${parallelDeps} gtest ) if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core ) + list( APPEND dependencyList geosx_core ) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() -# # Add gtest C++ based tests -# foreach(test ${dataRepository_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() diff --git a/src/coreComponents/unitTests/fieldSpecificationTests/CMakeLists.txt b/src/coreComponents/unitTests/fieldSpecificationTests/CMakeLists.txt index ba7c6f648ed..23fcfdfe745 100644 --- a/src/coreComponents/unitTests/fieldSpecificationTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/fieldSpecificationTests/CMakeLists.txt @@ -1,35 +1,27 @@ -# # Specify list of tests -# - set( gtest_geosx_tests testAquiferBoundaryCondition.cpp testFieldSpecificationsEnums.cpp - testRecursiveFieldApplication.cpp - ) + testRecursiveFieldApplication.cpp ) set( dependencyList ${parallelDeps} gtest ) if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core ) + list( APPEND dependencyList geosx_core ) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() -# # Add gtest C++ based tests -# foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} - SOURCES ${test} - OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + SOURCES ${test} + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() diff --git a/src/coreComponents/unitTests/fileIOTests/CMakeLists.txt b/src/coreComponents/unitTests/fileIOTests/CMakeLists.txt index b61fa838248..a5caf07fcd7 100644 --- a/src/coreComponents/unitTests/fileIOTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/fileIOTests/CMakeLists.txt @@ -1,33 +1,24 @@ -# # Specify list of tests -# - -set(geosx_fileio_tests - testHDFFile.cpp - ) +set( geosx_fileio_tests testHDFFile.cpp ) set( dependencyList ${parallelDeps} gtest hdf5 ) if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core ) + list( APPEND dependencyList geosx_core ) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() -# # Add gtest C++ based tests -# foreach(test ${geosx_fileio_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() if ( ENABLE_MPI ) @@ -37,16 +28,14 @@ if ( ENABLE_MPI ) set( geosx_fileio_parallel_tests testHDFParallelFile.cpp ) foreach(test ${geosx_fileio_parallel_tests}) - get_filename_component( test_name ${test} NAME_WE ) - blt_add_executable( NAME ${test_name} - SOURCES ${test} - OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) - - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - NUM_MPI_TASKS ${nranks} - ) + get_filename_component( test_name ${test} NAME_WE ) + blt_add_executable( NAME ${test_name} + SOURCES ${test} + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON ${dependencyList} ) + + geos_add_test( NAME ${test_name} + COMMAND ${test_name} + NUM_MPI_TASKS ${nranks} ) endforeach() endif() diff --git a/src/coreComponents/unitTests/finiteVolumeTests/CMakeLists.txt b/src/coreComponents/unitTests/finiteVolumeTests/CMakeLists.txt index 4c33b4eea4b..e83e9f2cbb1 100644 --- a/src/coreComponents/unitTests/finiteVolumeTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/finiteVolumeTests/CMakeLists.txt @@ -1,29 +1,22 @@ -# # Specify list of tests -# - set( gtest_geosx_tests - testMimeticInnerProducts.cpp - ) + testMimeticInnerProducts.cpp ) set( dependencyList ${parallelDeps} gtest ) if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core ) + list( APPEND dependencyList geosx_core ) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() -# # Add gtest C++ based tests -# foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} - SOURCES ${test} - OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + SOURCES ${test} + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON ${dependencyList} ) # Guard to prevent GCC (version 8) from giving warnings due # to some sort of possible conversion from int to long unsigned. @@ -34,8 +27,7 @@ foreach(test ${gtest_geosx_tests}) endif() endif() - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() diff --git a/src/coreComponents/unitTests/fluidFlowTests/CMakeLists.txt b/src/coreComponents/unitTests/fluidFlowTests/CMakeLists.txt index e7bb8f2bd81..367d78ab0c0 100644 --- a/src/coreComponents/unitTests/fluidFlowTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/fluidFlowTests/CMakeLists.txt @@ -1,19 +1,15 @@ -# # Specify list of tests -# - set( gtest_geosx_tests testSinglePhaseBaseKernels.cpp testThermalCompMultiphaseFlow.cpp - testThermalSinglePhaseFlow.cpp - ) + testThermalSinglePhaseFlow.cpp ) set( dependencyList ${parallelDeps} gtest ) if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core ) + list( APPEND dependencyList geosx_core ) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() @@ -23,12 +19,10 @@ if( ENABLE_PVTPackage ) testCompMultiphaseFlowHybrid.cpp testReactiveCompositionalMultiphaseOBL.cpp ) - set( dependencyList ${dependencyList} PVTPackage ) + list( APPEND dependencyList PVTPackage ) endif() -# # Add gtest C++ based tests -# foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) @@ -37,8 +31,8 @@ foreach(test ${gtest_geosx_tests}) OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() # For some reason, BLT is not setting CUDA language for these source files diff --git a/src/coreComponents/unitTests/linearAlgebraTests/CMakeLists.txt b/src/coreComponents/unitTests/linearAlgebraTests/CMakeLists.txt index b7b32ff07e2..a15e61e04d2 100644 --- a/src/coreComponents/unitTests/linearAlgebraTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/linearAlgebraTests/CMakeLists.txt @@ -1,22 +1,17 @@ -# # Specify list of tests -# set( LAI_tests testDofManager.cpp - testLAIHelperFunctions.cpp - ) + testLAIHelperFunctions.cpp ) set( nranks 2 ) -# # Add gtest C++ based tests -# set( dependencyList ${parallelDeps} gtest ) if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core ) + list( APPEND dependencyList geosx_core ) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() foreach(test ${LAI_tests}) @@ -28,11 +23,11 @@ foreach(test ${LAI_tests}) DEPENDS_ON ${dependencyList} ) if ( ENABLE_MPI ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} -x ${nranks} - NUM_MPI_TASKS ${nranks} ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} -x ${nranks} + NUM_MPI_TASKS ${nranks} ) else() - blt_add_test( NAME ${test_name} - COMMAND ${test_name} ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endif() endforeach() diff --git a/src/coreComponents/unitTests/meshTests/CMakeLists.txt b/src/coreComponents/unitTests/meshTests/CMakeLists.txt index b1b8d217db5..a6d41e649c2 100644 --- a/src/coreComponents/unitTests/meshTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/meshTests/CMakeLists.txt @@ -1,25 +1,17 @@ -# # Specify list of tests -# - - set( gtest_geosx_tests testMeshEnums.cpp testMeshGeneration.cpp - testNeighborCommunicator.cpp - ) + testNeighborCommunicator.cpp ) set( gtest_geosx_mpi_tests - testNeighborCommunicator.cpp - ) + testNeighborCommunicator.cpp ) if( ENABLE_VTK ) list( APPEND gtest_geosx_tests - testVTKImport.cpp - ) + testVTKImport.cpp ) list( APPEND gtest_geosx_mpi_tests - testVTKImport.cpp - ) + testVTKImport.cpp ) endif() if( ENABLE_VTK ) @@ -30,25 +22,21 @@ endif() set( dependencyList ${parallelDeps} gtest ) if( GEOSX_BUILD_SHARED_LIBS ) - set( dependencyList ${dependencyList} geosx_core ) + list( APPEND dependencyList geosx_core ) else() - set( dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() -# # Add gtest C++ based tests -# foreach( test ${gtest_geosx_tests} ) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} ${CMAKE_CURRENT_LIST_DIR} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ${CMAKE_CURRENT_LIST_DIR} ) # Older g++ version need a hint to use std::filesystem if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) @@ -71,13 +59,11 @@ if( ENABLE_MPI ) blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} -x ${nranks} - NUM_MPI_TASKS ${nranks} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} -x ${nranks} + NUM_MPI_TASKS ${nranks} ) # Older g++ version need a hint to use std::filesystem if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9 ) diff --git a/src/coreComponents/unitTests/toolchain/CMakeLists.txt b/src/coreComponents/unitTests/toolchain/CMakeLists.txt new file mode 100644 index 00000000000..7a3b6e5c688 --- /dev/null +++ b/src/coreComponents/unitTests/toolchain/CMakeLists.txt @@ -0,0 +1,21 @@ +# Specify list of tests +set( gtest_geosx_tests testToolchain.cpp ) + +# NOTE: we explicitly depend on internal libraries in order to check for the spurious addition of -DNDEBUG flag +set( dependencyList ${parallelDeps} gtest physicsSolvers discretizationMethods fieldSpecification linearAlgebra dataRepository events fileIO optionparser ) + +# Add gtest C++ based tests +foreach(test ${gtest_geosx_tests}) + get_filename_component( test_name ${test} NAME_WE ) + + blt_add_executable( NAME ${test_name} + SOURCES ${test} + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON ${dependencyList} ) + + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) + + # NOTE: we explicitly depend on internal headers in order to check for the spurious addition of -DNDEBUG flag + target_include_directories( ${test_name} PUBLIC ${CMAKE_SOURCE_DIR}/coreComponents ) +endforeach() diff --git a/src/coreComponents/unitTests/toolchain/testToolchain.cpp b/src/coreComponents/unitTests/toolchain/testToolchain.cpp new file mode 100644 index 00000000000..ec81e510ff9 --- /dev/null +++ b/src/coreComponents/unitTests/toolchain/testToolchain.cpp @@ -0,0 +1,42 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2018-2020 Total, S.A + * Copyright (c) 2020- GEOS Contributors + * All right reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +#include "common/GeosxConfig.hpp" +#include + +TEST( Toolchain, NDEBUGfromTPls ) +{ + /* + * This test guards against spurious propagation of -DNDEBUG preprocessor flag + * (HDF5 from the TPLs in our case), which has the bogus effect of disabling LvArray assertions: + * we check that we are in RelWithDebInfo or Release build type when NDEBUG is defined and in Debug + * configuration when NDEBUG is not defined: thus, LvArray assertions remain in Debug builds. + */ + bool constexpr isDebug = std::string_view( GEOSX_CMAKE_BUILD_TYPE ) == std::string_view( "Debug" ); + +#ifdef NDEBUG + ASSERT_FALSE( isDebug ); // RelWithDebInfo or Release builds only +#else + ASSERT_TRUE( isDebug ); // Debug builds only +#endif +} + +int main( int argc, char * * argv ) +{ + ::testing::InitGoogleTest( &argc, argv ); + + int const result = RUN_ALL_TESTS(); + + return result; +} diff --git a/src/coreComponents/unitTests/virtualElementTests/CMakeLists.txt b/src/coreComponents/unitTests/virtualElementTests/CMakeLists.txt index ecefb71ca07..5752ea70ea3 100644 --- a/src/coreComponents/unitTests/virtualElementTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/virtualElementTests/CMakeLists.txt @@ -1,22 +1,16 @@ -# # Specify list of tests -# - -set(testSources - testConformingVirtualElementOrder1.cpp - ) +set( testSources + testConformingVirtualElementOrder1.cpp ) set( dependencyList ${parallelDeps} gtest ) if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core) + list( APPEND dependencyList geosx_core) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() -# # Add gtest C++ based tests -# foreach(test ${testSources}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} @@ -24,9 +18,8 @@ foreach(test ${testSources}) OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) if( ( NOT ${ENABLE_CUDA} ) AND ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" ) ) set_target_properties(${test_name} PROPERTIES COMPILE_FLAGS "-Wno-everything") diff --git a/src/coreComponents/unitTests/wavePropagationTests/CMakeLists.txt b/src/coreComponents/unitTests/wavePropagationTests/CMakeLists.txt index fde047481cf..67b5306afce 100644 --- a/src/coreComponents/unitTests/wavePropagationTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/wavePropagationTests/CMakeLists.txt @@ -1,30 +1,23 @@ -# # Specify list of tests -# - set( gtest_geosx_tests - testWavePropagation.cpp - testWavePropagationAcousticFirstOrder.cpp - ) + testWavePropagation.cpp + testWavePropagationAcousticFirstOrder.cpp ) set( dependencyList ${parallelDeps} gtest ) if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core ) + list( APPEND dependencyList geosx_core ) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() -# # Add gtest C++ based tests -# foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} - SOURCES ${test} - OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} - ) + SOURCES ${test} + OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} + DEPENDS_ON ${dependencyList} ) # Guard to prevent GCC (version 8) from giving warnings due # to some sort of possible conversion from int to long unsigned. @@ -35,9 +28,8 @@ foreach(test ${gtest_geosx_tests}) endif() endif() - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() diff --git a/src/coreComponents/unitTests/wellsTests/CMakeLists.txt b/src/coreComponents/unitTests/wellsTests/CMakeLists.txt index 559277c095b..fc85199a155 100644 --- a/src/coreComponents/unitTests/wellsTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/wellsTests/CMakeLists.txt @@ -1,31 +1,24 @@ -# # Specify list of tests -# - set( gtest_geosx_tests testReservoirSinglePhaseMSWells.cpp - testWellEnums.cpp - ) + testWellEnums.cpp ) set( dependencyList ${parallelDeps} gtest ) if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core ${parallelDeps} ) + list( APPEND dependencyList geosx_core ${parallelDeps} ) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ${parallelDeps} ) + list( APPEND dependencyList ${geosx_core_libs} ${parallelDeps} ) endif() if( ENABLE_PVTPackage ) list( APPEND gtest_geosx_tests testReservoirCompositionalMultiphaseMSWells.cpp ) - set( dependencyList ${dependencyList} PVTPackage ) + list( APPEND dependencyList PVTPackage ) endif() - -# # Add gtest C++ based tests -# foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) @@ -34,8 +27,8 @@ foreach(test ${gtest_geosx_tests}) OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() # For some reason, BLT is not setting CUDA language for these source files diff --git a/src/coreComponents/unitTests/xmlTests/CMakeLists.txt b/src/coreComponents/unitTests/xmlTests/CMakeLists.txt index 90becbf6abc..2820a00b0ef 100644 --- a/src/coreComponents/unitTests/xmlTests/CMakeLists.txt +++ b/src/coreComponents/unitTests/xmlTests/CMakeLists.txt @@ -1,36 +1,27 @@ -# # Specify list of tests -# - set( gtest_geosx_tests - testXML.cpp - ) + testXML.cpp ) set( gtest_tests_with_input - testXMLFile.cpp - ) + testXMLFile.cpp ) set( input_files basic_input - include_input - ) + include_input ) set( multi_files multifile_input/fieldspec.xml multifile_input/mesh.xml multifile_input/outputs.xml - multifile_input/solver.xml - ) + multifile_input/solver.xml ) -# # Add gtest C++ based tests -# set( dependencyList ${parallelDeps} gtest optionparser ) if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core) + list( APPEND dependencyList geosx_core ) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() # create test executables @@ -39,15 +30,14 @@ foreach(test ${gtest_geosx_tests} ${gtest_tests_with_input}) blt_add_executable( NAME ${test_name} SOURCES ${test} OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} - DEPENDS_ON ${dependencyList} "-lz" - ) + DEPENDS_ON ${dependencyList} "-lz" ) endforeach() # add tests that don't require input files foreach(test ${gtest_geosx_tests}) get_filename_component( test_name ${test} NAME_WE ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() # add tests that do require input files @@ -56,14 +46,15 @@ foreach( test ${gtest_tests_with_input} ) # test a single input file foreach( input ${input_files} ) - blt_add_test( NAME ${test_name}_${input} - COMMAND ${test_name} -i ${CMAKE_CURRENT_LIST_DIR}/${input}.xml ) + geos_add_test( NAME ${test_name}_${input} + EXECUTABLE ${test_name} + COMMAND ${test_name} -i ${CMAKE_CURRENT_LIST_DIR}/${input}.xml ) endforeach() # test multiple input files foreach( file ${multi_files} ) set( args ${args} -i ${CMAKE_CURRENT_LIST_DIR}/${file} ) endforeach() - blt_add_test( NAME ${test_name}_multiple_input - COMMAND ${test_name} ${args} ) + geos_add_test( NAME ${test_name}_multiple_input + COMMAND ${test_name} ${args} ) endforeach() diff --git a/src/docs/sphinx/developerGuide/Contributing/UnitTests.rst b/src/docs/sphinx/developerGuide/Contributing/UnitTests.rst index 48885e6705c..4d8c48baf17 100644 --- a/src/docs/sphinx/developerGuide/Contributing/UnitTests.rst +++ b/src/docs/sphinx/developerGuide/Contributing/UnitTests.rst @@ -29,12 +29,12 @@ What makes this such a good test is that it depends on very little other than ke MPI --- -Often times it makes sense to write a unit test that is meant to be run with multiple MPI ranks. This can be accomplished by simply adding the ``NUM_MPI_TASKS`` parameter to ``blt_add_test`` in the CMake file. For example +Often times it makes sense to write a unit test that is meant to be run with multiple MPI ranks. This can be accomplished by simply adding the ``NUM_MPI_TASKS`` parameter to ``geos_add_test`` in the CMake file. For example :: - blt_add_test( NAME testWithMPI - COMMAND testWithMPI - NUM_MPI_TASKS ${NUMBER_OF_MPI_TASKS} ) + geos_add_test( NAME testWithMPI + COMMAND testWithMPI + NUM_MPI_TASKS ${NUMBER_OF_MPI_TASKS} ) With this addition ``make test`` or calling ``ctest`` directly will run ``testWithMPI`` via something analogous to ``mpirun -n NUMBER_OF_MPI_TASKS testWithMPI``. diff --git a/src/externalComponents/newComponentTemplate/src/CMakeLists.txt b/src/externalComponents/newComponentTemplate/src/CMakeLists.txt index e849ab5d388..2ee1663ec90 100644 --- a/src/externalComponents/newComponentTemplate/src/CMakeLists.txt +++ b/src/externalComponents/newComponentTemplate/src/CMakeLists.txt @@ -1,23 +1,18 @@ -# # Specify all headers -# -set(componentHeaders NewComponent.hpp ) +set( componentHeaders NewComponent.hpp ) -# # Specify all sources -# - -set(componentSources NewComponent.cpp ) +set( componentSources NewComponent.cpp ) # blt_append_custom_compiler_flag(FLAGS_VAR CMAKE_CXX_FLAGS DEFAULT -I${CMAKE_SOURCE_DIR}/components/core/src) -# +unset( dependencyList ) + # Specify dependencies -# if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core) + list( APPEND dependencyList geosx_core) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() message("adding newComponentTemplate library") @@ -26,7 +21,6 @@ blt_add_library( NAME newComponentTemplate SOURCES ${componentSources} HEADERS ${componentHeaders} DEPENDS_ON ${dependencyList} - OBJECT ${GEOSX_BUILD_OBJ_LIBS} - ) + OBJECT ${GEOSX_BUILD_OBJ_LIBS} ) -target_include_directories( newComponentTemplate PUBLIC ${CMAKE_CURRENT_LIST_DIR} ) \ No newline at end of file +target_include_directories( newComponentTemplate PUBLIC ${CMAKE_CURRENT_LIST_DIR} ) diff --git a/src/externalComponents/newComponentTemplate/tests/CMakeLists.txt b/src/externalComponents/newComponentTemplate/tests/CMakeLists.txt index 7e6e50accf2..272d3f6a8a4 100644 --- a/src/externalComponents/newComponentTemplate/tests/CMakeLists.txt +++ b/src/externalComponents/newComponentTemplate/tests/CMakeLists.txt @@ -1,22 +1,16 @@ -# # Specify list of tests -# - set( dependencyList gtest ) if ( GEOSX_BUILD_SHARED_LIBS ) - set (dependencyList ${dependencyList} geosx_core) + list( APPEND dependencyList geosx_core ) else() - set (dependencyList ${dependencyList} ${geosx_core_libs} ) + list( APPEND dependencyList ${geosx_core_libs} ) endif() -set(newComponentTests - testNewComponent.cpp - ) +set( newComponentTests + testNewComponent.cpp ) -# # Add gtest C++ based tests -# foreach(test ${newComponentTests}) get_filename_component( test_name ${test} NAME_WE ) blt_add_executable( NAME ${test_name} @@ -24,7 +18,6 @@ foreach(test ${newComponentTests}) OUTPUT_DIR ${TEST_OUTPUT_DIRECTORY} DEPENDS_ON ${dependencyList} ) - blt_add_test( NAME ${test_name} - COMMAND ${test_name} - ) + geos_add_test( NAME ${test_name} + COMMAND ${test_name} ) endforeach() diff --git a/src/pygeosx/CMakeLists.txt b/src/pygeosx/CMakeLists.txt index ea5369f04c3..9f03409ef48 100644 --- a/src/pygeosx/CMakeLists.txt +++ b/src/pygeosx/CMakeLists.txt @@ -1,9 +1,7 @@ -set( python_headers pygeosx.hpp - ) +set( python_headers pygeosx.hpp ) -set( python_sources pygeosx.cpp - ) +set( python_sources pygeosx.cpp ) set( dependencyList ${extraComponentsLinkList} ${externalComponentsLinkList} Python3::Python )