Skip to content

Commit

Permalink
Merge branch 'develop' into pt/re-use-computeflux
Browse files Browse the repository at this point in the history
  • Loading branch information
rrsettgast authored Aug 21, 2024
2 parents de10230 + d8c3166 commit d6921ea
Show file tree
Hide file tree
Showing 101 changed files with 461 additions and 486 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
BUILD_AND_TEST_CLI_ARGS:
required: false
type: string
BUILD_SHARED_LIBS:
required: false
type: string
default: 'ON'
BUILD_TYPE:
required: false
type: string
Expand Down Expand Up @@ -184,6 +188,7 @@ jobs:
docker_args+=(-e ENABLE_HYPRE=${ENABLE_HYPRE:-OFF})
docker_args+=(-e ENABLE_HYPRE_DEVICE=${ENABLE_HYPRE_DEVICE:-CPU})
docker_args+=(-e ENABLE_TRILINOS=${ENABLE_TRILINOS:-ON})
docker_args+=(-e GEOS_BUILD_SHARED_LIBS=${{ inputs.BUILD_SHARED_LIBS }})
docker_args+=(--cap-add=SYS_PTRACE --rm)
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,43 +149,49 @@ jobs:
- name: Ubuntu (20.04, gcc 9.4.0, open-mpi 4.0.3)
CMAKE_BUILD_TYPE: Release
DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc9
BUILD_SHARED_LIBS: ON

- name: Ubuntu debug (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces
CMAKE_BUILD_TYPE: Debug
DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10
BUILD_SHARED_LIBS: ON

- name: Ubuntu (20.04, gcc 10.5.0, open-mpi 4.0.3) - github codespaces
CMAKE_BUILD_TYPE: Release
DOCKER_REPOSITORY: geosx/ubuntu20.04-gcc10
BUILD_SHARED_LIBS: ON

- name: Ubuntu (22.04, gcc 11.4.0, open-mpi 4.1.2)
CMAKE_BUILD_TYPE: Release
DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc11
ENABLE_HYPRE: ON
ENABLE_TRILINOS: OFF
GCP_BUCKET: geosx/ubuntu22.04-gcc11
BUILD_SHARED_LIBS: ON

- name: Ubuntu (22.04, gcc 12.3.0, open-mpi 4.1.2)
CMAKE_BUILD_TYPE: Release
DOCKER_REPOSITORY: geosx/ubuntu22.04-gcc12
ENABLE_HYPRE: ON
ENABLE_TRILINOS: OFF
BUILD_SHARED_LIBS: ON

- name: Ubuntu (22.04, clang 15.0.7, open-mpi 4.1.2)
CMAKE_BUILD_TYPE: Release
DOCKER_REPOSITORY: geosx/ubuntu22.04-clang15
ENABLE_HYPRE: ON
ENABLE_TRILINOS: OFF
BUILD_SHARED_LIBS: ON

uses: ./.github/workflows/build_and_test.yml
with:
BUILD_SHARED_LIBS: ${{ matrix.BUILD_SHARED_LIBS }}
CMAKE_BUILD_TYPE: ${{ matrix.CMAKE_BUILD_TYPE }}
DOCKER_IMAGE_TAG: ${{ needs.is_not_draft_pull_request.outputs.DOCKER_IMAGE_TAG }}
DOCKER_REPOSITORY: ${{ matrix.DOCKER_REPOSITORY }}
ENABLE_HYPRE: ${{ matrix.ENABLE_HYPRE }}
ENABLE_TRILINOS: ${{ matrix.ENABLE_TRILINOS }}
GCP_BUCKET: ${{ matrix.GCP_BUCKET }}
HOST_CONFIG: ${{ matrix.HOST_CONFIG }}
RUNS_ON: ubuntu-22.04
secrets: inherit

Expand Down Expand Up @@ -328,8 +334,6 @@ jobs:
ENABLE_HYPRE_DEVICE: ${{ matrix.ENABLE_HYPRE_DEVICE }}
ENABLE_HYPRE: ${{ matrix.ENABLE_HYPRE }}
ENABLE_TRILINOS: ${{ matrix.ENABLE_TRILINOS }}
GCP_BUCKET: ${{ matrix.GCP_BUCKET }}
HOST_CONFIG: ${{ matrix.HOST_CONFIG }}
NPROC: ${{ matrix.NPROC }}
RUNS_ON: ${{ matrix.RUNS_ON }}
REQUIRED_LABEL: "ci: run CUDA builds"
Expand Down
4 changes: 0 additions & 4 deletions host-configs/LBL/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "")

set(GEOS_TPL_DIR "/global/project/projectdirs/m1411/GEOSX/tpls/install-cori-gcc\@8.1.0-release-24-07-20" CACHE PATH "" )


set(GEOS_LINK_PREPEND_FLAG "-Wl,--whole-archive" CACHE STRING "" FORCE)
set(GEOS_LINK_POSTPEND_FLAG "-Wl,--no-whole-archive" CACHE STRING "" FORCE)

set(ENABLE_SPHINX_EXECUTABLE OFF CACHE BOOL "")
set(ENABLE_UNCRUSTIFY OFF CACHE BOOL "")
set(ENABLE_DOXYGEN OFF CACHE BOOL "")
Expand Down
3 changes: 0 additions & 3 deletions host-configs/LBL/cori-intel.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ set(MPIEXEC_NUMPROC_FLAG "-n" CACHE STRING "")

set(GEOS_TPL_DIR "/global/project/projectdirs/m1411/GEOSX/tpls/install-cori-intel-release-22-07-20" CACHE PATH "" )

set(GEOS_LINK_PREPEND_FLAG "-Wl,--whole-archive" CACHE STRING "" FORCE)
set(GEOS_LINK_POSTPEND_FLAG "-Wl,--no-whole-archive" CACHE STRING "" FORCE)

set(ENABLE_SPHINX_EXECUTABLE OFF CACHE BOOL "")
set(ENABLE_UNCRUSTIFY OFF CACHE BOOL "")
set(ENABLE_DOXYGEN OFF CACHE BOOL "")
Expand Down
1 change: 0 additions & 1 deletion host-configs/LLNL/lassen-base.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#
###############################################################################

set( GEOS_BUILD_SHARED_LIBS ON CACHE BOOL "" )
set( GEOS_BUILD_OBJ_LIBS OFF CACHE BOOL "" )
# Fortran
set(ENABLE_FORTRAN OFF CACHE BOOL "")
Expand Down
1 change: 0 additions & 1 deletion host-configs/ORNL/frontier-base.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ set( ENABLE_DOCS OFF CACHE BOOL "" FORCE )
set( ENABLE_SCOTCH OFF CACHE BOOL "" FORCE )
set( ENABLE_SUPERLU_DIST OFF CACHE BOOL "" FORCE )

set( GEOS_BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE )
set( GEOS_BUILD_OBJ_LIBS OFF CACHE BOOL "" FORCE )

set( CMAKE_CXX_STANDARD 17 CACHE STRING "" )
Expand Down
1 change: 0 additions & 1 deletion host-configs/TOTAL/pangea3-gcc8.4.1-openmpi-4.1.2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ set(ENABLE_MATHPRESSO OFF CACHE BOOL "")
# Silo configure script doesn't recognize systype
set(SILO_BUILD_TYPE powerpc64-unknown-linux-gnu CACHE STRING "")

set(GEOS_BUILD_SHARED_LIBS OFF CACHE BOOL "")
set(ENABLE_PVTPackage ON CACHE BOOL "")

set(ENABLE_CALIPER ON CACHE BOOL "")
Expand Down
3 changes: 2 additions & 1 deletion host-configs/apple/macOS_base.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ set( LAPACK_LIBRARIES ${HOMEBREW_DIR}/opt/lapack/lib/liblapack.dylib CACHE PATH

set(ENABLE_DOXYGEN OFF CACHE BOOL "" FORCE)
set(ENABLE_MATHPRESSO OFF CACHE BOOL "" FORCE )
#set(GEOS_BUILD_OBJ_LIBS ON CACHE BOOL "" FORCE)

set(GEOS_BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)



Expand Down
4 changes: 4 additions & 0 deletions host-configs/environment.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,9 @@ if(DEFINED ENV{LAPACK_LIBRARIES})
set(LAPACK_LIBRARIES "$ENV{LAPACK_LIBRARIES}" CACHE PATH "" FORCE)
endif()

if(DEFINED ENV{GEOS_BUILD_SHARED_LIBS})
set(GEOS_BUILD_SHARED_LIBS "$ENV{GEOS_BUILD_SHARED_LIBS}" CACHE BOOL "" FORCE)
endif()

set(GEOS_TPL_DIR "$ENV{GEOSX_TPL_DIR}" CACHE PATH "" FORCE)
include(${CMAKE_CURRENT_LIST_DIR}/tpls.cmake)
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<Mesh>
<VTKMesh
surfacicFieldsToImport="{aperture}"
surfacicFieldsInGEOSX="{elementAperture}"
surfacicFieldsInGEOS="{elementAperture}"
name="mesh1"
useGlobalIds="1"
faceBlocks="{fracture}"
Expand Down
6 changes: 4 additions & 2 deletions src/CMakeGraphVizOptions.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
set( GRAPHVIZ_EXECUTABLES FALSE )
set( GRAPHVIZ_EXECUTABLES TRUE )
set( GRAPHVIZ_OBJECT_LIBS TRUE )
set( GRAPHVIZ_EXTERNAL_LIBS FALSE )
set( GRAPHVIZ_GENERATE_DEPENDERS FALSE )
set( GRAPHVIZ_GENERATE_DEPENDERS FALSE )
set( GRAPHVIZ_IGNORE_TARGETS "test*;example*;benchmark*" )
set( GRAPHVIZ_CUSTOM_TARGETS FALSE )
21 changes: 3 additions & 18 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,33 +135,18 @@ if( ENABLE_HIP )
list( APPEND extraComponentsLinkList blt::hip )
endif()

if ( GEOS_BUILD_SHARED_LIBS )
list( APPEND extraComponentsLinkList geosx_core )
else()
list( APPEND extraComponentsLinkList ${geosx_core_libs} )
endif()

blt_add_executable( NAME geosx
SOURCES main/main.cpp
DEPENDS_ON ${extraComponentsLinkList}
${externalComponentsLinkList} fmt::fmt-header-only HDF5::HDF5 )

# blt_print_target_properties(TARGET geosx
# CHILDREN TRUE
# PROPERTY_NAME_REGEX "LINK_LIBRARIES"
# )

# blt_print_target_properties(TARGET HDF5::HDF5
# CHILDREN TRUE )
DEPENDS_ON geosx_core
${extraComponentsLinkList}
${externalComponentsLinkList} )

# Seems to be required on some CMake versions (e.g. 3.16) to get enforce device linking
if( ${ENABLE_HYPRE_DEVICE} STREQUAL "CUDA" )
set_target_properties( geosx PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS TRUE )
endif()


target_include_directories( geosx PUBLIC ${CMAKE_SOURCE_DIR}/coreComponents )

# To change the runtime path during installation
set_target_properties( geosx PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" )
set_target_properties( geosx PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE )
Expand Down
36 changes: 36 additions & 0 deletions src/cmake/GeosxMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,39 @@ macro( geos_add_test )
COMMAND ${arg_COMMAND} ${ARGN} )

endmacro( geos_add_test )


macro( geos_decorate_link_dependencies )

set( options )
set( singleValueArgs LIST )
set( multiValueArgs DEPENDENCIES )

# Parse the arguments to the macro
cmake_parse_arguments( arg
"${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN} )

set( staticLibs "" )
set( otherLibs "" )
foreach( dep ${arg_DEPENDENCIES} )
if( NOT TARGET ${dep} )
message( FATAL_ERROR "Dependency ${dep} not found" )
endif()

get_target_property( targetType ${dep} TYPE)
# message( " ${dep} targetType = ${targetType}" ) # debug

if (targetType STREQUAL STATIC_LIBRARY)
list( APPEND staticLibs ${dep} )
else()
list( APPEND otherLibs ${dep} )
endif()
endforeach()

# message( " staticLibs = ${staticLibs}" ) # debug
# message( " otherLibs = ${otherLibs}" ) # debug

string (REPLACE ";" "," staticLibsString "${staticLibs}")
set( ${arg_LIST} "$<LINK_LIBRARY:WHOLE_ARCHIVE,${staticLibsString}>" ${otherLibs} )

endmacro( geos_decorate_link_dependencies )
15 changes: 1 addition & 14 deletions src/cmake/GeosxOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,6 @@ if( ${CMAKE_MAKE_PROGRAM} STREQUAL "ninja" OR ${CMAKE_MAKE_PROGRAM} MATCHES ".*/
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GEOS_NINJA_FLAGS}" )
endif()


if( CMAKE_HOST_APPLE )
# set(GEOS_LINK_PREPEND_FLAG "-Wl,-force_load" CACHE STRING "")
# set(GEOS_LINK_POSTPEND_FLAG "" CACHE STRING "")
# elseif( ENABLE_CUDA )
# set( GEOS_LINK_PREPEND_FLAG "-Xcompiler \\\\\"-Wl,--whole-archive\\\\\"" CACHE STRING "" )
# set( GEOS_LINK_POSTPEND_FLAG "-Xcompiler \\\\\"-Wl,--no-whole-archive\\\\\"" CACHE STRING "" )
else()
set( GEOS_LINK_PREPEND_FLAG "-Wl,--whole-archive" CACHE STRING "" )
set( GEOS_LINK_POSTPEND_FLAG "-Wl,--no-whole-archive" CACHE STRING "" )
endif()

set( GEOS_LOCALINDEX_TYPE "int" CACHE STRING "" )
if( ENABLE_HYPRE_MIXINT )
set( GEOS_GLOBALINDEX_TYPE "long long int" CACHE STRING "" )
Expand Down Expand Up @@ -216,6 +204,5 @@ message( "GEOS_GLOBALINDEX_TYPE_FLAG = ${GEOS_GLOBALINDEX_TYPE_FLAG}" )


message( "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}" )
message( "GEOS_LINK_PREPEND_FLAG=${GEOS_LINK_PREPEND_FLAG}" )
message( "GEOS_LINK_POSTPEND_FLAG=${GEOS_LINK_POSTPEND_FLAG}" )

message( "Leaving GeosxOptions.cmake\n" )
55 changes: 9 additions & 46 deletions src/coreComponents/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ set( subdirs
common
codingUtilities
dataRepository
schema
denseLinearAlgebra
functions
constitutive
schema
finiteElement
mesh
denseLinearAlgebra
linearAlgebra
fieldSpecification
finiteElement
finiteVolume
discretizationMethods
events
constitutiveDrivers
fileIO
physicsSolvers
events
mainInterface )

unset( parallelDeps )
Expand Down Expand Up @@ -56,53 +57,15 @@ foreach( lib ${subdirs} )
endif()
endforeach()

# if we're building full static libs and not obj_libs
if( NOT GEOS_BUILD_SHARED_LIBS )
set( geosx_core_list "" )
foreach( lib ${coreLibs} )
list( APPEND geosx_core_list ${GEOS_LINK_PREPEND_FLAG} ${lib} ${GEOS_LINK_POSTPEND_FLAG} )
endforeach()
set ( geosx_core_libs "${geosx_core_list}" CACHE INTERNAL "" )
endif( )

foreach( lib ${subdirs} )
add_subdirectory( ${lib} )
endforeach()

if( GEOS_BUILD_SHARED_LIBS AND GEOS_BUILD_OBJ_LIBS )
message( "Building shared geosx_core library with object coreComponents, executables link to geosx_core" )
blt_add_library ( NAME geosx_core
SOURCES dummy.cpp
DEPENDS_ON mainInterface physicsSolvers HDF5::HDF5
SHARED TRUE )

elseif( GEOS_BUILD_SHARED_LIBS AND NOT GEOS_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 ${GEOS_LINK_PREPEND_FLAG}
LINK_POSTPEND ${GEOS_LINK_POSTPEND_FLAG} )

elseif( NOT GEOS_BUILD_SHARED_LIBS AND GEOS_BUILD_OBJ_LIBS )
message( "Building object coreComponents, executables link to coreComponents" )
add_library(geosx_core INTERFACE)
if( GEOS_BUILD_SHARED_LIBS)
target_link_libraries(geosx_core INTERFACE mainInterface )
else()
message( "Building static coreComponents, executables link to coreComponents" )
endif()

if ( TARGET geosx_core )
# Seems to be required on some CMake versions (e.g. 3.16) to get enforce device linking
if( ${ENABLE_HYPRE_DEVICE} STREQUAL "CUDA" )
set_target_properties( geosx_core PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS TRUE )
endif()

# To install the library with the runtime path used during the building
set_target_properties( geosx_core PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE )

# To install the shared library
install( TARGETS geosx_core LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib )

target_include_directories( geosx_core PUBLIC ${CMAKE_SOURCE_DIR}/coreComponents )
target_link_libraries(geosx_core INTERFACE $<LINK_LIBRARY:WHOLE_ARCHIVE,mainInterface> )
endif()

geosx_add_code_checks( PREFIX coreComponents
Expand Down
5 changes: 4 additions & 1 deletion src/coreComponents/codingUtilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ set( codingUtilities_sources
)

set( dependencyList ${parallelDeps} common fast_float )
geos_decorate_link_dependencies( LIST decoratedDependencies
DEPENDENCIES ${dependencyList} )

blt_add_library( NAME codingUtilities
SOURCES ${codingUtilities_sources}
HEADERS ${codingUtilities_headers}
DEPENDS_ON ${dependencyList}
DEPENDS_ON ${decoratedDependencies}
OBJECT ${GEOS_BUILD_OBJ_LIBS}
SHARED ${GEOS_BUILD_SHARED_LIBS}
)

# Avoid compiling with nvcc which sometimes crashes on fast_float
Expand Down
6 changes: 4 additions & 2 deletions src/coreComponents/codingUtilities/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ set( testSources
testParsing.cpp
testUtilities.cpp )

set( dependencyList gtest codingUtilities ${parallelDeps} )
set( dependencyList codingUtilities ${parallelDeps} )

geos_decorate_link_dependencies( LIST decoratedDependencies
DEPENDENCIES ${dependencyList} )
# 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} )
DEPENDS_ON ${decoratedDependencies} gtest )

geos_add_test( NAME ${test_name}
COMMAND ${test_name} )
Expand Down
Loading

0 comments on commit d6921ea

Please sign in to comment.