1 |
ce107 |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
jahn |
1.7 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_open64,v 1.6 2012/04/13 14:57:33 jmc Exp $ |
4 |
ce107 |
1.1 |
# $Name: $ |
5 |
|
|
# |
6 |
jmc |
1.2 |
# Build options for Open64 Compiler on Linux x86-64 |
7 |
|
|
# first version tested on Fedore Core 4 x86-64 Opteron (Linux batsi) |
8 |
|
|
# updated and tested on acesgrid (Fedora Core 15), using: |
9 |
|
|
# module load open64 (Version 4.2.4) |
10 |
jmc |
1.4 |
# Also tested with MPI on acesgrid, using: |
11 |
|
|
# module load open64 (Version 4.2.4) |
12 |
|
|
# and with mpich1: |
13 |
|
|
# module load mvapich |
14 |
|
|
# or with mpich2: |
15 |
|
|
# module load mvapich2 |
16 |
|
|
# or with openmpi: <== not yet tested |
17 |
|
|
# module load openmpi |
18 |
jmc |
1.2 |
|
19 |
|
|
#------- |
20 |
|
|
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
21 |
|
|
# and generally, needs to increase the thread stack-size: |
22 |
|
|
# - sh,bash: |
23 |
|
|
# > export OMP_NUM_THREADS=2 |
24 |
|
|
# > export OMP_SLAVE_STACK_SIZE=400m |
25 |
|
|
# - csh,tcsh: |
26 |
|
|
# > setenv OMP_NUM_THREADS 2 |
27 |
|
|
# > setenv OMP_SLAVE_STACK_SIZE 400m |
28 |
|
|
#------- |
29 |
ce107 |
1.1 |
|
30 |
jmc |
1.4 |
if test "x$MPI" = xtrue ; then |
31 |
|
|
CC=mpicc |
32 |
|
|
FC=mpif90 |
33 |
jahn |
1.7 |
F90C=mpif90 |
34 |
jmc |
1.4 |
LINK=mpif90 |
35 |
|
|
else |
36 |
|
|
CC=opencc |
37 |
|
|
FC=openf90 |
38 |
jahn |
1.7 |
F90C=openf90 |
39 |
jmc |
1.4 |
LINK=openf90 |
40 |
|
|
fi |
41 |
jmc |
1.2 |
|
42 |
ce107 |
1.1 |
DEFINES='-DWORDLENGTH=4' |
43 |
|
|
CPP='cpp -traditional -P' |
44 |
jmc |
1.2 |
EXTENDED_SRC_FLAG='-extend-source' |
45 |
jahn |
1.7 |
F90FIXEDFORMAT='-fixedform -x f95' |
46 |
jmc |
1.2 |
GET_FC_VERSION="--version" |
47 |
|
|
OMPFLAG='-openmp' |
48 |
|
|
#OMPFLAG='-openmp -OPT:early_mp=ON' |
49 |
|
|
|
50 |
|
|
NOOPTFLAGS='-O0 -g' |
51 |
ce107 |
1.1 |
NOOPTFILES='' |
52 |
|
|
|
53 |
jmc |
1.2 |
FFLAGS="$FFLAGS -m64 -fPIC -convert big_endian" |
54 |
|
|
#- might want to use '-r8' for fizhi pkg: |
55 |
|
|
#FFLAGS="$FFLAGS -r8" |
56 |
ce107 |
1.1 |
|
57 |
jmc |
1.2 |
if test "x$IEEE" = x ; then #- with optimisation: |
58 |
jmc |
1.3 |
#- full optimisation |
59 |
|
|
# ("-Ofast" eqv "-O3 -ipa -OPT:Ofast -fno-math-errno -ffast-math" and "-OPT:Ofast" |
60 |
|
|
# eqv to "-OPT:roundoff=2 -OPT:Olimit=0 -OPT:div_split=ON -OPT:alias=typed") |
61 |
jmc |
1.5 |
#FOPTIM='-Ofast -OPT:roundoff=1:IEEE_arithmetic=3 -LNO:fusion=2' |
62 |
|
|
FOPTIM='-O3 -OPT:Ofast:roundoff=1:IEEE_arithmetic=3 -ffast-math -LNO:fusion=2' |
63 |
jmc |
1.3 |
#- high optimisation (-O3), might find Pb with few S/R; fully safe: switch to -O2: |
64 |
jmc |
1.5 |
#FOPTIM='-O3 -OPT:roundoff=1:IEEE_arithmetic=3 -LNO:fusion=2' |
65 |
jmc |
1.6 |
NOOPTFLAGS='-O3 -OPT:roundoff=1:IEEE_arithmetic=2 -LNO:fusion=2' |
66 |
|
|
NOOPTFILES='seaice_evp.F' |
67 |
ce107 |
1.1 |
else |
68 |
jmc |
1.2 |
if test "x$DEVEL" = x ; then #- no optimisation + IEEE : |
69 |
|
|
FOPTIM='-O0 -OPT:roundoff=0:IEEE_arithmetic=1 -fmath-errno -fno-fast-math' |
70 |
|
|
else #- development/check options: |
71 |
|
|
FFLAGS="$FFLAGS -ffortran-bounds-check -trapuv -g" |
72 |
|
|
FOPTIM='-O0 -OPT:roundoff=0:IEEE_arithmetic=1 -fmath-errno -fno-fast-math' |
73 |
|
|
fi |
74 |
ce107 |
1.1 |
fi |
75 |
|
|
|
76 |
|
|
F90FLAGS=$FFLAGS |
77 |
|
|
F90OPTIM=$FOPTIM |
78 |
jmc |
1.2 |
CFLAGS='-O0 -m64 -fPIC' |
79 |
ce107 |
1.1 |
GSLLIB='-lgsl -lgslcblas' |
80 |
|
|
|
81 |
jmc |
1.4 |
INCLUDEDIRS='' |
82 |
|
|
INCLUDES='' |
83 |
|
|
LIBS='' |
84 |
|
|
|
85 |
ce107 |
1.1 |
if [ "x$NETCDF_ROOT" != x ] ; then |
86 |
|
|
INCLUDEDIR="${NETCDF_ROOT}/include" |
87 |
|
|
INCLUDES="-I${NETCDF_ROOT}/include" |
88 |
|
|
LIBDIR="${NETCDF_ROOT}/lib" |
89 |
|
|
LIBS="-L${NETCDF_ROOT}/lib" |
90 |
|
|
elif [ "x$NETCDF_HOME" != x ]; then |
91 |
|
|
INCLUDEDIR="${NETCDF_HOME}/include" |
92 |
|
|
INCLUDES="-I${NETCDF_HOME}/include" |
93 |
|
|
LIBDIR="${NETCDF_HOME}/lib" |
94 |
|
|
LIBS="-L${NETCDF_HOME}/lib" |
95 |
|
|
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
96 |
|
|
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
97 |
|
|
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
98 |
|
|
INCLUDEDIR="${NETCDF_INC}" |
99 |
|
|
INCLUDES="-I${NETCDF_INC}" |
100 |
|
|
LIBDIR="${NETCDF_LIB}" |
101 |
|
|
LIBS="-L${NETCDF_LIB}" |
102 |
|
|
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
103 |
|
|
INCLUDEDIR="${NETCDF_INCDIR}" |
104 |
|
|
INCLUDES="-I${NETCDF_INCDIR}" |
105 |
|
|
LIBDIR="${NETCDF_LIBDIR}" |
106 |
|
|
LIBS="-L${NETCDF_LIBDIR}" |
107 |
|
|
elif test -d /usr/include/netcdf-3 ; then |
108 |
|
|
INCLUDES='-I/usr/include/netcdf-3' |
109 |
|
|
LIBS='-L/usr/lib64/netcdf-3 -lnetcdf_g77' |
110 |
|
|
elif test -d /usr/include/netcdf ; then |
111 |
|
|
INCLUDES='-I/usr/include/netcdf' |
112 |
|
|
elif test -d /usr/local/netcdf ; then |
113 |
|
|
INCLUDES='-I/usr/local/netcdf/include' |
114 |
|
|
LIBS='-L/usr/local/netcdf/lib' |
115 |
|
|
elif test -d /usr/local/include/netcdf.inc ; then |
116 |
|
|
INCLUDES='-I/usr/local/include' |
117 |
|
|
LIBS='-L/usr/local/lib64' |
118 |
|
|
fi |
119 |
|
|
|
120 |
jmc |
1.4 |
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
121 |
|
|
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
122 |
|
|
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
123 |
|
|
MPIINCLUDEDIR="$MPI_INC_DIR" |
124 |
|
|
MPI_HEADER_FILES='mpif.h mpiof.h' |
125 |
|
|
MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h' |
126 |
|
|
fi |
127 |
|
|
|