fre.make.create_compile_script module

Create_compile_script consists of one method called compile_create to retrieve information from the resolved YAML configuration to generate a compile.sh script to

[modelRoot]/[experiment]/[platform]-[target]/exec/compile.sh

where

  • modelRoot is defined in platforms.yaml

  • experiment is the experiment value in compile.yaml

  • platform and target are passed via the -p / -t CLI options to fre make compile-script and fre make all

When executed, compile.sh

  1. Sets src_dir (where source code was checked out by checkout.sh)

  2. Sets bld_dir (the exec/ directory where the executable is placed)

  3. Sets the path to the mkmf template (value to mkTemplate key in platforms.yaml)

  4. Loads the correct environment modules to set the compile environment (see envSetup in platforms.yaml)

  5. Calls mkmf for each model component listed under src in compile.yaml to generate component Makefiles

  6. Calls make (with -j [makejobs]) to build the model executable

Container platforms are silently skipped — compilation inside a container image is handled by the Dockerfile generated by fre make dockerfile.

fre.make.create_compile_script.compile_create(yamlfile: str, platform: tuple[str], target: tuple[str], makejobs: int = 4, nparallel: int = 1, execute: bool | None = False, verbose: bool | None = None)

Generates the compile.sh script for each bare-metal platform and target combination, and optionally executes compile.sh to compile a model executable.

For each bare-metal platform-target combination, a compile.sh script is written to [modelRoot]/[experiment]/[platform]-[target]/exec/.

Parameters:
  • yamlfile (str) – is the path to the model YAML file (e.g. am5.yaml).

  • platform (tuple[str]) – is one or more FRE platform strings as defined in the platform yaml (e.g. ncrc5.intel23). Container platforms in this tuple are silently ignored.

  • target (tuple[str]) – is one or more mkmf target strings (e.g. debug-openmp, repro-openmp, prod-openmp) One compile.sh is generated per platform/target pair.

  • makejobs (int) – is the number of Makefile recipes to run simultaneously, passed to make -j. Defaults to 4.

  • nparallel (int) – is the number of compile.sh scripts to run concurrently when execute=True. Defaults to 1.

  • execute (bool) – is a flag where if True, run every generated compile.sh after creation. Defaults to False.

  • verbose (bool) – is a flag where if True, set logger level to “DEBUG” for detailed output. Defaults to False, setting the logger level set to “INFO”.

Raises:

ValueError

  • If a specified platform does not exist in the platforms yaml.

  • If the mkTemplate path defined in the platforms yaml does not exist.