E3SM’s Default Build System Converted to CMake

  • November 13, 2019
  • Releases
  • A very significant change was recently introduced to the E3SM’s code by replacing the default build system with one based on CMakeThe “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

    High-level build diagram before CMake

     

    Build Diagram After the Switch to CMake

    High-level diagram of build with CMake

     

    Documentation

    Detailed description can be found at

    Contact

    Jim Foucar, Sandia National Laboratories

    Send this to a friend