Update EKAT to require C++20 - #400
Conversation
|
Asking the obv question: are we sure that E3SM will build everywhere with C++20 required? If not, this my hold back any ekat update in e3sm. |
|
It will not build with all of our current default compilers. In particular, the "intel" compiler on Chrysalis. Possibly others. |
bartgol
left a comment
There was a problem hiding this comment.
Looks good. Only possible concern is whether e3sm is ready for c++20 across all machines.
|
@bartgol @rljacob Good to know. I created this PR while I'm testing E3SM on the target machines, but since we already know there will be some that are not compatible, we will need to find a different way to handle this. Kokkos 5 is going to require C++20, what would the process be to eventually update compilers on Chrysalis (and maybe others) so that we can upgrade? Or is this going to be a bigger roadblock? I guess the first step is for me to test exactly which compilers do not work. |
|
One solution would be to mis with a cmake2.0 way of specifying the std, via something like if (NOT CMAKE_CXX_STANDARD)
target_compile_features(ekat_core PUBLIC cxx_std_20)
endif()Then, in the mach files for old compilers we keep lines like which will force ekat to honor the required standard. Of course, for machines where we do set 17 in the mach files, we won't be able to build anything that needs kokkos 5.0 (e.g. any F case, since EAM still use kokkos for the SL transport). This means that we cannot switch to kokkos 5 until we can abandon compilers that only support c++17. |
|
On Chrysalis:
|
Ugh, that's underwhelming. I wonder if this is on the chrys IT folks' radar... |
Yeah, I want to try and make a small reproducer outside of E3SM. Make sure it's not something we are doing. |
5695852 to
9b9729c
Compare
9b9729c to
8244207
Compare
11b44e4 to
8b79f4f
Compare
|
Update:
@rljacob @bartgol How should we proceed? Can we require users of Chrysalis start switching to oneapi? Do we need to have a frozen version of Kokkos as a tpl for the other compilers? Could we require anyone using ekat (running with EAMxx) use oneapi? |
Did you run both gnu and intel on pm-cpu? I think @ndkeen is also using
I think we can keep both intel and oneapi. But we won't be able to run anything that uses kokkos with the intel compiler. I think this includes also any EAM case though, since EAM uses hommexx's SL transport by default, so this may impact a lot of ppl. @jgfouca wild option: can CIME update a submodule conditionally on the compiler (or any other XML var)? E.g., can we do something like if compiler is "intel":
update_submodule(f'{SRCROOT}/externals/ekat', 'v1.1', recursive=True) to switch the submodule to an older tag? |
|
We will require Chrysalis users to use oneapi-ifx. It will be made the default. ifort will still be an option for anyone who needs it and they have to use an earlier hash. We should make a plan on when this goes to master since its a breaking change for chrysalis. |
We should prob make this change first, and then update ekat/kokkos (and the required cxx standard). Maybe mid-late March? I think 2 months may be a good enough window for ppl to switch to the new compiler. |
|
@bartgol , CIME does not support that currently. We could, in theory, add support for configuration that allows for customizing submodules, but that seems kinda hacky. |
|
Testing update
I will next go to frontier, then I think we will have all the info we need to move forward. |
|
Re: intel compiler on chrysalis Confirmed, the F2010 test case still requires ekat and does not work with C++20. I'll create a PR in E3SM switching the default compiler to oneapi on chrysalis. Not sure how we want to deal with trying to have an old version of Kokkos available vs. trying to require everyone switch compilers. |
I'm in favor of requiring ppl to switch. The master branch should always follow the latest development. If ppl need older compiler, they can use tags and swtich to older tags. @rljacob may have other thoughts though... |
|
In your switch, will you also make a older pre-built version of Kokkos availble for ifort users? There are in-progress production runs with ifort and its not clear yet if they can switch. Also CCing @amametjanov |
Are the in-progress prod runs using version-of-the-day master? Or are they working on a particular tag? Imho, every production campaign should work on a tag, rather than use current master (which can also undergo non-bfb changes). |
I agree with Luca that any campaigns I think should be on a tag, and so my preference would be to not have a separate Kokkos, unless there was major pushback. |
|
As far as different compilers, |
|
the gnu compiler on Chrysalis is used for ice sheet model (MALI) development. Either they need to also switch to oneapi or yes the gnu issue has to be solved. |
One big reason to bump to c++20 is b/c MALI would like to follow trilinos more closely. So I think they'd be ok with switching. Pinging @mperego. Another option could be to bump gnu's version on chrys from 11 to something like 13 (which I think is what pm-cpu uses?). |
|
OMEGA also gets its Kokkos from EKAT so may need to chime in on this. @amametjanov should know what compilers/machines matter for OMEGA. |
|
@tcclevenger I think it needs a full rebase. I tried the "draft+undraft" trick, but the workflow files are evaluated on the PR branch itself, not the merge commit. |
c7cdbd6 to
4a223cf
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates EKAT’s build configuration to require C++20 to support upgrading to
Kokkos 5.0.
Changes:
- Set the project-wide C++ standard to C++20 in the top-level CMake.
- Remove the per-target C++ standard requirement from
ekat_core. - Update the spdlog FetchContent commit and remove redundant CI C++ standard
configuration.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
CMakeLists.txt |
Sets C++20 requirement at the project level. |
src/core/CMakeLists.txt |
Removes per-target C++ standard requirement from ekat_core. |
cmake/tpls/EkatBuildSpdlog.cmake |
Bumps the pinned spdlog commit SHA (noted as 1.17.0). |
cacts.yaml |
Drops redundant CMAKE_CXX_STANDARD CI configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # EKAT requires c++17 features | ||
| target_compile_features(ekat_core PUBLIC cxx_std_17) | ||
|
|
||
| # Add the correct ekat::Comm impl file, depending on whether MPI is ON/OFF. |
There was a problem hiding this comment.
@copilot Now that C++20 is required at the top level, is this not redundant?
There was a problem hiding this comment.
Not quite. The top-level CMAKE_CXX_STANDARD makes EKAT itself build as C++20, but it does not advertise that requirement to downstream targets that link ekat::Core/ekat::AllLibs. The PUBLIC compile feature is what propagates the minimum standard through the exported interface, so I restored it in e1d6764.
There was a problem hiding this comment.
@tcclevenger I think we should keep THIS change, and rm the CMAKE_CXX_STANDARD/CMAKE_CXX_STANDARD_REQUIRED vars... They are pointless. All they do is ensuring ALL ekat targets use cxx 20. But virtually all of ekat links against ekat_core anyways...
bartgol
left a comment
There was a problem hiding this comment.
Given the latest change by copilot, I think we should rm the cmake vars. Setting targets properties is much more cmake-y than setting global vars.
|
|
||
| # EKAT requires c++17 features | ||
| target_compile_features(ekat_core PUBLIC cxx_std_17) | ||
|
|
||
| # Add the correct ekat::Comm impl file, depending on whether MPI is ON/OFF. |
There was a problem hiding this comment.
@tcclevenger I think we should keep THIS change, and rm the CMAKE_CXX_STANDARD/CMAKE_CXX_STANDARD_REQUIRED vars... They are pointless. All they do is ensuring ALL ekat targets use cxx 20. But virtually all of ekat links against ekat_core anyways...
|
@bartgol With this version of the PR, compiling with it sets the CXX standard to 17. So it is not picking it up from ekat core. CMake output: |
8d1d3af to
6ab8088
Compare
|
Ah, Kokkos still defaults to 17. But I wonder if the ekat files are built with c++20... |
Yes, it looks like ekat_core was built with c++20 |
Then I'm ok. We could run some tests forcing kokkos to use c++20, but I suppose it works fine. If ekat uses c++20, then conceptually we did enough. Upstream libs should default to whatever standard they want/need. |
|
@bartgol We have some warnings in yaml-cpp Maybe these have gone away in newer versions? How interested are we in testing? |
|
Those warnings have been there for a while. IIRC, the cmake option Edit: actually, that option was to silence warnings when building TPLS, not when TPLs are linked. Do you know what file was being built when that happened? |
Update EKAT to require C++20
Motivation
Needed to update to Kokkos 5.0.
Testing
CI already uses C++20.