1 |
jahn |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
|
|
# $Header$ |
4 |
|
|
# $Name$ |
5 |
|
|
# |
6 |
|
|
# Build options for ifort with impi on Linux AMD64 platform |
7 |
|
|
# |
8 |
|
|
# Tested on engaging1 (Centos 6) with ifort 14.0.2 (20140120) and impi 4.1.3.048 |
9 |
|
|
# |
10 |
|
|
#------- |
11 |
|
|
|
12 |
|
|
if test "x$MPI" = xtrue ; then |
13 |
|
|
CC=${MPICC:=mpiicc} |
14 |
|
|
FC=${MPIFC:=mpiifort} |
15 |
|
|
F90C=${MPIF90C:=mpiifort} |
16 |
|
|
LINK="$F90C -shared-intel -no-ipo" |
17 |
|
|
else |
18 |
|
|
CC=icc |
19 |
|
|
FC=ifort |
20 |
|
|
F90C=ifort |
21 |
|
|
LINK="$F90C -shared-intel" |
22 |
|
|
fi |
23 |
|
|
|
24 |
|
|
DEFINES='-DWORDLENGTH=4' |
25 |
|
|
F90FIXEDFORMAT='-fixed -Tf' |
26 |
|
|
EXTENDED_SRC_FLAG='-132' |
27 |
|
|
GET_FC_VERSION="--version" |
28 |
|
|
OMPFLAG='-openmp' |
29 |
|
|
|
30 |
|
|
NOOPTFLAGS='-O0 -g' |
31 |
|
|
NOOPTFILES='' |
32 |
|
|
|
33 |
|
|
if test "x$GENERIC" != x ; then |
34 |
|
|
PROCF=-axSSE4.2,SSE4.1,SSSE3,SSE3,SSE2 |
35 |
|
|
else |
36 |
|
|
PROCF=-xHost |
37 |
|
|
fi |
38 |
|
|
|
39 |
|
|
CFLAGS="-O0 -ip -m64 $PROCF" |
40 |
|
|
FFLAGS="$FFLAGS -m64 -convert big_endian -assume byterecl" |
41 |
|
|
#- for big setups, compile & link with "-fPIC" or set memory-model to "medium": |
42 |
|
|
#CFLAGS="$CFLAGS -fPIC" |
43 |
|
|
#FFLAGS="$FFLAGS -fPIC" |
44 |
|
|
#- with FC 19, need to use this without -fPIC (which cancels -mcmodel option): |
45 |
|
|
CFLAGS="$CFLAGS -mcmodel=medium" |
46 |
|
|
FFLAGS="$FFLAGS -mcmodel=medium" |
47 |
|
|
#- might want to use '-r8' for fizhi pkg: |
48 |
|
|
#FFLAGS="$FFLAGS -r8" |
49 |
|
|
|
50 |
|
|
if test "x$IEEE" = x ; then #- with optimisation: |
51 |
|
|
FOPTIM="-O2 -align -ip -fp-model source $PROCF" |
52 |
|
|
else |
53 |
|
|
if test "x$DEVEL" = x ; then #- no optimisation + IEEE : |
54 |
|
|
FOPTIM="-O0 -fp-model source -noalign $PROCF" |
55 |
|
|
else #- development/check options: |
56 |
|
|
#FFLAGS="$FFLAGS -debug all -debug-parameters all -fp-model strict" |
57 |
|
|
FOPTIM="-O0 -noalign -g -traceback $PROCF" |
58 |
|
|
NOOPTFLAGS=$FOPTIM |
59 |
|
|
NOOPTFILES='adread_adwrite.F mdsio_rw_field.F mdsio_rw_slice.F' |
60 |
|
|
FOPTIM="$FOPTIM -warn all -warn nounused" |
61 |
|
|
FOPTIM="$FOPTIM -fpe0 -ftz -fp-stack-check -check all -ftrapuv" |
62 |
|
|
fi |
63 |
|
|
fi |
64 |
|
|
|
65 |
|
|
F90FLAGS=$FFLAGS |
66 |
|
|
F90OPTIM=$FOPTIM |
67 |
|
|
|
68 |
|
|
INCLUDEDIRS='' |
69 |
|
|
INCLUDES='' |
70 |
|
|
LIBS='' |
71 |
|
|
|
72 |
|
|
if [ "x$NETCDF_ROOT" != x ] ; then |
73 |
|
|
INCLUDEDIRS="${NETCDF_ROOT}/include" |
74 |
|
|
INCLUDES="-I${NETCDF_ROOT}/include" |
75 |
|
|
LIBS="-L${NETCDF_ROOT}/lib64 -L${NETCDF_ROOT}/lib" |
76 |
|
|
elif [ "x$NETCDF_HOME" != x ]; then |
77 |
|
|
INCLUDEDIRS="${NETCDF_HOME}/include" |
78 |
|
|
INCLUDES="-I${NETCDF_HOME}/include" |
79 |
|
|
LIBS="-L${NETCDF_ROOT}/lib64 -L${NETCDF_HOME}/lib" |
80 |
|
|
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
81 |
|
|
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
82 |
|
|
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
83 |
|
|
INCLUDEDIRS="${NETCDF_INC}" |
84 |
|
|
INCLUDES="-I${NETCDF_INC}" |
85 |
|
|
LIBS="-L${NETCDF_LIB}" |
86 |
|
|
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
87 |
|
|
INCLUDEDIRS="${NETCDF_INCDIR}" |
88 |
|
|
INCLUDES="-I${NETCDF_INCDIR}" |
89 |
|
|
LIBS="-L${NETCDF_LIBDIR}" |
90 |
|
|
elif test -d /usr/include/netcdf-3 ; then |
91 |
|
|
INCLUDEDIRS='/usr/include/netcdf-3' |
92 |
|
|
INCLUDES='-I/usr/include/netcdf-3' |
93 |
|
|
LIBS='-L/usr/lib64/netcdf-3 -L/usr/lib/netcdf-3' |
94 |
|
|
elif test -d /usr/local/pkg/netcdf ; then |
95 |
|
|
INCLUDEDIRS='/usr/local/pkg/netcdf/include' |
96 |
|
|
INCLUDES='-I/usr/local/pkg/netcdf/include' |
97 |
|
|
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' |
98 |
|
|
elif test -d /usr/include/netcdf ; then |
99 |
|
|
INCLUDEDIRS='/usr/include/netcdf' |
100 |
|
|
INCLUDES='-I/usr/include/netcdf' |
101 |
|
|
elif test -d /usr/local/netcdf ; then |
102 |
|
|
INCLUDEDIRS='/usr/include/netcdf/include' |
103 |
|
|
INCLUDES='-I/usr/local/netcdf/include' |
104 |
|
|
LIBS='-L/usr/local/netcdf/lib64 -L/usr/local/netcdf/lib' |
105 |
|
|
elif test -f /usr/local/include/netcdf.inc ; then |
106 |
|
|
INCLUDEDIRS='/usr/local/include' |
107 |
|
|
INCLUDES='-I/usr/local/include' |
108 |
|
|
LIBS='-L/usr/local/lib64 -L/usr/local/lib' |
109 |
|
|
fi |
110 |
|
|
|
111 |
|
|
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
112 |
|
|
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
113 |
|
|
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
114 |
|
|
#- used for parallel (MPI) DIVA |
115 |
|
|
MPIINCLUDEDIR="$MPI_INC_DIR" |
116 |
|
|
#MPI_HEADER_FILES='mpif.h mpiof.h' |
117 |
|
|
fi |