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; flush with upstream #246

Merged
merged 75 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
16d1dce
removed submodules
mauneyc-LANL Mar 29, 2023
583bdb3
CMake updates, new dependency handling, submodules removed
mauneyc-LANL Mar 29, 2023
446855e
variant update
mauneyc-LANL Mar 30, 2023
00f00a2
Revert "removed submodules"
mauneyc-LANL Apr 3, 2023
f8cadbc
use kernels, update paths
mauneyc-LANL Apr 3, 2023
52e9a21
moved kokkos SMs to 3.7.01
mauneyc-LANL Apr 3, 2023
a808196
bifurcate build strategy
mauneyc-LANL Apr 3, 2023
0ae0dde
removed relocatable kokkos configure option
mauneyc-LANL Apr 4, 2023
6bce674
options and consistancy checks
May 2, 2023
654b060
merge main
May 2, 2023
bbe7985
Merge branch 'main' into mauneyc/flush-with-upstream
May 16, 2023
539e52b
updates
May 17, 2023
a120a48
updates
Jun 6, 2023
efc524f
debugging hdf5
mauneyc-LANL Jun 6, 2023
74583f5
merge dev
mauneyc-LANL Jun 6, 2023
5b9557d
add presets (gpu only for now)
mauneyc-LANL Jun 6, 2023
83a9999
Merge branch 'main' into mauneyc/flush-with-upstream
mauneyc-LANL Jun 6, 2023
c45b102
explicit reference to HL libs; this may need a little work
mauneyc-LANL Jun 7, 2023
15a4e19
trying to reason about HDF5 libs
mauneyc-LANL Jun 7, 2023
081ded1
Update the github CI yamls
mauneyc-LANL Jun 7, 2023
c7009b2
debugging githubCI
mauneyc-LANL Jun 7, 2023
041ba89
force SM mode on CI
mauneyc-LANL Jun 7, 2023
0de14e5
update docs CI
mauneyc-LANL Jun 7, 2023
528f6d0
temp debug on CI
mauneyc-LANL Jun 7, 2023
a1e23f9
pleading with HDF5 to stop
mauneyc-LANL Jun 7, 2023
35ab328
Presets
Jun 19, 2023
005c284
install stage update, testing configs
Jun 21, 2023
ea5580a
clarifying build, testing GPU
mauneyc-LANL Jun 22, 2023
5218c11
ignore user presets; draft of build guide
Jun 22, 2023
0f911dc
Merge branch 'mauneyc/flush-with-upstream' of github.com:lanl/singula…
Jun 22, 2023
dc40e74
use updates to spiner in branch, undo when spiner updated
Jun 23, 2023
583ec22
moved spiner sm to dev branch -- revert to main before merging
Jun 23, 2023
3a5d7f5
moved poc sm to main
Jun 23, 2023
83c715c
updated github test with correct options
Jun 23, 2023
691d38b
spackage updates and spiner alignment
Jun 27, 2023
bf08ff2
initial CI change
Jun 27, 2023
7a2529f
github CI turn off HDF5 on minimal test
Jun 27, 2023
a5267f3
change/add databox definition
Jun 28, 2023
dcd783a
adding to build doc
Jun 28, 2023
9eb7b68
databox template simplification
Jun 28, 2023
dd35609
moved databox declaration to out of singularity scope
Jun 28, 2023
7e8c808
Merge branch 'main' into mauneyc/flush-with-upstream
Jul 10, 2023
8820059
remove -d from spack env command
ktsai7 Jul 10, 2023
10cbd45
Merge branch 'mauneyc/flush-with-upstream' of ssh://re-git.lanl.gov:1…
Jul 11, 2023
520555e
add sesame2spiner with databox update
Jul 11, 2023
54df12f
disable sesame2spiner if eospac is off
Jul 11, 2023
c74554f
add new databox to test_pte
mauneyc-LANL Jul 11, 2023
4adceb4
update spiner spackage to accecpt lesser cmake version
mauneyc-LANL Jul 12, 2023
c5512bf
more README doc
Jul 26, 2023
da1e86e
Add missing eosSafeDestroy call
rbberger Jul 6, 2023
309b80a
Update CHANGELOG.md
rbberger Jul 6, 2023
8b0cbc8
Fix GitHub bot workflow
rbberger Jul 12, 2023
a4d97f8
CI spec and spackage change
Jul 27, 2023
d27e5e4
Some spackage adjustments
Jul 27, 2023
f0a8818
Sphinx build doc rewrite
Jul 27, 2023
b430eef
Merge branch 'main' into mauneyc/flush-with-upstream
Yurlungur Jul 27, 2023
fc9993b
Merge branch 'main' into mauneyc/flush-with-upstream
Yurlungur Jul 27, 2023
11270f8
format
jonahm-LANL Jul 27, 2023
69ae1ac
Merge branch 'main' into mauneyc/flush-with-upstream
Yurlungur Jul 31, 2023
d0c31b1
add 'build' to gitignore
Jul 31, 2023
7284fea
merge main and manual fix changes
Jul 31, 2023
598ae6d
variant target guard, removed spiner flags
Jul 31, 2023
1d1ec1c
fixed typo in description
mauneyc-LANL Jul 31, 2023
c3883cc
change description
mauneyc-LANL Jul 31, 2023
02a6d2b
check for closure for LA lib
Jul 31, 2023
aa5c913
format file and remove spiner+kokkos defines
Jul 31, 2023
d5a9bab
moved closure option and include eigen logic
Jul 31, 2023
554fe22
check for cuda/eigen
Jul 31, 2023
5ec9ec4
fixed missing endif
Jul 31, 2023
17883de
merge main and fix conflict
Jul 31, 2023
8855477
update spackage for version diffs
Jul 31, 2023
5e8130b
removed dead code
Jul 31, 2023
4b439d3
removed marco for out-of-source kokkos source
Jul 31, 2023
9d7efa2
Merge branch 'main' into mauneyc/flush-with-upstream
Yurlungur Aug 1, 2023
36c6233
Merge branch 'main' into mauneyc/flush-with-upstream
dholladay00 Aug 2, 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
12 changes: 0 additions & 12 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
[submodule "utils/eigen"]
path = utils/eigen
url = https://gitlab.com/libeigen/eigen.git
[submodule "utils/spiner"]
path = utils/spiner
url = ../spiner.git
[submodule "utils/variant"]
path = utils/variant
url = https://github.com/mpark/variant.git
[submodule "utils/kokkos"]
path = utils/kokkos
url = https://github.com/kokkos/kokkos.git
[submodule "utils/ports-of-call"]
path = utils/ports-of-call
url = ../ports-of-call.git
228 changes: 58 additions & 170 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# publicly and display publicly, and to permit others to do so.
#------------------------------------------------------------------------------#

cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.20)
mauneyc-LANL marked this conversation as resolved.
Show resolved Hide resolved

project(singularity-eos VERSION 1.7.0 LANGUAGES NONE)

Expand All @@ -22,11 +22,6 @@ set(SINGULARITY_GOLDFILES_VERSION "goldfiles-1.6.2")
set(SINGULARITY_GOLDFILE_HASH
33ef74b29937cc1347b525f72662933dd2b0556550f6541f97fc1de8a01c3c2a)

#------------------------------------------------------------------------------#
# Use better messages
#------------------------------------------------------------------------------#
include(cmake/singularity_utils.cmake)

#------------------------------------------------------------------------------#
# Options
#------------------------------------------------------------------------------#
Expand All @@ -45,38 +40,43 @@ option (SINGULARITY_BUILD_STELLARCOLLAPSE2SPINER "Compile stellarcollapse2spiner
option (SINGULARITY_BETTER_DEBUG_FLAGS
"Better debug flags for singularity" ON)
option (SINGULARITY_HIDE_MORE_WARNINGS "hide more warnings" OFF)
option (SINGULARITY_SUBMODULE_MODE "Submodule mode" OFF)
option (SINGULARITY_BUILD_CLOSURE "Mixed cell closure" ON)
option (SINGULARITY_TEST_SESAME "Test the Sesame table readers" OFF)
option (SINGULARITY_TEST_STELLAR_COLLAPSE "Test the stellar collapse table readers" OFF)
option (SINGULARITY_TEST_PYTHON "Test the Python bindings" OFF)
option (SINGULARITY_USE_SINGLE_LOGS "Use single precision logs. Can harm accuracy." OFF)
option (SINGULARITY_USE_TRUE_LOG_GRIDDING "Use grids that conform to log spacing." OFF)
option (SINGULARITY_PATCH_MPARK_VARIANT "Apply GPU patch to mpark-variant submodule" ON)

option (SINGULARITY_SUBMODULE_MODE "Submodule mode" OFF)
option (SINGULARITY_CUSTOM_KOKKOS "Use custom kokkos dir" OFF)

#option (SINGULARITY_PATCH_MPARK_VARIANT "Apply GPU patch to mpark-variant submodule" ON)

# Patches variant to be compatible with cuda
# Assumes "patch" is present on system
if(SINGULARITY_PATCH_MPARK_VARIANT)
message(STATUS "Patching mpark::variant to support GPUs")
execute_process(COMMAND patch -N -s -V never
${CMAKE_CURRENT_SOURCE_DIR}/utils/variant/include/mpark/variant.hpp
${CMAKE_CURRENT_SOURCE_DIR}/utils/cuda_compatibility.patch
)
Yurlungur marked this conversation as resolved.
Show resolved Hide resolved
endif()
#if(SINGULARITY_PATCH_MPARK_VARIANT)
# message(STATUS "Patching mpark::variant to support GPUs")
# execute_process(COMMAND patch -N -s -V never
# ${CMAKE_CURRENT_SOURCE_DIR}/utils/variant/include/mpark/variant.hpp
# ${CMAKE_CURRENT_SOURCE_DIR}/utils/cuda_compatibility.patch
# )
#endif()
#------------------------------------------------------------------------------#
# singularity-eos Library
#------------------------------------------------------------------------------#

include(singularity/Eigen3)
include(singularity/eospac)
include(singularity/hdf5)
include(singularity/kokkos)
include(singularity/mpark_variant)
include(singularity/spiner)

# keep config data stored in easily accessable vars,
# only attaching them to targets as late as possible.
# this allows for easier handling and manipulating, as
# well as later info printing and debugging
set(SINGULARITY_PUBLIC_DEFINES "") # list to `target_compile_definitions()`
set(SINGULARITY_PRIVATE_DEFINES "") # """
set(SINGULARITY_PUBLIC_INCS "") # list to `target_include_directories()`
set(SINGULARITY_PRIVATE_INCS "") # """
set(SINGULARITY_PUBLIC_LIBS "") # list to `target_link_libraries()`
set(SINGULARITY_PRIVATE_LIBS "") # """
set(SINGULARITY_EXPORT_TARGETS "") # probably not useful
set(SINGULARITY_COMPILEFLAGS "") # TODO: actually use these
set(SINGULARITY_DEP_PKGS "") # a list of packages, used to generate import rules for installed targets. (may want to rename)
add_library(singularity-eos)
add_library(singularity-eos::singularity-eos ALIAS singularity-eos)

#?
target_include_directories(singularity-eos PUBLIC $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>)

#------------------------------------------------------------------------------#
# Compiler & language setup
Expand Down Expand Up @@ -154,28 +154,38 @@ endif()
# side-projects
if(SINGULARITY_USE_HDF5)
if(SINGULARITY_BUILD_STELLARCOLLAPSE2SPINER)
list(APPEND _subdirs2add stellarcollapse2spiner)
add_subdirectory(stellarcollapse2spiner)
endif()
if(SINGULARITY_USE_EOSPAC AND SINGULARITY_BUILD_SESAME2SPINER)
list(APPEND _subdirs2add sesame2spiner)
add_subdirectory(sesame2spiner)
endif()
if(SINGULARITY_BUILD_EXAMPLES)
list(APPEND _subdirs2add example)
add_subdirectory(example)
endif()
endif()

if (SINGULARITY_BUILD_PYTHON)
list(APPEND _subdirs2add python)
add_subdirectory(python)
endif()

if(SINGULARITY_USE_SINGLE_LOGS)
list(APPEND TAR_DEFINES SINGULARITY_USE_SINGLE_LOGS)
target_compile_definitions(singularity-eos PUBLIC SINGULARITY_USE_SINGLE_LOGS)
endif()

#------------------------------------------------------------------------------#
# Handle dependencies
#------------------------------------------------------------------------------#

find_package(mpark_variant REQUIRED)
target_link_libraries(singularity-eos PUBLIC mpark_variant)

find_package(ports-of-call REQUIRED)
target_link_libraries(singularity-eos PUBLIC ports-of-call::ports-of-call)
mauneyc-LANL marked this conversation as resolved.
Show resolved Hide resolved

#----------------------------------------------------------------------------#
# Optional dependencies
#----------------------------------------------------------------------------#

# need this for consistant Catch2 up/downstream.
# depending on how this develops, this could be wrapped
# into the dependcy logic (below)
Expand All @@ -201,138 +211,32 @@ if(SINGULARITY_BUILD_TESTS)
endif()
endif()

include(cmake/dependency.cmake)

if(SINGULARITY_USE_KOKKOS)
# kokkos offloading
# type: soft submodule
singularity_import_dependency(
PKG Kokkos
TARGETS Kokkos::kokkos
SUBDIR ${PROJECT_SOURCE_DIR}/utils/kokkos
)
set(PORTABILITY_STRATEGY "Kokkos")
set(SPINER_USE_KOKKOS ON)
list(APPEND SINGULARITY_PUBLIC_DEFINES PORTABILITY_STRATEGY_KOKKOS)
list(APPEND SINGULARITY_PUBLIC_DEFINES SPINER_USE_KOKKOS)
####
# TODO: Once it's oppurtune, we will
# not support Kokkos < 3.3
if((${Kokkos_VERSION_MAJOR} MATCHES "^[0-9]+$") AND (${Kokkos_VERSION_MINOR} MATCHES "^[0-9]+$"))
if(${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR} VERSION_LESS "3.3")
message(WARNING "`Kokkos` version [${Kokkos_VERSION_MAJOR}.${Kokkos_VERSION_MINOR}] is DEPRECATED, and `singularity-eos` will not support versions < '3.3' in the very near future.")
if(SINGULARITY_USE_CUDA)
get_filename_component(_compiler_exe ${CMAKE_CXX_COMPILER} NAME)
if(NOT _compiler_exe STREQUAL "nvcc_wrapper")
message(FATAL_ERROR "To use CUDA offloading with `Kokkos` version <= 3.2, you must use `-DCMAKE_CXX_COMPILER=/path/to/kokkos/bin/nvcc_wrapper` when invoking `cmake`. You may also need to set a Kokkos target architecture via: https://github.com/kokkos/kokkos/wiki/Compiling.")
endif()
endif() #SINGULARITY_USE_CUDA
endif() #Kokkos_VERSION_MAJOR
else()
message(WARNING "`Kokkos` version could not be inferred. Note that versions less than `3.3` are DEPRECATED and may not work properly.")
endif() #Kokkos_VERSION_MAJOR
####
else()
set(PORTABILITY_STRATEGY "None")
list(APPEND SINGULARITY_PUBLIC_DEFINES PORTABILITY_STRATEGY_NONE)
endif() #SINGULARITY_USE_KOKKOS
message(STATUS "Portability strategy set to ${PORTABILITY_STRATEGY}")

# TODO(JMM): If linear algebra needs grow beyond mixed cell closures,
# we may need to rename this variable.
if (SINGULARITY_BUILD_CLOSURE)
if(SINGULARITY_USE_KOKKOSKERNELS)
# type: external
singularity_import_dependency(
PKG KokkosKernels
TARGETS Kokkos::kokkoskernels
)
list(APPEND SINGULARITY_PUBLIC_DEFINES SINGULARITY_USE_KOKKOSKERNELS)
else()
# type: soft submodule
singularity_import_dependency(
PKG Eigen3
TARGETS Eigen3::Eigen
SUBDIR ${PROJECT_SOURCE_DIR}/utils/eigen
)
endif() #SINGULARITY_USE_KOKKOS_KERNELS
endif() #SINGULARITY_BUILD_CLOSURE

# variant for prior C++17
# type: soft submodule
singularity_import_dependency(
PKG mpark_variant
TARGETS mpark_variant
SUBDIR ${PROJECT_SOURCE_DIR}/utils/variant
)

# ports-of-call
# type: soft submodule
singularity_import_dependency(
PKG ports-of-call
TARGETS ports-of-call::ports-of-call
SUBDIR ${PROJECT_SOURCE_DIR}/utils/ports-of-call
)

# spiner
# type: soft submodule
singularity_import_dependency(
PKG spiner
TARGETS spiner::spiner
SUBDIR ${PROJECT_SOURCE_DIR}/utils/spiner
)

# only use hdf5 if spiner
if (SINGULARITY_USE_HDF5)
# hdf5, for data interopability
# type: external
enable_language(C)
singularity_import_dependency(
PKG HDF5
COMPONENTS C HL
TARGETS hdf5::hdf5 hdf5::hdf5_hl
)

# make sure we use MPI
if (HDF5_IS_PARALLEL)
# Message passing interface
# type: external
singularity_import_dependency(
PKG MPI
COMPONENTS CXX
TARGETS MPI::MPI_CXX
)
endif()

list(APPEND SINGULARITY_PUBLIC_DEFINES SPINER_USE_HDF)
list(APPEND SINGULARITY_PUBLIC_DEFINES SINGULARITY_USE_HDF)
endif() # SINGULARITY_USE_HDF5
singularity_enable_kokkos(singularity-eos)
endif()

#NB: An edge-case (but an easy one), that doesn't slot
# easily into the `import_dependency()` setup.
# TODO: just do it correctly
#TODO: Check: Does EOSPAC only pass into side-targets?
if (SINGULARITY_USE_EOSPAC)
#TODO: should be strictly module mode
find_package(EOSPAC REQUIRED)
list(APPEND SINGULARITY_PUBLIC_DEFINES SINGULARITY_USE_EOSPAC)
list(APPEND SINGULARITY_PUBLIC_LIBS EOSPAC::eospac)
list(APPEND SINGULARITY_PUBLIC_LIBS eospac-wrapper)
list(APPEND SINGULARITY_DEPS_PKGS EOSPAC)
if(SINGULARITY_USE_HDF5)
singularity_enable_hdf5(singularity-eos)
endif()

list(APPEND _subdirs2add eospac-wrapper)
endif ()
if(SINGULARITY_USE_SPINER)
singularity_enable_spiner(singularity-eos)
endif()

if(SINGULARITY_USE_EOSPAC)
singularity_enable_eospac(singularity-eos)
endif()

#TODO: this feels out-of-place here, though i haven't crawled into the source yet to see
# what the point is.
if (SINGULARITY_TEST_SESAME)
list(APPEND SINGULARITY_PRIVATE_DEFINES SINGULARITY_TEST_SESAME)
target_compile_definitions(singularity-eos PRIVATE SINGULARITY_TEST_SESAME)
endif()
if (SINGULARITY_BUILD_CLOSURE)
list(APPEND SINGULARITY_PRIVATE_DEFINES SINGULARITY_BUILD_CLOSURE)
target_compile_definitions(singularity-eos PRIVATE SINGULARITY_BUILD_CLOSURE)
endif()

###########################OLD
#------------------------------------------------------------------------------#
# singularity-eos library
#------------------------------------------------------------------------------#
Expand All @@ -356,9 +260,7 @@ foreach(_src ${EOS_SRCS})
list(APPEND _srcs singularity-eos/${_src})
endforeach()

# define the
add_library(singularity-eos ${_srcs} ${_headers})
add_library(singularity-eos::singularity-eos ALIAS singularity-eos)
target_sources(singularity-eos PRIVATE ${_srcs} ${_headers})

# make sure .mods are placed in build path, and installed
# along with includes
Expand Down Expand Up @@ -443,20 +345,6 @@ target_link_options(singularity-eos
)

include(GNUInstallDirs)
foreach(_sdir ${_subdirs2add})
singularity_msg(STATUS "Adding ${_sdir}...")
add_subdirectory(${_sdir})
endforeach()


# TODO either expand this or do feature_summary
#singularity_msg(STATUS "Configuration")
#message(STATUS "[== INFO: status so far ===============================")
#message(STATUS "[== dependency list: ${SINGULARITY_DEP_PKGS}")
#message(STATUS "[== library targets: ${SINGULARITY_PUBLIC_LIBS} ${SINGULARITY_PRIVATE_LIBS}")
#message(STATUS "[== compiler definitions: ${SINGULARITY_PUBLIC_DEFINES} ${SINGULARITY_PRIVATE_DEFINES}")
#message(STATUS "[======================================================")


#----------------------------------------------------------------------------#
# Export/install
Expand Down
Loading