1 |
#!/bin/bash |
2 |
# |
3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_ia32_open64,v 1.5 2011/09/07 20:05:57 jmc Exp $ |
4 |
# $Name: $ |
5 |
# |
6 |
# Build options for Open64 compiler on Linux IA32 platform |
7 |
# tested on lagoon (FC 4), |
8 |
# |
9 |
# and on aces cluster (FC 2), version 4.2.1, using: |
10 |
# module add open64 |
11 |
# export NETCDF_ROOT='/usr/local/pkg/netcdf/netcdf-3.5.1/g77' |
12 |
# and set environment variable 'GSL_IEEE_MODE' if using "-gsl" option: |
13 |
# - sh,bash: |
14 |
# export GSL_IEEE_MODE=double-precision,mask-underflow,mask-denormalized |
15 |
# - csh,tcsh: |
16 |
# setenv GSL_IEEE_MODE double-precision,mask-underflow,mask-denormalized |
17 |
|
18 |
# Multithreaded tests require |
19 |
# export OMP_SLAVE_STACK_SIZE=400m |
20 |
# export OMP_NUM_THREADS=2 |
21 |
|
22 |
# MPI : not yet tested |
23 |
|
24 |
if test "x$MPI" = xtrue ; then |
25 |
CC=mpicc |
26 |
FC=mpif90 |
27 |
F90C=mpif90 |
28 |
LINK=$FC |
29 |
else |
30 |
CC=opencc |
31 |
FC=openf90 |
32 |
F90C=openf90 |
33 |
LINK=$FC |
34 |
fi |
35 |
|
36 |
# Pb with "-byteswapio"/"-convert big_endian" option in version 4.0 => use -D_BYTESWAPIO |
37 |
DEFINES='-D_BYTESWAPIO -DWORDLENGTH=4' |
38 |
CPP='cpp -traditional -P' |
39 |
EXTENDED_SRC_FLAG='-extend-source' |
40 |
F90FIXEDFORMAT='-fixedform -x f95' |
41 |
GET_FC_VERSION="--version" |
42 |
OMPFLAG='-openmp' |
43 |
#OMPFLAG="$OMPFLAG -OPT:early_mp=ON" |
44 |
|
45 |
NOOPTFLAGS='-O0 -g' |
46 |
NOOPTFILES='ini_vertical_grid.F' |
47 |
|
48 |
FFLAGS="$FFLAGS -m32 -fPIC" |
49 |
#- might want to use '-r8' for fizhi pkg: |
50 |
#FFLAGS="$FFLAGS -r8" |
51 |
|
52 |
if test "x$IEEE" = x ; then #- with optimisation: |
53 |
# Note: use just -O2 optimisation to avoid some wierd problems with -O3 |
54 |
# on aces (open64/4.1 & 4.2) (ideal_2D_ocean) |
55 |
FOPTIM='-O2 -LNO:fusion=2 -OPT:roundoff=1:IEEE_arithmetic=3' # -funsafe-math-optimizations' |
56 |
NOOPTFILES="$NOOPTFILES mon_set_iounit.F mon_init.F" |
57 |
else |
58 |
if test "x$DEVEL" = x ; then #- no optimisation + IEEE : |
59 |
FOPTIM='-O0 -OPT:roundoff=0:IEEE_arithmetic=1 -fmath-errno -fno-fast-math' |
60 |
else #- development/check options: |
61 |
FOPTIM='-O0 -OPT:roundoff=0:IEEE_arithmetic=1 -fmath-errno -fno-fast-math' |
62 |
# full checking options: |
63 |
FOPTIM="$FOPTIM -g -ffortran-bounds-check -trapuv" |
64 |
NOOPTFILES='mds_byteswapr8.F mds_byteswapr4.F mds_byteswapi4.F' |
65 |
fi |
66 |
fi |
67 |
|
68 |
F90FLAGS=$FFLAGS |
69 |
F90OPTIM=$FOPTIM |
70 |
CFLAGS='-O0 -m32 -fPIC' |
71 |
GSLLIB='-lgsl -lgslcblas' |
72 |
|
73 |
if [ "x$NETCDF_ROOT" != x ] ; then |
74 |
INCLUDEDIR="${NETCDF_ROOT}/include" |
75 |
INCLUDES="-I${NETCDF_ROOT}/include" |
76 |
LIBDIR="${NETCDF_ROOT}/lib" |
77 |
LIBS="-L${NETCDF_ROOT}/lib" |
78 |
elif [ "x$NETCDF_HOME" != x ]; then |
79 |
INCLUDEDIR="${NETCDF_HOME}/include" |
80 |
INCLUDES="-I${NETCDF_HOME}/include" |
81 |
LIBDIR="${NETCDF_HOME}/lib" |
82 |
LIBS="-L${NETCDF_HOME}/lib" |
83 |
elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then |
84 |
NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'` |
85 |
NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'` |
86 |
INCLUDEDIR="${NETCDF_INC}" |
87 |
INCLUDES="-I${NETCDF_INC}" |
88 |
LIBDIR="${NETCDF_LIB}" |
89 |
LIBS="-L${NETCDF_LIB}" |
90 |
elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then |
91 |
INCLUDEDIR="${NETCDF_INCDIR}" |
92 |
INCLUDES="-I${NETCDF_INCDIR}" |
93 |
LIBDIR="${NETCDF_LIBDIR}" |
94 |
LIBS="-L${NETCDF_LIBDIR}" |
95 |
elif test -d /usr/include/netcdf-3 ; then |
96 |
INCLUDES='-I/usr/include/netcdf-3' |
97 |
LIBS='-L/usr/lib/netcdf-3 -lnetcdf_g77' |
98 |
elif test -d /usr/include/netcdf ; then |
99 |
INCLUDES='-I/usr/include/netcdf' |
100 |
elif test -d /usr/local/netcdf ; then |
101 |
INCLUDES='-I/usr/local/netcdf/include' |
102 |
LIBS='-L/usr/local/netcdf/lib' |
103 |
elif test -d /usr/local/include/netcdf.inc ; then |
104 |
INCLUDES='-I/usr/local/include' |
105 |
LIBS='-L/usr/local/lib' |
106 |
fi |
107 |
|
108 |
#if [ "x$LIBS" != x ] ; then |
109 |
# LIBS="$LIBS -lstdc++" |
110 |
#else |
111 |
# LIBS="-lstdc++" |
112 |
#fi |
113 |
|
114 |
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
115 |
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
116 |
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
117 |
MPIINCLUDEDIR="$MPI_INC_DIR" |
118 |
MPI_HEADER_FILES='mpif.h mpiof.h' |
119 |
MPI_HEADER_FILES_INC='./mpi_headers/mpif.h ./mpi_headers/mpiof.h' |
120 |
fi |