Skip to content

Complete support for ninja cmake backend - #8532

Merged
jgfouca merged 3 commits into
masterfrom
jgfouca/e3sm_ninja
Jul 20, 2026
Merged

jgfouca merged 3 commits into
masterfrom
jgfouca/e3sm_ninja

Conversation

@jgfouca

@jgfouca jgfouca commented Jul 2, 2026 •

Copy link
Copy Markdown
Member

With this PR, ninja is a usable CMake backend for E3SM. Ninja offers superior features to gmake with better parallelism, builds that terminate immediately when there's a failure, etc. If you want to try this feature, you can pass --ninja to create_test or change the default CMake backend for your machine, now represented by the config_machines.xml setting CMAKE_BACKEND to ninja.

Change list:

  1. Includes a CIME update that only brings in better ninja support
  2. Update build scripts to use flexible build invocation cmake --build instead of gmake.
  3. Remove obsolete independent build scripts buildexe that appear to be tailored to the pre-cmake E3SM build system.
  4. Make ninja the default for mappy
  5. Update the ninja executable the comes bundled with E3SM.
  6. Remove dangerous comment style in icepack

Fixes #6784

[BFB]

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

This pull request aims to make Ninja a usable CMake backend in E3SM by modernizing build script invocations (favoring cmake --build / cmake --install over direct gmake) and introducing a machine-configurable CMake backend selection.

Changes:

  • Switch several shared-library build scripts from gmake to cmake --build / cmake --install.
  • Add a new CMAKE_BACKEND build setting to driver component config and set mappy to default to ninja.
  • Remove obsolete buildexe scripts from both MOAB and MCT driver configs.

Reviewed changes

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

Show a summary per file
File Description
share/build/buildlib.spio Switch SCORPIO build invocation from gmake to cmake --build.
share/build/buildlib.gptl Switch GPTL build/install from gmake to cmake --build / cmake --install.
share/build/buildlib.ekat Switch EKAT build/install from gmake to cmake --build / cmake --install.
share/build/buildlib.csm_share Switch csm_share build invocation from gmake to cmake --build.
driver-moab/cime_config/config_component.xml Introduce CMAKE_BACKEND entry for MOAB driver build configuration.
driver-mct/cime_config/config_component.xml Introduce CMAKE_BACKEND entry for MCT driver build configuration.
driver-moab/cime_config/buildexe Remove obsolete standalone build script.
driver-mct/cime_config/buildexe Remove obsolete standalone build script.
cime_config/machines/config_machines.xml Set mappy machine default CMAKE_BACKEND to ninja.

Comment thread share/build/buildlib.spio
Comment on lines 210 to +212
# This runs the pio make command from the cmake generated Makefile
logger.info("Building SCORPIO")
run_bld_cmd_ensure_logging(f"{gmake} -j {gmake_j}", logger, from_dir=pio_bld_dir)
run_bld_cmd_ensure_logging(f"cmake --build . -v -j {gmake_j}", logger, from_dir=pio_bld_dir)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is not true:
--parallel [<jobs>], -j [<jobs>]
-v, --verbose

Comment thread share/build/buildlib.gptl
Comment thread share/build/buildlib.ekat
Comment thread share/build/buildlib.csm_share
Comment on lines +799 to +805
<entry id="CMAKE_BACKEND">
<type>char</type>
<default_value>gmake</default_value>
<group>build_def</group>
<file>env_build.xml</file>
<desc>Tells cmake which backend to use</desc>
</entry>
Comment on lines +813 to +819
<entry id="CMAKE_BACKEND">
<type>char</type>
<default_value>gmake</default_value>
<group>build_def</group>
<file>env_build.xml</file>
<desc>Tells cmake which backend to use</desc>
</entry>
@jgfouca jgfouca mentioned this pull request Jul 2, 2026
41 of 50 tasks
@jgfouca
jgfouca requested a review from jonbob July 2, 2026 19:17
jgfouca added a commit that referenced this pull request Jul 3, 2026
Complete support for ninja cmake backend

With this PR, ninja is a usable CMake backend for E3SM. Ninja offers
superior features to gmake with better parallelism, builds that
terminate immediately when there's a failure, etc. If you want to try
this feature, you can pass --ninja to create_test or change the
default CMake backend for your machine, now represented by the
config_machines.xml setting CMAKE_BACKEND to ninja.

Change list:
1) Includes a CIME update that only brings in better ninja support
2) Update build scripts to use flexible build invocation cmake --build instead of gmake.
3) Remove obsolete independent build scripts buildexe that appear to be tailored to the pre-cmake E3SM build system.
4) Make ninja the default for mappy
5) Update the ninja executable the comes bundled with E3SM.

Fixes #6784

[BFB]
@rljacob

rljacob commented Jul 3, 2026

Copy link
Copy Markdown
Member

can this option be used with create_newcase ?

@rljacob

rljacob commented Jul 4, 2026

Copy link
Copy Markdown
Member

The switch the ninja appears to have created diffs in mappy testing. Please revert this from next if you can't explain/fix that.

rljacob added a commit that referenced this pull request Jul 6, 2026
This reverts commit 76e4639, reversing
changes made to 88fc2c2.

Unexplained diffs on mappy next
@rljacob

rljacob commented Jul 6, 2026

Copy link
Copy Markdown
Member

reverted from next so we have a clean dashboard Monday.

@jgfouca

jgfouca commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@rljacob ,

can this option be used with create_newcase ?

There's no need. They can just add --ninja when they call case.build.

@jgfouca jgfouca added Icepack MPAS-seaice Concerning the MPAS-seaice model labels Jul 8, 2026
@jgfouca

jgfouca commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

@jonbob , some small changes to ice stuff was needed.

@jonbob

jonbob commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

@jgfouca -- you had to change a line in the icepack submodule?

@jgfouca

jgfouca commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

@jonbob , yep! It was a brutal debugging session. I explained the problem in the upstream PR I made:
CICE-Consortium/Icepack#562

@jonbob

jonbob commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

That would be really messy -- excellent sleuthing! So will this PR wait until the one into icepack gets merged?

@jgfouca

jgfouca commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

@jonbob , thanks! I don't think we need to wait because I added the patch to our version. I made the upstream PR so that, whenever we update the submodule in the future, the fix will be there.

jgfouca added a commit that referenced this pull request Jul 16, 2026
Complete support for ninja cmake backend

With this PR, ninja is a usable CMake backend for E3SM. Ninja offers
superior features to gmake with better parallelism, builds that
terminate immediately when there's a failure, etc. If you want to try
this feature, you can pass --ninja to create_test or change the
default CMake backend for your machine, now represented by the
config_machines.xml setting CMAKE_BACKEND to ninja.

Change list:
1) Includes a CIME update that only brings in better ninja support
2) Update build scripts to use flexible build invocation cmake --build instead of gmake.
3) Remove obsolete independent build scripts buildexe that appear to be tailored to the pre-cmake E3SM build system.
4) Make ninja the default for mappy
5) Update the ninja executable the comes bundled with E3SM.
6) Remove dangerous comment style in icepack

Fixes #6784

[BFB]

* jgfouca/e3sm_ninja:
  Fix very subtle f90 comment cpp issue
jgfouca added a commit that referenced this pull request Jul 16, 2026
@jgfouca
jgfouca merged commit a468e63 into master Jul 20, 2026
@jgfouca
jgfouca deleted the jgfouca/e3sm_ninja branch July 20, 2026 18:14
darincomeau added a commit to E3SM-Project/Icepack that referenced this pull request Jul 23, 2026
Bringing comment change introduced in E3SM-Project/E3SM#8532 into main.
Fix unsafe comment
jonbob added a commit that referenced this pull request Jul 24, 2026
…t (PR #8582)

Updating Icepack hash to main branch

Updates Icepack submodule hash to point to main. The comment change
introduced in #8532 changed the Icepack hash
(E3SM-Project/Icepack@5d30e92) away from main. This change has been
brought into the Icepack main branch in E3SM-Project/Icepack#44, so this
PR has no code changes, only submodule hash update.

[BFB]
jonbob added a commit that referenced this pull request Jul 27, 2026
Updating Icepack hash to main branch

Updates Icepack submodule hash to point to main. The comment change
introduced in #8532 changed the Icepack hash
(E3SM-Project/Icepack@5d30e92) away from main. This change has been
brought into the Icepack main branch in E3SM-Project/Icepack#44, so this
PR has no code changes, only submodule hash update.

[BFB]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

case.build unnecessarily continues after encountering the first build error

5 participants