Warning, /tools/build_options/linux_ia64_cray_ollie is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit f606cc09 on 2018-10-17 15:59:24 UTC
233baf222b Mart*0001 #!/bin/bash
0002 #
c1984bdebd Mart*0003 # Tested on cray CS400 ollie.awi.de
0004 # <https://swrepo1.awi.de/plugins/mediawiki/wiki/hpc/index.php/Main_Page>
0005 # module load craype-broadwell
233baf222b Mart*0006 # module load PrgEnv-cray
0007
0008 FC='ftn'
0009 CC='cc'
0010
0011 FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X ## _"
0012 DEFINES='-DWORDLENGTH=4 '
b0df872762 Mart*0013 # in some cases
0014 DEFINES="$DEFINES -DTARGET_CRAYXT"
233baf222b Mart*0015 CPP='cpp -traditional -P'
0016 EXTENDED_SRC_FLAG='-Mextend'
760edfb165 Mart*0017 OMPFLAG='-homp'
233baf222b Mart*0018 GET_FC_VERSION="-V"
0019 RMFILES='*.lst'
0020
839d600d72 Mart*0021 NOOPTFLAGS="-O1"
b0df872762 Mart*0022 # under some circumstances, the high optimization of floating point operations
0023 # with -fhp3 lead to wrong results of MOD(a,b) in the following function, so
0024 # we need to use a lower (default) value of -hfp2 implicit in the NOOPTFLAGS
0025 NOOPTFILES="exf_getffieldrec.F"
9d9d2b356f Mart*0026 # since the cray compiler update of April 2018, these routines break with -O3
0027 # for tutorial_barotropic_gyre; they work with -O2 and lower, so we include
0028 # them here to be compiled with NOOPTFLAGS.
0029 NOOPTFILES="${NOOPTFILES} exch_r4_send_put_y.F exch_r8_send_put_y.F"
0030 NOOPTFILES="${NOOPTFILES} exch_rl_send_put_y.F exch_rs_send_put_y.F"
0031
760edfb165 Mart*0032 FFLAGS="$FFLAGS -h byteswapio"
b83ae242ca Mart*0033 if test "x$OMP" = xtrue ; then
0034 # alternative if-statement: if test ! "x$OMP" = x ; then
839d600d72 Mart*0035 # for some reason this solves a problem with an unexpected
0036 # "expectStatus=20" when using OpenMP with hyperthreads
bdd5077d47 Mart*0037 NOOPTFILES="${NOOPTFILES} diagnostics_switch_onoff.F mon_init.F mon_set_iounit.F"
839d600d72 Mart*0038 else
b83ae242ca Mart*0039 # be default the cray compiler uses omp, turn it off here
839d600d72 Mart*0040 FFLAGS="$FFLAGS -hnoomp"
760edfb165 Mart*0041 fi
0042 # source file listing with compiler messages:
0043 #FFLAGS="$FFLAGS -rm"
233baf222b Mart*0044 #FFLAGS="$FFLAGS -Wl,--whole-archive,-lhugetlbfs,--no-whole-archive -Wl,-Ttext-segment=0x20000000,-zmax-page-size=0x20000000 "
0045
0046 if test "x$IEEE" = x ; then #- with optimisation:
0047 # this is the default
0048 # FOPTIM='-O2'
0049 # more aggressive
839d600d72 Mart*0050 FOPTIM="-O ipa3 -hfp3 -O3 "
233baf222b Mart*0051 else
839d600d72 Mart*0052 NOOPTFLAGS="-O0"
233baf222b Mart*0053 if test "x$DEVEL" = x ; then #- no optimisation + IEEE :
0054 FOPTIM="-O0 -hfp0"
0055 # -fltconsistency
0056 else #- development/check options:
0057 FOPTIM="-O0 -hfp0"
0058 FOPTIM="$FOPTIM -g -hfp0 -Rbc"
0059 # -r[list_ opt] produces a source listing file *.lst, -rm produces a
0060 # listing with loopmark information and much more, not needed
0061 # for simple tests
0062 # -hmsgs -hnegmsgs writes a lot of optimisation messages to stderr
0063 #FOPTIM="$FOPTIM -rm -hmsgs -hnegmsgs"
0064 fi
0065 fi
0066
b83ae242ca Mart*0067 if test "x$OMP" = xtrue ; then
0068 # this is a necessary hack to have -homp after the optimization flags,
0069 # because -O0 overrides the default to have -homp
0070 FOPTIM="$FOPTIM $OMPFLAG"
0071 OMPFLAG=" "
0072 fi
233baf222b Mart*0073 F90FLAGS=$FFLAGS
0074 F90OPTIM=$FOPTIM
0075 CFLAGS="-O0 $MCMODEL"
0076
51f6851bde Mart*0077
f606cc0984 Mart*0078 # the extra -Wl,-rpath,${NETCDF_LIB} makes sure that the path to the
0079 # dynamics libraries is hardwired in the executable and does not depend
0080 # on which module you have loaded
51f6851bde Mart*0081 if [ "x$NETCDF_ROOT" != x ] ; then
0082 INCLUDEDIRS="${NETCDF_ROOT}/include"
0083 INCLUDES="-I${NETCDF_ROOT}/include"
f606cc0984 Mart*0084 LIBS="-L${NETCDF_ROOT}/lib -Wl,-rpath,${NETCDF_ROOT}/lib"
51f6851bde Mart*0085 elif [ "x$NETCDF_HOME" != x ]; then
0086 INCLUDEDIRS="${NETCDF_HOME}/include"
0087 INCLUDES="-I${NETCDF_HOME}/include"
f606cc0984 Mart*0088 LIBS="-L${NETCDF_HOME}/lib -Wl,-rpath,${NETCDF_HOME}/lib"
51f6851bde Mart*0089 elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
0090 NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
0091 NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
0092 INCLUDEDIRS="${NETCDF_INC}"
0093 INCLUDES="-I${NETCDF_INC}"
f606cc0984 Mart*0094 LIBS="-L${NETCDF_LIB} -Wl,-rpath,${NETCDF_LIB}"
51f6851bde Mart*0095 fi
0096
97c30fdcc9 Mart*0097 if [ -n "$MPI_ROOT" -a -z "$MPI_INC_DIR" ]; then
0098 MPI_INC_DIR=${MPI_ROOT}/include
0099 fi
0100 if [ -n "$MPI_HOME" -a -z "$MPI_INC_DIR" ]; then
0101 MPI_INC_DIR="$MPI_HOME/include"
0102 fi
0103 # MPI_INC_DIR needs to be set properly
0104 if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then
233baf222b Mart*0105 INCLUDES="$INCLUDES -I$MPI_INC_DIR"
0106 INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR"
0107 #- used for parallel (MPI) DIVA
0108 # MPIINCLUDEDIR="$MPI_INC_DIR"
0109 # MPI_HEADER_FILES='mpif.h mpiof.h'
97c30fdcc9 Mart*0110 else
0111 echo "MPI_INC_DIR needs to point to the correct directory, so that"
0112 echo "\$MPI_INC_DIR/mpif.h is available"
233baf222b Mart*0113 fi
0114