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