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

make phoebus a library #206

Merged
merged 4 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
42 changes: 27 additions & 15 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#=========================================================================================
# (C) (or copyright) 2021. Triad National Security, LLC. All rights reserved.
# (C) (or copyright) 2021-2024. Triad National Security, LLC. All rights reserved.
#
# This program was produced under U.S. Government contract 89233218CNA000001 for Los
# Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC
Expand All @@ -11,9 +11,11 @@
# the public, perform publicly and display publicly, and to permit others to do so.
#=========================================================================================

add_executable(phoebus
main.cpp # first
set(MAX_NUMBER_CONSERVED_VARS 9 CACHE INTEGER "Maximum number of conserved variables")

configure_file(compile_constants.hpp.in generated/compile_constants.hpp @ONLY)

set (SRC_LIST
# alphabetical
fixup/fixup.hpp
fixup/fixup.cpp
Expand Down Expand Up @@ -150,13 +152,15 @@ add_executable(phoebus

tracers/tracers.hpp
tracers/tracers.cpp

# Generated
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>/compile_constants.hpp
)
Yurlungur marked this conversation as resolved.
Show resolved Hide resolved

set(MAX_NUMBER_CONSERVED_VARS 9 CACHE INTEGER "Maximum number of conserved variables")

configure_file(compile_constants.hpp.in generated/compile_constants.hpp @ONLY)
add_library(phoebuslib ${SRC_LIST})

target_include_directories(phoebus PRIVATE
target_include_directories(phoebuslib PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
# JMM: Not needed, but can't hurt
Expand All @@ -169,29 +173,37 @@ target_include_directories(phoebus PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../external/singularity-opac/utils"
)

target_compile_features(phoebus PUBLIC cxx_std_14)
target_compile_features(phoebuslib PUBLIC cxx_std_17)
# TODO(JMM): Remove this since we're never going to run on XL again (I hope)
if (CMAKE_CXX_COMPILER_ID STREQUAL "XL")
target_compile_options(phoebus PUBLIC -std=c++1y -qxflag=disable__cplusplusOverride)
target_compile_options(phoebuslib PUBLIC -std=c++1y -qxflag=disable__cplusplusOverride)
endif()

target_compile_definitions(phoebus PRIVATE PORTABILITY_STRATEGY_KOKKOS)
target_compile_definitions(phoebuslib PUBLIC PORTABILITY_STRATEGY_KOKKOS)
if (PHOEBUS_ENABLE_HDF5)
target_compile_definitions(phoebus PRIVATE
target_compile_definitions(phoebuslib PUBLIC
SINGULARITY_USE_HDF
SPINER_USE_HDF
)
endif()

if (Kokkos_ENABLE_CUDA)
target_compile_options(phoebus PUBLIC --expt-relaxed-constexpr)
target_compile_options(phoebuslib PUBLIC --expt-relaxed-constexpr)
endif()

# target_compile_options(phoebus PUBLIC -G -lineinfo)

target_link_libraries(phoebus PRIVATE parthenon
target_link_libraries(phoebuslib PUBLIC parthenon
singularity-eos::singularity-eos
# singularity-opac::singularity-opac
)
if (PHOEBUS_ENABLE_HDF5)
target_link_libraries(phoebus PRIVATE hdf5::hdf5 hdf5::hdf5_hl)
target_link_libraries(phoebuslib PUBLIC hdf5::hdf5 hdf5::hdf5_hl)
endif()

# Disable executable automatically for builds with downstream codes
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
message(STATUS "Standalone mode. Adding Phoebus executable")
add_executable(phoebus main.cpp)
target_link_libraries(phoebus PRIVATE phoebuslib)
endif()

# target_compile_options(phoebus PUBLIC -G -lineinfo)
3 changes: 2 additions & 1 deletion tst/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2021. Triad National Security, LLC. All rights reserved. This
# © 2021-2024. Triad National Security, LLC. All rights reserved. This
# program was produced under U.S. Government contract 89233218CNA000001
# for Los Alamos National Laboratory (LANL), which is operated by Triad
# National Security, LLC for the U.S. Department of Energy/National
Expand All @@ -15,6 +15,7 @@ include(Catch)
add_executable(phoebus_unit_tests phoebus_unit_test_main.cpp)
target_link_libraries(phoebus_unit_tests
PRIVATE
phoebuslib
parthenon
Catch2::Catch2
Kokkos::kokkos
Expand Down
46 changes: 2 additions & 44 deletions tst/unit/geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2021. Triad National Security, LLC. All rights reserved. This
# © 2021-2024. Triad National Security, LLC. All rights reserved. This
# program was produced under U.S. Government contract 89233218CNA000001
# for Los Alamos National Laboratory (LANL), which is operated by Triad
# National Security, LLC for the U.S. Department of Energy/National
Expand All @@ -13,57 +13,15 @@
add_library(geometry_unit_tests OBJECT
test_geometry.cpp
test_tetrads.cpp

${CMAKE_CURRENT_SOURCE_DIR}/../../../src/analysis/history.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/analysis/history.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/analytic_system.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/boyer_lindquist.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/boyer_lindquist.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/cached_system.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/flrw.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/flrw.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/fmks.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/fmks.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/geometry_defaults.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/geometry_utils.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/mckinney_gammie_ryan.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/mckinney_gammie_ryan.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/modified_system.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/minkowski.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/minkowski.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/snake.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/snake.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/spherical_kerr_schild.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/spherical_kerr_schild.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/spherical_minkowski.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/spherical_minkowski.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/phoebus_utils/phoebus_interpolation.hpp
)

# Super annoying but it had to be done.
set(MAX_NUMBER_CONSERVED_VARS 9 CACHE STRING "Maximum number of conserved variables")
configure_file(../../../src/compile_constants.hpp.in generated/compile_constants.hpp @ONLY)

target_link_libraries(geometry_unit_tests
PRIVATE
phoebuslib
parthenon
singularity-eos::singularity-eos
Catch2::Catch2
Kokkos::kokkos)

target_include_directories(geometry_unit_tests PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../../../src"
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils/ports-of-call"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils/spiner"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils/variant/include"
)

target_compile_definitions(geometry_unit_tests PRIVATE
PORTABILITY_STRATEGY_KOKKOS)

target_link_libraries(geometry_unit_tests PRIVATE Catch2::Catch2)
target_sources(phoebus_unit_tests PRIVATE $<TARGET_OBJECTS:geometry_unit_tests>)
30 changes: 2 additions & 28 deletions tst/unit/monopole_gr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2021. Triad National Security, LLC. All rights reserved. This
# © 2021-2024. Triad National Security, LLC. All rights reserved. This
# program was produced under U.S. Government contract 89233218CNA000001
# for Los Alamos National Laboratory (LANL), which is operated by Triad
# National Security, LLC for the U.S. Department of Energy/National
Expand All @@ -13,42 +13,16 @@
add_library(monopole_gr_unit_tests OBJECT
test_monopole_gr.cpp
test_interp_3d_to_1d.cpp

${CMAKE_CURRENT_SOURCE_DIR}/../../../src/monopole_gr/monopole_gr.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/monopole_gr/monopole_gr_utils.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/monopole_gr/monopole_gr.cpp

${CMAKE_CURRENT_SOURCE_DIR}/../../../src/tov/tov.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/tov/tov.cpp

${CMAKE_CURRENT_SOURCE_DIR}/../../../src/phoebus_utils/unit_conversions.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/phoebus_utils/unit_conversions.cpp

${CMAKE_CURRENT_SOURCE_DIR}/../../../src/microphysics/eos_phoebus/eos_phoebus.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/microphysics/eos_phoebus/eos_phoebus.cpp
)

target_link_libraries(monopole_gr_unit_tests
PRIVATE
phoebuslib
parthenon
Catch2::Catch2
Kokkos::kokkos
singularity-eos::singularity-eos
)

target_include_directories(monopole_gr_unit_tests PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../../../src"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils/ports-of-call"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils/spiner"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils/variant/include"
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
)

target_compile_definitions(monopole_gr_unit_tests PRIVATE PHOEBUS_IN_UNIT_TESTS)
target_compile_definitions(monopole_gr_unit_tests PRIVATE
PORTABILITY_STRATEGY_KOKKOS)

target_sources(phoebus_unit_tests PRIVATE $<TARGET_OBJECTS:monopole_gr_unit_tests>)
36 changes: 8 additions & 28 deletions tst/unit/phoebus_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2021. Triad National Security, LLC. All rights reserved. This
# © 2021-2024. Triad National Security, LLC. All rights reserved. This
# program was produced under U.S. Government contract 89233218CNA000001
# for Los Alamos National Laboratory (LANL), which is operated by Triad
# National Security, LLC for the U.S. Department of Energy/National
Expand Down Expand Up @@ -38,41 +38,21 @@ add_library(phoebus_utils_unit_tests OBJECT
test_relativity_utils.cpp
test_reader.cpp
test_adiabats.cpp

${CMAKE_CURRENT_SOURCE_DIR}/../../../src/geometry/geometry.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/progenitor/ascii_reader.cpp
)

target_include_directories(phoebus_utils_unit_tests PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../../"
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
)

target_link_libraries(phoebus_utils_unit_tests
PRIVATE
phoebuslib
parthenon
Catch2::Catch2
Kokkos::kokkos
singularity-eos::singularity-eos
)
if (PHOEBUS_ENABLE_HDF5)
target_link_libraries(phoebus_utils_unit_tests PRIVATE hdf5::hdf5 hdf5::hdf5_hl )
endif()

target_include_directories(phoebus_utils_unit_tests PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../../../src"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils/ports-of-call"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils/spiner"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils/variant/include"
"${CMAKE_CURRENT_SOURCE_DIR}/../../"
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
)

target_compile_definitions(phoebus_utils_unit_tests PRIVATE
PORTABILITY_STRATEGY_KOKKOS)
if (PHOEBUS_ENABLE_HDF5)
target_compile_definitions(phoebus_utils_unit_tests PRIVATE
SINGULARITY_USE_HDF
SPINER_USE_HDF
)
endif()

target_sources(phoebus_unit_tests PRIVATE $<TARGET_OBJECTS:phoebus_utils_unit_tests>)
20 changes: 2 additions & 18 deletions tst/unit/radiation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# © 2021. Triad National Security, LLC. All rights reserved. This
# © 2021-2024. Triad National Security, LLC. All rights reserved. This
# program was produced under U.S. Government contract 89233218CNA000001
# for Los Alamos National Laboratory (LANL), which is operated by Triad
# National Security, LLC for the U.S. Department of Energy/National
Expand All @@ -12,32 +12,16 @@

add_library(radiation_unit_tests OBJECT
test_closure.cpp

${CMAKE_CURRENT_SOURCE_DIR}/../../../src/radiation/closure.hpp

)

target_link_libraries(radiation_unit_tests
PRIVATE
phoebuslib
parthenon
Catch2::Catch2
Kokkos::kokkos
singularity-eos::singularity-eos
)

target_include_directories(radiation_unit_tests PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../../../src"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils/ports-of-call"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils/spiner"
"${CMAKE_CURRENT_SOURCE_DIR}/../../../external/singularity-eos/utils/variant/include"
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>
)

target_compile_definitions(radiation_unit_tests PRIVATE
PORTABILITY_STRATEGY_KOKKOS)

target_link_libraries(radiation_unit_tests PRIVATE Catch2::Catch2)
target_sources(phoebus_unit_tests PRIVATE $<TARGET_OBJECTS:radiation_unit_tests>)
Loading