Difference between revisions of "Setting Up the GCHP Environment"

From Geos-chem
Jump to: navigation, search
Line 6: Line 6:
#<span style="color:blue">'''Setting Up the GCHP Environment'''</span>
#<span style="color:blue">'''Setting Up the GCHP Environment'''</span>
#[[GCHP_Basic_Example_Run|Running GCHP: Part 1]]
#[[Running_GCHP:_Basics|Running GCHP: Basics]]
#[[Running_GCHP|Running GCHP: Part 2]]
#[[Running_GCHP:_Configuration|Running GCHP: Configuration]]
#[[GEOS-Chem_HP_Output_Data|Output Data]]
#[[GEOS-Chem_HP_Output_Data|Output Data]]
#[[Developing_GCHP|Developing GCHP]]
#[[Developing_GCHP|Developing GCHP]]

Revision as of 23:00, 6 March 2019

Previous | Next | User Manual Home | GCHP Home

  1. Hardware and Software Requirements
  2. Downloading Source Code and Data Directories
  3. Obtaining a Run Directory
  4. Setting Up the GCHP Environment
  5. Compiling
  6. Running GCHP: Basics
  7. Running GCHP: Configuration
  8. Output Data
  9. Developing GCHP
  10. Run Configuration Files

Create an Environment File

You must load all necessary libraries and export certain environment variables before compiling GCHP. The GCHP environment is different from GEOS-Chem Classic and is often considered the largest obstacle to getting GCHP up and running for the first time. We have tried to make setting libraries and variables as automatic as possible to minimize problems. However, libraries will always be specific to your local compute cluster which presents challenges for compatibility. We recommend simplifying the environment setup process by customizing a GCHP-specific environment file that works on your system and saving it for future work.

Sample environment files are included in the run directory, several for the Harvard University Odyssey cluster and one for a more generic Linux system. These are located in the bashrcSamples subdirectory for versions prior to 12.1.0, and in the environmentFileSamples subdirectory starting in 12.1.0. You can use these to develop one compatible with your system. Each sample environment file is customized for a specific combination of Fortran compiler, MPI implementation, netCDF libraries, and compute cluster. For clarity we recommend using the naming format gchp.compiler_mpi_cluster.env. For example, gchp.ifort17_openMPI3_computecanada.env.

We recommend opening several of the sample environment files and getting familiar with the environment variables set. The files include printing the variables to screen when sourced. This is particularly useful for logging purposes if you automatically source the environment file within a run script as all of the run script samples included in the run directory do. The environment variables will be printed to your system log file and will reflect the settings used during your run, potentially useful for debugging and archiving.

An example of environment variables needed for GCHP are as follows:

Gchp Env.png

System memory limits should also be set to unlimited if possible.

Gchp Memory.png

Also included in the sample environment files are a few aliases for commands that are commonly used when developing, compiling, and running GCHP. It may be useful to look at them to see if you would like to adopt them or add your own.

GCHP aliases.png

Expanding MPI Options

GCHP is compatible with MPICH, OpenMPI, and MVAPICH2 MPI implementations. However, you may want to use a different implementation, possibly out of necessity. To do this, follow the steps below.

  1. Specify environment variable ESMF_COMM to match the MPI implementation. Options are currently in place for MVAPICH2 (ESMF_COMM=mvapich2), OpenMPI (ESMF_COMM=openmpi), and a generic MPI implementation. (ESMF_COMM=mpi). The generic option is sufficient when, for example, running with the SGI MPI implementation on NASA's Pleiades servers. If you are using a new MPI implementation not covered by one of these options, we recommend running first with ESMF_COMM=mpi.
  2. Specify the environment variable MPI_ROOT to point to the MPI root directory, such that $MPI_ROOT/bin/mpirun points to the correct MPI run binary.
  3. Ensure that you have valid mpif90 and mpifort executables. These almost always perform the same role but both names are invoked in the build sequence. If you have one but not the other, we strongly recommend that you make a symbolic link to the working binary with the name of the missing binary in a dedicated folder, and then add that folder to your path at the command line and in your .bashrc. For example, if you have a mpifort binary but not an mpif90 binary, run the following commands:
mkdir $HOME/mpi_extra
cd $HOME/mpi_extra
ln -s $( which mpifort ) mpif90
export PATH=${PATH}:${HOME}/mpi_extra

You should now try to compile GCHP. If the generic option does not work then you will need to implement a new option. This involves updating GCHP source code. An example of how to do this for Intel MPI is as follows:

  1. Decide a new name, such as ESMF_COMM=intel for the Intel MPI implementation.
  2. Determine the relevant include path and linker commands for your MPI implementation. In this example for Intel MPI they are $(MPI_ROOT)/include and -L$(MPI_ROOT)/lib -lmpi -lmpi++ respectively.
  3. Update source code files CodeDir/GCHP/GIGC.mk and CodeDir/GCHP/Shared/Config/ESMA_base.mk. In both files, search for environment variable ESMF_COMM in the file. You should find a small set of occurrences in a single "if..else.." block. Add a new clause below the one for mvapich2 as follows.

In GIGC.mk:

else ifeq ($(ESMF_COMM),intel)
   # %%%%% Intel MPI %%%%%
   MPI_LIB     := -L$(MPI_ROOT)/lib -lmpi -lmpi++

In ESMA_base.mk:

else ifeq ($(ESMF_COMM),intel)
   INC_MPI := $(MPI_ROOT)/include
   LIB_MPI := -L$(MPI_ROOT)/lib -lmpi -lmpi++

Previous | Next | User Manual Home | GCHP Home