Skip to content

Commit

Permalink
Add an explicit target for updating doxygen geos config, disable auto…
Browse files Browse the repository at this point in the history
… updating. Cleanup some version stuff. (#2602)

This PR adds an explicit target for updating docs/doxygen/GeosxConfig.hpp, and disables auto updating. No more diffs on every system. The file will be updated manually once in a while.

Drive-by cleanup of some version-related stuff (mainly just to unify hypre version printout with the rest; also add petsc/trilinos versions).

Originally I was hoping to move TPL version macros from GeosxConfig.hpp to GeosxVersion.hpp, but that doesn't work since the latter is generated at build time, not cmake time, so all those CMake version variables are not available to it.
  • Loading branch information
klevzoff authored Dec 9, 2023
1 parent a9b4cac commit f079bca
Show file tree
Hide file tree
Showing 11 changed files with 164 additions and 156 deletions.
27 changes: 0 additions & 27 deletions src/cmake/GeosxConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,3 @@ configure_file( ${CMAKE_SOURCE_DIR}/coreComponents/common/GeosxConfig.hpp.in

install( FILES ${CMAKE_BINARY_DIR}/include/common/GeosxConfig.hpp
DESTINATION ${CMAKE_INSTALL_PREFIX}/include/common )


function( make_full_config_file
PREPROCESSOR_VARS )
foreach( DEP in ${PREPROCESSOR_VARS} )
set( USE_${DEP} TRUE )
set( GEOSX_USE_${DEP} TRUE )
set( ${DEP} TRUE )
endforeach()

# Fix some options to avoid changes in committed config for doxygen
set( GEOSX_CMAKE_BUILD_TYPE "\"Release\"" )
set( GEOSX_LOCALINDEX_TYPE "std::ptrdiff_t" )
set( GEOSX_LOCALINDEX_TYPE_FLAG "3" )
set( GEOSX_GLOBALINDEX_TYPE "long long int" )
set( GEOSX_GLOBALINDEX_TYPE_FLAG "2" )
set( GEOSX_LA_INTERFACE "Hypre" )
set( GEOSX_LA_INTERFACE_HYPRE ON )
set( GEOSX_LA_INTERFACE_TRILINOS OFF )
set( GEOSX_LA_INTERFACE_PETSC OFF )

configure_file( ${CMAKE_SOURCE_DIR}/coreComponents/common/GeosxConfig.hpp.in
${CMAKE_SOURCE_DIR}/docs/doxygen/GeosxConfig.hpp )
endfunction()


make_full_config_file( "${PREPROCESSOR_DEFINES}" )
101 changes: 66 additions & 35 deletions src/cmake/thirdparty/SetupGeosxThirdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,29 +61,43 @@ endmacro(find_and_register)


macro(extract_version_from_header)
set(singleValueArgs NAME PACKAGE_NAME
PATH HEADER
set(singleValueArgs NAME
HEADER
VERSION_STRING
MAJOR_VERSION_STRING
MINOR_VERSION_STRING
SUBMINOR_VERSION_STRING )
PATCH_VERSION_STRING )

cmake_parse_arguments(arg
"${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN})
"${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN})

file(READ ${arg_HEADER} header_file )
file(READ ${arg_HEADER} header_file)

string(REGEX MATCH "${arg_MAJOR_VERSION_STRING} *([0-9]+)" _ ${header_file})
set(ver_major ${CMAKE_MATCH_1})
if(DEFINED arg_VERSION_STRING)

string(REGEX MATCH "${arg_MINOR_VERSION_STRING} *([0-9]*)" _ ${header_file})
set(ver_minor ".${CMAKE_MATCH_1}")
if(DEFINED arg_VERSION_STRING AND "${header_file}" MATCHES "${arg_VERSION_STRING} *\"([^\"]*)\"")
set(${arg_NAME}_VERSION "${CMAKE_MATCH_1}" CACHE STRING "" FORCE)
endif()

string(REGEX MATCH "${arg_SUBMINOR_VERSION_STRING} *([0-9]*)" _ ${header_file})
set(ver_patch ".${CMAKE_MATCH_1}")
else()

if(DEFINED arg_MAJOR_VERSION_STRING AND "${header_file}" MATCHES "${arg_MAJOR_VERSION_STRING} *([0-9]+)")
set(ver_major "${CMAKE_MATCH_1}")
endif()

if(DEFINED arg_MINOR_VERSION_STRING AND "${header_file}" MATCHES "${arg_MINOR_VERSION_STRING} *([0-9]+)")
set(ver_minor ".${CMAKE_MATCH_1}")
endif()

set( ${arg_NAME}_VERSION "${ver_major}${ver_minor}${ver_patch}" CACHE STRING "" FORCE )
if(DEFINED arg_PATCH_VERSION_STRING AND "${header_file}" MATCHES "${arg_PATCH_VERSION_STRING} *([0-9]+)")
set(ver_patch ".${CMAKE_MATCH_1}")
endif()

set(${arg_NAME}_VERSION "${ver_major}${ver_minor}${ver_patch}" CACHE STRING "" FORCE)

endif()

message( " ----> ${arg_NAME}_VERSION = ${${arg_NAME}_VERSION}")
message(" ----> ${arg_NAME}_VERSION = ${${arg_NAME}_VERSION}")

endmacro( extract_version_from_header)

Expand Down Expand Up @@ -264,7 +278,7 @@ if(DEFINED RAJA_DIR)
PATHS ${RAJA_DIR}
NO_DEFAULT_PATH)

message( " ----> RAJA_VERSION=${RAJA_VERSION}")
message( " ----> RAJA_VERSION = ${RAJA_VERSION}")

get_target_property(RAJA_INCLUDE_DIRS RAJA INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(RAJA PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${RAJA_INCLUDE_DIRS}")
Expand Down Expand Up @@ -297,7 +311,7 @@ if(DEFINED UMPIRE_DIR)
PATHS ${UMPIRE_DIR}
NO_DEFAULT_PATH)

message( " ----> umpire_VERSION=${umpire_VERSION}")
message( " ----> umpire_VERSION = ${umpire_VERSION}")

set(ENABLE_UMPIRE ON CACHE BOOL "")
set(thirdPartyLibs ${thirdPartyLibs} umpire)
Expand All @@ -316,7 +330,7 @@ if(DEFINED CHAI_DIR)
PATHS ${CHAI_DIR}
NO_DEFAULT_PATH)

message( " ----> chai_VERSION=${chai_VERSION}")
message( " ----> chai_VERSION = ${chai_VERSION}")

get_target_property(CHAI_INCLUDE_DIRS chai INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(chai
Expand Down Expand Up @@ -381,7 +395,7 @@ if(DEFINED CALIPER_DIR)
HEADER "${CALIPER_DIR}/include/caliper/caliper-config.h"
MAJOR_VERSION_STRING "CALIPER_MAJOR_VERSION"
MINOR_VERSION_STRING "CALIPER_MINOR_VERSION"
SUBMINOR_VERSION_STRING "CALIPER_PATCH_VERSION")
PATCH_VERSION_STRING "CALIPER_PATCH_VERSION")

set_property(TARGET caliper
APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
Expand Down Expand Up @@ -437,11 +451,11 @@ if(DEFINED METIS_DIR)
HEADER metis.h
LIBRARIES metis)

extract_version_from_header( NAME METIS
extract_version_from_header( NAME metis
HEADER "${METIS_DIR}/include/metis.h"
MAJOR_VERSION_STRING "METIS_VER_MAJOR"
MINOR_VERSION_STRING "METIS_VER_MINOR"
SUBMINOR_VERSION_STRING "METIS_VER_SUBMINOR")
PATCH_VERSION_STRING "METIS_VER_PATCH")


set(ENABLE_METIS ON CACHE BOOL "")
Expand All @@ -468,11 +482,11 @@ if(DEFINED PARMETIS_DIR)
LIBRARIES parmetis
DEPENDS metis)

extract_version_from_header( NAME PARAMETIS
extract_version_from_header( NAME parmetis
HEADER "${PARMETIS_DIR}/include/parmetis.h"
MAJOR_VERSION_STRING "PARMETIS_MAJOR_VERSION"
MINOR_VERSION_STRING "PARMETIS_MINOR_VERSION"
SUBMINOR_VERSION_STRING "PARMETIS_SUBMINOR_VERSION")
PATCH_VERSION_STRING "PARMETIS_PATCH_VERSION")

set(ENABLE_PARMETIS ON CACHE BOOL "")
set(thirdPartyLibs ${thirdPartyLibs} parmetis)
Expand Down Expand Up @@ -508,7 +522,7 @@ if(DEFINED SCOTCH_DIR)
HEADER "${SCOTCH_DIR}/include/scotch.h"
MAJOR_VERSION_STRING "SCOTCH_VERSION"
MINOR_VERSION_STRING "SCOTCH_RELEASE"
SUBMINOR_VERSION_STRING "SCOTCH_PATCHLEVEL")
PATCH_VERSION_STRING "SCOTCH_PATCHLEVEL")

set(ENABLE_SCOTCH ON CACHE BOOL "")
set(thirdPartyLibs ${thirdPartyLibs} scotch ptscotch)
Expand Down Expand Up @@ -539,7 +553,7 @@ if(DEFINED SUPERLU_DIST_DIR)
HEADER "${SUPERLU_DIST_DIR}/include/superlu_defs.h"
MAJOR_VERSION_STRING "SUPERLU_DIST_MAJOR_VERSION"
MINOR_VERSION_STRING "SUPERLU_DIST_MINOR_VERSION"
SUBMINOR_VERSION_STRING "SUPERLU_DIST_PATCH_VERSION")
PATCH_VERSION_STRING "SUPERLU_DIST_PATCH_VERSION")

set(ENABLE_SUPERLU_DIST ON CACHE BOOL "")
set(thirdPartyLibs ${thirdPartyLibs} superlu_dist)
Expand Down Expand Up @@ -569,7 +583,7 @@ if(DEFINED SUITESPARSE_DIR)
HEADER "${SUITESPARSE_DIR}/include/umfpack.h"
MAJOR_VERSION_STRING "UMFPACK_MAIN_VERSION"
MINOR_VERSION_STRING "UMFPACK_SUB_VERSION"
SUBMINOR_VERSION_STRING "UMFPACK_SUBSUB_VERSION")
PATCH_VERSION_STRING "UMFPACK_SUBSUB_VERSION")

set(ENABLE_SUITESPARSE ON CACHE BOOL "")
set(thirdPartyLibs ${thirdPartyLibs} suitesparse)
Expand Down Expand Up @@ -610,19 +624,26 @@ if(DEFINED HYPRE_DIR AND ENABLE_HYPRE)
EXTRA_LIBRARIES ${EXTRA_LIBS}
DEPENDS ${HYPRE_DEPENDS})

extract_version_from_header( NAME hypre
HEADER "${HYPRE_DIR}/include/HYPRE_config.h"
VERSION_STRING "HYPRE_RELEASE_VERSION" )

# Extract some additional information about development version of hypre
file(READ ${HYPRE_DIR}/include/HYPRE_config.h header_file)
if("${header_file}" MATCHES "HYPRE_DEVELOP_STRING *\"([^\"]*)\"")
set(hypre_dev_string "${CMAKE_MATCH_1}")
if("${header_file}" MATCHES "HYPRE_BRANCH_NAME *\"([^\"]*)\"")
set(hypre_dev_branch "${CMAKE_MATCH_1}")
endif()
set(hypre_VERSION "${hypre_dev_string} (${hypre_dev_branch})" CACHE STRING "" FORCE)
message(" ----> hypre_VERSION = ${hypre_VERSION}")
endif()

# Prepend Hypre to link flags, fix for Umpire appearing before Hypre on the link line
# if (NOT CMAKE_HOST_APPLE)
# blt_add_target_link_flags (TO hypre FLAGS "-Wl,--whole-archive ${HYPRE_DIR}/lib/libHYPRE.a -Wl,--no-whole-archive")
# endif()

file(READ ${HYPRE_DIR}/include/HYPRE_config.h hypre_config)
string(REGEX MATCH "HYPRE_RELEASE_VERSION \"([0-9]*).([0-9]*).([0-9]*)\"" hypre_version ${hypre_config} )
set( HYPRE_VERSION_MAJOR ${CMAKE_MATCH_1} )
set( HYPRE_VERSION_MINOR ${CMAKE_MATCH_2} )
set( HYPRE_VERSION_PATCH ${CMAKE_MATCH_3} )
message(STATUS "Hypre version parsed as: ${HYPRE_VERSION_MAJOR}.${HYPRE_VERSION_MINOR}.${HYPRE_VERSION_PATCH}" )

# if( ENABLE_CUDA AND ( NOT ${ENABLE_HYPRE_DEVICE} STREQUAL "CUDA" ) )
# set(ENABLE_HYPRE OFF CACHE BOOL "" FORCE)
# if( GEOSX_LA_INTERFACE STREQUAL "Hypre")
Expand Down Expand Up @@ -655,10 +676,14 @@ if(DEFINED TRILINOS_DIR AND ENABLE_TRILINOS)
list(REMOVE_DUPLICATES Trilinos_LIBRARIES)

blt_import_library(NAME trilinos
DEPENDS_ON ${TRILINOS_DEPENDS}
INCLUDES ${Trilinos_INCLUDE_DIRS}
LIBRARIES ${Trilinos_LIBRARIES}
TREAT_INCLUDES_AS_SYSTEM ON)
DEPENDS_ON ${TRILINOS_DEPENDS}
INCLUDES ${Trilinos_INCLUDE_DIRS}
LIBRARIES ${Trilinos_LIBRARIES}
TREAT_INCLUDES_AS_SYSTEM ON)

extract_version_from_header( NAME trilinos
HEADER "${TRILINOS_DIR}/include/Trilinos_version.h"
VERSION_STRING "TRILINOS_VERSION_STRING" )

# This conditional is due to the lack of mixedInt support on hypre GPU.
# This can be removed when support is added into hypre.
Expand Down Expand Up @@ -693,6 +718,12 @@ if(DEFINED PETSC_DIR AND ENABLE_PETSC)
LIBRARIES petsc
DEPENDS ${PETSC_DEPENDS})

extract_version_from_header( NAME petsc
HEADER "${PETSC_DIR}/include/petscversion.h"
MAJOR_VERSION_STRING "PETSC_VERSION_MAJOR"
MINOR_VERSION_STRING "PETSC_VERSION_MINOR"
PATCH_VERSION_STRING "PETSC_VERSION_SUBMINOR")

set(ENABLE_PETSC ON CACHE BOOL "")
set(thirdPartyLibs ${thirdPartyLibs} petsc)
else()
Expand Down
22 changes: 11 additions & 11 deletions src/coreComponents/common/GeosxConfig.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@
/// Enables use of Hypre library (CMake option ENABLE_HYPRE)
#cmakedefine GEOSX_USE_HYPRE

#if defined( GEOSX_USE_HYPRE )
/// Parsed hypre version information
#define HYPRE_VERSION_MAJOR @HYPRE_VERSION_MAJOR@
/// Parsed hypre version information
#define HYPRE_VERSION_MINOR @HYPRE_VERSION_MINOR@
/// Parsed hypre version information
#define HYPRE_VERSION_PATCH @HYPRE_VERSION_PATCH@
#endif

/// Denotes HYPRE using CPU
#define GEOS_USE_HYPRE_CPU 0
/// Denotes HYPRE using CUDA
Expand Down Expand Up @@ -150,10 +141,10 @@
#cmakedefine caliper_VERSION @caliper_VERSION@

/// Version information for Metis
#cmakedefine METIS_VERSION @METIS_VERSION@
#cmakedefine metis_VERSION @metis_VERSION@

/// Version information for ParMetis
#cmakedefine PARAMETIS_VERSION @PARAMETIS_VERSION@
#cmakedefine parmetis_VERSION @parmetis_VERSION@

/// Version information for scotch
#cmakedefine scotch_VERSION @scotch_VERSION@
Expand All @@ -164,6 +155,15 @@
/// Version information for suitesparse
#cmakedefine suitesparse_VERSION @suitesparse_VERSION@

/// Version information for hypre
#cmakedefine hypre_VERSION @hypre_VERSION@

/// Version information for trilinos
#cmakedefine trilinos_VERSION @trilinos_VERSION@

/// Version information for petsc
#cmakedefine petsc_VERSION @petsc_VERSION@

/// Version information for VTK
#cmakedefine VTK_VERSION @VTK_VERSION@

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,6 @@ void HypreInterface::initialize()
hypre_HandleSpgemmUseVendor( hypre_handle() ) = 0;
#endif
HYPRE_SetMemoryLocation( hypre::memoryLocation );

// Hypre version info
#if defined(HYPRE_DEVELOP_STRING)
#if defined(HYPRE_BRANCH_NAME)
GEOS_LOG_RANK_0( " - hypre development version: " << HYPRE_DEVELOP_STRING <<
" (" << HYPRE_BRANCH_NAME << ")" );
#else
GEOS_LOG_RANK_0( " - hypre development version: " << HYPRE_DEVELOP_STRING );
#endif
#elif defined(HYPRE_RELEASE_VERSION)
GEOS_LOG_RANK_0( " - hypre release version: " << HYPRE_RELEASE_VERSION );
#endif
}

void HypreInterface::finalize()
Expand Down
19 changes: 12 additions & 7 deletions src/coreComponents/mainInterface/GeosxVersion.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@
#ifndef GEOS_MAININTERFACE_VERSION_HPP_
#define GEOS_MAININTERFACE_VERSION_HPP_

/// GEOSX major version number
/// GEOS major version number
#define GEOSX_VERSION_MAJOR @GEOSX_VERSION_MAJOR@
/// GEOSX minor version number

/// GEOS minor version number
#define GEOSX_VERSION_MINOR @GEOSX_VERSION_MINOR@
/// GEOSX patch version number

/// GEOS patch version number
#define GEOSX_VERSION_PATCH @GEOSX_VERSION_PATCH@
/// GEOSX full version number string

/// GEOS full version number string
#define GEOSX_VERSION_FULL "@GEOSX_VERSION_FULL@"

/// GEOSX development branch string
/// GEOS development branch string
#cmakedefine GEOSX_GIT_BRANCH "@GEOSX_GIT_BRANCH@"
/// GEOSX development branch string

/// GEOS development branch string
#cmakedefine GEOSX_GIT_HASH "@GEOSX_GIT_HASH@"
/// GEOSX development branch string

/// GEOS development branch string
#cmakedefine GEOSX_GIT_TAG "@GEOSX_GIT_TAG@"

#endif /* GEOS_MAININTERFACE_VERSION_HPP_ */
Expand Down
3 changes: 0 additions & 3 deletions src/coreComponents/mainInterface/initialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,6 @@ std::unique_ptr< CommandLineOptions > parseCommandLineOptions( int argc, char *
std::unique_ptr< CommandLineOptions > basicSetup( int argc, char * argv[], bool const parseCommandLine )
{
setupEnvironment( argc, argv );

outputVersionInfo();

setupLAI();

if( parseCommandLine )
Expand Down
Loading

0 comments on commit f079bca

Please sign in to comment.