bow mpt

From Fluids Wiki
Revision as of 14:45, 20 February 2018 by Fluidslab (talk | contribs) (MITgcm config file for bow.math.private etc.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#!/bin/bash
#
# build options for gfortran & mpt at bow
# ensure to use:  module load mpt/2.16
#
# Notes
# NETCDF_ROOT may need to be set below
# MPI_INC_DIR is set by $MPI_ROOT (set by module mpt/2.16)


FC=${FC:=mpif77}
F90C=${F90C:=mpif90}
CC=${CC:=mpicc}

DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR -DHAVE_SIGREG'
CPP='cpp -traditional -P'
EXTENDED_SRC_FLAG='-ffixed-line-length-132'
GET_FC_VERSION="--version"
OMPFLAG='-fopenmp'

NOOPTFLAGS='-O0'
NOOPTFILES=''

INCLUDEDIRS=''
INCLUDES=''
LIBS=''

if test "x$DEVEL" != x ; then
    FFLAGS='-g -Wall -W -ffpe-trap=invalid,zero,overflow -fbounds-check'
else
    FFLAGS=''
fi

# Requires gfortran from 2006 onwards for -fconvert=big-endian
FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none -ffixed-line-length-132"
# for big objects:
FFLAGS="$FFLAGS -fPIC -mcmodel=medium"

if test "x$IEEE" = x ; then
    #  No need for IEEE-754
    FOPTIM='-O3 -funroll-loops'
    NOOPTFILES="$NOOPTFILES ini_masks_etc.F"
    CFLAGS="$FOPTIM -fPIC"
else
    #  Try to follow IEEE-754
    FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation"
    FOPTIM='-O0'
    CFLAGS="$FOPTIM -fPIC"
#   to get plenty of warnings :
#   FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels"
#   more checking (to use with testreport, put DEVEL option in IEEE section):
#   FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check"
fi
F90FLAGS=$FFLAGS
F90OPTIM=$FOPTIM

#NETCDF_ROOT=/path/to/netcdf
if [ "x$NETCDF_ROOT" != x ] ; then
    INCLUDEDIR="${NETCDF_ROOT}/include"
    INCLUDES="-I${NETCDF_ROOT}/include"
    LIBDIR="${NETCDF_ROOT}/lib"
    LIBS="-L${NETCDF_ROOT}/lib"
elif [ "x$NETCDF_HOME" != x ]; then
    INCLUDEDIR="${NETCDF_HOME}/include"
    INCLUDES="-I${NETCDF_HOME}/include"
    LIBDIR="${NETCDF_HOME}/lib"
    LIBS="-L${NETCDF_HOME}/lib"
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
    NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
    NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
    INCLUDEDIR="${NETCDF_INC}"
    INCLUDES="-I${NETCDF_INC}"
    LIBDIR="${NETCDF_LIB}"
    LIBS="-L${NETCDF_LIB}"
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then
    INCLUDEDIR="${NETCDF_INCDIR}"
    INCLUDES="-I${NETCDF_INCDIR}"
    LIBDIR="${NETCDF_LIBDIR}"
    LIBS="-L${NETCDF_LIBDIR}"
elif test -d /usr/include/netcdf-3 ; then
    INCLUDES='-I/usr/include/netcdf-3'
    LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3'
elif test -d /usr/include/netcdf ; then
    INCLUDES='-I/usr/include/netcdf'
elif test -d /usr/local/netcdf ; then
    INCLUDES='-I/usr/local/netcdf/include'
    LIBS='-L/usr/local/netcdf/lib'
elif test -d /usr/local/include/netcdf.inc ; then
    INCLUDES='-I/usr/local/include'
    LIBS='-L/usr/local/lib64'
fi

# MPI_ROOT is set by "module show mpt/2.16"
MPI_INC_DIR=${MPI_ROOT}
if [ -n "$MPI_INC_DIR" ]; then
    INCLUDES="$INCLUDES -I$MPI_INC_DIR"
    INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR"
    MPIINCLUDEDIR="$MPI_INC_DIR"
    MPI_HEADER_FILES='mpif.h mpiof.h'
    MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h'
fi