Warning, /tools/build_options/unsupported/linux_amd64_gfortran+mpi_generic 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
1335f9f461 Jean*0001 #!/bin/bash
0002 #
0003 #
0004
916fa74662 Jean*0005 # Tested with gcc-gfortran v4.1.x on FC5, FC6, FC8, using flags
1335f9f461 Jean*0006 # formally for gcc-gfortran 4.3*
916fa74662 Jean*0007 # + with gcc-gfortran v4.3.x on FC9, FC10
0008 # + with gcc-gfortran v4.4.x on FC11,FC12,FC13
0009 #
0010 # on baudelaire.csail.mit.edu (FC13), uses:
0011 # export MPI_GCC_DIR=/srv/software/gcc/gcc-packages/gcc-4.4.5/mpich2/mpich2-1.3
0012 # export MPI_INC_DIR=$MPI_GCC_DIR/include
0013 # export PATH=$MPI_GCC_DIR/bin:$PATH
0014 #
0015 #-------
0016 # run with OpenMP: needs to set environment var. OMP_NUM_THREADS
0017 # and generally, needs to increase the thread stack-size:
0018 # - sh,bash:
0019 # > export OMP_NUM_THREADS=2
0020 # > export GOMP_STACKSIZE=400m
0021 # - csh,tcsh:
0022 # > setenv OMP_NUM_THREADS 2
0023 # > setenv GOMP_STACKSIZE 400m
0024 #-------
1335f9f461 Jean*0025
0026 FC=${FC:=mpif77}
0027 F90C=${F90C:=mpif90}
0028 CC=${CC:=mpicc}
0029
916fa74662 Jean*0030 DEFINES='-DWORDLENGTH=4 -DNML_TERMINATOR'
1335f9f461 Jean*0031 CPP='cpp -traditional -P'
0032 EXTENDED_SRC_FLAG='-ffixed-line-length-132'
916fa74662 Jean*0033 GET_FC_VERSION="--version"
1335f9f461 Jean*0034 OMPFLAG='-fopenmp'
0035
0036 NOOPTFLAGS='-O0'
0037 NOOPTFILES=''
0038
0039 INCLUDEDIRS=''
0040 INCLUDES=''
0041 LIBS=''
0042
0043 if test "x$DEVEL" != x ; then
0044 FFLAGS='-g -Wall -W -ffpe-trap=invalid,zero,overflow -fbounds-check'
0045 else
0046 FFLAGS=''
0047 fi
0048
0049 # Requires gfortran from 2006 onwards for -fconvert=big-endian
0050 FFLAGS="$FFLAGS -fconvert=big-endian -fimplicit-none"
916fa74662 Jean*0051 # for big objects:
0052 FFLAGS="$FFLAGS -fPIC"
1335f9f461 Jean*0053
0054 if test "x$IEEE" = x ; then
0055 # No need for IEEE-754
0056 FOPTIM='-O3 -funroll-loops'
65071e63b1 Jean*0057 NOOPTFILES="$NOOPTFILES ini_masks_etc.F"
916fa74662 Jean*0058 CFLAGS="$FOPTIM -fPIC"
1335f9f461 Jean*0059 else
0060 # Try to follow IEEE-754
916fa74662 Jean*0061 FFLAGS="$FFLAGS -Waliasing -Wampersand -Wsurprising -Wline-truncation"
1335f9f461 Jean*0062 FOPTIM='-O0'
916fa74662 Jean*0063 CFLAGS="$FOPTIM -fPIC"
0064 # to get plenty of warnings :
0065 # FFLAGS="$FFLAGS -Wconversion -Wimplicit-interface -Wunused-labels"
0066 # more checking (to use with testreport, put DEVEL option in IEEE section):
0067 # FOPTIM="$FOPTIM -g -ffpe-trap=invalid,zero,overflow -fbounds-check"
1335f9f461 Jean*0068 fi
0069 F90FLAGS=$FFLAGS
0070 F90OPTIM=$FOPTIM
0071
0072 if [ "x$NETCDF_ROOT" != x ] ; then
0073 INCLUDEDIR="${NETCDF_ROOT}/include"
0074 INCLUDES="-I${NETCDF_ROOT}/include"
0075 LIBDIR="${NETCDF_ROOT}/lib"
0076 LIBS="-L${NETCDF_ROOT}/lib"
0077 elif [ "x$NETCDF_HOME" != x ]; then
0078 INCLUDEDIR="${NETCDF_HOME}/include"
0079 INCLUDES="-I${NETCDF_HOME}/include"
0080 LIBDIR="${NETCDF_HOME}/lib"
0081 LIBS="-L${NETCDF_HOME}/lib"
0082 elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
0083 NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
0084 NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
0085 INCLUDEDIR="${NETCDF_INC}"
0086 INCLUDES="-I${NETCDF_INC}"
0087 LIBDIR="${NETCDF_LIB}"
0088 LIBS="-L${NETCDF_LIB}"
0089 elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then
0090 INCLUDEDIR="${NETCDF_INCDIR}"
0091 INCLUDES="-I${NETCDF_INCDIR}"
0092 LIBDIR="${NETCDF_LIBDIR}"
0093 LIBS="-L${NETCDF_LIBDIR}"
0094 elif test -d /usr/include/netcdf-3 ; then
0095 INCLUDES='-I/usr/include/netcdf-3'
0096 LIBS='-L/usr/lib/netcdf-3 -L/usr/lib64/netcdf-3'
0097 elif test -d /usr/include/netcdf ; then
0098 INCLUDES='-I/usr/include/netcdf'
0099 elif test -d /usr/local/netcdf ; then
0100 INCLUDES='-I/usr/local/netcdf/include'
0101 LIBS='-L/usr/local/netcdf/lib'
0102 elif test -d /usr/local/include/netcdf.inc ; then
0103 INCLUDES='-I/usr/local/include'
0104 LIBS='-L/usr/local/lib64'
0105 fi
0106
44bbe01483 Jean*0107 if [ -n "$MPI_INC_DIR" ]; then
0108 INCLUDES="$INCLUDES -I$MPI_INC_DIR"
0109 INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR"
0110 MPIINCLUDEDIR="$MPI_INC_DIR"
0111 MPI_HEADER_FILES='mpif.h mpiof.h'
0112 MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h'
0113 fi