Page tree

MESH - A Community Hydrology - Land Surface Model

Skip to end of metadata
Go to start of metadata

Compiling Standalone MESH on Plato is the same as compiling other Fortran, C/C++, and/or MPI equivalents of these codes. While the GNU GCC/GFortran compiler exists on Plato, users are advised to instead use the Intel compiler, as it is kept more up-to-date.

Sections on this page:

Step-by-step guide

Two steps are involved with compiling code on Plato. First, the module(s) containing the compiler must be loaded, if not already loaded by default. Second, the code must be compiled.

Loading a module for the compiler

Since recent system upgrades to Plato to align with ComputeCanada systems, the necessary modules may be loaded automatically. To check, you can run which mpifort. If it returns a path, then the module containing the compiler is loaded and there is no need to complete the following steps in this section.

[nsid@plato ~]$ which mpifort
  1. Check the version of the Intel compiler available:
    module avail openmpi

    [nsid@plato ~]$ module avail openmpi
    ------- Global Aliases -------
       allinea-cpu -> ddt-cpu    allinea-gpu -> ddt-gpu    arm-forge-cpu -> ddt-cpu    arm-forge-gpu -> ddt-gpu
    ------- Compiler-dependent avx modules -------
       openmpi/1.8.8 (m)    openmpi/2.0.2 (m)    openmpi/2.1.1 (m,D)
       m:  MPI implementations / Implémentations MPI
       L:  Module is loaded
       D:  Default Module
    The module marked D is loaded if no specific version is provided when loading the module.
  2. Load the module:

    1. To load the default version (advised):
      module load openmpi

    2. To load a specific version:
      module load openmpi/1.8.8

      In this case, you should adjust your profile to load the desired version, or else jobs may run using the default version.

You can confirm that the module is loaded using the which command:

[nsid@plato* ~]$ which mpifort

If the module was not loaded, which will return with a message that it cannot find the program:

[nsid@plato* ~]$ which mpifort
/usr/bin/which: no mpifort in (...)

Compiling Standalone MESH

Since Plato has been migrated to SLURM, MPI-compatible programs can no longer be run in serial. They have to be called with 'mpirun -np 1' explicitly, or else recompiled to run in serial (e.g., using 'ifort' compiler).

It is advised to compile both serial and parallel versions of Standalone MESH for Plato. The process of loading the Intel module remains unchanged.

  1. Navigate to the folder containing 'makefile' for Standalone MESH:
    cd /path/to/MESH_Code

    Replace '/path/to/MESH_Code' with the path to the folder containing the 'makefile' and code for Standalone MESH.

  2. Compile the code:

    1. Use makefile.mpi_intel to compile code that is MPI-compatible:

      1. Run 'make -f makefile.mpi_intel' to compile the code.

      2. Run 'make -f makefile.mpi_intel clean' to remove intermediate objects (or else run 'rm *.mod *.o').

        This process creates a program named mpi_sa_mesh.
    2. Use makefile.ifort to compile code to run in serial, which is not MPI-compatible:
      1. Run 'make -f makefile.ifort' to compile the code.

      2. Run 'make -f makefile.ifort clean' to remove intermediate objects (or else run 'rm *.mod *.o').

        This process creates a program named sa_mesh.

It is essential to run the 'clean' command between switching from 'makefile.mpi_intel' and 'makefile.ifort', and vice versa.