Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 19 additions & 33 deletions model/bin/cmplr.env
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# #
# value : mpt / intel / gnu / pgi #
# suffix : _debug #
# prefix : zeus_ / datarmor_ #
# prefix : datarmor_ #
# #
# - examples : intel / pgi_debug / datarmor_mpt_debug #
# #
Expand All @@ -38,7 +38,6 @@ list='no'
###############################

if [ "$cmplr" == "mpt" ] || [ "$cmplr" == "mpt_debug" ] || \
[ "$cmplr" == "zeus_mpt" ] || [ "$cmplr" == "zeus_mpt_debug" ] || \
[ "$cmplr" == "datarmor_mpt" ] || [ "$cmplr" == "datarmor_mpt_debug" ] ; then

# COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand All @@ -47,8 +46,8 @@ if [ "$cmplr" == "mpt" ] || [ "$cmplr" == "mpt_debug" ] || \
comp_seq='ifort'
comp_mpi='ifort -lmpi'

# zeus compiler
if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then
# Cray compiler
if [ ! -z "$(echo $cmplr | grep wcoss_cray)" ] ; then
comp_seq='ftn'
comp_mpi='ftn'
fi
Expand Down Expand Up @@ -79,10 +78,7 @@ if [ "$cmplr" == "mpt" ] || [ "$cmplr" == "mpt_debug" ] || \
fi

# system-dependant options
if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then
optc="$optc -fastsse"
optl="$optl -fastsse"
elif [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then
if [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then
optc="$optc -xcore-avx2"
optl="$optl -xcore-avx2"
else
Expand All @@ -98,7 +94,10 @@ fi
###############################

if [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || \
[ "$cmplr" == "zeus_intel" ] || [ "$cmplr" == "zeus_intel_debug" ] || \
[ "$cmplr" == "wcoss_phase2" ] || [ "$cmplr" == "wcoss_phase2_intel_debug" ] || \
[ "$cmplr" == "wcoss_cray" ] || [ "$cmplr" == "wcoss_cray_intel_debug" ] || \
[ "$cmplr" == "wcoss_dell_p3" ] || [ "$cmplr" == "wcoss_dell_p3_intel_debug" ] || \
[ "$cmplr" == "theia" ] || [ "$cmplr" == "theia_intel_debug" ] || \
[ "$cmplr" == "datarmor_intel" ] || [ "$cmplr" == "datarmor_intel_debug" ] ; then

# COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand All @@ -107,8 +106,8 @@ if [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || \
comp_seq='ifort'
comp_mpi='mpiifort'

# zeus compiler
if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then
# cray compiler
if [ ! -z "$(echo $cmplr | grep wcoss_cray)" ] ; then
comp_seq='ftn'
comp_mpi='ftn'
fi
Expand All @@ -117,7 +116,7 @@ if [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || \
# OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# common options
optc='-c -module $path_m -no-fma -ip -p -g -i4 -real-size 32 -fp-model precise -assume byterecl -convert big_endian -fno-alias -fno-fnalias'
optc='-c -module $path_m -no-fma -fPIC -ip -p -g -i4 -real-size 32 -fp-model precise -assume byterecl -convert big_endian -fno-alias -fno-fnalias'
optl='-o $prog -p -g'

# list options
Expand All @@ -139,10 +138,7 @@ if [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || \
fi

# system-dependant options
if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then
optc="$optc -fastsse"
optl="$optl -fastsse"
elif [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then
if [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then
optc="$optc -xcore-avx2"
optl="$optl -xcore-avx2"
else
Expand All @@ -153,14 +149,11 @@ if [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || \
fi




###############################
# GNU #
###############################

if [ "$cmplr" == "gnu" ] || [ "$cmplr" == "gnu_debug" ] || \
[ "$cmplr" == "zeus_gnu" ] || [ "$cmplr" == "zeus_gnu_debug" ] || \
[ "$cmplr" == "datarmor_gnu" ] || [ "$cmplr" == "datarmor_gnu_debug" ] ; then

# COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand All @@ -169,8 +162,8 @@ if [ "$cmplr" == "gnu" ] || [ "$cmplr" == "gnu_debug" ] || \
comp_seq='gfortran'
comp_mpi='mpif90'

# zeus compiler
if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then
# Cray compiler
if [ ! -z "$(echo $cmplr | grep wcoss_cray)" ] ; then
comp_seq='ftn'
comp_mpi='ftn'
fi
Expand All @@ -179,7 +172,7 @@ if [ "$cmplr" == "gnu" ] || [ "$cmplr" == "gnu_debug" ] || \
# OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# common options
optc='-c -J$path_m -p -g -fno-second-underscore -ffree-line-length-none -fconvert=big-endian'
optc='-c -J$path_m -p -fPIC -g -fno-second-underscore -ffree-line-length-none -fconvert=big-endian'
optl='-o $prog -p -g'

# omp options
Expand All @@ -198,10 +191,7 @@ if [ "$cmplr" == "gnu" ] || [ "$cmplr" == "gnu_debug" ] || \
fi

# system-dependant options
if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then
optc="$optc -fastsse"
optl="$optl -fastsse"
elif [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then
if [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then
optc="$optc -march=core-avx2"
optl="$optl -march=core-avx2"
else
Expand All @@ -219,7 +209,6 @@ fi
###############################

if [ "$cmplr" == "pgi" ] || [ "$cmplr" == "pgi_debug" ] || \
[ "$cmplr" == "zeus_pgi" ] || [ "$cmplr" == "zeus_pgi_debug" ] || \
[ "$cmplr" == "datarmor_pgi" ] || [ "$cmplr" == "datarmor_pgi_debug" ] ; then

# COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand All @@ -228,8 +217,8 @@ if [ "$cmplr" == "pgi" ] || [ "$cmplr" == "pgi_debug" ] || \
comp_seq='pgf90'
comp_mpi='mpif90'

# zeus compiler
if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then
# Cray compiler
if [ ! -z "$(echo $cmplr | grep wcoss_cray)" ] ; then
comp_seq='ftn'
comp_mpi='ftn'
fi
Expand Down Expand Up @@ -260,10 +249,7 @@ if [ "$cmplr" == "pgi" ] || [ "$cmplr" == "pgi_debug" ] || \
fi

# system-dependant options
if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then
optc="$optc -fastsse"
optl="$optl -fastsse"
elif [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then
if [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then
optc="$(echo $optc | sed 's/O3/O2/') -Mlist"
optl="$optl"
else
Expand Down
211 changes: 211 additions & 0 deletions model/bin/comp.wcoss_dell_p3
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
#!/bin/bash
# --------------------------------------------------------------------------- #
# comp : Compiler script for use in ad3 (customized for hardware and #
# optimization). Note that this script will not be replaced if part #
# of WAVEWATCH III is re-installed. Used by ad3. #
# #
# use : comp name #
# name: name of source code file without the extension. #
# #
# error codes : 1 : input error #
# 2 : no environment file $ww3_env found. #
# 3 : error in creating scratch directory. #
# 4 : w3adc error. #
# 5 : compiler error. #
# #
# remarks : #
# #
# - This script runs from the scratch directory, where it should remain. #
# #
# - For this script to interact with ad3, it needs to generate / leave #
# following files : #
# $name.f90 : Source code (generated by ad3). #
# $name.o : Object module. #
# $name.l : Listing file. #
# comp.stat.$name : status file of compiler, containing number of errors #
# and number of warnings (generated by comp). #
# #
# - Upon (first) installation of WAVEWATCH III the user needs to check the #
# following parts of this script : #
# sec. 2.b : Provide correct compiler/options. #
# sec. 3.a : Provide correct error capturing. #
# sec. 3.d : Remove unnecessary files. #
# #
# - This version is made for the Intel ifort version 12 on Xeon Westmere #
# - On zeus the -list option slows down the compilation time by an order #
# of magnitude. For this section 1.c is added. #
# #
# Hendrik L. Tolman #
# June 2012 #
# --------------------------------------------------------------------------- #
# 1. Preparations #
# --------------------------------------------------------------------------- #
# 1.a Check and process input

if [ "$#" != '1' ]
then
echo "usage: comp name" ; exit 1
fi
name="$1"

# 1.b Initial clean-up - - - - - - - - - - - - - - - - - - - - - - - - - - - -

rm -f $name.l
rm -f $name.o
rm -f comp.stat.$name

# 1.c Set listing option - - - - - - - - - - - - - - - - - - - - - - - - - - -

list=' -list'
list=

# --------------------------------------------------------------------------- #
# 2. Compile #
# --------------------------------------------------------------------------- #
# Add here the correct compiler call including command line options
# Note: - do not invoke a link step
# - if possible, generate a listing $name.l
# - make sure the compiler point to the proper directory where the
# modules are stored ($m_path), see examples below.

# 2.a Determine file extension - - - - - - - - - - - - - - - - - - - - - - - -
# .f90 assumes free format, .f assumes fixed format, change if necessary
# *** file extension (fext) is set and exported by calling program (ad3) ***

# 2.b Perform compilation - - - - - - - - - - - - - - - - - - - - - - - - - -
# Save compiler exit code in $OK
#
# Intel compiler on Linux ----------------------------------------------------
# 2.b.1 Build options and determine compiler name

opt="-c $list -O3 -assume byterecl -ip -module $path_m"
# opt="-c $list -O3 -assume byterecl -xSSE4.2 -ip -module $path_m"
# opt="-c $list -O3 -assume byterecl -prec-div -prec-sqrt -xHost -align array128byte -ip -module $path_m"
# opt="-c $list -O0 -assume byterecl -g -traceback -check all -fpe0 -ftrapuv -module $path_m"

if [ "$name" != 'ww3_gspl' ]
then
opt="$opt -convert big_endian"
fi

# mpi implementation
if [ "$mpi_mod" = 'yes' ]
then
comp=mpiifort
which mpiifort 1> /dev/null 2> /dev/null
OK=$?
if [ $OK != 0 ]
then
comp=ifort
fi

else
comp=ifort
fi

# open mpi implementation
if [ "$omp_mod" = 'yes' ]
then
opt="$opt -qopenmp"
fi

# oasis coupler include dir
if [ "$oasis_mod" = 'yes' ]
then
opt="$opt -I$OASISDIR/build/lib/psmile.MPI1"
fi

# netcdf include dir
if [ "$netcdf_compile" = 'yes' ]
then
case $WWATCH3_NETCDF in
NC3) opt="$opt -I$NETCDF_INCDIR" ;;
NC4) if [ "$mpi_mod" = 'no' ]; then comp="`$NETCDF_CONFIG --fc`"; fi
opt="$opt -I`$NETCDF_CONFIG --includedir`" ;;
esac
fi

# ftn include dir
opt="$opt -I$path_i"
opt="$opt $ESMF_F90COMPILEPATHS"
opt="$opt $EXTRA_COMP_OPTIONS"

# 2.b.2 Compile

$comp $opt $name.$fext > $name.out 2> $name.err
OK="$?"

# 2.b.2 Process listing

if [ -s $name.lst ]
then
mv $name.lst $name.l
fi

# 2.b.3 Add test output to listing for later viewing

if [ -s $name.l ]
then
echo '------------' >> $name.l
echo "$comp $opt" >> $name.l
echo '------------' >> $name.l
cat $name.out >> $name.l 2> /dev/null
echo '------------' >> $name.l
cat $name.err >> $name.l 2> /dev/null
echo '------------' >> $name.l
fi

# --------------------------------------------------------------------------- #
# 3. Postprocessing #
# --------------------------------------------------------------------------- #
# 3.a Capture errors
# nr_err : number of errors.
# nr_war : number of errors.

nr_err='0'
nr_war='0'

if [ -s $name.err ]
then
nr_err=`grep 'error' $name.err | wc -l | awk '{ print $1 }'`
nr_war=`grep 'warning' $name.err | wc -l | awk '{ print $1 }'`
else
if [ "$OK" != '0' ]
then
nr_err='1'
fi
fi

# 3.b Make file comp.stat.$name - - - - - - - - - - - - - - - - - - - - - - - - - -

echo "ERROR $nr_err" > comp.stat.$name
echo "WARNING $nr_war" >> comp.stat.$name

# 3.c Prepare listing - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# if compiler does not provide listing, make listing from source code
# and compiler messages. Second input line for w3list identifies if
# comment lines are to be numbered.

if [ ! -f $name.l ]
then
echo "$name.$fext" > w3list.inp
echo "T" >> w3list.inp
w3list < w3list.inp 2> /dev/null
rm -f w3list.inp
mv w3list.out $name.l
echo '------------' >> $name.l
echo "$comp $opt" >> $name.l
echo '------------' >> $name.l
cat $name.out >> $name.l #2> /dev/null
echo '------------' >> $name.l
cat $name.err >> $name.l #2> /dev/null
echo '------------' >> $name.l
fi

# 3.d Remove unwanted files - - - - - - - - - - - - - - - - - - - - - - - - -
# include here unwanted files generated by the compiler

# rm -f $name.out
# rm -f $name.err

# end of comp --------------------------------------------------------------- #
Loading