From 048461aea61c98d9a4c88d7d45160f269f53e71e Mon Sep 17 00:00:00 2001 From: Jose-Henrique Alves <47567389+ajhenrique@users.noreply.github.com> Date: Tue, 14 Jan 2020 12:37:14 -0500 Subject: [PATCH] Gefs v12: Adjusting comp/link options for NCEP wcoss build (#145) Changes reflect NEMS update allowing using generalized build scripts cmplr.env + comp/link.tmpl instead of machine-specific comp/link files. * Updated wcoss entries in cmplr.env * Deleted comp/link.wcoss files --- model/bin/cmplr.env | 6 +- model/bin/comp.wcoss_cray | 216 ---------------------------------- model/bin/comp.wcoss_dell_p3 | 212 ---------------------------------- model/bin/link.wcoss_cray | 217 ----------------------------------- model/bin/link.wcoss_dell_p3 | 217 ----------------------------------- 5 files changed, 3 insertions(+), 865 deletions(-) delete mode 100755 model/bin/comp.wcoss_cray delete mode 100755 model/bin/comp.wcoss_dell_p3 delete mode 100755 model/bin/link.wcoss_cray delete mode 100755 model/bin/link.wcoss_dell_p3 diff --git a/model/bin/cmplr.env b/model/bin/cmplr.env index 53c21bcfb..50f083c56 100644 --- a/model/bin/cmplr.env +++ b/model/bin/cmplr.env @@ -130,10 +130,10 @@ if [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || [ "$c optc="$optc -xcore-avx2" optl="$optl -xcore-avx2" elif [ ! -z "$(echo $cmplr | grep wcoss_cray)" ] ; then - optc="$optc -xCORE-AVX2 -qno-opt-dynamic-align -auto -nowarn -align array64byte -safe-cray-ptr" + optc="$optc -xCORE-AVX2" optl="$optl -xCORE-AVX2" elif [ ! -z "$(echo $cmplr | grep wcoss_dell_p3)" ] ; then - optc="$opt -xHOST -qno-opt-dynamic-align -auto -nowarn -align array64byte -Wp,-w" + optc="$opt -xHOST" optl="$optl -xHOST" else optc="$optc -xhost" @@ -146,7 +146,7 @@ if [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || [ "$c # omp options if [ "$omp_mod" == 'yes' ] ; then - if [ "$cmplr" == "hera" ] ; then + if [ "$cmplr" == "hera" ] || [ "$cmplr" == "wcoss_dell_p3" ] ; then optc="$optc -qopenmp" optl="$optl -qopenmp" else diff --git a/model/bin/comp.wcoss_cray b/model/bin/comp.wcoss_cray deleted file mode 100755 index fe439caaf..000000000 --- a/model/bin/comp.wcoss_cray +++ /dev/null @@ -1,216 +0,0 @@ -#!/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 -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -nowarn -sox -align array64byte" -opt="$opt -xCORE-AVX2 -qno-opt-dynamic-align -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 - comp=ftn - which ftn - OK=$? - if [ $OK != 0 ] - then - comp=ftn - fi - - else - comp=ftn - fi - - # open mpi implementation - if [ "$omp_mod" = 'yes' ] - then - opt="$opt -openmp" - 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) opt="$opt -I$NETCDF/include" ;; - #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 --------------------------------------------------------------- # diff --git a/model/bin/comp.wcoss_dell_p3 b/model/bin/comp.wcoss_dell_p3 deleted file mode 100755 index 15fe28f11..000000000 --- a/model/bin/comp.wcoss_dell_p3 +++ /dev/null @@ -1,212 +0,0 @@ -#!/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 -module $path_m -no-fma -ip -g -i4 -real-size 32 -fp-model precise -assume byterecl -convert big_endian -fno-alias -sox -xhost -O2" -# Add profiling -# opt="$opt -p" - - 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 --------------------------------------------------------------- # diff --git a/model/bin/link.wcoss_cray b/model/bin/link.wcoss_cray deleted file mode 100755 index 83462a924..000000000 --- a/model/bin/link.wcoss_cray +++ /dev/null @@ -1,217 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# link : Linker script for use in make (customized for hardware and # -# optimization. Note that this script will not be replaced if part # -# of WAVEWATCH III is re-installed. # -# # -# use : link name [name ... ] # -# name: name of source code file without the extension. # -# the first name will become the program name. # -# # -# error codes : all error output directly to screen. # -# # -# remarks : # -# # -# - Upon (first) installation of WAVEWATCH III the user needs to check the # -# following parts of this scripts : # -# sec. 3 : Provide correct link command # -# # -# - This version is made for the Intel ifort version 12 on nehalem. # -# processor. # -# # -# Hendrik L. Tolman # -# February 2012 # -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # -# 1.a Check and process input - - if [ "$#" -lt '1' ] - then - echo "usage: link name [name]" ; exit 1 - fi - - prog=$1 - echo " Linking $prog" - input="$*" - -# 1.b Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST - - -# 1.c Initial clean-up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rm -f $main_dir/exe/$prog - -# --------------------------------------------------------------------------- # -# 2. Check objects # -# --------------------------------------------------------------------------- # - - cd $main_dir/obj - objects=$NULL - error='n' - set $input - - while [ "$#" -gt '0' ] - do - file=$1.o - if [ -f "$file" ] - then - objects="$objects $file" - else - echo " *** file $file not found ***" - error='y' - fi - shift - done - if [ "$error" = 'y' ] - then - echo "*** Missing object files ***" - exit 3 - fi - -# --------------------------------------------------------------------------- # -# 3. Link all things # -# --------------------------------------------------------------------------- # -# Add here the correct linker call including switches - -# Intel compiler ------------------------------------------------------------ -# 3.a Build options and determine compiler name -# No GRIB libraries for this one - - # linking options - libs="" - opt="-O3 -ip -static -o $prog" -# opt="-O3 -ip -o $prog" -# opt="-O3 -xSSE4.2 -ip -o $prog" -# opt="-O3 -prec-div -prec-sqrt -xHost -align array128byte -ip -o $prog" -# opt="-O0 -g -traceback -check all -fpe0 -ftrapuv -o $prog" - - # mpi implementation - if [ "$mpi_mod" = 'yes' ] - then - #comp=mpiifort - #which mpiifort 1> /dev/null 2> /dev/null - comp=ftn - which ftn - OK=$? - if [ $OK != 0 ] - then - comp='ftn -lmpi' - fi -# opt="-O3 -o $prog" - else - comp=ftn - fi - - # open mpi implementation - if [ "$omp_mod" = 'yes' ] - then - opt="$opt -openmp" - fi - - # oasis coupler archive - if [ "$prog" = 'ww3_shel' ] || [ "$prog" = 'ww3_multi' ] || [ "$prog" = 'ww3_sbs1' ] || \ - [ "$prog" = 'ww3_prnc' ] || [ "$prog" = 'ww3_prep' ] || [ "$prog" = 'ww3_prtide' ] || \ - [ "$prog" = 'ww3_gspl' ] - then - if [ "$oasis_mod" = 'yes' ] - then - if [ -z "$(env | grep OASISDIR)" ] - then - echo '' - echo "[ERROR] OASISDIR is not defined" - exit 1 - fi - echo "link with oasis" - libs="$libs $OASISDIR/lib/libpsmile.MPI1.a $OASISDIR/lib/libmct.a $OASISDIR/lib/libmpeu.a $OASISDIR/lib/libscrip.a" - fi - fi - - # grib for wcoss_cray - case $prog in - 'ww3_grib' ) libs="${G2_LIB4} ${W3NCO_LIB4} ${BACIO_LIB4} ${JASPER_LIB} ${PNG_LIB} ${Z_LIB}" ;; - * ) libs= ;; - esac - - # netcdf library dir - if [ "$netcdf_compile" = 'yes' ] - then - case $WWATCH3_NETCDF in - NC3) libs="$libs -L$NETCDF_LIBDIR -lnetcdf" ;; - NC4) if [ "$mpi_mod" = 'no' ]; then comp="`$NETCDF_CONFIG --fc`"; fi - libs="$libs `$NETCDF_CONFIG --flibs`" ;; - esac - fi - - # parmetis library - if [ "$prog" = 'ww3_shel' ] || [ "$prog" = 'ww3_multi' ] || [ "$prog" = 'ww3_sbs1' ] - then - if [ "$pdlib_mod" = 'yes' ] - then - if [ -z "$(env | grep METIS_PATH)" ] - then - echo '' - echo "[ERROR] METIS_PATH is not defined" - exit 1 - fi - echo "link with parmetis" - libs="$libs $METIS_PATH/lib/libparmetis.a $METIS_PATH/lib/libmetis.a" - fi - fi - - opt="$opt $EXTRA_LINK_OPTIONS" - -# 3.b Link - - rprfx="-Wl,-rpath," - rpath= - for path in $libs - do - if [ "${path:0:2}" = '-L' ] - then - rpath="$rpath ${rprfx}${path//-L/}" - fi - done - - $comp $opt $objects $libs $rpath > link.out 2> link.err - OK="$?" - -# --------------------------------------------------------------------------- # -# 4. Postprocessing # -# --------------------------------------------------------------------------- # - - if [ "$OK" != '0' ] - then - echo " *** error in linking ***" - echo ' ' - cat link.out - echo ' ' - cat link.err - echo ' ' - rm -f link.??? - rm -f $prog - exit $OK - else - if [ ! -f $prog ] - then - echo " *** program $prog not found ***" - echo ' ' - cat link.out - echo ' ' - cat link.err - echo ' ' - rm -f link.??? - exit 1 - else - mv $prog $main_dir/exe/. - rm -f link.??? - fi - fi - -# end of link --------------------------------------------------------------- # diff --git a/model/bin/link.wcoss_dell_p3 b/model/bin/link.wcoss_dell_p3 deleted file mode 100755 index 25aa081af..000000000 --- a/model/bin/link.wcoss_dell_p3 +++ /dev/null @@ -1,217 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# link : Linker script for use in make (customized for hardware and # -# optimization. Note that this script will not be replaced if part # -# of WAVEWATCH III is re-installed. # -# # -# use : link name [name ... ] # -# name: name of source code file without the extension. # -# the first name will become the program name. # -# # -# error codes : all error output directly to screen. # -# # -# remarks : # -# # -# - Upon (first) installation of WAVEWATCH III the user needs to check the # -# following parts of this scripts : # -# sec. 3 : Provide correct link command # -# # -# - This version is made for the Intel ifort version 12 on nehalem. # -# processor. # -# # -# Hendrik L. Tolman # -# February 2012 # -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # -# 1.a Check and process input - - if [ "$#" -lt '1' ] - then - echo "usage: link name [name]" ; exit 1 - fi - - prog=$1 - echo " Linking $prog" - input="$*" - -# 1.b Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST - - -# 1.c Initial clean-up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rm -f $main_dir/exe/$prog - -# --------------------------------------------------------------------------- # -# 2. Check objects # -# --------------------------------------------------------------------------- # - - cd $main_dir/obj - objects=$NULL - error='n' - set $input - - while [ "$#" -gt '0' ] - do - file=$1.o - if [ -f "$file" ] - then - objects="$objects $file" - else - echo " *** file $file not found ***" - error='y' - fi - shift - done - if [ "$error" = 'y' ] - then - echo "*** Missing object files ***" - exit 3 - fi - -# --------------------------------------------------------------------------- # -# 3. Link all things # -# --------------------------------------------------------------------------- # -# Add here the correct linker call including switches - -# Intel compiler ------------------------------------------------------------ -# 3.a Build options and determine compiler name -# No GRIB libraries for this one - - # linking options - libs="" - - opt="-o $prog -g -xhost -O2" - -# Add profiling -# opt="$opt -p" - - # mpi implementation - if [ "$mpi_mod" = 'yes' ] - then - comp=mpiifort - which mpiifort 1> /dev/null 2> /dev/null - OK=$? - if [ $OK != 0 ] - then - comp='ifort -lmpi' - fi -# opt="-O3 -o $prog" - else - comp=ifort - fi - - # open mpi implementation - if [ "$omp_mod" = 'yes' ] - then - opt="$opt -qopenmp" - fi - - # oasis coupler archive - if [ "$prog" = 'ww3_shel' ] || [ "$prog" = 'ww3_multi' ] || [ "$prog" = 'ww3_sbs1' ] || \ - [ "$prog" = 'ww3_prnc' ] || [ "$prog" = 'ww3_prep' ] || [ "$prog" = 'ww3_prtide' ] || \ - [ "$prog" = 'ww3_gspl' ] - then - if [ "$oasis_mod" = 'yes' ] - then - if [ -z "$(env | grep OASISDIR)" ] - then - echo '' - echo "[ERROR] OASISDIR is not defined" - exit 1 - fi - echo "link with oasis" - libs="$libs $OASISDIR/lib/libpsmile.MPI1.a $OASISDIR/lib/libmct.a $OASISDIR/lib/libmpeu.a $OASISDIR/lib/libscrip.a" - fi - fi - - # netcdf library dir - if [ "$netcdf_compile" = 'yes' ] - then - case $WWATCH3_NETCDF in - NC3) libs="$libs -L$NETCDF_LIBDIR -lnetcdf" ;; - NC4) if [ "$mpi_mod" = 'no' ]; then comp="`$NETCDF_CONFIG --fc`"; fi - libs="$libs `$NETCDF_CONFIG --flibs`" ;; - esac - fi - -# NCEP grib creation - if [ "$ncep_grib_compile" = 'yes' ] - then -# GRIB libraries for this one - opt="$opt -convert big_endian -assume byterecl -prec-div -prec-sqrt -ip" - libs="$libs ${G2_LIB4} ${W3NCO_LIB4} ${BACIO_LIB4} ${JASPER_LIB} ${PNG_LIB} ${Z_LIB}" - fi - - # parmetis library - if [ "$prog" = 'ww3_shel' ] || [ "$prog" = 'ww3_multi' ] || [ "$prog" = 'ww3_sbs1' ] - then - if [ "$pdlib_mod" = 'yes' ] - then - if [ -z "$(env | grep METIS_PATH)" ] - then - echo '' - echo "[ERROR] METIS_PATH is not defined" - exit 1 - fi - echo "link with parmetis" - libs="$libs $METIS_PATH/lib/libparmetis.a $METIS_PATH/lib/libmetis.a" - fi - fi - - opt="$opt $EXTRA_LINK_OPTIONS" - -# 3.b Link - - rprfx="-Wl,-rpath," - rpath= - for path in $libs - do - if [ "${path:0:2}" = '-L' ] - then - rpath="$rpath ${rprfx}${path//-L/}" - fi - done - - $comp $opt $objects $libs $rpath > link.out 2> link.err - OK="$?" - -# --------------------------------------------------------------------------- # -# 4. Postprocessing # -# --------------------------------------------------------------------------- # - - if [ "$OK" != '0' ] - then - echo " *** error in linking ***" - echo ' ' - cat link.out - echo ' ' - cat link.err - echo ' ' - rm -f link.??? - rm -f $prog - exit $OK - else - if [ ! -f $prog ] - then - echo " *** program $prog not found ***" - echo ' ' - cat link.out - echo ' ' - cat link.err - echo ' ' - rm -f link.??? - exit 1 - else - mv $prog $main_dir/exe/. - rm -f link.??? - fi - fi - -# end of link --------------------------------------------------------------- #