1 |
#!/bin/bash |
2 |
# |
3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_ifort,v 1.6 2010/03/21 18:00:26 jmc Exp $ |
4 |
# $Name: $ |
5 |
# |
6 |
|
7 |
# Composed and tested by ce107 on ross/weddell (Opteron system) |
8 |
# Should work fine on EM64T and other AMD64 compatible Intel systems |
9 |
# a) Processor specific flags: |
10 |
# 1) for more speed on Core2 processors replace -xW with -xT |
11 |
# 2) for more speed on Pentium4 based EM64T processors replaces -xW with -xP |
12 |
# b) For more speed, provided your data size doesn't exceed 2GB you can |
13 |
# remove -fPIC which carries a performance penalty of 2-6%. |
14 |
# c) Provided that the libraries you link to are compiled with -fPIC this |
15 |
# optfile should work. |
16 |
# d) You can replace -fPIC with -mcmodel=medium which may perform faster |
17 |
# than -fPIC and still support data sizes over 2GB per process but all |
18 |
# the libraries you link to must be compiled with -fPIC or -mcmodel=medium |
19 |
# e) Changed from -O3 to -O2 to avoid buggy Intel v.10 compilers. Speed |
20 |
# impact appears to be minimal. |
21 |
|
22 |
#------- |
23 |
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
24 |
# and generally, needs to increase the stack-size: |
25 |
# - sh,bash: |
26 |
# > export OMP_NUM_THREADS=2 |
27 |
# > export KMP_STACKSIZE=400m |
28 |
# - csh,tcsh: |
29 |
# > setenv OMP_NUM_THREADS 2 |
30 |
# > setenv KMP_STACKSIZE 400m |
31 |
#------- |
32 |
|
33 |
FC=ifort |
34 |
F90C=ifort |
35 |
CC=icc |
36 |
LINK='ifort -i-dynamic -no-ipo' |
37 |
|
38 |
DEFINES='-DWORDLENGTH=4' |
39 |
CPP='cpp -traditional -P' |
40 |
F90FIXEDFORMAT='-fixed -Tf' |
41 |
EXTENDED_SRC_FLAG='-132' |
42 |
OMPFLAG='-openmp' |
43 |
|
44 |
NOOPTFLAGS='-O0 -g -m64 -fPIC' |
45 |
NOOPTFILES='' |
46 |
|
47 |
INCLUDEDIRS='' |
48 |
INCLUDES='' |
49 |
LIBS='' |
50 |
|
51 |
if test "x$DEVEL" != x ; then |
52 |
FFLAGS="$FFLAGS -w95 -W0 -WB -convert big_endian -assume byterecl -fPIC -O0 -g -noalign -fpstkchk -check all -fpe0 -traceback -ftrapuv -fpmodel except -warn all" |
53 |
else |
54 |
FFLAGS="$FFLAGS -w95 -W0 -WB -convert big_endian -assume byterecl -fPIC" |
55 |
fi |
56 |
#- might want to use '-r8' for fizhi pkg: |
57 |
#FFLAGS="$FFLAGS -r8" |
58 |
|
59 |
# Note that the -mp switch is for ieee "maintain precision" and is |
60 |
# roughly equivalent to -ieee |
61 |
if test "x$IEEE" = x ; then |
62 |
# No need for IEEE-754 |
63 |
FOPTIM='-O2 -align -xW -ip' |
64 |
else |
65 |
# Try to follow IEEE-754 |
66 |
FOPTIM='-O2 -align -xW -ip -mp' |
67 |
fi |
68 |
F90FLAGS=$FFLAGS |
69 |
F90OPTIM=$FOPTIM |
70 |
CFLAGS='-O2 -ip -fPIC' |
71 |
|
72 |
if [ "x$NETCDF_ROOT" != x ] ; then |
73 |
INCLUDEDIRS="${NETCDF_ROOT}/include" |
74 |
INCLUDES="-I${NETCDF_ROOT}/include" |
75 |
LIBS="-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_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/lib/netcdf-3 -L/usr/lib64/netcdf-3' |
94 |
elif test -d /usr/include/netcdf ; then |
95 |
INCLUDEDIRS='/usr/include/netcdf' |
96 |
INCLUDES='-I/usr/include/netcdf' |
97 |
elif test -d /usr/local/netcdf ; then |
98 |
INCLUDEDIRS='/usr/include/netcdf/include' |
99 |
INCLUDES='-I/usr/local/netcdf/include' |
100 |
LIBS='-L/usr/local/netcdf/lib' |
101 |
elif test -d /usr/local/include/netcdf.inc ; then |
102 |
INCLUDEDIRS='/usr/local/include' |
103 |
INCLUDES='-I/usr/local/include' |
104 |
LIBS='-L/usr/local/lib64' |
105 |
fi |