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