Example c-shell commands
################################################################################
#     In order to build the CAMx model with MPI support, some version of 
#     an MPI development package must be available on the the same system
#     where you compile/build the model. This package includes static libraries
#     used to link into the CAMx executable, as well as the FORTRAN header files
#     (mpif.h) needed for compiling CAMx. We recommend that the MPI package is
#     built from source code using the same compiler that is used to compile
#     CAMx.
#
#     This document is guidance on how to build MPI for use with CAMx. It is 
#     not a shell script. Instead, it contains a list of the commands that 
#     should be executed and the order of execution. It is assumed that this 
#     will be done from the command line. The are 2 sections: one for MPICH3
#     and another for OpenMPI.
################################################################################
#         Building MPICH3 (OpenMPI is below)
#         This guidance uses v3.0.4. The libraries in MPICH3 changed with v3.1
################################################################################
#
# ---- make sure you are using C-shell (the commands could easily be 
#      translated to BASH shell) ----
#
tcsh
#
# ---- Download MPICH3 source code 
#      Put this package in a directory on your system.  We will refer to this
#      directory as {SRC_DIR}. The build of each package will be in a different 
#      directory (such as /usr/local).  We will refer to the directory where 
#      the packages will be built as {BLD_DIR} ----
#
https://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz
#
# ---- Set the environment variable for the compilers to be used to build
#      the packages. We recommend that you use gcc for all C compilations.
#      The FORTRAN compiler should be the same compiler used to build CAMx ----
#
setenv FC pgf90
setenv CC gcc
#
# ---- Move to the source code directory
#
cd {SRC_DIR}
#
# ---- Build the MPICH3 package ---
#
tar xvzf mpich-3.0.4.tar.gz
cd mpich-3.0.4
./configure --prefix={BLD_DIR}/mpich-3.0.4
make
make install
#
# ---- Verify that libraries and executables were built ----
#
ls -l {BLD_SRC}/mpich-3.0.4/lib/libmpich.a
ls -l {BLD_SRC}/mpich-3.0.4/lib/libmpl.a
ls -l {BLD_SRC}/mpich-3.0.4/bin/mpiexec
#
################################################################################
#         Building OpenMPI (MPICH3 is above)
################################################################################
#
# ---- Make sure you are using C-shell (the commands could easily be 
#      translated to BASH shell) ----
#
tcsh
#
# ---- Download OpenMPI source code 
#      Put this package in a directory on your system.  We will refer to this
#      directory as {SRC_DIR}. The build of each package will be in a different
$      directory (such as /usr/local).  We will refer to the directory where 
#      the packages will be built as {BLD_DIR} ----
#
https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.1.0.tar.gz
#
# ---- Set the environment variable for the compilers to be used to build
#      the packages. We recommend that you use gcc for all C compilations.
#      The FORTRAN compiler should be the same compiler used to build CAMx ----
#
setenv FC pgf90
setenv CC gcc
#
# ---- Move to the source code directory
#
cd {SRC_DIR}
#
# ---- Build the OpenMPI package ---
#
tar xvzf openmpi-4.1.0.tar.gz
cd openmpi-4.1.0
./configure --prefix={BLD_DIR}/openmpi-4.1.0 --enable-static
make
make install
#
# ---- Verify that libraries and executables were built ----
#
ls -l {$BLD_DIR}/openmpi-4.1.0/lib/libmpi.a
ls -l {$BLD_DIR}/openmpi-4.1.0/lib/libmpi_mpifh.a
ls -l {$BLD_DIR}/openmpi-4.1.0/bin/mpirun
ls -l {$BLD_DIR}/openmpi-4.1.0/bin/mpif90
################################################################################