Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add NDEBUG test - add build_test target - fix asserts #2721

Merged
merged 58 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
6c1cb39
add `DNDEBUG` test case
tbeltzun Sep 27, 2023
f1860ef
add `build_unittests` to build all the test targets
tbeltzun Sep 28, 2023
821ca88
Merge branch 'develop' into bugfix/tbeltzun/ndebug
tbeltzun Oct 6, 2023
fa80be1
final cleanup
tbeltzun Oct 6, 2023
c90e62f
try verbose build for cxx flags
tbeltzun Oct 9, 2023
295dd39
increase ninja verbosity
tbeltzun Oct 9, 2023
7bbad8d
try to depend on internal libraries
tbeltzun Oct 9, 2023
e192b62
cleanup
tbeltzun Oct 10, 2023
39833f4
Merge branch 'develop' into bugfix/tbeltzun/ndebug
tbeltzun Oct 12, 2023
c04c7a6
update submodules
tbeltzun Oct 12, 2023
12b4f25
update submodules
tbeltzun Oct 12, 2023
b2bde52
update `GEOSX_TPL_TAG`
tbeltzun Oct 16, 2023
aff5199
Merge branch 'develop' into bugfix/tbeltzun/ndebug
tbeltzun Oct 16, 2023
ddb903a
update submodules
tbeltzun Oct 16, 2023
738afbe
update
tbeltzun Oct 16, 2023
40295bb
include patch
tbeltzun Oct 16, 2023
4b83785
conform to `gtest`
tbeltzun Oct 24, 2023
ff872d8
format
tbeltzun Oct 25, 2023
cf3a687
Point to the appropriate TPL PR
TotoGaz Nov 2, 2023
729910a
Merge branch 'develop' into bugfix/tbeltzun/ndebug
TotoGaz Nov 2, 2023
397a3c5
try to use `JOB_POOLS`
tbeltzun Nov 6, 2023
c10f098
implement `geos_add_test`
tbeltzun Nov 6, 2023
438b8ac
Merge branch 'develop' into bugfix/tbeltzun/ndebug
tbeltzun Nov 6, 2023
bb49090
enforce `CMake` consistency (tests)
tbeltzun Nov 6, 2023
e9da678
update
tbeltzun Nov 6, 2023
5a30e98
enhance macro robustness
tbeltzun Nov 6, 2023
6af5925
fix indentation inconsistency
tbeltzun Nov 6, 2023
838a9f7
fix submdoules
tbeltzun Nov 7, 2023
b7c9c10
Merge branch 'develop' into bugfix/tbeltzun/ndebug
tbeltzun Nov 10, 2023
2b6852f
Update TPL tag to get last fixes of TPL's branch 'revert-247-revert-2…
Algiane Nov 13, 2023
b9ca046
Revert "try to use `JOB_POOLS`"
Algiane Nov 14, 2023
ef8a19f
remove leftovers
tbeltzun Nov 15, 2023
832b828
fix variable naming
tbeltzun Nov 15, 2023
7fcf73e
add description - fix CUDA builds
tbeltzun Nov 15, 2023
8ab5f58
remove spurious tab
tbeltzun Nov 15, 2023
75ddcc8
remove more tabs
tbeltzun Nov 15, 2023
17717af
consistency / tabs
tbeltzun Nov 15, 2023
da7635d
try using cache - restore nproc
tbeltzun Nov 15, 2023
69933e8
swap
tbeltzun Nov 15, 2023
d247d89
set explicit docker memory
tbeltzun Nov 15, 2023
6c3a8a0
rework docker args
tbeltzun Nov 15, 2023
15c6619
alternative
tbeltzun Nov 15, 2023
71d3d33
fix
tbeltzun Nov 15, 2023
009a4c0
remove unsupported oom-killer
tbeltzun Nov 15, 2023
a6c0ca6
update
tbeltzun Nov 15, 2023
d9f357c
update TPL tag
tbeltzun Nov 15, 2023
4bd376e
cleanup
tbeltzun Nov 16, 2023
b26d047
update TPL tag
tbeltzun Nov 16, 2023
9264e43
Merge branch 'develop' into bugfix/tbeltzun/ndebug
tbeltzun Nov 16, 2023
d459d92
update TPL tag
tbeltzun Nov 16, 2023
672a6c1
simplify script
tbeltzun Nov 17, 2023
441527b
rework NDEBUG test structure
tbeltzun Nov 17, 2023
209c066
Merge branch 'develop' into bugfix/tbeltzun/ndebug
tbeltzun Nov 20, 2023
aeb5677
Merge branch 'develop' into bugfix/tbeltzun/ndebug
tbeltzun Nov 28, 2023
ac62fbb
Merge branch 'develop' into bugfix/tbeltzun/ndebug
tbeltzun Nov 28, 2023
753f192
update TPL tag
tbeltzun Nov 28, 2023
cd99245
Merge branch 'develop' into bugfix/tbeltzun/ndebug
tbeltzun Nov 29, 2023
b0956ce
Merge branch 'develop' into bugfix/tbeltzun/ndebug
paveltomin Nov 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
"GEOS_TPL_TAG": "245-86"
"GEOS_TPL_TAG": "248-90"
}
},
"runArgs": [
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ concurrency:
cancel-in-progress: true

env:
GEOSX_TPL_TAG: 245-86
GEOSX_TPL_TAG: 248-90

jobs:

Expand Down Expand Up @@ -195,7 +195,7 @@ jobs:
include:
- name: Ubuntu CUDA debug (20.04, clang 10.0.0 + gcc 9.4.0, open-mpi 4.0.3, cuda-11.8.89)
DOCKER_REPOSITORY: geosx/ubuntu20.04-clang10.0.0-cuda11.8.89
OS: Runner_4core_16GB
OS: Runner_8core_32GB
tbeltzun marked this conversation as resolved.
Show resolved Hide resolved
CMAKE_BUILD_TYPE: Debug
BUILD_AND_TEST_ARGS: "--disable-unit-tests --build-exe-only --disable-schema-deployment"
ENABLE_HYPRE: ON
Expand Down
2 changes: 1 addition & 1 deletion integratedTests
Submodule integratedTests updated 1625 files
43 changes: 25 additions & 18 deletions scripts/ci_build_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,35 @@ BUILD_DIR=${GITHUB_WORKSPACE}
# Since this information is repeated twice, we use a variable.
BUILD_DIR_MOUNT_POINT=/tmp/GEOSX

# We need to keep track of the building container (hence the `CONTAINER_NAME`)
# so we can extract the data from it later (if needed). Another solution would have been to use a mount point,
# but that would not have solved the problem for the TPLs (we would require extra action to copy them to the mount point).
CONTAINER_NAME=geosx_build

dargs=() # docker arguments
tbeltzun marked this conversation as resolved.
Show resolved Hide resolved

if [ ${USE_SCCACHE} = true ]; then
dargs+=(--volume=/opt/gcs:/opt/gcs)
SCCACHE_CLI="--use-sccache"

echo "Creating the configuration file for sccache..."
mkdir -p /opt/gcs
cp -rp ${GOOGLE_GHA_CREDS_PATH} /opt/gcs/credentials.json
SCCACHE_VOLUME_MOUNT="--volume=/opt/gcs:/opt/gcs"
SCCACHE_CLI="--use-sccache"
fi

# We need to keep track of the building container (hence the `CONTAINER_NAME`)
# so we can extract the data from it later (if needed). Another solution would have been to use a mount point,
# but that would not have solved the problem for the TPLs (we would require extra action to copy them to the mount point).
CONTAINER_NAME=geosx_build
dargs+=(--name=${CONTAINER_NAME})
dargs+=(--volume=${BUILD_DIR}:${BUILD_DIR_MOUNT_POINT})
dargs+=(--cap-add=ALL)

dargs+=(-e HOST_CONFIG=${HOST_CONFIG:-host-configs/environment.cmake})
dargs+=(-e GEOSX_DIR=${GEOSX_DIR})
dargs+=(-e ENABLE_HYPRE=${ENABLE_HYPRE:-OFF})
dargs+=(-e ENABLE_HYPRE_DEVICE=${ENABLE_HYPRE_DEVICE:-CPU})
dargs+=(-e ENABLE_TRILINOS=${ENABLE_TRILINOS:-ON})
dargs+=(-e CMAKE_BUILD_TYPE)

# Now we can build GEOSX.
docker run \
--name=${CONTAINER_NAME} \
--volume=${BUILD_DIR}:${BUILD_DIR_MOUNT_POINT} ${SCCACHE_VOLUME_MOUNT} \
--cap-add=ALL \
-e HOST_CONFIG=${HOST_CONFIG:-host-configs/environment.cmake} \
-e CMAKE_BUILD_TYPE \
-e GEOSX_DIR=${GEOSX_DIR} \
-e ENABLE_HYPRE=${ENABLE_HYPRE:-OFF} \
-e ENABLE_HYPRE_DEVICE=${ENABLE_HYPRE_DEVICE:-CPU} \
-e ENABLE_TRILINOS=${ENABLE_TRILINOS:-ON} \
${DOCKER_REPOSITORY}:${GEOSX_TPL_TAG} \
${BUILD_DIR_MOUNT_POINT}/scripts/ci_build_and_test_in_container.sh ${BUILD_AND_TEST_ARGS} ${SCCACHE_CLI};
docker run "${dargs[@]}" \
${DOCKER_REPOSITORY}:${GEOSX_TPL_TAG} \
${BUILD_DIR_MOUNT_POINT}/scripts/ci_build_and_test_in_container.sh \
${BUILD_AND_TEST_ARGS} ${SCCACHE_CLI};
4 changes: 3 additions & 1 deletion scripts/ci_build_and_test_in_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ env
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

Expand Down Expand Up @@ -100,7 +103,6 @@ if [[ "$*" == *--test-documentation* ]]; then
fi

# "Make" target check (builds geosx executable target only if true)
# Use one process to prevent out-of-memory error
if [[ "$*" == *--build-exe-only* ]]; then
or_die ninja -j $(nproc) geosx
else
Expand Down
42 changes: 25 additions & 17 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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" )
Expand Down Expand Up @@ -81,7 +82,7 @@ add_subdirectory( thirdparty )
################################
# Add components
################################
set( externalComponentsLinkList "" )
unset( externalComponentsLinkList )
add_subdirectory( coreComponents )
add_subdirectory( externalComponents )
add_subdirectory( main )
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand All @@ -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} " )
37 changes: 36 additions & 1 deletion src/cmake/GeosxMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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} )
Expand All @@ -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`
tbeltzun marked this conversation as resolved.
Show resolved Hide resolved
## 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 )
21 changes: 9 additions & 12 deletions src/coreComponents/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -76,17 +75,15 @@ 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" )
blt_combine_static_libraries( NAME geosx_core
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" )
Expand Down
15 changes: 4 additions & 11 deletions src/coreComponents/codingUtilities/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
#
# 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}
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()
10 changes: 5 additions & 5 deletions src/coreComponents/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Loading