1 |
#!/bin/bash |
2 |
# |
3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_ia64_cray_ollie,v 1.8 2017/08/08 12:24:53 mlosch Exp $ |
4 |
# $Name: $ |
5 |
|
6 |
# Tested on cray CS400 ollie.awi.de |
7 |
# <https://swrepo1.awi.de/plugins/mediawiki/wiki/hpc/index.php/Main_Page> |
8 |
# module load craype-broadwell |
9 |
# module load PrgEnv-cray |
10 |
# module swap mvapich2_cce cray-impi |
11 |
# module load intel/impi-5.1.3 |
12 |
|
13 |
FC='ftn' |
14 |
CC='cc' |
15 |
|
16 |
FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X ## _" |
17 |
DEFINES='-DWORDLENGTH=4 ' |
18 |
# in some cases |
19 |
DEFINES="$DEFINES -DTARGET_CRAYXT" |
20 |
CPP='cpp -traditional -P' |
21 |
EXTENDED_SRC_FLAG='-Mextend' |
22 |
OMPFLAG='-homp' |
23 |
GET_FC_VERSION="-V" |
24 |
RMFILES='*.lst' |
25 |
|
26 |
NOOPTFLAGS="-O1" |
27 |
# under some circumstances, the high optimization of floating point operations |
28 |
# with -fhp3 lead to wrong results of MOD(a,b) in the following function, so |
29 |
# we need to use a lower (default) value of -hfp2 implicit in the NOOPTFLAGS |
30 |
NOOPTFILES="exf_getffieldrec.F" |
31 |
|
32 |
FFLAGS="$FFLAGS -h byteswapio" |
33 |
if test "x$OMP" = xtrue ; then |
34 |
# alternative if-statement: if test ! "x$OMP" = x ; then |
35 |
# for some reason this solves a problem with an unexpected |
36 |
# "expectStatus=20" when using OpenMP with hyperthreads |
37 |
NOOPTFILES="${NOOPTFILES} diagnostics_switch_onoff.F mon_init.F mon_set_iounit.F" |
38 |
else |
39 |
# be default the cray compiler uses omp, turn it off here |
40 |
FFLAGS="$FFLAGS -hnoomp" |
41 |
fi |
42 |
# source file listing with compiler messages: |
43 |
#FFLAGS="$FFLAGS -rm" |
44 |
#FFLAGS="$FFLAGS -Wl,--whole-archive,-lhugetlbfs,--no-whole-archive -Wl,-Ttext-segment=0x20000000,-zmax-page-size=0x20000000 " |
45 |
|
46 |
if test "x$IEEE" = x ; then #- with optimisation: |
47 |
# this is the default |
48 |
# FOPTIM='-O2' |
49 |
# more aggressive |
50 |
FOPTIM="-O ipa3 -hfp3 -O3 " |
51 |
else |
52 |
NOOPTFLAGS="-O0" |
53 |
if test "x$DEVEL" = x ; then #- no optimisation + IEEE : |
54 |
FOPTIM="-O0 -hfp0" |
55 |
# -fltconsistency |
56 |
else #- development/check options: |
57 |
FOPTIM="-O0 -hfp0" |
58 |
FOPTIM="$FOPTIM -g -hfp0 -Rbc" |
59 |
# -r[list_ opt] produces a source listing file *.lst, -rm produces a |
60 |
# listing with loopmark information and much more, not needed |
61 |
# for simple tests |
62 |
# -hmsgs -hnegmsgs writes a lot of optimisation messages to stderr |
63 |
#FOPTIM="$FOPTIM -rm -hmsgs -hnegmsgs" |
64 |
fi |
65 |
fi |
66 |
|
67 |
if test "x$OMP" = xtrue ; then |
68 |
# this is a necessary hack to have -homp after the optimization flags, |
69 |
# because -O0 overrides the default to have -homp |
70 |
FOPTIM="$FOPTIM $OMPFLAG" |
71 |
OMPFLAG=" " |
72 |
fi |
73 |
F90FLAGS=$FFLAGS |
74 |
F90OPTIM=$FOPTIM |
75 |
CFLAGS="-O0 $MCMODEL" |
76 |
|
77 |
|
78 |
if [ "x$NETCDF_ROOT" != x ] ; then |
79 |
INCLUDEDIRS="${NETCDF_ROOT}/include" |
80 |
INCLUDES="-I${NETCDF_ROOT}/include" |
81 |
LIBS="-L${NETCDF_ROOT}/lib" |
82 |
elif [ "x$NETCDF_HOME" != x ]; then |
83 |
INCLUDEDIRS="${NETCDF_HOME}/include" |
84 |
INCLUDES="-I${NETCDF_HOME}/include" |
85 |
LIBS="-L${NETCDF_HOME}/lib" |
86 |
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
87 |
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
88 |
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
89 |
INCLUDEDIRS="${NETCDF_INC}" |
90 |
INCLUDES="-I${NETCDF_INC}" |
91 |
LIBS="-L${NETCDF_LIB}" |
92 |
fi |
93 |
|
94 |
if [ -n "$MPI_ROOT" -a -z "$MPI_INC_DIR" ]; then |
95 |
MPI_INC_DIR=${MPI_ROOT}/include |
96 |
fi |
97 |
if [ -n "$MPI_HOME" -a -z "$MPI_INC_DIR" ]; then |
98 |
MPI_INC_DIR="$MPI_HOME/include" |
99 |
fi |
100 |
# MPI_INC_DIR needs to be set properly |
101 |
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
102 |
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
103 |
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
104 |
#- used for parallel (MPI) DIVA |
105 |
# MPIINCLUDEDIR="$MPI_INC_DIR" |
106 |
# MPI_HEADER_FILES='mpif.h mpiof.h' |
107 |
else |
108 |
echo "MPI_INC_DIR needs to point to the correct directory, so that" |
109 |
echo "\$MPI_INC_DIR/mpif.h is available" |
110 |
fi |