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

CMake updates #1181

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
46916f3
Add HYPRE_Setup*Toolkit.cmake files
victorapm Sep 13, 2024
7583390
Add HYPRE_USING_GPU to define C++ source files
victorapm Sep 13, 2024
d79a204
Initial working version for HIP support
victorapm Sep 13, 2024
777875d
Add summary table + misc improvements
victorapm Sep 14, 2024
8690017
Change to modern CMake practice
victorapm Sep 14, 2024
31b0d97
Remove unused variable
victorapm Sep 14, 2024
f7c411f
Add configure_mpi_target function
victorapm Sep 14, 2024
25491ae
Modernizing CUDA cmake build
victorapm Sep 15, 2024
1fda469
Add missing HYPRE_CUDA/HIP_CALL macros
victorapm Sep 15, 2024
f936f14
Allow CUDA/HIP builds with specific toolkit locations
victorapm Sep 15, 2024
ee9f9d5
Improve CUDA and HIP builds robustness
victorapm Sep 16, 2024
f4d3f4d
Adjustment to run nvidia-smi to detect cuda arch
victorapm Sep 16, 2024
329729f
Simplify build options setup with set_conditional_var + Simplify GPU …
victorapm Sep 16, 2024
c7da232
Add setup_tpl to simplify TPLs usage
victorapm Sep 17, 2024
c1f9961
Add find_package support to setup_tpl
victorapm Sep 17, 2024
3859516
Add VERSION and SOVERSION info
victorapm Sep 17, 2024
5b8a310
Modernize shared lib build: improve dependency linkage and CMake setup
victorapm Sep 18, 2024
6e08c7d
Top-level CMakeLists refactoring
victorapm Sep 21, 2024
fcb58e6
Simplify build with set_hypre_option
victorapm Sep 21, 2024
14f58d8
Add ensure_options_match/differ macros
victorapm Sep 22, 2024
657d0d5
Fix target: CUDAToolkit -> CUDA
victorapm Sep 24, 2024
34cd9cd
Improve dependency search in HYPREConfig.cmake
victorapm Sep 24, 2024
9212a93
Adjustments
victorapm Sep 27, 2024
c032f71
Merge branch 'master' into cmake-hip
victorapm Sep 27, 2024
254f586
Merge branch 'master' into cmake-hip
victorapm Oct 5, 2024
0b79d5a
Merge branch 'master' into cmake-hip
victorapm Oct 16, 2024
f60f359
Update SOVERSION for consistency with ABI approach in hypre
victorapm Oct 16, 2024
1c9fb99
Merge branch 'master' into cmake-hip
victorapm Oct 17, 2024
35a8c91
cmake: update soversion (#1164)
junghans Oct 17, 2024
b4a5fbe
Merge branch 'master' into cmake-hip
victorapm Nov 8, 2024
d32a7dc
Remove redundant options + use cache internal
victorapm Nov 8, 2024
de4e0a8
Update CMake documentation
victorapm Nov 9, 2024
c0bd265
Fix a few documentation warnings
victorapm Nov 9, 2024
3c60a47
Apply astyle
victorapm Nov 9, 2024
dd81c97
New tests + CTest support + Doc fixes
victorapm Nov 11, 2024
0954a4b
Fix typo involving BLAS/LAPACK variables
victorapm Nov 15, 2024
2512cf3
Fix typo involving BLAS/LAPACK variables
victorapm Nov 15, 2024
9179d21
Draft idea for copying executables to the original source directory f…
rfalgout Nov 18, 2024
2687afb
Fix SYCL build via cmake
victorapm Nov 20, 2024
018c605
Add targets: etags, distclean, uninstall + test fixes
victorapm Nov 20, 2024
1968f5a
Disabling uninstall target
victorapm Nov 20, 2024
ecdcf55
Remove duplicate
victorapm Nov 20, 2024
8dfb4e4
Change DPCT_ROOT to DPCTROOT
Nov 20, 2024
2f724c6
Merge branch 'cmake-hip' of github.com:hypre-space/hypre into cmake-hip
Nov 20, 2024
373661b
CMake debug build now matches debug flags set via configure
victorapm Nov 21, 2024
8eb54c4
Use ENABLE for pkg features
victorapm Nov 21, 2024
a5768c7
ENABLE_STRICT_CHECKING support via cmake
victorapm Nov 21, 2024
35d32f4
[Doc]: Add section about testing
victorapm Nov 21, 2024
512ab47
Fix issue with make distclean
victorapm Nov 21, 2024
4890e46
Fix make uninstall target
victorapm Nov 21, 2024
395b0c4
Fix: propagate compiler options to drivers
victorapm Nov 22, 2024
0055eeb
[Doc]: update section about AUTOTEST
victorapm Nov 22, 2024
e2b71bc
[Fix]: enforce C standard when not given by the user
victorapm Nov 22, 2024
0899168
Merge branch 'cmake-hip' of github.com:hypre-space/hypre into cmake-hip
victorapm Nov 22, 2024
dea751a
Minor fixes
victorapm Nov 23, 2024
6d72863
Adding cmbuild/.gitignore to keep the cmbuild directory
rfalgout Nov 26, 2024
a139a4c
Fix CUDA build on MSVC
victorapm Nov 28, 2024
d6bc5ee
Fix nvidia-smi search on Windows
victorapm Nov 28, 2024
65cd3d5
Ignore Windows executables
victorapm Nov 28, 2024
b678e65
Update cmake variables that are really internal
victorapm Nov 28, 2024
a44dfde
Fix LTO-related issues and add HYPRE_ENABLE_LTO build option
victorapm Dec 2, 2024
9649c9a
Updating cmake.sh autotest script to work with cmake build changes
rfalgout Dec 9, 2024
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
Prev Previous commit
Next Next commit
Remove redundant options + use cache internal
  • Loading branch information
victorapm committed Nov 8, 2024
commit d32a7dcea99699ba6aa494959a76e4c81b8161e9
114 changes: 48 additions & 66 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -52,53 +52,35 @@ if (${HYPRE_SOURCE_DIR} STREQUAL ${HYPRE_BINARY_DIR})
message(FATAL_ERROR "In-place build not allowed! Please use a separate build directory. See the Users Manual or INSTALL file for details.")
endif ()

# Set default installation directory, but provide a means for users to change
set(CMAKE_INSTALL_PREFIX "${HYPRE_SOURCE_DIR}/hypre" CACHE PATH "Installation directory for HYPRE" FORCE)

# Ensure RPATH/RUNPATH is set properly during the build
set(CMAKE_SKIP_BUILD_RPATH FALSE) # Includes rpath in the binaries being built
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) # Use different paths for build and install
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # Use link-time paths
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") # Where binaries can look for shared libraries
if(NOT BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS OFF) # Build static library by default
endif()
set(CMAKE_SKIP_BUILD_RPATH FALSE CACHE BOOL "Include rpath in the binaries being built")
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE CACHE BOOL "Use different paths for build and install")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "Use link-time paths for install rpath")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" CACHE STRING "Where binaries look for shared libraries")

# Build static library by default
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)

# Set cmake module path
set(CMAKE_MODULE_PATH "${HYPRE_SOURCE_DIR}/config/cmake" "${CMAKE_MODULE_PATH}")

# Set default installation directory, but provide a means for users to change
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT DEFINED HYPRE_INSTALL_PREFIX)
if (NOT DEFINED HYPRE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/hypre" CACHE PATH "Installation directory for HYPRE" FORCE)
else()
set(CMAKE_INSTALL_PREFIX "${HYPRE_INSTALL_PREFIX}" CACHE PATH "Installation directory for HYPRE" FORCE)
endif()
else()
if (NOT DEFINED HYPRE_INSTALL_PREFIX)
set(HYPRE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Installation directory for HYPRE" FORCE)
endif()
endif()

# Set default compile optimization flag
if(NOT CMAKE_BUILD_TYPE AND NOT DEFINED HYPRE_BUILD_TYPE)
set(HYPRE_BUILD_TYPE "Release" CACHE STRING
"Optimization flags: set to Debug, Release, RelWithDebInfo, or MinSizeRel")
# Set CMAKE_BUILD_TYPE to default to Release if not already specified
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type options: Debug, Release, RelWithDebInfo, or MinSizeRel." FORCE)
endif()

# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
# Set the possible values of build type for ccmake/cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")

# If CMAKE_BUILD_TYPE is not set, use HYPRE_BUILD_TYPE
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "${HYPRE_BUILD_TYPE}" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif()

# Print the build type
# Print the configuration
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Shared library: ${BUILD_SHARED_LIBS}")
message(STATUS "Installation directory: ${CMAKE_INSTALL_PREFIX}")

# Base boolean configuration options
set_hypre_option(BASE HYPRE_ENABLE_SHARED "Build a shared library" ${BUILD_SHARED_LIBS})
set_hypre_option(BASE HYPRE_ENABLE_BIGINT "Use long long int for HYPRE_Int and HYPRE_BigInt" OFF)
set_hypre_option(BASE HYPRE_ENABLE_MIXEDINT "Use long long int for HYPRE_BigInt, int for HYPRE_Int" OFF)
set_hypre_option(BASE HYPRE_ENABLE_SINGLE "Use float for HYPRE_Real" OFF)
@@ -170,7 +152,6 @@ set(HYPRE_SYCL_TARGET "" CACHE STRING "Target SYCL architectu
set(HYPRE_SYCL_TARGET_BACKEND "" CACHE STRING "Additional SYCL backend options, e.g. '-device 12.1.0,12.4.0'.")

# Set config name values
set_internal_hypre_option(ENABLE "" SHARED)
set_internal_hypre_option(ENABLE "" BIGINT)
set_internal_hypre_option(ENABLE "" MIXEDINT)
set_internal_hypre_option(ENABLE "" SINGLE)
@@ -188,73 +169,74 @@ set_internal_hypre_option(WITH USING SYCL)
set_internal_hypre_option(WITH USING MAGMA)
set_internal_hypre_option(WITH USING CALIPER)

if (BUILD_SHARED_LIBS)
set(HYPRE_SHARED ON CACHE INTERNAL "")
endif ()

if (HYPRE_WITH_MPI)
set(HYPRE_HAVE_MPI ON CACHE BOOL "" FORCE)
set(HYPRE_SEQUENTIAL OFF CACHE BOOL "" FORCE)
set(HYPRE_HAVE_MPI ON CACHE INTERNAL "")
set(HYPRE_SEQUENTIAL OFF CACHE INTERNAL "")
else ()
set(HYPRE_SEQUENTIAL ON CACHE BOOL "" FORCE)
set(HYPRE_SEQUENTIAL ON CACHE INTERNAL "")
endif ()

if (HYPRE_WITH_SUPERLU)
set(HYPRE_USING_SUPERLU ON CACHE BOOL "" FORCE)
set(HYPRE_USING_SUPERLU ON CACHE INTERNAL "")
add_compile_definitions(HAVE_SUPERLU)
endif ()

if (HYPRE_WITH_DSUPERLU)
set(HYPRE_USING_DSUPERLU ON CACHE BOOL "" FORCE)
set(HYPRE_USING_HYPRE_BLAS OFF CACHE BOOL "" FORCE)
set(HYPRE_USING_HYPRE_LAPACK OFF CACHE BOOL "" FORCE)
set(HYPRE_USING_DSUPERLU ON CACHE INTERNAL "")
set(HYPRE_USING_HYPRE_BLAS OFF CACHE INTERNAL "")
set(HYPRE_USING_HYPRE_LAPACK OFF CACHE INTERNAL "")
endif ()

if (HYPRE_ENABLE_FEI)
set(HYPRE_USING_FEI ON CACHE BOOL "" FORCE)
set(HYPRE_USING_FEI ON CACHE INTERNAL "")
message(WARNING "CMake support for FEI is not complete!")
endif ()

# FEI doesn't currently compile with shared
if (HYPRE_SHARED OR HYPRE_BIGINT OR HYPRE_SINGLE OR HYPRE_LONG_DOUBLE)
set(HYPRE_USING_FEI OFF CACHE BOOL "" FORCE)
set(HYPRE_ENABLE_FEI OFF CACHE BOOL "" FORCE)
set(HYPRE_USING_FEI OFF CACHE INTERNAL "")
set(HYPRE_ENABLE_FEI OFF CACHE INTERNAL "")
endif ()

if (HYPRE_SEQUENTIAL)
set(HYPRE_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(HYPRE_BUILD_EXAMPLES OFF CACHE INTERNAL "")
endif ()

if (HYPRE_WITH_UMPIRE)
set(HYPRE_USING_UMPIRE ON CACHE BOOL "" FORCE)
set(HYPRE_USING_UMPIRE_DEVICE ON CACHE BOOL "" FORCE)
set(HYPRE_USING_UMPIRE_UM ON CACHE BOOL "" FORCE)
set(HYPRE_USING_UMPIRE ON CACHE INTERNAL "")
set(HYPRE_USING_UMPIRE_DEVICE ON CACHE INTERNAL "")
set(HYPRE_USING_UMPIRE_UM ON CACHE INTERNAL "")
endif ()

if (HYPRE_WITH_UMPIRE_HOST)
set(HYPRE_WITH_UMPIRE ON CACHE BOOL "" FORCE)
set(HYPRE_USING_UMPIRE ON CACHE BOOL "" FORCE)
set(HYPRE_USING_UMPIRE_HOST ON CACHE BOOL "" FORCE)
set(HYPRE_WITH_UMPIRE ON CACHE INTERNAL "")
set(HYPRE_USING_UMPIRE ON CACHE INTERNAL "")
set(HYPRE_USING_UMPIRE_HOST ON CACHE INTERNAL "")
endif ()

if (HYPRE_WITH_UMPIRE_DEVICE)
set(HYPRE_WITH_UMPIRE ON CACHE BOOL "" FORCE)
set(HYPRE_USING_UMPIRE ON CACHE BOOL "" FORCE)
set(HYPRE_USING_UMPIRE_DEVICE ON CACHE BOOL "" FORCE)
set(HYPRE_WITH_UMPIRE ON CACHE INTERNAL "")
set(HYPRE_USING_UMPIRE ON CACHE INTERNAL "")
set(HYPRE_USING_UMPIRE_DEVICE ON CACHE INTERNAL "")
endif ()

if (HYPRE_WITH_UMPIRE_UM)
set(HYPRE_WITH_UMPIRE ON CACHE BOOL "" FORCE)
set(HYPRE_USING_UMPIRE ON CACHE BOOL "" FORCE)
set(HYPRE_USING_UMPIRE_UM ON CACHE BOOL "" FORCE)
set(HYPRE_WITH_UMPIRE ON CACHE INTERNAL "")
set(HYPRE_USING_UMPIRE ON CACHE INTERNAL "")
set(HYPRE_USING_UMPIRE_UM ON CACHE INTERNAL "")
endif ()

if (HYPRE_WITH_UMPIRE_PINNED)
set(HYPRE_WITH_UMPIRE ON CACHE BOOL "" FORCE)
set(HYPRE_USING_UMPIRE ON CACHE BOOL "" FORCE)
set(HYPRE_USING_UMPIRE_PINNED ON CACHE BOOL "" FORCE)
set(HYPRE_WITH_UMPIRE ON CACHE INTERNAL "")
set(HYPRE_USING_UMPIRE ON CACHE INTERNAL "")
set(HYPRE_USING_UMPIRE_PINNED ON CACHE INTERNAL "")
endif ()

# Check for conflicting options
ensure_options_match(HYPRE_ENABLE_SHARED BUILD_SHARED_LIBS)
ensure_options_match(HYPRE_INSTALL_PREFIX CMAKE_INSTALL_PREFIX)
ensure_options_match(HYPRE_BUILD_TYPE CMAKE_BUILD_TYPE)
ensure_options_differ(HYPRE_WITH_CUDA HYPRE_WITH_HIP)
ensure_options_differ(HYPRE_WITH_CUDA HYPRE_WITH_SYCL)
ensure_options_differ(HYPRE_WITH_CUDA HYPRE_BIGINT)
2 changes: 1 addition & 1 deletion src/config/cmake/HYPRE_CMakeUtilities.cmake
Original file line number Diff line number Diff line change
@@ -241,7 +241,7 @@ function(setup_tpl_or_internal LIB_NAME)
# Use external library
if(TPL_${LIB_NAME_UPPER}_LIBRARIES)
# Use specified TPL libraries
message(STATUS "Enabled support for using ${LIB_NAME_UPPER}.")
message(STATUS "Enabled support for using external ${LIB_NAME_UPPER}.")
foreach(lib ${TPL_${LIB_NAME_UPPER}_LIBRARIES})
if(EXISTS ${lib})
message(STATUS "${LIB_NAME_UPPER} library found: ${lib}")