Back to home page

MITgcm

 
 

    


Warning, /tools/build_options/linux_amd64_pathf90 is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
8df7fb61a8 Jean*0001 #! /usr/bin/env bash
93eb40a4f1 Cons*0002 #
                0003 #
8df7fb61a8 Jean*0004 # Build options for PathScale (EKOPATH) Compiler on Linux x86-64
                0005 #  first version tested on Fedore Core 3 x86-64 Opteron (Linux batsi)
9bcd734406 Jean*0006 #  updated and tested on acesgrid (Fedora Core 15), using:
                0007 #     module load ekopath       (Version 4.0.10)
6e8ad69775 Jean*0008 # Also tested with MPI on acesgrid, using:
                0009 #     module load ekopath       (Version 4.0.10)
                0010 #   and with mpich1:
                0011 #     module load mvapich
                0012 #   or  with mpich2:
                0013 #     module load mvapich2
                0014 #   or  with openmpi:
                0015 #     module load openmpi
                0016 
8df7fb61a8 Jean*0017 #-------
                0018 # run with OpenMP: needs to set environment var. OMP_NUM_THREADS
                0019 #    and generally, needs to increase the thread stack-size:
                0020 #   -  sh,bash:
                0021 #     > export OMP_NUM_THREADS=2
                0022 #     > export PSC_OMP_STACK_SIZE=400m
                0023 #   - csh,tcsh:
                0024 #     > setenv OMP_NUM_THREADS 2
                0025 #     > setenv PSC_OMP_STACK_SIZE 400m
                0026 #-------
93eb40a4f1 Cons*0027 
6e8ad69775 Jean*0028 if test "x$MPI" = xtrue ; then
                0029   CC=mpicc
                0030   FC=mpif90
                0031   LINK=mpif90
                0032 else
                0033   CC=pathcc
                0034   FC=pathf90
                0035   LINK=pathf90
                0036 fi
9bcd734406 Jean*0037 
a55812cda4 Cons*0038 DEFINES='-DWORDLENGTH=4'
3bf3eecc6b Jean*0039 EXTENDED_SRC_FLAG='-extend-source'
6e8ad69775 Jean*0040 GET_FC_VERSION="--version"
8df7fb61a8 Jean*0041 OMPFLAG='-openmp'
3bf3eecc6b Jean*0042 #OMPFLAG='-openmp -OPT:early_mp=ON'
a55812cda4 Cons*0043 
9bcd734406 Jean*0044 NOOPTFLAGS='-O0 -g'
                0045 NOOPTFILES=''
                0046 
3248e2136a Jean*0047 CFLAGS='-O0 -m64'
                0048 FFLAGS="$FFLAGS -m64 -convert big_endian"
                0049 
                0050 #- for big setups, compile & link with "-fPIC" or set memory-model to "medium":
                0051  CFLAGS="$CFLAGS -fPIC"
                0052  FFLAGS="$FFLAGS -fPIC"
                0053 #-  with FC 19, need to use this without -fPIC (which cancels -mcmodel option):
                0054 #CFLAGS="$CFLAGS -mcmodel=medium"
                0055 #FFLAGS="$FFLAGS -mcmodel=medium"
3bf3eecc6b Jean*0056 #- might want to use '-r8' for fizhi pkg:
                0057 #FFLAGS="$FFLAGS -r8"
a55812cda4 Cons*0058 
3bf3eecc6b Jean*0059 if test "x$IEEE" = x ; then     #- with optimisation:
                0060    #- full optimisation, trips over MITgcm code because of compiler problems:
                0061    #FOPTIM='-Ofast -LNO:fusion=2 -funsafe-math-optimizations'
8f3e8fae18 Jean*0062    #- high optimisation (-O3 & (loop)fusion=2), might find Pb with few S/R:
                0063    #FOPTIM='-O3 -LNO:fusion=2 -funsafe-math-optimizations'
a5a9d4d4aa Jean*0064    #FOPTIM='-O3 -funsafe-math-optimizations'
0328497096 Jean*0065    #- fully safe: switch to -O2 without (loop)fusion=2 (to fix some restart Pb):
a5a9d4d4aa Jean*0066     FOPTIM='-O2 -funsafe-math-optimizations'
0328497096 Jean*0067     NOOPTFILES="$NOOPTFILES exf_interpolate.F"
8f3e8fae18 Jean*0068    #- multi-threaded: mon_set_iounit.F needs lower optimisation (lower than -02)
6e8ad69775 Jean*0069     NOOPTFILES="$NOOPTFILES mon_set_iounit.F"
0328497096 Jean*0070     NOOPTFLAGS='-O1'
93eb40a4f1 Cons*0071 else
3bf3eecc6b Jean*0072   if test "x$DEVEL" = x ; then  #- no optimisation + IEEE :
                0073     FOPTIM='-O0 -OPT:roundoff=0:IEEE_arithmetic=1 -fmath-errno -fno-fast-math'
                0074   else                          #- development/check options:
                0075     FFLAGS="$FFLAGS -ffortran-bounds-check -trapuv -g"
8df7fb61a8 Jean*0076     FOPTIM='-O0 -OPT:roundoff=0:IEEE_arithmetic=1 -fmath-errno -fno-fast-math'
3bf3eecc6b Jean*0077   fi
93eb40a4f1 Cons*0078 fi
a55812cda4 Cons*0079 
                0080 F90FLAGS=$FFLAGS
                0081 F90OPTIM=$FOPTIM
07739a35f2 Jean*0082 GSLLIB='-lgsl -lgslcblas'
a55812cda4 Cons*0083 
6e8ad69775 Jean*0084 INCLUDEDIRS=''
                0085 INCLUDES=''
                0086 LIBS=''
                0087 
a55812cda4 Cons*0088 if [ "x$NETCDF_ROOT" != x ] ; then
                0089     INCLUDEDIR="${NETCDF_ROOT}/include"
                0090     INCLUDES="-I${NETCDF_ROOT}/include"
                0091     LIBDIR="${NETCDF_ROOT}/lib"
                0092     LIBS="-L${NETCDF_ROOT}/lib"
                0093 elif [ "x$NETCDF_HOME" != x ]; then
                0094     INCLUDEDIR="${NETCDF_HOME}/include"
                0095     INCLUDES="-I${NETCDF_HOME}/include"
                0096     LIBDIR="${NETCDF_HOME}/lib"
                0097     LIBS="-L${NETCDF_HOME}/lib"
                0098 elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
                0099     NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
                0100     NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
                0101     INCLUDEDIR="${NETCDF_INC}"
                0102     INCLUDES="-I${NETCDF_INC}"
                0103     LIBDIR="${NETCDF_LIB}"
                0104     LIBS="-L${NETCDF_LIB}"
                0105 elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then
                0106     INCLUDEDIR="${NETCDF_INCDIR}"
                0107     INCLUDES="-I${NETCDF_INCDIR}"
                0108     LIBDIR="${NETCDF_LIBDIR}"
                0109     LIBS="-L${NETCDF_LIBDIR}"
                0110 elif test -d /usr/include/netcdf-3 ; then
                0111     INCLUDES='-I/usr/include/netcdf-3'
                0112     LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3'
                0113 elif test -d /usr/include/netcdf ; then
                0114     INCLUDES='-I/usr/include/netcdf'
                0115 elif test -d /usr/local/netcdf ; then
                0116     INCLUDES='-I/usr/local/netcdf/include'
                0117     LIBS='-L/usr/local/netcdf/lib'
                0118 elif test -d /usr/local/include/netcdf.inc ; then
                0119     INCLUDES='-I/usr/local/include'
                0120     LIBS='-L/usr/local/lib64'
                0121 fi
                0122 
6e8ad69775 Jean*0123 if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then
                0124     INCLUDES="$INCLUDES -I$MPI_INC_DIR"
                0125     INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR"
15978f0412 Jean*0126     #- used for parallel (MPI) DIVA
6e8ad69775 Jean*0127     MPIINCLUDEDIR="$MPI_INC_DIR"
15978f0412 Jean*0128    #MPI_HEADER_FILES='mpif.h mpiof.h'
6e8ad69775 Jean*0129 fi