1 |
#!/bin/bash |
2 |
# |
3 |
# $Header: /u/gcmpack/MITgcm/tools/build_options/linux_amd64_pgf90,v 1.1 2014/08/05 03:54:34 heimbach Exp $ |
4 |
# $Name: $ |
5 |
# |
6 |
# Build options for PGI compiler on Linux AMD64 platform |
7 |
# |
8 |
# tested with PGI version 10.9 on baudelaire (Linux 2.6.34.7-61.fc13.x86_64), using: |
9 |
# - sh,bash: |
10 |
# > export PGI=/srv/software/pgi/pgi-10.9 |
11 |
# > export PATH=$PGI/linux86-64/10.9/bin:$PATH |
12 |
# > export MANPATH=$MANPATH:$PGI/linux86-64/10.9/man |
13 |
# > export LM_LICENSE_FILE=$PGI/license.dat |
14 |
# - csh,tcsh: |
15 |
# > setenv PGI /srv/software/pgi/pgi-10.9 |
16 |
# > set path=($PGI/linux86-64/10.9/bin $path) |
17 |
# > setenv MANPATH "$MANPATH":$PGI/linux86-64/10.9/man |
18 |
# > setenv LM_LICENSE_FILE $PGI/license.dat |
19 |
# |
20 |
# and tested also with MPI on acesgrid (Fedora Core 15), using: |
21 |
# module load pgi (Version 11.7) |
22 |
# and with mpich2: |
23 |
# module load mvapich2 |
24 |
# or with openmpi: (support also OpenMP to run mpi+mth) |
25 |
# module load openmpi |
26 |
|
27 |
#------- |
28 |
# compile (genmake2 -omp) and run with OpenMP: needs to set environment var. |
29 |
# OMP_NUM_THREADS and generally, needs to increase the thread stack-size: |
30 |
# - sh,bash: |
31 |
# > export OMP_NUM_THREADS=2 |
32 |
# > export OMP_STACKSIZE=400m |
33 |
# - csh,tcsh: |
34 |
# > setenv OMP_NUM_THREADS 2 |
35 |
# > setenv OMP_STACKSIZE 400m |
36 |
#------- |
37 |
|
38 |
if test "x$MPI" = xtrue ; then |
39 |
CC=mpicc |
40 |
FC=mpif77 |
41 |
F90C=mpif90 |
42 |
else |
43 |
CC=pgcc |
44 |
FC=pgf90 |
45 |
F90=pgf90 |
46 |
F90C=pgf90 |
47 |
fi |
48 |
|
49 |
DEFINES="-DWORDLENGTH=4" |
50 |
if test "x$ALWAYS_USE_F90" = x1 ; then |
51 |
FC=$F90C |
52 |
else |
53 |
DEFINES="$DEFINES -DNML_EXTENDED_F77" |
54 |
fi |
55 |
CPP='cpp -traditional -P' |
56 |
EXTENDED_SRC_FLAG='-Mextend' |
57 |
GET_FC_VERSION="-V" |
58 |
OMPFLAG='-mp' |
59 |
|
60 |
NOOPTFLAGS='-O0' |
61 |
NOOPTFILES='' |
62 |
|
63 |
FFLAGS="$FFLAGS -byteswapio -Ktrap=fp" |
64 |
F90FLAGS="$F90FLAGS -byteswapio -Ktrap=fp" |
65 |
F90FIXEDFORMAT='-Mfixed' |
66 |
#- might want to use '-r8' for fizhi pkg: |
67 |
#FFLAGS="$FFLAGS -r8" |
68 |
|
69 |
if test "x$IEEE" = x ; then #- with optimisation: |
70 |
FOPTIM='-tp k8-64 -pc=64 -O2 -Mvect=sse' |
71 |
F90OPTIM='-tp k8-64 -pc=64 -O2 -Mvect=sse' |
72 |
else #- no optimisation + IEEE : |
73 |
#FFLAGS="$FFLAGS -Mdclchk" #- pkg/zonal_filt does not pass with declaration-check |
74 |
FOPTIM='-pc=64 -O0 -Kieee' |
75 |
fi |
76 |
|
77 |
INCLUDEDIRS='' |
78 |
INCLUDES='' |
79 |
LIBS='' |
80 |
|
81 |
if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then |
82 |
INCLUDES="$INCLUDES -I$MPI_INC_DIR" |
83 |
INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR" |
84 |
#- used for parallel (MPI) DIVA |
85 |
MPIINCLUDEDIR="$MPI_INC_DIR" |
86 |
#MPI_HEADER_FILES='mpif.h mpiof.h' |
87 |
fi |