Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

At a high-level, the diagram below describes how CIME handles these core components:

Image RemovedImage Added

To make sense of the above diagramdiagrams, use this legend:

  • Squares = callstacks
  • Ovals = input/output files
  • Green = python
  • Blue = perl
  • Black = raw text
  • Purple = CMake
  • Pink = XML

Explaining a bit further, the build of an E3SM case is primarily influenced by the Setup (case.setup, represented by the left side of the diagram) and Build (case.build, represented by the right side of the diagram) case phases. Case.setup will call BuildTools.configure, which processes all the XML stuff in E3SM/cime/config/e3sm/machines/config_compilers.xml and produces a Macros.cmake file. This file contains things like which compilers to usecopy cmake_macros from your repository to your case. These macros include a generic Macros.cmake file which uses case settings to include the various compiler and machine macros needed for the case. Macros.cmake will be copied directly into your case and the rest of the contents of cmake_macros will be recursively copied into $case/cmake_macros. These macro files contain things like which compilers to use, which compiler flags to use, and which link flags to add. The next key task for setup is building namelists for each active component. As best as I can tell, our builds are not influenced by namelist files, but the buildnml scripts are responsible for calling the build configure scripts ($component/bld/configure) which are still in Perl for all our core components. The build configure scripts are responsible for producing two key input files for the build phase, "Filepath" and "CCSM_cppdefs", which will be placed in $case/Buildconf/${component}conf (e.g. $case/Buildconf/camconf/Filepath). Filepath is list of directories that will be globbed for source files. An interesting feature of our build system is that no repeated file basenames are allowed. For example, if Filepath contains directories A and B and A/foo.f90 and B/foo.f90 both exist, then only A/foo.f90 will be compiled by our build system (assuming A came first in the Filepath list). I believe the original intent of this approach was to allow for custom per-case srcmods. CCSM_cppdefs is a list of c preprocessor directives that will be applied to every compilation of every source file in the component. Both Filepath and CCSM_cppdefs are tweakable by users (users can modify these files in-place and re-run case.build).

...

  • E3SM/cime_config/machines/config_machines.xml: Contains list of valid compilers (COMPILERS) and environment setup (modules, environment_variables).
  • E3SM/cime_config/machines/config_compilers.xml: DEPRECATED. Contains specifications (flags, link flags, exe names) for compilers (gcc, pgi) as well as machine-specific modifications for those compilers.
  • E3SM/cime_config/machines/Depends.$compiler.$machine.cmakecmake_macros/*: Contains specifications (flags, link flags, exe names) for compilers (gcc, pgi) as well as machine-specific modifications for those compilers. Replaces config_compilers.xml.
  • E3SM/cime_config/machines/Depends.$compiler.$machine.cmake: Contains machine/compiler-specific flag changes for specific E3SM component files
  • E3SM/cime_config/machines/Depends.$compiler.$machine: Contains machine/compiler-specific flag changes for shared-lib files, this system still uses Makefile syntax
  • E3SM/cime/scripts/Tools/e3sm_compile_wrap.py: The default compile/link wrapper. It is used to produce timings of all operations
  • E3SM/components/CMakeLists.txt: The root CMakeLists.txt file for E3SM, mostly just iterates over components and calls functions
  • E3SM/components/cmake/cmake_util.cmake: Contains some generally useful functions for cmake
  • E3SM/components/cmake/build_mpas_model.cmake: Implements the handoff between E3SM's CMake system to MPAS's Cmake system
  • E3SM/components/cmake/common_setup.cmake: Cmake setup common to all core components, this is only invoked ones (AFTER mpas is configured)

  • E3SM/components/cmake/build_model.cmake: Implements how an individual core component gets configures (involves reading the Filepath and CCSM_cppdefs, globbing files, etc)
  • E3SM/components/cmake/*/CMakeLists.txt: Very thin CMakeLists.txt files for each component type, this is just to ensure each component get it's own build area
  • E3SM/components/*/bld/configure: Perl configure script for component, should produce Filepath and CCSM_cppdefs files
  • E3SM/components/*/cime_config/buildnml: The buildnml script for component, controls what flags get passed to $component/bld/configure
  • E3SM/components/*/cime_config/buildlib: The legacy buildlib driver for the classic deprecated Makefile-based build system
  • E3SM/components/*/cime_config/buildlib_cmake: A insertion point for last-minute, component-specific changes before cmake is called. For example, mosart uses this file, not bld/configure, to generate Filepath and CCSM_cppdefs
  • E3SM/components/mpas-source/src/CMakeLists.txt: The root CMakeLists.txt for MPAS
  • E3SM/components/mpas-source/src/cmake_utils.cmake: Contains some generally useful functions for configuring MPAS
  • E3SM/components/mpas-source/src/build_core.cmake: A generic implementation for building MPAS cores
  • E3SM/components/mpas-source/src/core_landice/landice.cmake: The CMake definition of the landice core
  • E3SM/components/mpas-source/src/core_ocean/ocean.cmake: The CMake definition of the ocean core
  • E3SM/components/mpas-source/src/core_seaice/seaice.cmake: The CMake definition of the seaice core
  • $case/Buildconf/*conf: The various build conf dirs for all active components, the Filepath and CCSM_cppdefs files for each component live here
  • $case/Macros.cmake: The file that ultimately includes the relevant files in cmake_macros. You can modify this locally in your case.
  • $case/cmake_macros/*: The files that ultimately sets flags, link flags, etc. You can modify this locally in your case.
  • $case/Macros.make: A makefile macro derived from the cmake macros, needed for the sharedlibs that still use Makefile build systems. This is an auto-generated file that you should never edit.
  • $EXEROOT/cmake-bld: The root cmake build/binary directory 
  • $case/Tools/e3sm_compile_wrap.py: The case-specific compiler wrapper, this will start out as a copy of the e3sm_compile_wrap.py from the repo. Users can customize this one.

...