Warning, /tools/build_options/linux_amd64_ifort+gcc is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit c26ad343 on 2023-02-14 14:29:40 UTC
1f8408d1d2 Jean*0001 #!/bin/bash
0002 #
0003 # Build options for intel fortran compiler (ifort) & gnu C compiler (gcc) on Linux AMD64 platform
0004
0005 # Tested on svante (FC 24) with Intel Fortran compiler 17.0.3 (20170404)
0006 # and GNU C compiler 6.3.1 (20161221)
0007 #
0008 # MPI : Tested svante, with OpenMPI 1.10.5
0009 # ==> DON'T FORGET to set environment variable MPI_INC_DIR to the include
0010 # directory of your MPI implementation
0011
0012 if test "x$MPI" = xtrue ; then
0013 FC=${FC:=mpif77}
0014 F90C=${F90C:=mpif90}
0015 LINK="$F90C -shared-intel -no-ipo"
0016 else
0017 FC=ifort
0018 F90C=ifort
0019 LINK="$F90C -shared-intel"
0020 fi
0021 CC=gcc
0022
0023 DEFINES='-DWORDLENGTH=4'
0024 F90FIXEDFORMAT='-fixed -Tf'
0025 EXTENDED_SRC_FLAG='-132'
0026 GET_FC_VERSION="--version"
0027 OMPFLAG='-openmp'
0028
0029 NOOPTFLAGS='-O0 -g'
0030 NOOPTFILES=''
0031
c26ad343d2 Jean*0032 #- for setting specific options, check compiler version:
0033 fcVers=`$FC $GET_FC_VERSION | head -n 1 | awk '{print $NF}'`
0034 if ! [[ $fcVers =~ ^[0-9]+$ ]] ; then
0035 echo " un-recognized Compiler-release '$fcVers' ; ignored (-> set to 0)" ; fcVers=0 ;
0036 else echo " get Compiler-release: '$fcVers'" ; fi
0037 if [ $fcVers -ge 20160301 ] ; then
0038 OMPFLAG='-qopenmp'
0039 fi
0040
1f8408d1d2 Jean*0041 if test "x$GENERIC" != x ; then
0042 PROCF=-axSSE4.2,SSE4.1,SSSE3,SSE3,SSE2
0043 else
0044 PROCF=-xHost
0045 fi
0046
0047 CFLAGS='-O0'
0048 FFLAGS="$FFLAGS -m64 -convert big_endian -assume byterecl"
0049 #- for big setups, compile & link with "-fPIC" or set memory-model to "medium":
0050 #CFLAGS="$CFLAGS -fPIC"
0051 #FFLAGS="$FFLAGS -fPIC"
0052 #- with FC 19, need to use this without -fPIC (which cancels -mcmodel option):
0053 CFLAGS="$CFLAGS -mcmodel=medium"
0054 FFLAGS="$FFLAGS -mcmodel=medium"
0055 #- might want to use '-r8' for fizhi pkg:
0056 #FFLAGS="$FFLAGS -r8"
0057
0058 if test "x$IEEE" = x ; then #- with optimisation:
0059 FOPTIM="-O2 -align -ip -fp-model source $PROCF"
0060 else
0061 if test "x$DEVEL" = x ; then #- no optimisation + IEEE :
0062 FOPTIM="-O0 -fp-model source -noalign $PROCF"
0063 else #- development/check options:
0064 #FFLAGS="$FFLAGS -debug all -debug-parameters all -fp-model strict"
0065 FOPTIM="-O0 -noalign -g -traceback $PROCF"
0066 NOOPTFLAGS=$FOPTIM
dba3d5ad42 Jean*0067 NOOPTFILES='adread_adwrite.F'
1f8408d1d2 Jean*0068 FOPTIM="$FOPTIM -warn all -warn nounused"
0069 FOPTIM="$FOPTIM -fpe0 -ftz -fp-stack-check -check all -ftrapuv"
0070 fi
0071 fi
0072
0073 F90FLAGS=$FFLAGS
0074 F90OPTIM=$FOPTIM
0075
0076 INCLUDEDIRS=''
0077 INCLUDES=''
0078 LIBS=''
0079
0080 if [ "x$NETCDF_ROOT" != x ] ; then
0081 INCLUDEDIRS="${NETCDF_ROOT}/include"
0082 INCLUDES="-I${NETCDF_ROOT}/include"
0083 LIBS="-L${NETCDF_ROOT}/lib64 -L${NETCDF_ROOT}/lib"
0084 elif [ "x$NETCDF_HOME" != x ]; then
0085 INCLUDEDIRS="${NETCDF_HOME}/include"
0086 INCLUDES="-I${NETCDF_HOME}/include"
0087 LIBS="-L${NETCDF_ROOT}/lib64 -L${NETCDF_HOME}/lib"
0088 elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
0089 NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
0090 NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
0091 INCLUDEDIRS="${NETCDF_INC}"
0092 INCLUDES="-I${NETCDF_INC}"
0093 LIBS="-L${NETCDF_LIB}"
0094 elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then
0095 INCLUDEDIRS="${NETCDF_INCDIR}"
0096 INCLUDES="-I${NETCDF_INCDIR}"
0097 LIBS="-L${NETCDF_LIBDIR}"
0098 elif test -d /usr/include/netcdf-3 ; then
0099 INCLUDEDIRS='/usr/include/netcdf-3'
0100 INCLUDES='-I/usr/include/netcdf-3'
0101 LIBS='-L/usr/lib64/netcdf-3 -L/usr/lib/netcdf-3'
0102 elif test -d /usr/local/pkg/netcdf ; then
0103 INCLUDEDIRS='/usr/local/pkg/netcdf/include'
0104 INCLUDES='-I/usr/local/pkg/netcdf/include'
0105 LIBS='-L/usr/local/pkg-x86_64/netcdf/lib64 -L/usr/local/pkg-x86_64/netcdf/lib -L/usr/local/pkg/netcdf/lib64 -L/usr/local/pkg/netcdf/lib'
0106 elif test -d /usr/include/netcdf ; then
0107 INCLUDEDIRS='/usr/include/netcdf'
0108 INCLUDES='-I/usr/include/netcdf'
0109 elif test -d /usr/local/netcdf ; then
0110 INCLUDEDIRS='/usr/include/netcdf/include'
0111 INCLUDES='-I/usr/local/netcdf/include'
0112 LIBS='-L/usr/local/netcdf/lib64 -L/usr/local/netcdf/lib'
0113 elif test -f /usr/local/include/netcdf.inc ; then
0114 INCLUDEDIRS='/usr/local/include'
0115 INCLUDES='-I/usr/local/include'
0116 LIBS='-L/usr/local/lib64 -L/usr/local/lib'
0117 fi
0118
0119 if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then
0120 INCLUDES="$INCLUDES -I$MPI_INC_DIR"
0121 INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR"
0122 #- used for parallel (MPI) DIVA
0123 MPIINCLUDEDIR="$MPI_INC_DIR"
0124 #MPI_HEADER_FILES='mpif.h mpiof.h'
0125 fi