diff --git a/CHANGELOG.md b/CHANGELOG.md index 15571cf144e..bc0cfa19ee4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - [[PR583]](https://github.com/lanl/singularity-eos/pull/583) Added GenericIndexer class to provide more complex array indirection ### Fixed (Repair bugs, etc) +- [[PR593]](https://github.com/lanl/singularity-eos/pull/593) Guard tests for AMD GPU for problematic LLVM versions. Also cleaned up code for clarity. - [[PR567]](https://github.com/lanl/singularity-eos/pull/567) Fixed an OOB array access bug in the Fixed T PTE solver - [[PR561]](https://github.com/lanl/singularity-eos/pull/561) Fix logic for kokkos-kernels in spackage so that it is only required for closure models on GPU - [[PR563]](https://github.com/lanl/singularity-eos/pull/563) Fixed DensityFromPressureTemperature for the Carnahan-Starling EOS. diff --git a/singularity-eos/eos/eos_gruneisen.hpp b/singularity-eos/eos/eos_gruneisen.hpp index 8b79e79978a..b4eb41745f8 100644 --- a/singularity-eos/eos/eos_gruneisen.hpp +++ b/singularity-eos/eos/eos_gruneisen.hpp @@ -292,7 +292,7 @@ PORTABLE_INLINE_FUNCTION Real Gruneisen::ComputeRhoMax(const Real s1, const Real maxbound = std::min(min_extremum, maxbound); } } // s3 > 0 ; else - } // discriminant >= 0 + } // discriminant >= 0 if (poly(minbound) * poly(maxbound) < 0.) { // Root is appropriately bounded using RootFinding1D::regula_falsi; diff --git a/singularity-eos/eos/eos_variant.hpp b/singularity-eos/eos/eos_variant.hpp index c5bb8dc8cc7..232d531ec7a 100644 --- a/singularity-eos/eos/eos_variant.hpp +++ b/singularity-eos/eos/eos_variant.hpp @@ -76,8 +76,8 @@ class Variant { } Variant GetOnDevice() { - return PortsOfCall::visit([](auto &eos) { return eos_variant(eos.GetOnDevice()); }, - eos_); + return PortsOfCall::visit( + [](auto &eos) { return eos_variant(eos.GetOnDevice()); }, eos_); } // Place member functions here @@ -88,12 +88,14 @@ class Variant { template PORTABLE_INLINE_FUNCTION void EvaluateDevice(const Functor_t f) const { - return PortsOfCall::visit([&f](const auto &eos) { return eos.EvaluateDevice(f); }, eos_); + return PortsOfCall::visit([&f](const auto &eos) { return eos.EvaluateDevice(f); }, + eos_); } template void EvaluateHost(Functor_t &f) const { - return PortsOfCall::visit([&f](const auto &eos) { return eos.EvaluateHost(f); }, eos_); + return PortsOfCall::visit([&f](const auto &eos) { return eos.EvaluateHost(f); }, + eos_); } // EOS modifier object-oriented API @@ -336,7 +338,8 @@ class Variant { PORTABLE_INLINE_FUNCTION Real RhoPmin(const Real temp) const { - return PortsOfCall::visit([&temp](const auto &eos) { return eos.RhoPmin(temp); }, eos_); + return PortsOfCall::visit([&temp](const auto &eos) { return eos.RhoPmin(temp); }, + eos_); } PORTABLE_FORCEINLINE_FUNCTION @@ -346,7 +349,8 @@ class Variant { PORTABLE_FORCEINLINE_FUNCTION Real MinimumTemperature() const { - return PortsOfCall::visit([](const auto &eos) { return eos.MinimumTemperature(); }, eos_); + return PortsOfCall::visit([](const auto &eos) { return eos.MinimumTemperature(); }, + eos_); } PORTABLE_FORCEINLINE_FUNCTION @@ -356,7 +360,8 @@ class Variant { PORTABLE_FORCEINLINE_FUNCTION Real MinimumPressure() const { - return PortsOfCall::visit([](const auto &eos) { return eos.MinimumPressure(); }, eos_); + return PortsOfCall::visit([](const auto &eos) { return eos.MinimumPressure(); }, + eos_); } PORTABLE_FORCEINLINE_FUNCTION @@ -373,7 +378,8 @@ class Variant { } PORTABLE_INLINE_FUNCTION Real MeanAtomicNumber() const { - return PortsOfCall::visit([](const auto &eos) { return eos.MeanAtomicNumber(); }, eos_); + return PortsOfCall::visit([](const auto &eos) { return eos.MeanAtomicNumber(); }, + eos_); } template PORTABLE_INLINE_FUNCTION Real MeanAtomicMassFromDensityTemperature( @@ -1235,11 +1241,12 @@ class Variant { // class/individual EOS's so that the variant state is properly // carried. Otherwise de-serialization would need to specify a type. std::size_t DynamicMemorySizeInBytes() const { - return PortsOfCall::visit([](const auto &eos) { return eos.DynamicMemorySizeInBytes(); }, - eos_); + return PortsOfCall::visit( + [](const auto &eos) { return eos.DynamicMemorySizeInBytes(); }, eos_); } std::size_t DumpDynamicMemory(char *dst) { - return PortsOfCall::visit([dst](auto &eos) { return eos.DumpDynamicMemory(dst); }, eos_); + return PortsOfCall::visit([dst](auto &eos) { return eos.DumpDynamicMemory(dst); }, + eos_); } std::size_t SetDynamicMemory(char *src, const SharedMemSettings &stngs = DEFAULT_SHMEM_STNGS) { @@ -1247,12 +1254,12 @@ class Variant { [src, stngs](auto &eos) { return eos.SetDynamicMemory(src, stngs); }, eos_); } std::size_t SharedMemorySizeInBytes() const { - return PortsOfCall::visit([](const auto &eos) { return eos.SharedMemorySizeInBytes(); }, - eos_); + return PortsOfCall::visit( + [](const auto &eos) { return eos.SharedMemorySizeInBytes(); }, eos_); } constexpr bool AllDynamicMemoryIsShareable() const { - return PortsOfCall::visit([](const auto &eos) { return eos.AllDynamicMemoryIsShareable(); }, - eos_); + return PortsOfCall::visit( + [](const auto &eos) { return eos.AllDynamicMemoryIsShareable(); }, eos_); } std::size_t SerializedSizeInBytes() const { return sizeof(*this) + DynamicMemorySizeInBytes(); @@ -1323,8 +1330,8 @@ class Variant { PORTABLE_INLINE_FUNCTION unsigned long max_scratch_size(const unsigned int nelements) { - return PortsOfCall::visit([&](const auto &eos) { return eos.max_scratch_size(nelements); }, - eos_); + return PortsOfCall::visit( + [&](const auto &eos) { return eos.max_scratch_size(nelements); }, eos_); } PORTABLE_FORCEINLINE_FUNCTION @@ -1334,14 +1341,14 @@ class Variant { template PORTABLE_INLINE_FUNCTION bool NeedsLambda() const { - return PortsOfCall::visit([](const auto &eos) { return eos.template NeedsLambda(); }, - eos_); + return PortsOfCall::visit( + [](const auto &eos) { return eos.template NeedsLambda(); }, eos_); } template PORTABLE_INLINE_FUNCTION bool NeedsLambda(const T &t) const { - return PortsOfCall::visit([](const auto &eos) { return eos.template NeedsLambda(); }, - eos_); + return PortsOfCall::visit( + [](const auto &eos) { return eos.template NeedsLambda(); }, eos_); } template diff --git a/singularity-eos/eos/eos_vinet.hpp b/singularity-eos/eos/eos_vinet.hpp index 14b182c1340..83634f70bde 100644 --- a/singularity-eos/eos/eos_vinet.hpp +++ b/singularity-eos/eos/eos_vinet.hpp @@ -222,7 +222,7 @@ inline void Vinet::InitializeVinet(const Real *d2tod40input) { for (int ind = VinetInternalParametersSize - 2; ind >= 2; ind--) { // _VIP[42]=d40=f40 given,first calculated is _VIP[41]=f39 _VIP[ind] = _VIP[ind] - (ind) / _VIP[1] * _VIP[ind + 1]; // prefactors f40 to f0 - } // _VIP[n+2]=fn, ind=n+2 + } // _VIP[n+2]=fn, ind=n+2 } PORTABLE_INLINE_FUNCTION void Vinet::Vinet_F_DT_func(const Real rho, const Real T, @@ -241,7 +241,7 @@ PORTABLE_INLINE_FUNCTION void Vinet::Vinet_F_DT_func(const Real rho, const Real sumP = _d2tod40[pref0vp + ind] + onemx * sumP; //_d2tod40[38]=d40 sumB = _d2tod40[pref0vp + ind] * ind + onemx * sumB; //_d2tod40[-2+40]=d40 sumE = _VIP[pref0vip + ind] + onemx * sumE; //_VIP[42]=f40 - } //_VIP[2]=f0 + } //_VIP[2]=f0 #pragma unroll for (int ind = 1; ind >= 0; ind--) { sumE = _VIP[pref0vip + ind] + onemx * sumE; diff --git a/singularity-eos/eos/modifiers/shifted_eos.hpp b/singularity-eos/eos/modifiers/shifted_eos.hpp index ff52b2eac26..72c968345f9 100644 --- a/singularity-eos/eos/modifiers/shifted_eos.hpp +++ b/singularity-eos/eos/modifiers/shifted_eos.hpp @@ -161,8 +161,7 @@ class ShiftedEOS : public EosBase> { singularity::mfuncname::member_func_name(typeid(ShiftedEOS).name(), __func__); static auto const cname = name.c_str(); const auto shift_val = shift_; - portableFor( - cname, 0, num, PORTABLE_LAMBDA(const int i) { sies[i] += shift_val; }); + portableFor(cname, 0, num, PORTABLE_LAMBDA(const int i) { sies[i] += shift_val; }); } template diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index dce185feed2..c7f1a7da17e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -121,11 +121,19 @@ if(SINGULARITY_BUILD_CLOSURE) catch_discover_tests(closure_unit_tests PROPERTIES TIMEOUT 120) if(SINGULARITY_USE_SPINER) - add_executable(test_pte test_pte.cpp) - target_link_libraries(test_pte PRIVATE Catch2::Catch2 - singularity-eos::singularity-eos) - target_include_directories(test_pte PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - add_test(pte test_pte) + if(SINGULARITY_USE_KOKKOS AND Kokkos_ENABLE_HIP + AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.0.0") + message(WARNING + "Test PTE appears to encounter a compiler bug for LLVM builds targeting AMD GPUs " + "for compiler versions ${CMAKE_CXX_COMPILER_VERSION} < 19, and the test is disabled. " + "Note this corresponds to rocm versions less than 6.4.") + else() + add_executable(test_pte test_pte.cpp) + target_link_libraries(test_pte PRIVATE Catch2::Catch2 + singularity-eos::singularity-eos) + target_include_directories(test_pte PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + add_test(pte test_pte) + endif() add_executable(test_pte_2phase test_pte_2phaseVinetSn.cpp) target_link_libraries(test_pte_2phase PRIVATE Catch2::Catch2 diff --git a/test/catch2_define.cpp b/test/catch2_define.cpp index 0959e50f5a4..2433a9425c3 100644 --- a/test/catch2_define.cpp +++ b/test/catch2_define.cpp @@ -21,7 +21,9 @@ int main(int argc, char *argv[]) { Kokkos::initialize(); #endif int result; - { result = Catch::Session().run(argc, argv); } + { + result = Catch::Session().run(argc, argv); + } #ifdef PORTABILITY_STRATEGY_KOKKOS Kokkos::finalize(); #endif diff --git a/test/test_pte.cpp b/test/test_pte.cpp index 007458e092d..bee30f1adbb 100644 --- a/test/test_pte.cpp +++ b/test/test_pte.cpp @@ -47,8 +47,8 @@ using atomic_view = Kokkos::MemoryTraits; #endif template