E3SM’s Default Build System Converted to CMake
A very significant change was recently introduced to the E3SM’s code by replacing the default build system with one based on CMake. The “build system” is the set of software scripts that compiles the software code into binary code. E3SM uses Common Infrastructure for Modeling the Earth (CIME) to configure, build, run and test the Earth System Model. Since the re-writing of the case control system code into the python language, this is the most significant change to CIME. CMake was a tool of choice because it is a well established, cross-platform, free and open-source software tool for managing the build process of software using a compiler-independent method.
Motivation
Several important objectives impacted the design of the system. They are:
- Allow the developer to get much “closer” to the build commands. Instead of significant layers of CIME “magic” in-between the developer and their build, they can now simply go to the build directory and type “ninja” command.
- Reduce latency in development cycle.
- Reduce complexity/technical-debt of the existing system.
- Improve overall build times (preliminary testing shows nearly 2x speedup in builds on a large workstation).
- Eliminate build reliance on hidden environment settings in CIME.
- Bring E3SM closer in-line with other CMake-based code bases.
- Improve understanding of the E3SM build system.
- Put E3SM on a sustainable path going into the future with easier integration of new code and components.
Features
Here are a few features of the new system
- Instead of significant layers of CIME calls in-between the developer and their build, they can now simply go to the build directory and type “make” (but still must create a case with CIME).
- There are no longer separate build directories with logs for each component. Since it all goes through a single CMake invocation, there’s only one log file and one build directory. Within that single build directory, each component will have its own build subdirectory.
- One can go back to the “classic” build system by providing the “–use-old” option when setting up the model.
- E3SM can now support various CMake backends such as “ninja”.
- Component developers should never have to worry about Fortran dependencies again, CMake takes care of that automatically.
High-level Overview of Build Change
The diagrams below show how complex the E3SM build system was before adopting CMake, notice the order of commands in the build section and how they are invoked. CMake makes the build simple, exposed to the user, and orderly.
Build Diagram Before
Build Diagram After the Switch to CMake
Documentation
Detailed description can be found at
- Github: https://github.com/E3SM-Project/E3SM/pull/3043
- E3SM Internal Confluence Documentation: E3SM Build System and CMake
Contact
Jim Foucar, Sandia National Laboratories