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