1 |
ce107 |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
jmc |
1.14 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_ifort11,v 1.13 2013/09/23 23:32:59 jmc Exp $ |
4 |
jmc |
1.2 |
# $Name: $ |
5 |
jmc |
1.7 |
|
6 |
|
|
# Build options for version 11 and newer of intel compiler on Linux AMD64 platform |
7 |
|
|
# Author: Constantinos Evangelinos |
8 |
|
|
|
9 |
|
|
# Tested on baudelaire (FC 13) with intel compiler v.11.1.073 (20100806) |
10 |
jmc |
1.2 |
# |
11 |
jmc |
1.6 |
# OpenMP : tested on danton (FC 14) using intel compiler v.11.1.046 (20090630) |
12 |
jmc |
1.14 |
# and (FC 14,17 & 19) v.12.0.4 (20110427) |
13 |
|
|
# and also (FC 19) v.14.0.0 (20130728) |
14 |
jmc |
1.7 |
# |
15 |
jmc |
1.14 |
# MPI : Tested on danton, with and without OpenMP, |
16 |
|
|
# using intel compiler v.11.1.046 and v.12.0.4 and also v.14.0.0 |
17 |
|
|
# and on acesgrid (FC 15) with intel compiler v.13.0.0.079 (20120731) |
18 |
jmc |
1.7 |
# ==> DON'T FORGET to set environment variable MPI_INC_DIR to the include |
19 |
|
|
# directory of your MPI implementation |
20 |
ce107 |
1.1 |
|
21 |
jmc |
1.2 |
#------- |
22 |
|
|
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
23 |
|
|
# and generally, needs to increase the stack-size: |
24 |
|
|
# - sh,bash: |
25 |
|
|
# > export OMP_NUM_THREADS=2 |
26 |
|
|
# > export KMP_STACKSIZE=400m |
27 |
|
|
# - csh,tcsh: |
28 |
|
|
# > setenv OMP_NUM_THREADS 2 |
29 |
|
|
# > setenv KMP_STACKSIZE 400m |
30 |
jmc |
1.7 |
# NOTE, MPI+OpenMP: might need to set KMP_STACKSIZE in ~/.tcshrc |
31 |
|
|
# (but curiously, works without OMP_NUM_THREADS in ~/.tcshrc). |
32 |
jmc |
1.2 |
#------- |
33 |
|
|
|
34 |
jmc |
1.7 |
if test "x$MPI" = xtrue ; then |
35 |
|
|
CC=${CC:=mpicc} |
36 |
|
|
FC=${FC:=mpif77} |
37 |
|
|
F90C=${F90C:=mpif90} |
38 |
|
|
LINK="$F90C -shared-intel -no-ipo" |
39 |
|
|
else |
40 |
|
|
CC=icc |
41 |
|
|
FC=ifort |
42 |
|
|
F90C=ifort |
43 |
jmc |
1.10 |
LINK="$F90C -shared-intel" |
44 |
jmc |
1.7 |
fi |
45 |
ce107 |
1.1 |
|
46 |
|
|
DEFINES='-DWORDLENGTH=4' |
47 |
jmc |
1.2 |
F90FIXEDFORMAT='-fixed -Tf' |
48 |
ce107 |
1.1 |
EXTENDED_SRC_FLAG='-132' |
49 |
jmc |
1.5 |
GET_FC_VERSION="--version" |
50 |
jmc |
1.2 |
OMPFLAG='-openmp' |
51 |
ce107 |
1.1 |
|
52 |
jmc |
1.5 |
NOOPTFLAGS='-O0 -g' |
53 |
ce107 |
1.1 |
NOOPTFILES='' |
54 |
|
|
|
55 |
jmc |
1.6 |
if test "x$GENERIC" != x ; then |
56 |
|
|
PROCF=-axSSE4.2,SSE4.1,SSSE3,SSE3,SSE2 |
57 |
ce107 |
1.1 |
else |
58 |
jmc |
1.6 |
PROCF=-xHost |
59 |
ce107 |
1.1 |
fi |
60 |
jmc |
1.6 |
|
61 |
jmc |
1.12 |
CFLAGS="-O0 -ip -m64 $PROCF" |
62 |
|
|
FFLAGS="$FFLAGS -m64 -convert big_endian -assume byterecl" |
63 |
|
|
#- for big setups, compile & link with "-fPIC" or set memory-model to "medium": |
64 |
jmc |
1.13 |
#CFLAGS="$CFLAGS -fPIC" |
65 |
|
|
#FFLAGS="$FFLAGS -fPIC" |
66 |
jmc |
1.12 |
#- with FC 19, need to use this without -fPIC (which cancels -mcmodel option): |
67 |
jmc |
1.13 |
CFLAGS="$CFLAGS -mcmodel=medium" |
68 |
|
|
FFLAGS="$FFLAGS -mcmodel=medium" |
69 |
jmc |
1.2 |
#- might want to use '-r8' for fizhi pkg: |
70 |
|
|
#FFLAGS="$FFLAGS -r8" |
71 |
ce107 |
1.1 |
|
72 |
jmc |
1.6 |
if test "x$IEEE" = x ; then #- with optimisation: |
73 |
jmc |
1.14 |
FOPTIM="-O2 -align -ip -fp-model source $PROCF" |
74 |
ce107 |
1.1 |
else |
75 |
jmc |
1.6 |
if test "x$DEVEL" = x ; then #- no optimisation + IEEE : |
76 |
|
|
FOPTIM="-O0 -fp-model source -noalign $PROCF" |
77 |
|
|
else #- development/check options: |
78 |
|
|
#FFLAGS="$FFLAGS -debug all -debug-parameters all -fp-model strict" |
79 |
jmc |
1.8 |
FOPTIM="-O0 -noalign -g -traceback $PROCF" |
80 |
|
|
NOOPTFLAGS=$FOPTIM |
81 |
jmc |
1.9 |
NOOPTFILES='adread_adwrite.F mdsio_rw_field.F mdsio_rw_slice.F' |
82 |
|
|
NOOPTFILES="$NOOPTFILES mdsio_readvector.F mdsio_writevector.F" |
83 |
jmc |
1.8 |
FOPTIM="$FOPTIM -warn all -warn nounused" |
84 |
|
|
FOPTIM="$FOPTIM -fpe0 -ftz -fp-stack-check -check all -ftrapuv" |
85 |
jmc |
1.6 |
fi |
86 |
ce107 |
1.1 |
fi |
87 |
jmc |
1.6 |
|
88 |
ce107 |
1.1 |
F90FLAGS=$FFLAGS |
89 |
|
|
F90OPTIM=$FOPTIM |
90 |
|
|
|
91 |
jmc |
1.7 |
INCLUDEDIRS='' |
92 |
|
|
INCLUDES='' |
93 |
|
|
LIBS='' |
94 |
|
|
|
95 |
ce107 |
1.1 |
if [ "x$NETCDF_ROOT" != x ] ; then |
96 |
|
|
INCLUDEDIRS="${NETCDF_ROOT}/include" |
97 |
|
|
INCLUDES="-I${NETCDF_ROOT}/include" |
98 |
|
|
LIBS="-L${NETCDF_ROOT}/lib64 -L${NETCDF_ROOT}/lib" |
99 |
|
|
elif [ "x$NETCDF_HOME" != x ]; then |
100 |
|
|
INCLUDEDIRS="${NETCDF_HOME}/include" |
101 |
|
|
INCLUDES="-I${NETCDF_HOME}/include" |
102 |
|
|
LIBS="-L${NETCDF_ROOT}/lib64 -L${NETCDF_HOME}/lib" |
103 |
|
|
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
104 |
|
|
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
105 |
|
|
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
106 |
|
|
INCLUDEDIRS="${NETCDF_INC}" |
107 |
|
|
INCLUDES="-I${NETCDF_INC}" |
108 |
|
|
LIBS="-L${NETCDF_LIB}" |
109 |
|
|
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
110 |
|
|
INCLUDEDIRS="${NETCDF_INCDIR}" |
111 |
|
|
INCLUDES="-I${NETCDF_INCDIR}" |
112 |
|
|
LIBS="-L${NETCDF_LIBDIR}" |
113 |
|
|
elif test -d /usr/include/netcdf-3 ; then |
114 |
|
|
INCLUDEDIRS='/usr/include/netcdf-3' |
115 |
|
|
INCLUDES='-I/usr/include/netcdf-3' |
116 |
|
|
LIBS='-L/usr/lib64/netcdf-3 -L/usr/lib/netcdf-3' |
117 |
|
|
elif test -d /usr/local/pkg/netcdf ; then |
118 |
|
|
INCLUDEDIRS='/usr/local/pkg/netcdf/include' |
119 |
|
|
INCLUDES='-I/usr/local/pkg/netcdf/include' |
120 |
|
|
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' |
121 |
|
|
elif test -d /usr/include/netcdf ; then |
122 |
|
|
INCLUDEDIRS='/usr/include/netcdf' |
123 |
|
|
INCLUDES='-I/usr/include/netcdf' |
124 |
|
|
elif test -d /usr/local/netcdf ; then |
125 |
|
|
INCLUDEDIRS='/usr/include/netcdf/include' |
126 |
|
|
INCLUDES='-I/usr/local/netcdf/include' |
127 |
|
|
LIBS='-L/usr/local/netcdf/lib64 -L/usr/local/netcdf/lib' |
128 |
|
|
elif test -f /usr/local/include/netcdf.inc ; then |
129 |
|
|
INCLUDEDIRS='/usr/local/include' |
130 |
|
|
INCLUDES='-I/usr/local/include' |
131 |
|
|
LIBS='-L/usr/local/lib64 -L/usr/local/lib' |
132 |
|
|
fi |
133 |
|
|
|
134 |
jmc |
1.7 |
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
135 |
|
|
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
136 |
|
|
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
137 |
jmc |
1.11 |
#- used for parallel (MPI) DIVA |
138 |
jmc |
1.7 |
MPIINCLUDEDIR="$MPI_INC_DIR" |
139 |
jmc |
1.11 |
#MPI_HEADER_FILES='mpif.h mpiof.h' |
140 |
jmc |
1.7 |
fi |