From 14b223ea28cf5ef820dd86658c759caa911f6d8d Mon Sep 17 00:00:00 2001 From: Maciej Waruszewski Date: Fri, 24 Apr 2026 09:37:08 -0600 Subject: [PATCH 1/5] Switch to C++20 --- components/omega/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/omega/CMakeLists.txt b/components/omega/CMakeLists.txt index 1f4e1d666d99..3d0c487d4992 100644 --- a/components/omega/CMakeLists.txt +++ b/components/omega/CMakeLists.txt @@ -38,7 +38,7 @@ if (NOT DEFINED PROJECT_NAME) # Collect machine and compiler info from CIME init_standalone_build() - set(CMAKE_CXX_STANDARD 17) # used in E3SM + set(CMAKE_CXX_STANDARD 20) # used in E3SM set(CMAKE_CXX_STANDARD_REQUIRED ON) project(${OMEGA_PROJECT_NAME} From 780e4b9f50361c3e0b9b741ec6ddfd5f0276d866 Mon Sep 17 00:00:00 2001 From: Maciej Waruszewski Date: Fri, 24 Apr 2026 09:38:27 -0600 Subject: [PATCH 2/5] Use fmt::runtime to prevent compilation error in logging --- components/omega/src/infra/Logging.cpp | 8 ++++---- components/omega/src/infra/Logging.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/omega/src/infra/Logging.cpp b/components/omega/src/infra/Logging.cpp index 5cf4a0c6cb7b..be007d53ff40 100644 --- a/components/omega/src/infra/Logging.cpp +++ b/components/omega/src/infra/Logging.cpp @@ -21,7 +21,7 @@ namespace OMEGA { //------------------------------------------------------------------------------ // Utility function to create a log message with prefix -std::string +fmt::runtime_format_string<> _PackLogMsg(const char *file, //[in] file from where log called (cpp __FILE__) int line, //[in] src code line where called (cpp __LINE__) const std::string &msg //[in] message text @@ -31,11 +31,11 @@ _PackLogMsg(const char *file, //[in] file from where log called (cpp __FILE__) std::string path(file); size_t pos = path.find_last_of("\\/"); if (pos != std::string::npos) { - return "[" + path.substr(pos + 1) + ":" + std::to_string(line) + "] " + - msg; + return fmt::runtime("[" + path.substr(pos + 1) + ":" + + std::to_string(line) + "] " + msg); } // add prefix of form [file:line] to message string - return "[" + path + ":" + std::to_string(line) + "] " + msg; + return fmt::runtime("[" + path + ":" + std::to_string(line) + "] " + msg); } //------------------------------------------------------------------------------ diff --git a/components/omega/src/infra/Logging.h b/components/omega/src/infra/Logging.h index c2599a54c366..b1a5635a1dc7 100644 --- a/components/omega/src/infra/Logging.h +++ b/components/omega/src/infra/Logging.h @@ -165,7 +165,7 @@ int initLogging( ); /// Utility function to create a log message with prefix -std::string +fmt::runtime_format_string<> _PackLogMsg(const char *file, ///< [in] file where log called (cpp __FILE__) int line, ///< [in] src code line where log (cpp __LINE__) const std::string &msg ///< [in] message text From afdf12e996144fea943fbabaf86dad057528c313 Mon Sep 17 00:00:00 2001 From: Maciej Waruszewski Date: Fri, 24 Apr 2026 10:49:41 -0600 Subject: [PATCH 3/5] Add const to formatters format member function --- components/omega/src/infra/LogFormatters.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/components/omega/src/infra/LogFormatters.h b/components/omega/src/infra/LogFormatters.h index 411a5e457c52..164ae8991a60 100644 --- a/components/omega/src/infra/LogFormatters.h +++ b/components/omega/src/infra/LogFormatters.h @@ -18,20 +18,20 @@ struct fmt::formatter \ : fmt::formatter { \ auto format(OMEGA::ARR##DIM##TYPE my, \ - format_context &ctx) -> decltype(ctx.out()) { \ + format_context &ctx) const -> decltype(ctx.out()) { \ return fmt::format_to(ctx.out(), "{}({}D:{})", my.label(), my.rank(), \ my.size()); \ } \ }; #else -#define GENERATE_FORMATTER(ARR, DIM, TYPE) \ - template <> \ - struct fmt::formatter \ - : fmt::formatter { \ - auto format(OMEGA::ARR##DIM##TYPE my, \ - format_context &ctx) -> decltype(ctx.out()) { \ - return fmt::format_to(ctx.out(), "{}", my.label()); \ - } \ +#define GENERATE_FORMATTER(ARR, DIM, TYPE) \ + template <> \ + struct fmt::formatter \ + : fmt::formatter { \ + auto format(OMEGA::ARR##DIM##TYPE my, \ + format_context &ctx) const -> decltype(ctx.out()) { \ + return fmt::format_to(ctx.out(), "{}", my.label()); \ + } \ }; #endif From 4f81dd0cde3834b514a88831bdac5ff31941cdd2 Mon Sep 17 00:00:00 2001 From: Maciej Waruszewski Date: Mon, 11 May 2026 16:54:30 -0600 Subject: [PATCH 4/5] Disable C++20 modules in cpptrace --- components/omega/external/CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/omega/external/CMakeLists.txt b/components/omega/external/CMakeLists.txt index 46e1ca7c19b9..45d1441e34dc 100644 --- a/components/omega/external/CMakeLists.txt +++ b/components/omega/external/CMakeLists.txt @@ -135,9 +135,10 @@ endif() # Add the cpptrace library if (NOT TARGET cpptrace::cpptrace) - option(CPPTRACE_INHERIT_HOST_STANDARD "" ON) - add_subdirectory( - ${OMEGA_SOURCE_DIR}/external/cpptrace - ${CMAKE_CURRENT_BINARY_DIR}/external/cpptrace - ) + option(CPPTRACE_INHERIT_HOST_STANDARD "" ON) + option(CPPTRACE_DISABLE_CXX_20_MODULES "" ON) + add_subdirectory( + ${OMEGA_SOURCE_DIR}/external/cpptrace + ${CMAKE_CURRENT_BINARY_DIR}/external/cpptrace + ) endif() From 6370d04c9a8588354d50e354c4ecc4f7fff29e0d Mon Sep 17 00:00:00 2001 From: Maciej Waruszewski Date: Fri, 24 Apr 2026 11:16:05 -0600 Subject: [PATCH 5/5] Don't use deprecated is_hostspace --- components/omega/src/infra/OmegaKokkos.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/omega/src/infra/OmegaKokkos.h b/components/omega/src/infra/OmegaKokkos.h index a7ab8bca89da..a89fa525df16 100644 --- a/components/omega/src/infra/OmegaKokkos.h +++ b/components/omega/src/infra/OmegaKokkos.h @@ -52,9 +52,10 @@ template constexpr ArrayDataType checkArrayType() { // determine ArrayMemLoc from Kokkos array type template constexpr ArrayMemLoc findArrayMemLoc() { - if (std::is_same_v) { + if constexpr (std::is_same_v) { return ArrayMemLoc::Both; - } else if (T::is_hostspace) { + } else if constexpr (std::is_same_v) { return ArrayMemLoc::Host; } else { return ArrayMemLoc::Device;