-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Successfully compile and run GCHP on ubuntu 18.04 with gcc 7.3.0
- Loading branch information
1 parent
af8a2c9
commit 0a9f8f3
Showing
3 changed files
with
111 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#============================================================================== | ||
# Environment variables | ||
#============================================================================== | ||
|
||
# Specify compilers | ||
export CC=gcc | ||
export OMPI_CC=$CC | ||
|
||
export CXX=g++ | ||
export OMPI_CXX=$CXX | ||
|
||
export FC=gfortran | ||
export F77=$FC | ||
export F90=$FC | ||
export OMPI_FC=$FC | ||
export COMPILER=$FC | ||
export ESMF_COMPILER=gfortran | ||
|
||
# MPI Communication | ||
export ESMF_COMM=mpich2 | ||
export MPI_ROOT=$( dirname $( dirname $( which mpirun ) ) ) | ||
|
||
# Base paths | ||
export NETCDF_HOME=/usr | ||
export NETCDF_FORTRAN_HOME=/usr | ||
|
||
export GC_BIN="$NETCDF_HOME/bin" | ||
export GC_INCLUDE="$NETCDF_HOME/include" | ||
export GC_LIB="$NETCDF_HOME/lib" | ||
|
||
# Add to primary path | ||
export PATH=${NETCDF_HOME}/bin:$PATH | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${NETCDF_HOME}/lib | ||
|
||
# If using NetCDF after the C/Fortran split (4.3+), then you will need to | ||
# specify the following additional environment variables | ||
export GC_F_BIN="$NETCDF_FORTRAN_HOME/bin" | ||
export GC_F_INCLUDE="$NETCDF_FORTRAN_HOME/include" | ||
export GC_F_LIB="$NETCDF_FORTRAN_HOME/lib" | ||
export PATH=${NETCDF_FORTRAN_HOME}/bin:$PATH | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${NETCDF_FORTRAN_HOME}/lib | ||
|
||
# Set ESMF optimization (g=debugging, O=optimized (capital o)) | ||
export ESMF_BOPT=O | ||
|
||
#============================================================================== | ||
# Raise memory limits | ||
#============================================================================== | ||
|
||
ulimit -c unlimited # coredumpsize | ||
ulimit -l unlimited # memorylocked | ||
ulimit -u 50000 # maxproc | ||
ulimit -v unlimited # vmemoryuse | ||
|
||
#============================================================================== | ||
# additional fixes for MAPL | ||
#============================================================================== | ||
export GC_CODE_DIR=$HOME/tutorial/Code.GCHP | ||
|
||
# --- Fixes for Makefile --- | ||
# Dependencies files *.d in MAPL are messed up in that | ||
# 1. It directly specifies library headers like mpi.h as dependency, which should have been handled by MPI wrapper like mpicc. | ||
# 2. It cannot find *.mod files that are in another directory. | ||
# VPATH allows makefile to search additional directories, although is not a good practice. | ||
# This prevents the error "no rule to make target" | ||
export VPATH=/usr/include/x86_64-linux-gnu:$VPATH # sys/resource.h | ||
export VPATH=$GC_CODE_DIR/GCHP/Shared/MAPL_Base:$VPATH # mapl_*.mod | ||
export VPATH=$GC_CODE_DIR/GCHP/ESMF/Linux/mod:$VPATH # esmf.mod | ||
|
||
# --- Fixed for header files ("#include <xxx.h>" statement) --- | ||
# This prevents the error "cannot find..." | ||
export CPATH=$GC_CODE_DIR/GCHP/Shared/MAPL_Base:$CPATH # MAPL_Generic.h | ||
export CPATH=$GC_CODE_DIR/GCHP/Shared/GFDL_fms/shared/include:$CPATH # fms_platform.h | ||
|
||
# --- Fixes for module files ("USE xxx" statement) --- | ||
# zonal.f is looking for mapl_constantsmod.mod in its own directory. Even /usr/include/ is not included | ||
sudo ln -sf $GC_CODE_DIR/GCHP/Shared/MAPL_Base/mapl_constantsmod.mod $GC_CODE_DIR/GCHP/Shared/GEOS_Util/plots/ |
18 changes: 18 additions & 0 deletions
18
scripts/build_environment/GCHP/ubuntu/install_libraries.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
# Tested on ubuntu 18.04 LTS (ami-0ac019f4fcb7cb7e6) | ||
sudo apt-get update | ||
|
||
# The quickest way to install NetCDF libraries. Can compile GEOS-Chem classic. | ||
sudo apt-get install -y bc gcc gfortran \ | ||
libnetcdf-dev libnetcdff-dev netcdf-bin \ | ||
python-numpy mpich | ||
|
||
sudo ln -s /usr/include/mpich/* /usr/include/ # so that MAPL can find header files | ||
|
||
# GCHP directly uses `gmake` command, which is not available on ubuntu | ||
# https://ubuntuforums.org/showthread.php?t=1811030 | ||
sudo ln -s /usr/bin/make /usr/bin/gmake | ||
|
||
# hemco_standalone.x and geos both links -lmpichf9 which doesn't exist. | ||
sudo ln -s /usr/lib/mpich/lib/libmpichfort.so /usr/lib/mpich/lib/libmpichf90.so | ||
sudo ln -s /usr/lib/mpich/lib/libmpichfort.a /usr/lib/mpich/lib/libmpichf90.a |