1 |
ce107 |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
jmc |
1.3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_open64,v 1.2 2011/08/17 14:53:19 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 |
|
|
|
11 |
|
|
#------- |
12 |
|
|
# run with OpenMP: needs to set environment var. OMP_NUM_THREADS |
13 |
|
|
# and generally, needs to increase the thread stack-size: |
14 |
|
|
# - sh,bash: |
15 |
|
|
# > export OMP_NUM_THREADS=2 |
16 |
|
|
# > export OMP_SLAVE_STACK_SIZE=400m |
17 |
|
|
# - csh,tcsh: |
18 |
|
|
# > setenv OMP_NUM_THREADS 2 |
19 |
|
|
# > setenv OMP_SLAVE_STACK_SIZE 400m |
20 |
|
|
#------- |
21 |
ce107 |
1.1 |
|
22 |
|
|
CC=opencc |
23 |
|
|
FC=openf90 |
24 |
jmc |
1.2 |
LINK=openf90 |
25 |
|
|
|
26 |
ce107 |
1.1 |
DEFINES='-DWORDLENGTH=4' |
27 |
|
|
CPP='cpp -traditional -P' |
28 |
jmc |
1.2 |
EXTENDED_SRC_FLAG='-extend-source' |
29 |
|
|
GET_FC_VERSION="--version" |
30 |
|
|
OMPFLAG='-openmp' |
31 |
|
|
#OMPFLAG='-openmp -OPT:early_mp=ON' |
32 |
|
|
|
33 |
|
|
NOOPTFLAGS='-O0 -g' |
34 |
ce107 |
1.1 |
NOOPTFILES='' |
35 |
|
|
|
36 |
jmc |
1.2 |
FFLAGS="$FFLAGS -m64 -fPIC -convert big_endian" |
37 |
|
|
#- might want to use '-r8' for fizhi pkg: |
38 |
|
|
#FFLAGS="$FFLAGS -r8" |
39 |
ce107 |
1.1 |
|
40 |
jmc |
1.2 |
if test "x$IEEE" = x ; then #- with optimisation: |
41 |
jmc |
1.3 |
#- full optimisation |
42 |
|
|
# ("-Ofast" eqv "-O3 -ipa -OPT:Ofast -fno-math-errno -ffast-math" and "-OPT:Ofast" |
43 |
|
|
# eqv to "-OPT:roundoff=2 -OPT:Olimit=0 -OPT:div_split=ON -OPT:alias=typed") |
44 |
|
|
FOPTIM='-Ofast -LNO:fusion=2 -OPT:roundoff=1:IEEE_arithmetic=3' |
45 |
|
|
#- high optimisation (-O3), might find Pb with few S/R; fully safe: switch to -O2: |
46 |
|
|
#FOPTIM='-O3 -LNO:fusion=2 -OPT:roundoff=1:IEEE_arithmetic=3' |
47 |
ce107 |
1.1 |
else |
48 |
jmc |
1.2 |
if test "x$DEVEL" = x ; then #- no optimisation + IEEE : |
49 |
|
|
FOPTIM='-O0 -OPT:roundoff=0:IEEE_arithmetic=1 -fmath-errno -fno-fast-math' |
50 |
|
|
else #- development/check options: |
51 |
|
|
FFLAGS="$FFLAGS -ffortran-bounds-check -trapuv -g" |
52 |
|
|
FOPTIM='-O0 -OPT:roundoff=0:IEEE_arithmetic=1 -fmath-errno -fno-fast-math' |
53 |
|
|
fi |
54 |
ce107 |
1.1 |
fi |
55 |
|
|
|
56 |
|
|
F90FLAGS=$FFLAGS |
57 |
|
|
F90OPTIM=$FOPTIM |
58 |
jmc |
1.2 |
CFLAGS='-O0 -m64 -fPIC' |
59 |
ce107 |
1.1 |
GSLLIB='-lgsl -lgslcblas' |
60 |
|
|
|
61 |
|
|
if [ "x$NETCDF_ROOT" != x ] ; then |
62 |
|
|
INCLUDEDIR="${NETCDF_ROOT}/include" |
63 |
|
|
INCLUDES="-I${NETCDF_ROOT}/include" |
64 |
|
|
LIBDIR="${NETCDF_ROOT}/lib" |
65 |
|
|
LIBS="-L${NETCDF_ROOT}/lib" |
66 |
|
|
elif [ "x$NETCDF_HOME" != x ]; then |
67 |
|
|
INCLUDEDIR="${NETCDF_HOME}/include" |
68 |
|
|
INCLUDES="-I${NETCDF_HOME}/include" |
69 |
|
|
LIBDIR="${NETCDF_HOME}/lib" |
70 |
|
|
LIBS="-L${NETCDF_HOME}/lib" |
71 |
|
|
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
72 |
|
|
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
73 |
|
|
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
74 |
|
|
INCLUDEDIR="${NETCDF_INC}" |
75 |
|
|
INCLUDES="-I${NETCDF_INC}" |
76 |
|
|
LIBDIR="${NETCDF_LIB}" |
77 |
|
|
LIBS="-L${NETCDF_LIB}" |
78 |
|
|
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
79 |
|
|
INCLUDEDIR="${NETCDF_INCDIR}" |
80 |
|
|
INCLUDES="-I${NETCDF_INCDIR}" |
81 |
|
|
LIBDIR="${NETCDF_LIBDIR}" |
82 |
|
|
LIBS="-L${NETCDF_LIBDIR}" |
83 |
|
|
elif test -d /usr/include/netcdf-3 ; then |
84 |
|
|
INCLUDES='-I/usr/include/netcdf-3' |
85 |
|
|
LIBS='-L/usr/lib64/netcdf-3 -lnetcdf_g77' |
86 |
|
|
elif test -d /usr/include/netcdf ; then |
87 |
|
|
INCLUDES='-I/usr/include/netcdf' |
88 |
|
|
elif test -d /usr/local/netcdf ; then |
89 |
|
|
INCLUDES='-I/usr/local/netcdf/include' |
90 |
|
|
LIBS='-L/usr/local/netcdf/lib' |
91 |
|
|
elif test -d /usr/local/include/netcdf.inc ; then |
92 |
|
|
INCLUDES='-I/usr/local/include' |
93 |
|
|
LIBS='-L/usr/local/lib64' |
94 |
|
|
fi |
95 |
|
|
|