Skip to content

Update to c++20 for EAMxx and Homme - #8559

Merged
tcclevenger merged 5 commits into
E3SM-Project:masterfrom
tcclevenger:tcclevenger/update_to_cpp20
Aug 6, 2026
Merged

tcclevenger merged 5 commits into
E3SM-Project:masterfrom
tcclevenger:tcclevenger/update_to_cpp20

Conversation

@tcclevenger

@tcclevenger tcclevenger commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Update EAMxx and Homme to C++20. Changes:

  • Update EKAT (now requires C++20) (Updated as a part of Initial port to vista machine at TACC #8604)
  • Remove setting CXX_STANDARD in EAMxx
  • Remove setting CXX_STANDARD in machine/cime build files
  • Update homme standalone testing to use C++20

[non-BFB] Potentially for EAMxx/homme standalone cases

@tcclevenger
tcclevenger marked this pull request as draft July 14, 2026 20:08
@tcclevenger
tcclevenger requested a review from Copilot July 14, 2026 20:08
@tcclevenger tcclevenger self-assigned this Jul 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Update the build configuration across E3SM components to use C++20 (instead of C++17), aligning with the updated EKAT requirement and ensuring Homme/EAMxx default to the newer standard.

Changes:

  • Set the global components build to C++20.
  • Default EAMxx standalone builds to C++20.
  • Default Homme standalone builds to C++20.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
components/CMakeLists.txt Switch global components build to C++20.
components/eamxx/CMakeLists.txt Update EAMxx default C++ standard from 17 to 20.
components/homme/CMakeLists.txt Set Homme standalone default C++ standard to 20.

Comment thread components/homme/CMakeLists.txt Outdated
Comment thread components/eamxx/CMakeLists.txt Outdated
Comment thread components/CMakeLists.txt Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

Comment thread components/CMakeLists.txt Outdated
Comment thread components/CMakeLists.txt Outdated
Comment thread components/eamxx/CMakeLists.txt Outdated
Comment thread components/homme/CMakeLists.txt Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread components/homme/CMakeLists.txt Outdated
Comment thread components/eamxx/CMakeLists.txt Outdated
Comment thread components/CMakeLists.txt Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Comment thread components/CMakeLists.txt Outdated
Comment thread components/eamxx/CMakeLists.txt Outdated
@tcclevenger
tcclevenger force-pushed the tcclevenger/update_to_cpp20 branch 3 times, most recently from 37d08d2 to 2f55695 Compare July 15, 2026 22:38
@tcclevenger
tcclevenger requested a review from bartgol July 15, 2026 22:38
@tcclevenger
tcclevenger marked this pull request as ready for review July 15, 2026 22:38
Comment thread components/homme/CMakeLists.txt Outdated
Comment thread components/CMakeLists.txt Outdated
set(CMAKE_CXX_STANDARD 17)

# Require C++20.
set(CMAKE_CXX_STANDARD 20)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to set these? If a library uses c++20, they can use target_compile_features, no?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, but we create targets in build_model.cmake, in a very code-agnostic way. So I guess for that reason we must set this here, in case some lib does use c++20?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line should actually not be touch. I misunderstood it to mean we were setting everything to C++17, but actually EAMxx is free to take C++20 from EKAT, correct?

Comment thread share/build/buildlib.ekat
@tcclevenger
tcclevenger force-pushed the tcclevenger/update_to_cpp20 branch 2 times, most recently from 64ac70c to c905b19 Compare July 16, 2026 20:47
@tcclevenger

tcclevenger commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor Author

I reverted back the changes in components/CMakeLists.txt. There is no reason each component must use C++20.

EAMxx will use C++20 due to it's dependence on EKAT.

As it stands, hommexx will not use C++20, but, if this PR is an effort to prepare us for updating to Kokkos 5, I'm now thinking again that we maybe should use C++20 here in hommexx instead of waiting till Kokkos 5 update. @bartgol thoughts?

@tcclevenger
tcclevenger force-pushed the tcclevenger/update_to_cpp20 branch from c905b19 to 12e6372 Compare July 20, 2026 18:40
@bartgol

bartgol commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

As it stands, hommexx will not use C++20, but, if this PR is an effort to prepare us for updating to Kokkos 5, I'm now thinking again that we maybe should use C++20 here in hommexx instead of waiting till Kokkos 5 update. @bartgol thoughts?

On one hand, I would say "no need to do it", but otoh C++20 adds new reserved keywords, so if linking against kk 5 will implicitly force to use c++20, we may as well test it now.

@rljacob rljacob added EAMxx C++ based E3SM atmosphere model (aka SCREAM) EKAT Machine Files labels Jul 21, 2026
@tcclevenger tcclevenger changed the title Update to c++20 (from c++17). Update to c++20 for EAMxx and Homme Jul 29, 2026
@tcclevenger
tcclevenger force-pushed the tcclevenger/update_to_cpp20 branch from 12e6372 to 3a616dc Compare July 29, 2026 18:40
@tcclevenger
tcclevenger requested a review from bartgol July 29, 2026 18:40
@tcclevenger
tcclevenger force-pushed the tcclevenger/update_to_cpp20 branch 2 times, most recently from a1c5746 to 2bb7528 Compare July 29, 2026 20:39
Comment thread components/eamxx/src/share/physics/tests/CMakeLists.txt
Comment thread share/build/buildlib.ekat
Comment thread components/homme/CMakeLists.txt Outdated
@tcclevenger
tcclevenger requested a review from bartgol August 2, 2026 14:26
@tcclevenger
tcclevenger force-pushed the tcclevenger/update_to_cpp20 branch from 0b3a6a9 to 8dbd570 Compare August 5, 2026 19:03
@tcclevenger
tcclevenger force-pushed the tcclevenger/update_to_cpp20 branch from fb6f47d to 705c5b7 Compare August 5, 2026 19:26
tcclevenger added a commit that referenced this pull request Aug 5, 2026
Update EAMxx and Homme to C++20. Changes:

~Update EKAT (now requires C++20)~ (Updated as a part of Initial
port to vista machine at TACC #8604)
Remove setting CXX_STANDARD in EAMxx
Remove setting CXX_STANDARD in machine/cime build files
Update homme standalone testing to use C++20

[non-BFB] Potentially for EAMxx/homme standalone cases
@tcclevenger tcclevenger added the non-BFB PR makes roundoff changes to answers. label Aug 5, 2026
tcclevenger added a commit that referenced this pull request Aug 6, 2026
This bug was introduced in #8604 when updating ekat to use C++20.
See #8559 (comment) for discussion of why this occurs.

[BFB]
tcclevenger added a commit that referenced this pull request Aug 6, 2026
This bug was introduced in #8604 when updating ekat to use C++20. 
See #8559 (comment) for discussion of why this occurs.

[BFB]
@tcclevenger
tcclevenger merged commit 66395db into E3SM-Project:master Aug 6, 2026
14 checks passed
@tcclevenger
tcclevenger deleted the tcclevenger/update_to_cpp20 branch August 6, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

EAMxx C++ based E3SM atmosphere model (aka SCREAM) EKAT Machine Files non-BFB PR makes roundoff changes to answers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants