Skip to content

Commit

Permalink
Merge pull request #245 from lanl/dholladay00/separate_get_sg_eos
Browse files Browse the repository at this point in the history
dholladay00/separate get sg eos
  • Loading branch information
dholladay00 authored Aug 16, 2023
2 parents 8bfcb85 + ed5a121 commit dd5d8d4
Show file tree
Hide file tree
Showing 32 changed files with 1,536 additions and 929 deletions.
11 changes: 9 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ variables:
SINGULARITY_EOS_GCC_VERSION: "9.3.0"
SINGULARITY_EOS_OPENMPI_VERSION: "4.1.3"
SINGULARITY_EOS_CUDA_VERSION: "11.6.0"
SINGULARITY_EOS_BUILD_TYPE: "RelWithDebInfo"
SINGULARITY_EOS_SPACK_SPEC: "singularity-eos@main+mpi+hdf5+python+tests%gcc@${SINGULARITY_EOS_GCC_VERSION} ^openmpi@${SINGULARITY_EOS_OPENMPI_VERSION}"
COLOR_CYAN: '\033[1;36m'
COLOR_PLAIN: '\033[0m'
Expand Down Expand Up @@ -45,10 +46,13 @@ before_script:
##########################

.buildtype_debug: &buildtype_debug
BUILD_TYPE: "Debug"
SINGULARITY_EOS_BUILD_TYPE: "Debug"

.buildtype_release: &buildtype_release
BUILD_TYPE: "Release"
SINGULARITY_EOS_BUILD_TYPE: "Release"

.buildtype_relDebugInfo: &buildtype_relDebugInfo
SINGULARITY_EOS_BUILD_TYPE: "RelWithDebInfo"

.gpu: &gpu
SINGULARITY_USE_CUDA: "true"
Expand Down Expand Up @@ -133,6 +137,7 @@ before_script:
- cd build
- |
cmake -DCMAKE_INSTALL_PREFIX=${CI_PROJECT_DIR}/install ${SINGULARITY_CMAKE_CXX_COMPILER_FLAG} \
-DCMAKE_BUILD_TYPE=${SINGULARITY_EOS_BUILD_TYPE} \
-DSINGULARITY_USE_EOSPAC=ON \
-DSINGULARITY_USE_SPINER=ON \
-DSINGULARITY_USE_SPINER_WITH_HDF5=ON \
Expand Down Expand Up @@ -190,13 +195,15 @@ test_gnu_power9_gpu:
extends: .test
variables:
<<: *power9
<<: *buildtype_release
<<: *gpu

test_x86_volta_gpu:
<<: *job_def
extends: .test
variables:
<<: *x86volta
<<: *buildtype_release
<<: *gpu

install_gnu_skylake_fort:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

### Infrastructure (changes irrelevant to downstream codes)
- [[PR190]](https://github.com/lanl/singularity-eos/pull/190) update CI on re-git
- [[PR245]](https://github.com/lanl/singularity-eos/pull/245) Separating get_sg_eos to other files. Build/compilation improvements, warning fixes/suppression.

### Removed (removing behavior/API/varaibles/...)

Expand Down
1 change: 0 additions & 1 deletion cmake/submodule_configs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ macro(singularity_cmake_config pkg)
if(SINGULARITY_USE_CUDA)
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "" FORCE)
set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "" FORCE)
set(Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE ON CACHE BOOL "" FORCE)
endif()
elseif(${pkg} STREQUAL "KokkosKernels")
# Disable TPLs
Expand Down
21 changes: 18 additions & 3 deletions singularity-eos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#------------------------------------------------------------------------------#

set(EOS_HEADERS
closure/mixed_cell_models.hpp
base/fast-math/logs.hpp
base/robust_utils.hpp
base/root-finding-1d/root_finding.hpp
Expand Down Expand Up @@ -49,12 +48,28 @@ set(EOS_SRCS
)

if (SINGULARITY_BUILD_CLOSURE)
list(APPEND EOS_SRCS eos/singularity_eos.cpp)
list(APPEND EOS_HEADERS eos/singularity_eos.hpp closure/mixed_cell_models.hpp)
list(APPEND EOS_HEADERS
closure/mixed_cell_models.hpp)
if (SINGULARITY_USE_FORTRAN)
list(APPEND EOS_SRCS
eos/get_sg_eos.cpp)
if (SINGULARITY_USE_KOKKOS)
list(APPEND EOS_SRCS
eos/get_sg_eos_p_t.cpp
eos/get_sg_eos_rho_t.cpp
eos/get_sg_eos_rho_p.cpp
eos/get_sg_eos_rho_e.cpp)
endif()
list(APPEND EOS_HEADERS
eos/get_sg_eos.hpp
eos/get_sg_eos_functors.hpp)
endif()
endif()

if (SINGULARITY_USE_FORTRAN)
list(APPEND EOS_SRCS eos/singularity_eos.f90)
list(APPEND EOS_SRCS eos/singularity_eos.cpp)
list(APPEND EOS_HEADERS eos/singularity_eos.hpp)
# would rather handle this more robustly, being sloppy for now
list(APPEND EOS_MODS singularity_eos.mod singularity_eos_types.mod)
endif()
Expand Down
23 changes: 7 additions & 16 deletions singularity-eos/base/variadic_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ struct flatten<type_list<Ts...>> {
};

// filter nested variadic templates
template <template <typename> class FIRST, template <typename> class... REST>
constexpr auto remove_first(adapt_list<FIRST, REST...>) {
return adapt_list<REST...>{};
}

// nested specialization filter type
template <template <typename> class Template, typename T>
Expand Down Expand Up @@ -109,18 +105,13 @@ struct filter<ADAPTER, Pred, Variadic, T, Ts...> {
typename filter<ADAPTER, Pred, Variadic, Ts...>::type>::type;
};

template <template <typename> class U, typename... Ts>
constexpr auto filter_nested(type_list<Ts...>) {
using f_list = typename filter<U, is_not_duplicate_nested, type_list, Ts...>::type;
return f_list{};
}

template <template <typename> class FIRST, template <typename> class... Us,
typename... Ts>
constexpr auto filter_nested_variadic(adapt_list<FIRST, Us...> m, type_list<Ts...> l) {
using t1 = type_list<decltype(filter_nested<FIRST>(l))>;
using t1 =
type_list<typename filter<FIRST, is_not_duplicate_nested, type_list, Ts...>::type>;
constexpr typename flatten<t1>::type l1{};
return filter_nested_variadic(remove_first(m), l1);
return filter_nested_variadic(adapt_list<Us...>{}, l1);
}

template <typename... Ts>
Expand All @@ -130,14 +121,14 @@ constexpr auto filter_nested_variadic(adapt_list<>, type_list<Ts...> l) {

// apply class template to typelist
template <template <typename> class T, typename... Us>
constexpr auto transform_list(type_list<Us...>) {
return type_list<T<Us>...>{};
}
struct transform_list_struct {
using type = type_list<T<Us>...>;
};

template <template <typename> class... Ts, typename... Us>
constexpr auto transform_variadic_list(type_list<Us...> list,
adapt_list<Ts...> mod_list) {
using t1 = type_list<decltype(transform_list<Ts>(list))...>;
using t1 = type_list<typename transform_list_struct<Ts, Us...>::type...>;
constexpr typename flatten<t1>::type l1{};
constexpr auto l2 = filter_nested_variadic(mod_list, l1);
return l2;
Expand Down
6 changes: 3 additions & 3 deletions singularity-eos/eos/eos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace singularity {
template <typename... Ts>
using tl = singularity::detail::type_list<Ts...>;

template <template <typename> typename... Ts>
template <template <typename> class... Ts>
using al = singularity::detail::adapt_list<Ts...>;

// transform variadic list: applies modifiers to eos's
Expand Down Expand Up @@ -113,8 +113,8 @@ static constexpr const auto combined_list_1 = singularity::detail::concat(
static constexpr const auto ramped_all =
transform_variadic_list(combined_list_1, al<BilinearRampEOS>{});
// final combined list
static constexpr const auto combined_list = singularity::detail::concat(
full_eos_list, shifted, scaled, scaled_of_shifted, unit_or_rel, ramped_all);
static constexpr const auto combined_list =
singularity::detail::concat(combined_list_1, ramped_all);
// a function that returns a Variant from a typelist
template <typename... Ts>
struct tl_to_Variant_struct {
Expand Down
18 changes: 11 additions & 7 deletions singularity-eos/eos/eos_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ char *StrCat(char *destination, const char *source) {
using EosBase<EOSDERIVED>::FillEos; \
using EosBase<EOSDERIVED>::EntropyFromDensityTemperature; \
using EosBase<EOSDERIVED>::EntropyFromDensityInternalEnergy; \
using EosBase<EOSDERIVED>::EntropyIsNotEnabled;
using EosBase<EOSDERIVED>::EntropyIsNotEnabled; \
using EosBase<EOSDERIVED>::IsModified; \
using EosBase<EOSDERIVED>::UnmodifyOnce; \
using EosBase<EOSDERIVED>::GetUnmodifiedObject;

class Factor {
Real value_ = 1.0;
Expand Down Expand Up @@ -606,12 +609,13 @@ class EosBase {
}

// Tooling for modifiers
PORTABLE_FORCEINLINE_FUNCTION
bool IsModified() const { return false; }
PORTABLE_FORCEINLINE_FUNCTION
auto UnmodifyOnce() { return *static_cast<CRTP *>(this); }
PORTABLE_FORCEINLINE_FUNCTION
auto GetUnmodifiedObject() { return *static_cast<CRTP *>(this); }
inline constexpr bool IsModified() const { return false; }

inline constexpr decltype(auto) UnmodifyOnce() { return *static_cast<CRTP *>(this); }

inline constexpr decltype(auto) GetUnmodifiedObject() {
return *static_cast<CRTP *>(this);
}
};
} // namespace eos_base
} // namespace singularity
Expand Down
Loading

0 comments on commit dd5d8d4

Please sign in to comment.