From b7c00efc9866af59a2a27c649d6674cb17231045 Mon Sep 17 00:00:00 2001 From: Guillaume Samson <guillaume.samson@mercator-ocean.fr> Date: Mon, 9 Jan 2023 11:15:09 +0000 Subject: [PATCH] Resolve "Makenemo cleaning" --- .gitignore | 4 + makenemo | 372 +++++++++++------------- mk/Fadd_keys.sh | 22 +- mk/Fcheck_archfile.sh | 12 +- mk/Fcheck_config.sh | 8 +- mk/Fclean_config.sh | 24 +- mk/Fclean_var.sh | 68 ----- mk/Fdef_keys.sh | 7 +- mk/Fdel_keys.sh | 23 +- mk/Flist_archfile.sh | 8 +- mk/Flist_cfgs.sh | 6 +- mk/Fmake_WORK.sh | 32 +- mk/Fmake_bld.sh | 63 ---- mk/Fmake_tools_bld.sh | 2 +- mk/Fprep_agrif.sh | 25 +- mk/README | 7 - mk/agrifpp.sh | 9 +- mk/bld.cfg | 30 +- mk/bld_preproagr.cfg | 10 +- mk/bld_preproagr_tools.cfg | 11 +- mk/bld_tools.cfg | 22 +- mk/bldxag.cfg | 18 +- mk/bldxag_tools.cfg | 8 +- mk/bldxagxcdf.cfg | 22 +- mk/bldxcdf.cfg | 28 +- mk/conv.cfg | 6 +- sette/all_functions.sh | 37 ++- sette/prepare_exe_dir.sh | 26 +- sette/prepare_job.sh | 8 +- sette/sette.sh | 7 +- sette/sette_eval.sh | 2 - sette/sette_list_avail_cfg.sh | 4 +- sette/sette_reference-configurations.sh | 42 +-- sette/sette_rpt.sh | 3 - sette/sette_test-cases.sh | 12 +- tools/maketools | 89 +++--- 36 files changed, 427 insertions(+), 650 deletions(-) delete mode 100755 mk/Fclean_var.sh delete mode 100755 mk/Fmake_bld.sh delete mode 100644 mk/README diff --git a/.gitignore b/.gitignore index ab4a609c..a8c97569 100644 --- a/.gitignore +++ b/.gitignore @@ -4,12 +4,16 @@ cfgs/work_cfgs.txt cfgs/*/BLD cfgs/*/EXP00 cfgs/*/WORK +cfgs/*/NEMOFILES +cfgs/*/AGRIFLIB cfgs/*_ST tests/work_cfgs.txt tests/*/BLD tests/*/EXP00 tests/*/WORK +tests/*/NEMOFILES +tests/*/AGRIFLIB tests/*_ST tools/*/BLD diff --git a/makenemo b/makenemo index 5d03dcc1..f473c4e5 100755 --- a/makenemo +++ b/makenemo @@ -1,9 +1,8 @@ #!/bin/bash -#set -x set -o posix +#set -x #set -u #set -e -#+ # # =============== # makenemo @@ -16,15 +15,12 @@ set -o posix # SYNOPSIS # ======== # -# :: -# # $ makenemo # # # DESCRIPTION # =========== # -# # This script aims : # # - to choose MYCONFIG @@ -44,11 +40,8 @@ set -o posix # # Locally defined : # -# - TAB : NEMO subdirectory used (read) # - MAIN_DIR : self explaining # - CONFIG_DIR : " " " -# - MODELES_DIR : " " " -# - TOOLS_DIR : " " " # - NEMO_DIR : " " " # - REMOTE_CTL : URL link to a remote resource list for an external configuration # which is not part of the reference suite @@ -59,62 +52,26 @@ set -o posix # EXAMPLES # ======== # -# :: -# -# $ ./makenemo -m ifort_osx - j3 -n ORCA2_SI3_PISCES -# -# -# TODO -# ==== -# -# option debug -# -# -# EVOLUTIONS -# ========== -# -# $Id: makenemo 15186 2021-08-12 16:39:09Z gsamson $ -# -# -# -# * creation -# -#- +# $ ./makenemo -m ifort_osx -j 3 -r ORCA2_ICE_PISCES -n MY_ORCA2 -#- -##- Initialization of the options --- + +# Initialization of the options x_d=''; x_h=''; x_n=''; x_r=''; x_c=''; x_u=''; x_a=''; x_m=''; x_t=''; x_b=''; -x_j='1'; x_e='none'; x_s='src'; x_v='1' -x_c_cfg=0 -x_nocdf=0 - -##- Local variables --- -b_n=$(basename ${0}) -OPTIND='1' -MAIN_DIR=$(cd $(dirname "$0"); pwd) -MAIN_DIR=${MAIN_DIR%/sette} -MAIN_DIR=${MAIN_DIR%/tools} -MAIN_DIR=${MAIN_DIR%/cfgs} -MAIN_DIR=${MAIN_DIR%/tests} -MAIN_DIR=${MAIN_DIR%/ext} -MAIN_DIR=${MAIN_DIR%/arch} -export MAIN_DIR -# -export CFGS_DIR=${MAIN_DIR}/cfgs -export TESTS_DIR=${MAIN_DIR}/tests -export TOOLS_DIR=${MAIN_DIR}/tools -export COMPIL_DIR=${MAIN_DIR}/mk -export NEMO_DIR=${MAIN_DIR}/${x_s} -export AGRIFUSE='10' +x_j='1'; x_e=''; x_s='src'; x_v='1' list_key='0'; chk_key='1' list_add_key=''; list_def_key=''; list_del_key='' -#- -#- FCM and functions location --- -export PATH=${MAIN_DIR}/ext/FCM/bin:$PATH +x_c_cfg=0; x_nocdf=0 + + +# Local variables +MAIN_DIR=$(cd $(dirname "$0"); pwd) +MAIN_DIR=${MAIN_DIR%/+(sette|tools|cfgs|tests|ext|arch)} +COMPIL_DIR=${MAIN_DIR}/mk +PATH=${MAIN_DIR}/ext/FCM/bin:$PATH -#- -#- Choice of the options --- + +# Choice of the options while [ ${#1} -gt 0 ]; do case "$1" in @@ -228,91 +185,107 @@ EOF shift done -export NEW_CONF=${x_n} + +# Variables definition based on options NBR_PRC=${x_j} CMP_NAM=${x_m} -NEM_SUBDIR=${x_d} -REF_CONF=${x_r} -DEMO_CONF=${x_a} -export NEMO_DIR=${MAIN_DIR}/${x_s} NEMO_DBG=${x_b} +NEMO_DIR=${MAIN_DIR}/${x_s} + + +# Print available arch files +[ "${CMP_NAM}" == 'all' ] && ${COMPIL_DIR}/Flist_archfile.sh && exit 0 + + +# New config case +if [ -n "${x_n}" ]; then + + # Look for already-existing new config + NEW_CONF=${x_n} + if [ -n "${x_t}" ]; then + NEW_DIR=$( find ${x_t} -maxdepth 1 -type d -name ${x_n} 2>/dev/null ) + else + NEW_DIR=$( find ${MAIN_DIR}/cfgs ${MAIN_DIR}/tests -maxdepth 1 -type d -name ${NEW_CONF} 2>/dev/null ) + fi + NEW_NB=$( echo ${NEW_DIR} | wc -w ) + NEW_CMP=$( grep -l "^${NEW_CONF} " ${MAIN_DIR}/cfgs/*_cfgs.txt ${MAIN_DIR}/tests/*_cfgs.txt ) + + # Define if new config needs to be created or not + if [[ ${NEW_NB:-0} -eq 0 || -z "${NEW_CMP}" ]]; then + DO_NEW=1 + else + DO_NEW=0 + NEW_SUB="$( grep "^${NEW_CONF} " ${NEW_CMP} | awk '{$1 = ""; print $0}' )" + if [[ -n "${x_r}" || -n "${x_a}" ]]; then + echo -e "\nWARNING: ${NEW_CONF} configuration is already existing, we ignore \"-r\" & \"-a\" options\n" + fi + fi -[ "${CMP_NAM}" == 'all' ] && . ${COMPIL_DIR}/Flist_archfile.sh all && exit - -# '-r': reference config ('cfgs' directory) -if [ -n "${REF_CONF}" ]; then - conf_file=ref_cfgs.txt ; export CONFIG_DIR=${CFGS_DIR} ; TML_CONF=${REF_CONF} -# '-a': testcases ('tests' directory) -elif [ -n "${DEMO_CONF}" ]; then - conf_file=demo_cfgs.txt; export CONFIG_DIR=${TESTS_DIR}; TML_CONF=${DEMO_CONF} -# '-n': new or already-existing config (any directory) -elif [[ -n "${NEW_CONF}" && -z "${conf_file}" ]]; then - # already-existing config (check work_cfgs.txt) - if [ $( grep -l "^${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt 2> /dev/null | wc -l ) -eq 1 ]; then - conf_file=$( grep -l "^${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt ) - export CONFIG_DIR=$( dirname $conf_file ); conf_file=$( basename $conf_file ) - TML_CONF=${NEW_CONF} - # new config (check ref_cfgs.txt & demo_cfgs.txt) - elif [ $( grep -l "^${NEW_CONF} " ${CFGS_DIR}/ref_cfgs.txt ${TESTS_DIR}/demo_cfgs.txt 2> /dev/null | wc -l ) -eq 1 ]; then - conf_file=$( grep -l "^${NEW_CONF} " ${CFGS_DIR}/ref_cfgs.txt ${TESTS_DIR}/demo_cfgs.txt ) - export CONFIG_DIR=$( dirname $conf_file ); conf_file=$( basename $conf_file ) - TML_CONF=${NEW_CONF} - # config not found in both cfgs & tests directories - else - echo -e "\033[0;31m\nUser configuration ${NEW_CONF} not found !" - echo -e "Please choose a reference configuration (-r) or a testcase (-a)" - echo -e "among this list to create your own configuration (-n):" - ${COMPIL_DIR}/Flist_cfgs.sh - exit 2 +fi + + +# Define ref config if new config not defined or not existing yet +if [[ ${DO_NEW:-0} -eq 1 || -z "${NEW_CONF}" ]]; then + + if [[ -n "${x_r}" || -n "${x_a}" ]]; then + REF_DIR=$( find ${MAIN_DIR}/cfgs ${MAIN_DIR}/tests -maxdepth 1 -type d -name ${x_r:-""} -o -name ${x_a:-""} 2>/dev/null ) + REF_NB=$( echo ${REF_DIR} | wc -w ) + REF_CMP=$( grep -l "^${x_r} \|^${x_a} " ${MAIN_DIR}/cfgs/ref_cfgs.txt ${MAIN_DIR}/tests/demo_cfgs.txt ) + if [[ ${REF_NB} -eq 1 && -n "${REF_CMP}" ]]; then + REF_CONF=$(basename ${REF_DIR}) + REF_TYPE=$(basename ${REF_DIR%\/*}) + REF_FILE=$(basename ${REF_CMP}) + REF_SUB="$( grep "^${REF_CONF} " ${REF_CMP} | awk '{$1 = ""; print $0}' )" + elif [ ${REF_NB} -gt 1 ]; then + echo -e "Please choose only one reference configuration (-r) or testcase (-a)"; exit 2 + elif [ ${REF_NB} -eq 0 ]; then + echo -e "Please choose at least one reference configuration (-r) or testcase (-a) from:" + ${COMPIL_DIR}/Flist_cfgs.sh ${MAIN_DIR}; exit 2 fi -# using both '-r' and '-a' options -elif [[ -n "${REF_CONF}" && -n "${DEMO_CONF}" ]]; then - echo -e "\033[0;31m\nYou have to choose whether you work with:" - echo -e " - LTS configurations in ./cfgs ('-r') or" - echo -e " - Unsupported cases in ./tests ('-a')\033[0m\n" - exit 2 -# config found in both cfgs & tests directories -elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt 2> /dev/null | wc -l ) -gt 1 ]; then - echo -e "\033[0;31m\nUser configuration ${NEW_CONF} is present in both" - echo -e "cfgs/work_cfgs.txt and tests/work_cfgs.txt files" - echo -e "Please choose only one \033[0m" - exit 2 -# 'all': list all available configurations -elif [[ "${REF_CONF}" == 'all' || "${DEMO_CONF}" == 'all' ]]; then - ${COMPIL_DIR}/Flist_cfgs.sh - exit 0 -# any other case -else - exit 2 + else + echo -e "Please choose at least one reference configuration (-r) or testcase (-a) from:" + ${COMPIL_DIR}/Flist_cfgs.sh ${MAIN_DIR}; exit 2 + fi + + # force config creation if ref config installed outside nemo directory + if [[ -n "${x_t}" && ${x_t} != ${REF_DIR%\/*} ]]; then DO_NEW=1; fi + fi -if [ -z "${NEW_CONF}" ]; then NEW_CONF=$TML_CONF; fi -export NEMO_TDIR=${x_t:-$CONFIG_DIR} + +# Current config (new or ref) definition +CFG_DIR=$( dirname ${NEW_CMP:-${REF_CMP}} ) +CUR_DIR=${NEW_DIR:-${REF_DIR}} +CUR_CONF=${NEW_CONF:-${REF_CONF}} +CUR_SUB=${NEW_SUB:-${REF_SUB}} +NEMO_TDIR=${x_t:-${CUR_DIR%\/*}} -# check configuration existence & clean it if asked -incfg=$( find $NEMO_TDIR -type d -maxdepth 1 -name ${NEW_CONF} 2>/dev/null | wc -l ) # this configuration exists in CFGS_DIR -if [ $incfg -eq 1 ] ; then - # CLEANING +# Config cleaning +if [ -d ${NEMO_TDIR}/${CUR_CONF} ]; then + if [ $x_c_cfg -eq 1 ] ; then - . ${COMPIL_DIR}/Fclean_config.sh + ${COMPIL_DIR}/Fclean_config.sh ${NEMO_TDIR}/${CUR_CONF} exit 0 elif [ ${#x_c} -ne 0 ]; then - #read -p "Are you sure that you want to clean $NEW_CONF configuration ? " -n 1 -r; echo + + #read -p "Are you sure that you want to clean $CUR_CONF configuration ? " -n 1 -r; echo #if [[ $REPLY =~ ^[Yy]$ ]]; then - # We coose the default light file - [ $x_nocdf -eq 1 ] && export USEBLD=bldxagxcdf.cfg || export USEBLD=bldxag.cfg - # We look after agrif - grep key_agrif ${NEMO_TDIR}/BLD/cpp.fcm 2>/dev/null && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/} + # choose & generate fcm cfg file + [ $x_nocdf -eq 1 ] && USEBLD=bldxagxcdf.cfg || USEBLD=bldxag.cfg + grep key_agrif ${NEMO_TDIR}/${CUR_CONF}/BLD/cpp.fcm 2>/dev/null && USEBLD=${USEBLD/xag/} + sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~NEMO_TDIR~${NEMO_TDIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/${USEBLD} > ${NEMO_TDIR}/${CUR_CONF}/BLD/${USEBLD} + # fcm clean - fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || exit 1 - # add remove for clean option - echo -e '\nCleaning '${NEW_CONF}' building directories and variables\n' + fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${NEMO_TDIR}/${CUR_CONF}/BLD/${USEBLD} || exit 1 + + # remove all build directories + echo -e '\nCleaning '${CUR_CONF}' building directories and variables\n' for dir in AGRIFLIB BLD LONG NEMOFILES REPRO_* SHORT WORK; do - rm -rf ${NEMO_TDIR}/${NEW_CONF}/$dir + rm -rf ${NEMO_TDIR}/${CUR_CONF}/$dir done for file in cpp.history cpp.fcm full_key_list.txt; do - rm -f ${NEMO_TDIR}/${NEW_CONF}/BLD/$file + rm -f ${NEMO_TDIR}/${CUR_CONF}/BLD/$file done exit 0 #else @@ -320,117 +293,108 @@ if [ $incfg -eq 1 ] ; then # exit 2 #fi fi - if [[ -n "$x_n" && -n "$REF_CONF" ]]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-r $REF_CONF\"\n"; REF_CONF=""; fi - if [[ -n "$x_n" && -n "$DEMO_CONF" ]]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-a $DEMO_CONF\"\n"; DEMO_CONF=""; fi -elif [ $incfg -eq 0 ]; then +else [ $x_c_cfg -eq 1 ] && echo -e "\nWARNING: Configuration cleaning of a non-existing configuration, we ignore\n" && exit 0 [ ${#x_c} -ne 0 ] && echo -e "\nWARNING: Compilation cleaning of a non-existing configuration, we ignore\n" && exit 0 fi -## No ref. cfg or demo selected -if [[ -z "${REF_CONF}" && -z "${DEMO_CONF}" && $incfg -eq 0 ]]; then - echo -e "\033[0;31m\nAt least a reference configuration ('-r'), a test case ('-a'), " - echo -e "a remote configuration ('-u') has to be choosen to build a new configuration!!!\033[0m" - ${COMPIL_DIR}/Flist_cfgs.sh - exit 2 +# Create/update config components list +NEM_SUBDIR=( ${x_d:-${CUR_SUB}} ) +if [ ${DO_NEW:-0} -eq 1 ]; then + echo + printf "\nYou are installing a new configuration %s from %s " ${CUR_CONF} ${REF_CONF} + printf "with sub-components: %s\n" "${NEM_SUBDIR[*]}" + echo +else + echo + printf "\nYou are compiling an existing configuration %s " ${CUR_CONF} + printf "with sub-components: %s\n" "${NEM_SUBDIR[*]}" + echo fi - -## Update sub-comps if needed -if [ -z "${NEM_SUBDIR}" ]; then - NEM_SUBDIR=$( grep "${TML_CONF} " ${CONFIG_DIR}/${conf_file} | awk '{$1 = ""; print $0}' ) +if [[ -n "${x_d}" || ${DO_NEW:-0} -eq 1 ]]; then + [ -f ${CFG_DIR}/work_cfgs.txt ] && sed -i "/^${CUR_CONF} /d" ${CFG_DIR}/work_cfgs.txt + echo ${CUR_CONF} "${NEM_SUBDIR[*]}" >> ${CFG_DIR}/work_cfgs.txt fi -export NEM_SUBDIR="${NEM_SUBDIR}" NEW_CONF="${NEW_CONF}" -## Create new config -if [ ${TML_CONF} != ${NEW_CONF} ]; then - echo - printf "\nYou are installing a new configuration %s from %s " ${NEW_CONF} ${TML_CONF} - if [ -n "${NEM_SUBDIR}" ]; then printf "with sub-components: %s\n" "${NEM_SUBDIR}"; fi - echo -fi -${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${CONFIG_DIR}/${TML_CONF} # must be called for existing config to create EXP00 if not existing +# Create config directories +${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${CUR_CONF} ${REF_DIR:-${NEMO_TDIR}/${CUR_CONF}} -## Save new configuration with sub-components set in work_cfgs.txt -[ -f ${CONFIG_DIR}/work_cfgs.txt ] && sed -i "/^${NEW_CONF} /d" ${CONFIG_DIR}/work_cfgs.txt -echo ${NEW_CONF} "${NEM_SUBDIR}" >> ${CONFIG_DIR}/work_cfgs.txt -#- Create the WORK --- -#- Clean links and librairies --- -#- Creating the good links, at first on OCE --- -. ${COMPIL_DIR}/Fmake_WORK.sh ${x_e[@]} || exit 3 +# Create/update WORK directory +${COMPIL_DIR}/Fmake_WORK.sh "${NEM_SUBDIR[*]/#/${NEMO_DIR}/}" "${x_e:-"MY_SRC"}" ${NEMO_TDIR}/${CUR_CONF} || exit 3 -. ${COMPIL_DIR}/Fmake_bld.sh ${CONFIG_DIR} ${NEW_CONF} ${NEMO_TDIR} || exit 3 -# build the complete list of the cpp keys of this configuration +# Build the complete list of the CPP keys of this configuration if [[ ${chk_key} -eq 1 || ${list_key} -eq 1 ]] ; then - for i in $( grep "^ *#.* key_" ${NEMO_TDIR}/${NEW_CONF}/WORK/* ); do - echo $i | grep key_ | sed -e "s/=.*//" - done \ - | sort -d | uniq > ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt - - [ ${list_key} -eq 1 ] && echo && cat ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt && exit 0 + grep -h "^#.*defined.*" ${NEMO_TDIR}/${CUR_CONF}/WORK/* | \ + grep -o "key_[[:alnum:]]\+\|key_[[:alnum:]]\+_[[:alnum:]]\+\|iso_[[:alnum:]]\+_[[:alnum:]]\+" | \ + sort | uniq > ${NEMO_TDIR}/${CUR_CONF}/BLD/full_key_list.txt + [ ${list_key} -eq 1 ] && echo && cat ${NEMO_TDIR}/${CUR_CONF}/BLD/full_key_list.txt && exit 0 fi -#- At this stage new configuration has been added, we add or remove keys -[ ! -z "${list_add_key}" ] && { . ${COMPIL_DIR}/Fadd_keys.sh ${NEW_CONF} add_key ${list_add_key}; } -[ ! -z "${list_def_key}" ] && { . ${COMPIL_DIR}/Fdef_keys.sh ${NEW_CONF} def_key ${list_def_key}; } -[ ! -z "${list_del_key}" ] && { . ${COMPIL_DIR}/Fdel_keys.sh ${NEW_CONF} del_key ${list_del_key}; } -#- check that all keys are really existing... +# CPP keys addition/removal +[ -n "${list_add_key}" ] && ${COMPIL_DIR}/Fadd_keys.sh ${NEMO_TDIR}/${CUR_CONF} ${list_add_key} +[ -n "${list_def_key}" ] && ${COMPIL_DIR}/Fdef_keys.sh ${NEMO_TDIR}/${CUR_CONF} ${list_def_key} +[ -n "${list_del_key}" ] && ${COMPIL_DIR}/Fdel_keys.sh ${NEMO_TDIR}/${CUR_CONF} ${list_del_key} + + +# CPP keys check if [ $chk_key -eq 1 ] ; then - for kk in $( cat ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ); do - if [ "$( echo $kk | cut -c 1-4 )" == "key_" ]; then - kk=${kk/=*/} - if [ ! $( grep -w $kk ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt ) ]; then - echo - echo "E R R O R : key "$kk" is not found in ${NEMO_TDIR}/${NEW_CONF}/WORK routines..." - echo "we stop..." - echo - exit 1 - fi - fi + for kk in $( sed -n "s/bld::tool::fppkeys \+//p" ${NEMO_TDIR}/${CUR_CONF}/cpp_${CUR_CONF}.fcm ); do + if ! grep -q $kk ${NEMO_TDIR}/${CUR_CONF}/BLD/full_key_list.txt; then + echo + echo "E R R O R : key "$kk" is not found in ${NEMO_TDIR}/${CUR_CONF}/WORK routines..." + echo "we stop..." + echo + exit 1 + fi done fi -#- At this stage cpp keys have been updated. we can check the arch file -#- When used for the first time, choose a compiler --- -. ${COMPIL_DIR}/Fcheck_archfile.sh ${NEMO_TDIR}/${NEW_CONF}/BLD/arch_nemo.fcm ${NEMO_TDIR}/${NEW_CONF}/BLD/cpp.fcm ${CMP_NAM} || exit 3 -#- -#_ END OF CONFIGURATION PHASE -#_ -#- -#- Compile --- +# CPP & arch files check +ln -sf ${NEMO_TDIR}/${CUR_CONF}/cpp_${CUR_CONF}.fcm ${NEMO_TDIR}/${CUR_CONF}/BLD/cpp.fcm +${COMPIL_DIR}/Fcheck_archfile.sh ${NEMO_TDIR}/${CUR_CONF}/BLD/arch_nemo.fcm ${NEMO_TDIR}/${CUR_CONF}/BLD/cpp.fcm ${MAIN_DIR}/arch/arch-${CMP_NAM}.fcm ${NEMO_DBG} || exit 3 + +# Compilation if [ "${NBR_PRC}" -gt 0 ]; then - # We coose the default light file - [ $x_nocdf -eq 1 ] && export USEBLD=bldxagxcdf.cfg || export USEBLD=bldxag.cfg + # choose & generate fcm cfg file + [ $x_nocdf -eq 1 ] && USEBLD=bldxagxcdf.cfg || USEBLD=bldxag.cfg - # We look after agrif - grep key_agrif ${NEMO_TDIR}/${NEW_CONF}/BLD/cpp.fcm 2>/dev/null && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/} - . ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} arch_nemo.fcm || exit 3 - - ## if AGRIF we do a first preprocessing - if [[ ${#x_c} -eq 0 && "$AGRIFUSE" -eq 1 ]]; then - fcm build --ignore-lock -j 1 ${COMPIL_DIR}/bld_preproagr.cfg || exit 1 - echo '' + # AGRIF preprocessing + grep key_agrif ${NEMO_TDIR}/${CUR_CONF}/BLD/cpp.fcm 2>/dev/null && USEBLD=${USEBLD/xag/} + if [[ ! ${USEBLD} =~ "xag" ]]; then + ${COMPIL_DIR}/Fprep_agrif.sh ${MAIN_DIR} ${NEMO_TDIR}/${CUR_CONF} || exit 3 + + # compile & copy conv + sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~NEMO_TDIR~${NEMO_TDIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/conv.cfg > ${NEMO_TDIR}/${CUR_CONF}/BLD/conv.cfg + fcm build ${NEMO_TDIR}/${CUR_CONF}/BLD/conv.cfg || exit 1 + ln -sfv ${MAIN_DIR}/ext/AGRIF/agrif_oce.in ${NEMO_TDIR}/${CUR_CONF}/AGRIFLIB/bin/conv ${NEMO_TDIR}/${CUR_CONF}/NEMOFILES/. + + sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~NEMO_TDIR~${NEMO_TDIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/bld_preproagr.cfg > ${NEMO_TDIR}/${CUR_CONF}/BLD/bld_preproagr.cfg + fcm build --ignore-lock -j 1 ${NEMO_TDIR}/${CUR_CONF}/BLD/bld_preproagr.cfg || exit 1 + echo echo "---------------------------------" echo "CONV preprocessing successfull !!" echo "---------------------------------" - echo '' + echo fi - fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || exit 1 + sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~NEMO_TDIR~${NEMO_TDIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/${USEBLD} > ${NEMO_TDIR}/${CUR_CONF}/BLD/${USEBLD} + fcm build --ignore-lock -v ${x_v} -j ${NBR_PRC} ${NEMO_TDIR}/${CUR_CONF}/BLD/${USEBLD} || exit 1 - if [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ]; then - ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ${NEMO_TDIR}/${NEW_CONF}/EXP00/nemo + if [ -f ${NEMO_TDIR}/${CUR_CONF}/BLD/bin/nemo.exe ]; then + ln -sfv ${NEMO_TDIR}/${CUR_CONF}/BLD/bin/nemo.exe ${NEMO_TDIR}/${CUR_CONF}/EXP00/nemo + else + exit 1 fi - fi -#- Unset variables -${COMPIL_DIR}/Fclean_var.sh + +exit 0 diff --git a/mk/Fadd_keys.sh b/mk/Fadd_keys.sh index e4fc8c78..d563a75a 100755 --- a/mk/Fadd_keys.sh +++ b/mk/Fadd_keys.sh @@ -62,16 +62,14 @@ set -o posix # * creation # #- - echo "Adding keys in : ${NEW_CONF}" - for i in ${list_add_key} ; do - if [ "$(cat ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "\<$i\>" )" -ne 0 ] ; then - echo "key $i already present in cpp_${NEW_CONF}.fcm" - else - sed -e "s/$/ ${i}/" ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm > ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp - mv ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm - echo "added key $i in ${NEW_CONF}" - fi - done - - unset -v list_add_key +echo "Adding keys ${2} in : ${1}" + +for i in ${2} ; do + if [ "$(cat ${1}/cpp_$(basename ${1}).fcm | grep -c "\<$i\>" )" -ne 0 ] ; then + echo "key $i already present in cpp_$(basename ${1}).fcm" + else + sed -i "s/$/ ${i}/" ${1}/cpp_$(basename ${1}).fcm + echo "added key $i in $(basename ${1})" + fi +done diff --git a/mk/Fcheck_archfile.sh b/mk/Fcheck_archfile.sh index f7aad910..b57a6aa3 100755 --- a/mk/Fcheck_archfile.sh +++ b/mk/Fcheck_archfile.sh @@ -118,7 +118,7 @@ if [ ${#3} -eq 0 ]; then # arch not specified fi fi else - nb=$( find ${MAIN_DIR}/arch -name arch-${3}.fcm -print | wc -l ) + nb=$( find $(dirname ${3}) -name $(basename ${3}) -print | wc -l ) if [ $nb -eq 0 ]; then # no arch file found echo "Warning !!!" echo "Compiler not existing" @@ -129,12 +129,12 @@ else if [ $nb -gt 1 ]; then # more than 1 arch file found echo "Warning !!!" echo "more than 1 arch file for the same compiler have been found" - find ${MAIN_DIR}/arch -name arch-${3}.fcm -print + find $(dirname ${3}) -name $(basename ${3}) -print echo "keep only 1" echo "EXITING..." exit 1 fi - myarch=$( find ${MAIN_DIR}/arch -name arch-${3}.fcm -print ) + myarch=$( find $(dirname ${3}) -name $(basename ${3}) -print ) # we were already using this arch file ? if [ "$myarch" == "$( cat $(dirname $1)/arch.history 2>/dev/null)" ]; then if [ -f $1 ]; then @@ -151,7 +151,7 @@ else [ ${#mycpp} -ne 0 ] && cpeval ${myarch} $1 fi # has myarch file been updated since we copied it in ${COMPIL_DIR}? - myarch=$( find -L ${MAIN_DIR}/arch -cnewer $(basename $1) -name arch-${3}.fcm -print ) + myarch=$( find -L $(dirname ${3}) -cnewer $(basename $1) -name $(basename ${3}) -print ) [ ${#myarch} -ne 0 ] && cpeval ${myarch} $1 else cpeval ${myarch} $1 @@ -185,7 +185,7 @@ then fi #- in TOOLS directory looking for USE xios else - use_iom=$( egrep --exclude-dir=.svn -r USE ${MAIN_DIR}/src/* | grep -c xios ) + use_iom=$( egrep --exclude-dir=.svn -r USE $(dirname ${3})/../src/* | grep -c xios ) have_lxios=$( sed -e "s/#.*$//" $1 | grep -c "\-lxios" ) if [[ ( $use_iom -eq 0 ) || ( $have_lxios != 1 ) ]] then @@ -216,7 +216,7 @@ do done # Nemo debug ? -if [ -n "${NEMO_DBG}" ]; then +if [ -n "${4}" ]; then if (! grep -q "^%DEBUG_FCFLAGS" $1 ); then echo "ERROR: You must defined '%DEBUG_FCFLAGS' in your arch file if you want to compile Nemo in debug mode using '-d' option" exit 1 diff --git a/mk/Fcheck_config.sh b/mk/Fcheck_config.sh index 996047f5..24b26104 100755 --- a/mk/Fcheck_config.sh +++ b/mk/Fcheck_config.sh @@ -69,18 +69,18 @@ declare -a ZTAB if [ ${#2} -eq 0 ]; then tail -1 ${CONFIG_DIR}/$1 > ${CONFIG_DIR}/cfg.tmp read -a ZTAB < ${CONFIG_DIR}/cfg.tmp - NEW_CONF=${ZTAB[0]} ; TAB=( ${ZTAB[@]:1} ) + CUR_CONF=${ZTAB[0]} ; TAB=( ${ZTAB[@]:1} ) \rm ${CONFIG_DIR}/cfg.tmp echo "Warning !!!" echo "No configuration specified" echo "Use makenemo -n MYCONFIG" echo "or makenemo -h for help" - echo "Using default configuration : ${NEW_CONF}" + echo "Using default configuration : ${CUR_CONF}" fi if [ "$1" == cfg.txt ]; then - cat ${CONFIG_DIR}/$1 | grep "${NEW_CONF} " > ${CONFIG_DIR}/cfg.tmp + cat ${CONFIG_DIR}/$1 | grep "${CUR_CONF} " > ${CONFIG_DIR}/cfg.tmp read -a ZTAB < ${CONFIG_DIR}/cfg.tmp - NEW_CONF=${ZTAB[0]} ; TAB=( ${ZTAB[@]:1} ) + CUR_CONF=${ZTAB[0]} ; TAB=( ${ZTAB[@]:1} ) \rm ${CONFIG_DIR}/cfg.tmp fi diff --git a/mk/Fclean_config.sh b/mk/Fclean_config.sh index af5d99d9..19ca4f06 100755 --- a/mk/Fclean_config.sh +++ b/mk/Fclean_config.sh @@ -63,31 +63,23 @@ set -o posix # #- -NEW_CONF=${x_n} +CONF=$(basename ${1}) +CONFIG_DIR=$(dirname ${1}) -if [ ${#NEW_CONF} -eq 0 ] ; then +if [ ${#CONF} -eq 0 ] ; then echo " " echo "No configuration specified, please use makenemo -n CONFIG clean_config " else echo " " - echo "Are you sure that you want to remove this directory $NEW_CONF? [y/n] " + echo "Are you sure that you want to remove this directory $CONF? [y/n] " read answer answer=`echo $answer | sed 's/^[y].*$/y/'` if [ -z "$answer" -o "x$answer" = "xy" ]; then - ## testing if configuration exists - if [[ ! $( grep "${NEW_CONF} " */work_cfgs.txt ) ]] ; then - echo "The configuration ${NEW_CONF} does not exist in file work_cfgs.txt" - echo "No removing configuration" - echo " " - else - CONFIG_DIR=${MAIN_DIR}/$( grep -l "${NEW_CONF} " */work_cfgs.txt | cut -d/ -f1 ) - rm -rf ${CONFIG_DIR}/${NEW_CONF} - sed -e "/${NEW_CONF} /d" ${CONFIG_DIR}/work_cfgs.txt > ${CONFIG_DIR}/work_cfgs.tmp - mv ${CONFIG_DIR}/work_cfgs.tmp ${CONFIG_DIR}/work_cfgs.txt - echo "${NEW_CONF} configuration REMOVED" - fi + rm -rf ${CONFIG_DIR}/${CONF} + sed -i "/^${CONF} /d" ${CONFIG_DIR}/work_cfgs.txt > ${CONFIG_DIR}/work_cfgs.tmp + echo "${CONF} configuration REMOVED" else echo " " @@ -95,5 +87,3 @@ else fi fi - -unset -v answer diff --git a/mk/Fclean_var.sh b/mk/Fclean_var.sh deleted file mode 100755 index eb624c71..00000000 --- a/mk/Fclean_var.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -#set -x -set -o posix -#set -u -#set -e -#+ -# -# ============= -# Fclean_var.sh -# ============= -# -# ---------------------------- -# Clean environment variables -# ---------------------------- -# -# SYNOPSIS -# ======== -# -# :: -# -# $ Fclean_var.sh -# -# -# DESCRIPTION -# =========== -# -# -# Clean environment variables -# -# EXAMPLES -# ======== -# -# :: -# -# $ ./Fclean_var.sh -# -# -# TODO -# ==== -# -# option debug -# -# -# EVOLUTIONS -# ========== -# -# $Id: Fclean_var.sh 4990 2014-12-15 16:42:49Z timgraham $ -# -# -# -# * creation -# -#- -#- Unset variables - -unset -v NSTOP -unset -v TAB -unset -v NEW_CONF -unset -v REF_CONF -unset -v CMP_NAM -unset -v NBR_PRC -unset -v NEM_SUBDIR -unset -v MAIN_DIR -unset -v CONFIG_DIR -unset -v TOOLS_DIR -unset -v COMPIL_DIR -unset -v NEMO_DIR -unset -v USEBLD diff --git a/mk/Fdef_keys.sh b/mk/Fdef_keys.sh index bf94a481..482db952 100755 --- a/mk/Fdef_keys.sh +++ b/mk/Fdef_keys.sh @@ -56,8 +56,5 @@ set -o posix # #- -echo "Defining keys in : ${NEW_CONF}" - -echo " bld::tool::fppkeys ${list_def_key}" > ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm - -unset -v list_def_key +echo "Defining keys in : $(dirname ${1})" +echo " bld::tool::fppkeys ${2}" > ${1}/cpp_$(basename ${1}).fcm diff --git a/mk/Fdel_keys.sh b/mk/Fdel_keys.sh index ff95aa2b..4bbcd38b 100755 --- a/mk/Fdel_keys.sh +++ b/mk/Fdel_keys.sh @@ -60,22 +60,13 @@ set -o posix # #- -echo "Removing keys in : ${NEW_CONF}" +echo "Removing keys ${2} in : ${1}" -for i in ${list_del_key} ; do - - if [ "$(echo ${i} | grep -c key_nproc )" -ne 0 ]; then - sed -e "s/key_nproc[ij]=.* //" ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \ - > ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp - mv ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm - echo " " - elif [ "$(cat ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "$i" )" -ne 0 ]; then - sed -e "s/\b${i}\b//" ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \ - > ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp - mv ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm - echo "deleted key $i in ${NEW_CONF}" +for i in ${2} ; do + if [ "$(echo ${i} | grep -c key_nproc )" -gt 0 ]; then + sed -i "s/key_nproc[ij]=.* //" ${1}/cpp_$(basename ${1}).fcm + elif [ "$(cat ${1}/cpp_$(basename ${1}).fcm | grep -c "$i")" -gt 0 ]; then + sed -i "s/\b${i}\b//" ${1}/cpp_$(basename ${1}).fcm + echo "deleted key $i in $(basename ${1})" fi - done - -unset -v list_del_key diff --git a/mk/Flist_archfile.sh b/mk/Flist_archfile.sh index 46c570be..506f620b 100755 --- a/mk/Flist_archfile.sh +++ b/mk/Flist_archfile.sh @@ -67,11 +67,11 @@ archfile_loop() { echo -e "\n ¤ Generic computing architectures" -archfile_loop ${MAIN_DIR}/arch +archfile_loop ${1}/arch -for dir in $( ls ${MAIN_DIR}/arch | grep -v "fcm$" ); do - echo -e "\n ¤ Specific HPC architectures for "${dir} - archfile_loop ${MAIN_DIR}/arch/$dir +for dir in $( ls ${1}/arch | grep -v "fcm$" ); do + echo -e "\n ¤ Specific HPC architectures for "${dir} + archfile_loop ${1}/arch/$dir done echo diff --git a/mk/Flist_cfgs.sh b/mk/Flist_cfgs.sh index 34c8b36c..33ca7cc2 100755 --- a/mk/Flist_cfgs.sh +++ b/mk/Flist_cfgs.sh @@ -1,14 +1,14 @@ #!/bin/bash echo -e "\n ¤ Reference configurations with default sub-components (can be updated by a new set)" -cat ${MAIN_DIR}/cfgs/ref_cfgs.txt \ +cat ${1}/cfgs/ref_cfgs.txt \ | awk '{printf "%-20s", $1}{$1 = ""; printf "%s\n", $0}' echo -e "\n ¤ Demonstrations cases (see https://github.com/sflavoni/NEMO-test-cases for more)" -cat ${MAIN_DIR}/tests/demo_cfgs.txt \ +cat ${1}/tests/demo_cfgs.txt \ | awk '{printf "%-20s", $1}{$1 = ""; printf "%s\n", $0}' echo -e "\n ¤ Available sub-components ('OCE' is mandatory in any set)" -ls ${MAIN_DIR}/src | awk -F/ '{ print $NF }' | column +ls ${1}/src | awk -F/ '{ print $NF }' | column echo diff --git a/mk/Fmake_WORK.sh b/mk/Fmake_WORK.sh index eee618ce..afa6a46b 100755 --- a/mk/Fmake_WORK.sh +++ b/mk/Fmake_WORK.sh @@ -34,7 +34,7 @@ set -o posix # # Make the WORK directory: # -# - Create line in NEW_CONF/WORK +# - Create line in CUR_CONF/WORK # - Use specified sub-directories previously # - OCE has to be done first !!! # @@ -63,39 +63,37 @@ set -o posix # * creation # #- -declare ZSRC=${@} -ZCONF=${NEMO_TDIR}/${NEW_CONF} -ZTAB=${NEM_SUBDIR[@]} -declare NDIR=${#ZTAB[@]} +ZTAB=( $1 ) +ZSRC=( $2 ) +ZCONF=$3 +NDIR=${#ZTAB[@]} +echo '' echo 'Creating '${ZCONF}'/WORK = '${ZTAB[*]}' for '${ZCONF##*/} +echo '' [ ! -d ${ZCONF}/MY_SRC ] && \mkdir -p ${ZCONF}/MY_SRC +[ ! -d ${ZCONF}/BLD ] && \mkdir -p ${ZCONF}/BLD [ -d ${ZCONF}/WORK ] || \mkdir -p ${ZCONF}/WORK for comp in ${ZTAB[*]}; do - find ${NEMO_DIR}/$comp -name \*.[Ffh]90 -exec ln -sf {} ${ZCONF}/WORK \; + find $comp -name \*.[Ffh]90 -exec ln -sf {} ${ZCONF}/WORK \; done -cd ${ZCONF} -for ZDIR in ${ZSRC[@]}; do - if [ -d ${ZDIR} ] ; then +for ZDIR in ${ZSRC[*]}; do + if [ -d ${ZCONF}/${ZDIR} ] ; then + d=${ZCONF}/${ZDIR} + elif [ -d ${ZDIR} ] ; then d=${ZDIR} - else - d='MY_SRC' - echo 'External directory for MY_SRC unspecified or does not exist. Using default.' fi for ff in `(find ${d} -name \*.[Ffh]90 2>/dev/null)` do if [ "$ff" != "${ff#/}" ]; then - ln -sf $ff WORK/. + ln -sf $ff ${ZCONF}/WORK/. else - ln -sf ../$ff WORK/. + ln -sf ../$ff ${ZCONF}/WORK/. fi done echo ${d}' content is linked to '${ZCONF}/WORK done -cd - - -unset -v ZCONF ZTAB NDIR diff --git a/mk/Fmake_bld.sh b/mk/Fmake_bld.sh deleted file mode 100755 index bd4b331c..00000000 --- a/mk/Fmake_bld.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -#set -x -set -o posix -#set -u -#set -e -#+ -# -# ============ -# Fmake_bld.sh -# ============ -# -# -------------------- -# Make build directory -# -------------------- -# -# SYNOPSIS -# ======== -# -# :: -# -# $ Fmake_bld.sh -# -# -# DESCRIPTION -# =========== -# -# -# Under CONFIG_NAME : -# - Make the build directory -# - Create repositories needed : -# - BLD for compilation -# -# A tmpdir can be specified for memory issues. -# -# -# EXAMPLES -# ======== -# -# :: -# -# $ ./Fmake_bld.sh NEMOGCM/cfgs GYRE /usr/tmp -# -# -# TODO -# ==== -# -# option debug -# -# -# EVOLUTIONS -# ========== -# -# $Id: Fmake_bld.sh 9651 2018-05-28 06:47:14Z nicolasmartin $ -# -# -# -# * creation -# -#- -[ ! -d ${3}/${2} ] && \mkdir -p ${3}/${2} -[ ! -d ${3}/${2}/BLD ] && \mkdir -p ${3}/${2}/BLD -[ -f ${3}/${2}/cpp_${2}.fcm ] && ln -sf ${3}/${2}/cpp_${2}.fcm ${3}/${2}/BLD/cpp.fcm -rm -f ${1}/${2}/BLD/fcm.bld.lock diff --git a/mk/Fmake_tools_bld.sh b/mk/Fmake_tools_bld.sh index 3a9a5041..a2da0c90 100755 --- a/mk/Fmake_tools_bld.sh +++ b/mk/Fmake_tools_bld.sh @@ -63,4 +63,4 @@ set -o posix # enforce presence of cpp_tools.fcm (write a blank one if not present in the tools directory) # cp instead of ln to avoid overwiting previous tool cpp_XXX.fcm file when compiling a file without cpp_YYY.fcm file. [ -f ${3}/${2}/cpp_${2}.fcm ] && ln -sf -f ${3}/${2}/cpp_${2}.fcm ${3}/${2}/BLD/cpp_tools.fcm || echo 'bld::tool::fppkeys ' > ${3}/${2}/BLD/cpp_tools.fcm -rm -f ${1}/${NEW_CONF}/BLD/fcm.bld.lock +rm -f ${1}/${CUR_CONF}/BLD/fcm.bld.lock diff --git a/mk/Fprep_agrif.sh b/mk/Fprep_agrif.sh index 64375c4f..75025edd 100755 --- a/mk/Fprep_agrif.sh +++ b/mk/Fprep_agrif.sh @@ -55,26 +55,13 @@ set -o posix #- #- AGRIF conv -if [ "$AGRIFUSE" == 1 ]; then + #-MPI for AGRIF -if [ ! -f ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h ];then - echo '#if ! defined key_mpi_off' > ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h - echo '#define AGRIF_MPI' >> ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h - echo '#endif' >> ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h +if [ ! -f ${1}/ext/AGRIF/nemo_mpi.h ]; then + echo '#if ! defined key_mpi_off' > ${1}/ext/AGRIF/nemo_mpi.h + echo '#define AGRIF_MPI' >> ${1}/ext/AGRIF/nemo_mpi.h + echo '#endif' >> ${1}/ext/AGRIF/nemo_mpi.h fi - #- CONV -export MYARCH=$3 -fcm build ${COMPIL_DIR}/conv.cfg || exit 1 -#C_COMPILER=${CC-cc} -#gmake CC=${C_COMPILER} -C ${MAIN_DIR}/ext/AGRIF/LIB - #- AGRIF sources -[ ! -d $2/$1/NEMOFILES ] && mkdir $2/$1/NEMOFILES -[ ! -d $2/$1/NEMOFILES/AGRIF_INC ] && mkdir $2/$1/NEMOFILES/AGRIF_INC -[ ! -d $2/$1/NEMOFILES/AGRIF_MODELFILES ] && mkdir $2/$1/NEMOFILES/AGRIF_MODELFILES -cp -f -r ${MAIN_DIR}/ext/AGRIF/agrif_oce.in $2/$1/NEMOFILES/ -#cp -f -r ${MAIN_DIR}/ext/AGRIF/conv $2/$1/NEMOFILES/ -cp -f -r $2/$1/AGRIFLIB/bin/conv $2/$1/NEMOFILES/ - -fi +mkdir -p ${2}/NEMOFILES diff --git a/mk/README b/mk/README deleted file mode 100644 index b54b12da..00000000 --- a/mk/README +++ /dev/null @@ -1,7 +0,0 @@ -CSHRC : -setenv PATH ~/NEMOGCM/TOOLS:$PATH -setenv NEMO_TDIR /users/rblod/tmp - -BASH : -export PATH=$PATH:~/NEMOGCM/TOOLS' -export NEMO_TDIR=/users/rblod/tmp diff --git a/mk/agrifpp.sh b/mk/agrifpp.sh index 308125ce..5ff5bcdb 100755 --- a/mk/agrifpp.sh +++ b/mk/agrifpp.sh @@ -56,12 +56,13 @@ set -o posix #- MYDIR=$1 MYFILE=$(basename "$2") + if [ "$MYFILE" == "agrif2model.f90" ];then - if [ -d ${MYDIR}/${NEW_CONF}/WORK ]; then - \cp ${MYDIR}/${NEW_CONF}/WORK/${MYFILE/.f90/.F90} ${MYDIR}/${NEW_CONF}/NEMOFILES/obj/$MYFILE + if [ -d ${MYDIR}/WORK ]; then + \cp ${MYDIR}//WORK/${MYFILE/.f90/.F90} ${MYDIR}/NEMOFILES/obj/$MYFILE else - \cp ${CONFIG_DIR}/${NEW_CONF}/WORK/${MYFILE/.f90/.F90} ${MYDIR}/${NEW_CONF}/NEMOFILES/obj/$MYFILE + \cp ${MYDIR}/WORK/${MYFILE/.f90/.F90} ${MYDIR}/NEMOFILES/obj/$MYFILE fi else -cd ${MYDIR}/${NEW_CONF}/NEMOFILES/ppsrc/nemo ; ${MYDIR}/${NEW_CONF}/NEMOFILES/conv ${MYDIR}/${NEW_CONF}/NEMOFILES/agrif_oce.in -rm -incdir ${MYDIR}/${NEW_CONF}/NEMOFILES/inc -comdirout ${MYDIR}/${NEW_CONF}/NEMOFILES/obj -convfile ${MYFILE} > /dev/null + cd ${MYDIR}/NEMOFILES/ppsrc/nemo ; ${MYDIR}/NEMOFILES/conv ${MYDIR}/NEMOFILES/agrif_oce.in -rm -incdir ${MYDIR}/NEMOFILES/inc -comdirout ${MYDIR}/NEMOFILES/obj -convfile ${MYFILE} > /dev/null fi diff --git a/mk/bld.cfg b/mk/bld.cfg index ebc688aa..e239f0dc 100644 --- a/mk/bld.cfg +++ b/mk/bld.cfg @@ -7,22 +7,21 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm -inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm +inc NEMO_TDIR/CUR_CONF/BLD/arch_nemo.fcm +inc NEMO_TDIR/CUR_CONF/BLD/cpp.fcm search_src 1 -src::ioipsl $MAIN_DIR/ext/IOIPSL/src -src::agrif $MAIN_DIR/ext/AGRIF/AGRIF_FILES -src::nemo $NEMO_TDIR/$NEW_CONF/NEMOFILES/obj -src::ppr_1d $MAIN_DIR/ext/PPR/src +src::ioipsl MAIN_DIR/ext/IOIPSL/src +src::ppr_1d MAIN_DIR/ext/PPR/src +src::agrif MAIN_DIR/ext/AGRIF/AGRIF_FILES +src::nemo NEMO_TDIR/CUR_CONF/NEMOFILES/obj - -bld::target nemo.exe +bld::target nemo.exe bld::exe_dep -dir::root $NEMO_TDIR/$NEW_CONF/BLD +dir::root NEMO_TDIR/CUR_CONF/BLD bld::tool::cpp %CPP @@ -38,13 +37,13 @@ bld::tool::make %MK # Pre-process code before analysing dependencies bld::pp::ioipsl 1 -bld::pp::nemo 1 -bld::pp::agrif 1 bld::pp::ppr_1d 1 -bld::tool::fppflags::nemo %FPPFLAGS -I$NEMO_TDIR/$NEW_CONF/NEMOFILES/inc -bld::tool::fppflags::ioipsl %FPPFLAGS -bld::tool::fppflags::agrif %FPPFLAGS -include ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h -bld::tool::fppflags::ppr_1d %FPPFLAGS +bld::pp::agrif 1 +bld::pp::nemo 1 +bld::tool::fppflags::ioipsl %FPPFLAGS +bld::tool::fppflags::ppr_1d %FPPFLAGS +bld::tool::fppflags::agrif %FPPFLAGS -include MAIN_DIR/ext/AGRIF/nemo_mpi.h +bld::tool::fppflags::nemo %FPPFLAGS -INEMO_TDIR/CUR_CONF/NEMOFILES/inc # Ignore the following dependencies bld::excl_dep inc::netcdf.inc @@ -60,6 +59,7 @@ bld::excl_dep use::mod_oasis bld::excl_dep use::mkl_dfti bld::excl_dep use::cudafor bld::excl_dep use::openacc + # Don't generate interface files bld::tool::geninterface none diff --git a/mk/bld_preproagr.cfg b/mk/bld_preproagr.cfg index 3f015aa1..cb99ab0f 100644 --- a/mk/bld_preproagr.cfg +++ b/mk/bld_preproagr.cfg @@ -7,20 +7,20 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm -inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm +inc NEMO_TDIR/CUR_CONF/BLD/arch_nemo.fcm +inc NEMO_TDIR/CUR_CONF/BLD/cpp.fcm search_src 1 -src::nemo $NEMO_TDIR/$NEW_CONF/WORK +src::nemo NEMO_TDIR/CUR_CONF/WORK bld::target lib_cray.f90 nemo.f90 agrif_user.f90 agrif2model.f90 -dir::root $NEMO_TDIR/$NEW_CONF/NEMOFILES +dir::root NEMO_TDIR/CUR_CONF/NEMOFILES bld::tool::fc_output bld::tool::fc_compile bld::tool::fc_include -bld::tool::fc $COMPIL_DIR/agrifpp.sh ${NEMO_TDIR} +bld::tool::fc COMPIL_DIR/agrifpp.sh NEMO_TDIR/CUR_CONF bld::tool::fflags bld::tool::ld bld::tool::ldflags diff --git a/mk/bld_preproagr_tools.cfg b/mk/bld_preproagr_tools.cfg index cc7eb552..32cd0956 100644 --- a/mk/bld_preproagr_tools.cfg +++ b/mk/bld_preproagr_tools.cfg @@ -7,20 +7,21 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_tools.fcm -inc $COMPIL_DIR/cpp_tools.fcm +inc TOOLS_DIR/CUR_CONF/BLD/arch_tools.fcm +inc TOOLS_DIR/CUR_CONF/BLD/cpp_tools.fcm + search_src 1 -src::nemo $TOOLS_DIR/$NEW_CONF/src +src::nemo TOOLS_DIR/CUR_CONF/src bld::target make_domain_cfg.f90 agrif_user.f90 agrif2model.f90 -dir::root $TOOLS_DIR/$NEW_CONF/NEMOFILES +dir::root TOOLS_DIR/CUR_CONF/NEMOFILES bld::tool::fc_output bld::tool::fc_compile bld::tool::fc_include -bld::tool::fc $COMPIL_DIR/agrifpp.sh $TOOLS_DIR +bld::tool::fc COMPIL_DIR/agrifpp.sh TOOLS_DIR bld::tool::fflags bld::tool::ld bld::tool::ldflags diff --git a/mk/bld_tools.cfg b/mk/bld_tools.cfg index aa204b4c..4e7db957 100644 --- a/mk/bld_tools.cfg +++ b/mk/bld_tools.cfg @@ -7,25 +7,22 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_tools.fcm -inc $COMPIL_DIR/cpp_tools.fcm +inc TOOLS_DIR/CUR_CONF/BLD/arch_tools.fcm +inc TOOLS_DIR/CUR_CONF/BLD/cpp_tools.fcm search_src 1 -src::agrif $MAIN_DIR/ext/AGRIF/AGRIF_FILES -src::nemo $TOOLS_DIR/$NEW_CONF/NEMOFILES/obj - +src::agrif MAIN_DIR/ext/AGRIF/AGRIF_FILES +src::nemo TOOLS_DIR/CUR_CONF/NEMOFILES/obj bld::target make_domain_cfg.exe bld::exe_dep - -dir::root $TOOLS_DIR/$NEW_CONF/BLD - +dir::root TOOLS_DIR/CUR_CONF/BLD bld::tool::cpp %CPP bld::tool::fpp %CPP -bld::tool::fc %FC +bld::tool::fc %FC bld::tool::fflags %FCFLAGS %USER_INC bld::tool::ld %LD bld::tool::ldflags %LDFLAGS %USER_LIB @@ -36,11 +33,8 @@ bld::tool::make %MK # Pre-process code before analysing dependencies bld::pp::nemo 1 bld::pp::agrif 1 -bld::tool::fppflags::nemo %FPPFLAGS -I$TOOLS_DIR/$NEW_CONF/NEMOFILES/inc -bld::tool::fppflags::agrif %FPPFLAGS -include ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h - - - +bld::tool::fppflags::nemo %FPPFLAGS -ITOOLS_DIR/CUR_CONF/NEMOFILES/inc +bld::tool::fppflags::agrif %FPPFLAGS -include MAIN_DIR/ext/AGRIF/nemo_mpi.h # Ignore the following dependencies bld::excl_dep inc::netcdf.inc diff --git a/mk/bldxag.cfg b/mk/bldxag.cfg index 78a775d5..d305520a 100644 --- a/mk/bldxag.cfg +++ b/mk/bldxag.cfg @@ -7,20 +7,20 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm -inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm +inc NEMO_TDIR/CUR_CONF/BLD/arch_nemo.fcm +inc NEMO_TDIR/CUR_CONF/BLD/cpp.fcm search_src 1 -src::ioipsl $MAIN_DIR/ext/IOIPSL/src -src::nemo $NEMO_TDIR/$NEW_CONF/WORK -src::ppr_1d $MAIN_DIR/ext/PPR/src +src::ioipsl MAIN_DIR/ext/IOIPSL/src +src::ppr_1d MAIN_DIR/ext/PPR/src +src::nemo NEMO_TDIR/CUR_CONF/WORK bld::target nemo.exe bld::exe_dep -dir::root $NEMO_TDIR/$NEW_CONF/BLD +dir::root NEMO_TDIR/CUR_CONF/BLD bld::tool::cpp %CPP @@ -35,11 +35,11 @@ bld::tool::make %MK # Pre-process code before analysing dependencies bld::pp::ioipsl 1 -bld::pp::nemo 1 bld::pp::ppr_1d 1 -bld::tool::fppflags::nemo %FPPFLAGS +bld::pp::nemo 1 bld::tool::fppflags::ioipsl %FPPFLAGS bld::tool::fppflags::ppr_1d %FPPFLAGS +bld::tool::fppflags::nemo %FPPFLAGS # Ignore the following dependencies bld::excl_dep inc::netcdf.inc @@ -55,6 +55,7 @@ bld::excl_dep use::mod_oasis bld::excl_dep use::mkl_dfti bld::excl_dep use::cudafor bld::excl_dep use::openacc + # Don't generate interface files bld::tool::geninterface none @@ -66,4 +67,3 @@ bld::outfile_ext::mod .mod # rename executable to nemo.exe bld::exe_name::model nemo.exe - diff --git a/mk/bldxag_tools.cfg b/mk/bldxag_tools.cfg index 7f54517b..93612cc7 100644 --- a/mk/bldxag_tools.cfg +++ b/mk/bldxag_tools.cfg @@ -7,14 +7,14 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $TOOLS_DIR/$NEW_CONF/BLD/arch_tools.fcm -inc $TOOLS_DIR/$NEW_CONF/BLD/cpp_tools.fcm +inc TOOLS_DIR/CUR_CONF/BLD/arch_tools.fcm +inc TOOLS_DIR/CUR_CONF/BLD/cpp_tools.fcm search_src 1 -src::nemo $TOOLS_DIR/$NEW_CONF/src +src::nemo TOOLS_DIR/CUR_CONF/src -dir::root $TOOLS_DIR/$NEW_CONF/BLD +dir::root TOOLS_DIR/CUR_CONF/BLD bld::tool::cpp %CPP bld::tool::fpp %CPP diff --git a/mk/bldxagxcdf.cfg b/mk/bldxagxcdf.cfg index 28361348..b0cccd23 100644 --- a/mk/bldxagxcdf.cfg +++ b/mk/bldxagxcdf.cfg @@ -7,21 +7,21 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm -inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm +inc NEMO_TDIR/CUR_CONF/BLD/arch_nemo.fcm +inc NEMO_TDIR/CUR_CONF/BLD/cpp.fcm search_src 1 -src::nocdf $MAIN_DIR/ext/DUMMY_NETCDF -src::ioipsl $MAIN_DIR/ext/IOIPSL/src -src::nemo $CONFIG_DIR/$NEW_CONF/WORK -src::ppr_1d $MAIN_DIR/ext/PPR/src +src::nocdf MAIN_DIR/ext/DUMMY_NETCDF +src::ioipsl MAIN_DIR/ext/IOIPSL/src +src::ppr_1d MAIN_DIR/ext/PPR/src +src::nemo NEMO_TDIR/CUR_CONF/WORK bld::target nemo.exe bld::exe_dep -dir::root $NEMO_TDIR/$NEW_CONF/BLD +dir::root NEMO_TDIR/CUR_CONF/BLD bld::tool::cpp %CPP @@ -37,12 +37,12 @@ bld::tool::make %MK # Pre-process code before analysing dependencies bld::pp::nocdf 1 bld::pp::ioipsl 1 -bld::pp::nemo 1 bld::pp::ppr_1d 1 -bld::tool::fppflags::nemo %FPPFLAGS +bld::pp::nemo 1 bld::tool::fppflags::nocdf %FPPFLAGS bld::tool::fppflags::ioipsl %FPPFLAGS -bld::tool::fppflags::ppr_1d %FPPFLAGS +bld::tool::fppflags::ppr_1d %FPPFLAGS +bld::tool::fppflags::nemo %FPPFLAGS # Ignore the following dependencies bld::excl_dep inc::VT.inc @@ -55,6 +55,7 @@ bld::excl_dep use::mod_oasis bld::excl_dep use::mkl_dfti bld::excl_dep use::cudafor bld::excl_dep use::openacc + # Don't generate interface files bld::tool::geninterface none @@ -66,4 +67,3 @@ bld::outfile_ext::mod .mod # rename executable to nemo.exe bld::exe_name::model nemo.exe - diff --git a/mk/bldxcdf.cfg b/mk/bldxcdf.cfg index 5a175b45..459e0a15 100644 --- a/mk/bldxcdf.cfg +++ b/mk/bldxcdf.cfg @@ -7,23 +7,22 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm -inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm +inc NEMO_TDIR/CUR_CONF/BLD/arch_nemo.fcm +inc NEMO_TDIR/CUR_CONF/BLD/cpp.fcm search_src 1 -src::nocdf $MAIN_DIR/ext/DUMMY_NETCDF -src::ioipsl $MAIN_DIR/ext/IOIPSL/src -src::agrif $MAIN_DIR/ext/AGRIF/AGRIF_FILES -src::nemo $CONFIG_DIR/$NEW_CONF/NEMOFILES/obj -src::ppr_1d $MAIN_DIR/ext/PPR/src +src::nocdf MAIN_DIR/ext/DUMMY_NETCDF +src::ioipsl MAIN_DIR/ext/IOIPSL/src +src::ppr_1d MAIN_DIR/ext/PPR/src +src::agrif MAIN_DIR/ext/AGRIF/AGRIF_FILES +src::nemo NEMO_TDIR/CUR_CONF/NEMOFILES/obj - -bld::target nemo.exe +bld::target nemo.exe bld::exe_dep -dir::root $NEMO_TDIR/$NEW_CONF/BLD +dir::root NEMO_TDIR/CUR_CONF/BLD bld::tool::cpp %CPP @@ -40,14 +39,14 @@ bld::tool::make %MK # Pre-process code before analysing dependencies bld::pp::nocdf 1 bld::pp::ioipsl 1 -bld::pp::nemo 1 -bld::pp::agrif 1 bld::pp::ppr_1d 1 -bld::tool::fppflags::nemo %FPPFLAGS -I$CONFIG_DIR/$NEW_CONF/NEMOFILES/inc +bld::pp::agrif 1 +bld::pp::nemo 1 bld::tool::fppflags::nocdf %FPPFLAGS bld::tool::fppflags::ioipsl %FPPFLAGS -bld::tool::fppflags::agrif %FPPFLAGS -include ${MAIN_DIR}/ext/AGRIF/nemo_mpi.h bld::tool::fppflags::ppr_1d %FPPFLAGS +bld::tool::fppflags::agrif %FPPFLAGS -include MAIN_DIR/ext/AGRIF/nemo_mpi.h +bld::tool::fppflags::nemo %FPPFLAGS -ICONFIG_DIR/CUR_CONF/NEMOFILES/inc # Ignore the following dependencies bld::excl_dep inc::VT.inc @@ -60,6 +59,7 @@ bld::excl_dep use::mod_oasis bld::excl_dep use::mkl_dfti bld::excl_dep use::cudafor bld::excl_dep use::openacc + # Don't generate interface files bld::tool::geninterface none diff --git a/mk/conv.cfg b/mk/conv.cfg index f8757962..b83cd1bb 100644 --- a/mk/conv.cfg +++ b/mk/conv.cfg @@ -7,18 +7,18 @@ cfg::version 1.0 # ------------------------------------------------------------------------------ # Build information # ------------------------------------------------------------------------------ -inc $NEMO_TDIR/$NEW_CONF/BLD/$MYARCH +inc NEMO_TDIR/CUR_CONF/BLD/arch_nemo.fcm bld::tool::cc %CC bld::tool::cflags %CFLAGS bld::tool::make %MK -src::convsrc $MAIN_DIR/ext/AGRIF/LIB +src::convsrc MAIN_DIR/ext/AGRIF/LIB #---------------------------------------------------------------------------- # Build options (code-specific, machine-independent) # ---------------------------------------------------------------------------- -dir::root $NEMO_TDIR/$NEW_CONF/AGRIFLIB +dir::root NEMO_TDIR/CUR_CONF/AGRIFLIB #bld::tool::cflags::convsrc -O0 #bld::tool::ld::convsrc cc diff --git a/sette/all_functions.sh b/sette/all_functions.sh index 167263ef..cdfa8d9a 100755 --- a/sette/all_functions.sh +++ b/sette/all_functions.sh @@ -57,7 +57,7 @@ # # REVISION_NUMBER(or DATE) : revision number by svn info, if problems with svn date is taken # -# TEST_NAME : set in sette.sh for each configuration to be tested (directory TEST_NAME is created under ${NEW_CONF} directory ) +# TEST_NAME : set in sette.sh for each configuration to be tested (directory TEST_NAME is created under ${config} directory ) # # EXAMPLES # ======== @@ -99,9 +99,6 @@ sync_config() { echo '-------------------------------------------------------------------------------' echo ' SOURCE AND CONFIG FILES SYNCHRONISATION ' - echo '' - echo "configuration $lCFG/MY_SRC will be synchronised with $lREF/MY_SRC" - echo '' # synchronise MY_SRC if $lCFG directory exist if [ -d $lREF/MY_SRC ] && [ -d $lCFG ] ; then @@ -124,20 +121,31 @@ sync_config() { fi # synchronisation $lREF/MY_SRC directory (and delete file in target location if needed) + echo '' + echo "configuration $lCFG/MY_SRC will be synchronised with $lREF/MY_SRC" + echo '' rsync -a --delete $lREF/MY_SRC/ $lCFG/MY_SRC # rsync keep preserve the modification time stamp. # To avoid case where a file in MY_SRC is replace by an older file, we touch the file touch --no-create $lCFG/MY_SRC/* + else + echo '' + echo "configuration $lCFG/MY_SRC not synchronised with $lREF/MY_SRC" + echo '' fi - echo '' - echo "configuration $lCFG/EXP00 will be synchronised with $lREF/EXPREF" - echo "(links are skipped)" - echo '' # synchronize EXPREF if [ -d $lREF/EXPREF ] && [ -d $lCFG/EXP00 ] ; then - rsync -a --no-links $lREF/EXPREF/ $lCFG/EXP00/. + echo '' + echo "configuration $lCFG/EXP00 will be synchronised with $lREF/EXPREF" + echo "(links are skipped)" + echo '' + rsync -a --no-links $lREF/EXPREF/ $lCFG/EXP00/. + else + echo '' + echo "configuration $lCFG/EXP00 not synchronised with $lREF/EXPREF" + echo '' fi echo '-------------------------------------------------------------------------------' fi @@ -158,7 +166,6 @@ clean_config() { echo '' echo "$(basename $lCFG) configuration has been cleaned" else - echo '' echo "$(basename $lCFG) configuration does not exist; we skip cleaning" fi echo '' @@ -190,13 +197,11 @@ set_valid_dir () { if [[ $localchanges > 0 ]] ; then REVISION_NB=${REVISION_NB}+ fi - # remove last _ST followed by zero or more alphanumeric characters - NEW_CONF1=$( echo $NEW_CONF | sed -e 's/_ST\([0-9a-zA-Z]*\)$//' ) CMP_NAM_L=$(echo ${CMP_NAM} | tr '[:upper:]' '[:lower:]') if [[ -n "${NEMO_DEBUG}" && ! ${CMP_NAM_L} =~ ("debug"|"dbg") ]]; then - export NEMO_VALID=${NEMO_VALIDATION_DIR}/${CMP_NAM}_DEBUG/${REVISION_NB}/${NEW_CONF1}/${TEST_NAME} + export NEMO_VALID=${NEMO_VALIDATION_DIR}/${CMP_NAM}_DEBUG/${REVISION_NB}/${config}/${TEST_NAME} else - export NEMO_VALID=${NEMO_VALIDATION_DIR}/${CMP_NAM}/${REVISION_NB}/${NEW_CONF1}/${TEST_NAME} + export NEMO_VALID=${NEMO_VALIDATION_DIR}/${CMP_NAM}/${REVISION_NB}/${config}/${TEST_NAME} fi } @@ -329,7 +334,7 @@ post_test_tidyup () { # EXE_DIR # CONFIG_DIR # NEMO_VALIDATION_DIR -# NEW_CONF +# config # CMP_NAM # TEST_NAME echo "SETTE directory is : ${SETTE_DIR}" @@ -337,7 +342,7 @@ echo "INPUT directory is : ${INPUT_DIR}" echo "EXECUTION directory is : ${EXE_DIR}" echo "CONFIG directory is : ${CONFIG_DIR}" echo "VALIDATION directory is : ${NEMO_VALID}" -echo "NEW CONFIGURATION is : ${NEW_CONF}" +echo "CONFIGURATION is : ${config}" echo "COMPILER is : ${CMP_NAM}" echo "TEST is : ${TEST_NAME}" echo "TOOLS directory is : ${TOOLS_DIR}" diff --git a/sette/prepare_exe_dir.sh b/sette/prepare_exe_dir.sh index a1d93fb6..c823b11a 100755 --- a/sette/prepare_exe_dir.sh +++ b/sette/prepare_exe_dir.sh @@ -66,21 +66,21 @@ set -o posix # PREPARE EXEC_DIR #================== -if [ -z "${CUSTOM_DIR}" ]; then - EXE_DIR=${CONFIG_DIR}/${NEW_CONF} -else - CMP_NAM_L=$(echo ${CMP_NAM} | tr '[:upper:]' '[:lower:]') - if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]; then - export EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}_DEBUG/${NEW_CONF} - else - EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}/${NEW_CONF} - fi -fi +#if [ -z "${CUSTOM_DIR}" ]; then +# EXE_DIR=${CONFIG_DIR}/${SETTE_CONFIG} +#else +# CMP_NAM_L=$(echo ${CMP_NAM} | tr '[:upper:]' '[:lower:]') +# if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]]; then +# export EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}_DEBUG/${SETTE_CONFIG} +# else +# EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}/${SETTE_CONFIG} +# fi +#fi +EXE_DIR=${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} mkdir -p ${EXE_DIR}/${TEST_NAME} -#cp -RL ${EXE_DIR:-${CONFIG_DIR}/${NEW_CONF}}/EXP00/* ${EXE_DIR}/${TEST_NAME}/. -cp -an ${EXE_DIR:-${CONFIG_DIR}/${NEW_CONF}}/EXP00/* ${EXE_DIR}/${TEST_NAME}/. -COMP_KEYS="`cat ${EXE_DIR}/cpp_${NEW_CONF}.fcm | sed -e 's/.*fppkeys *//'`" +cp -an ${EXE_DIR}/EXP00/* ${EXE_DIR}/${TEST_NAME}/. +COMP_KEYS="`cat ${EXE_DIR}/cpp_${SETTE_CONFIG}.fcm | sed -e 's/.*fppkeys *//'`" export EXE_DIR=${EXE_DIR}/${TEST_NAME} cd ${EXE_DIR} diff --git a/sette/prepare_job.sh b/sette/prepare_job.sh index 80d3fa1e..2c76c99d 100755 --- a/sette/prepare_job.sh +++ b/sette/prepare_job.sh @@ -101,10 +101,10 @@ NEMO_VALID=$7 # echo "date: `date`" >> ${SETTE_DIR}/output.sette echo "" >> ${SETTE_DIR}/output.sette -echo "running config: ${NEW_CONF}" >> ${SETTE_DIR}/output.sette +echo "running config: ${SETTE_CONFIG}" >> ${SETTE_DIR}/output.sette echo "" >> ${SETTE_DIR}/output.sette echo "list of cpp_keys: " >> ${SETTE_DIR}/output.sette -echo "`more ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm`" >> ${SETTE_DIR}/output.sette +echo "`more ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/cpp_${SETTE_CONFIG}.fcm`" >> ${SETTE_DIR}/output.sette echo "" >> ${SETTE_DIR}/output.sette echo "compiling with: ${CMP_NAM}" >> ${SETTE_DIR}/output.sette echo "" >> ${SETTE_DIR}/output.sette @@ -269,10 +269,10 @@ fi -e"s/NXIOPROCS/${NXIO_PROC}/" \ -e"s:DEF_SETTE_DIR:${SETTE_DIR}:" -e"s:DEF_INPUT_DIR:${INPUT_DIR}:" \ -e"s:DEF_EXE_DIR:${EXE_DIR}:" \ - -e"s:DEF_CONFIG_DIR:${NEMO_TDIR}:" \ + -e"s:DEF_CONFIG_DIR:${CMP_DIR:-${CONFIG_DIR0}}:" \ -e"s:DEF_TOOLS_DIR:${TOOLS_DIR}:" \ -e"s:MPI_FLAG:${MPI_FLAG}:" \ - -e"s:DEF_NEMO_VALIDATION:${NEMO_VALID}:" -e"s:DEF_NEW_CONF:${NEW_CONF}:" \ + -e"s:DEF_NEMO_VALIDATION:${NEMO_VALID}:" -e"s:DEF_NEW_CONF:${SETTE_CONFIG}:" \ -e"s:DEF_CMP_NAM:${CMP_NAM}:" -e"s:DEF_TEST_NAME:${TEST_NAME}:" > run_sette_test.job case ${COMPILER} in diff --git a/sette/sette.sh b/sette/sette.sh index 96182e16..5dcf8f26 100755 --- a/sette/sette.sh +++ b/sette/sette.sh @@ -1,5 +1,6 @@ #!/bin/sh #set -x + # initialise user dependent variable export cmd=$0 ; export cmdargs=$@ SETTE_DIR=$(cd $(dirname "$0"); pwd) @@ -82,8 +83,6 @@ if [ $# -gt 0 ]; then echo "-s: MY_SRC and EXP00 in ${SETTE_TEST_CONFIGS[@]} will be synchronised with the MY_SRC and EXPREF from the reference configuration" echo "";; n) OPTSTR="$OPTARG" - OPTSTR="${OPTSTR/ORCA2_SAS_ICE/SAS}" # Permit either shortened (expected) or full name for SAS - OPTSTR="${OPTSTR/AGRIF_DEMO/AGRIF}" # Permit either shortened (expected) or full name for AGRIF export SETTE_TEST_CONFIGS=(${OPTSTR}) echo "==================================" if [ ${#SETTE_TEST_CONFIGS[@]} -gt 1 ]; then @@ -216,8 +215,6 @@ if [ ! -d $NEMO_VALIDATION_DIR/$SETTE_SUB_VAL ] && [ ${dry_run} -eq 0 ] ; then fi export NEMO_VALIDATION_DIR=$NEMO_VALIDATION_DIR/$SETTE_SUB_VAL -TEST_CONFIGS="${TEST_CONFIGS/ORCA2_SAS_ICE/SAS}" # Shortening of 'ORCA2_SAS_ICE' to 'SAS' -TEST_CONFIGS="${TEST_CONFIGS/AGRIF_DEMO/AGRIF}" # Shortening of 'AGRIF_DEMO' to 'AGRIF' if [ ${#SETTE_TEST_CONFIGS[@]} -eq 0 ]; then echo "==================================" echo "Configurations $TEST_CONFIGS will be tested if they are available" @@ -287,7 +284,7 @@ while [[ $NRUN -ne 0 && $nit -le 1080 ]]; do printf "%-3d %s\r" $NRUN 'nemo_sette runs still in queue or running ...'; else printf "%-50s\n" " " - . ./sette_rpt.sh ${NEMO_DEBUG} + ./sette_rpt.sh ${NEMO_DEBUG} ${SETTE_SUB_VAL:+-v ${SETTE_SUB_VAL}} exit fi sleep 10 diff --git a/sette/sette_eval.sh b/sette/sette_eval.sh index 58263277..44c0a57c 100755 --- a/sette/sette_eval.sh +++ b/sette/sette_eval.sh @@ -156,8 +156,6 @@ function runcmpres(){ quiet=0 . ./param.cfg TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]:-${TEST_CONFIGS[@]}} # workaround for some dated param.cfgs files - TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]/ SAS / ORCA2_SAS_ICE } # workaround for some dated param.cfgs files - TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]/ AGRIF / AGRIF_DEMO } # workaround for some dated param.cfgs files USER_INPUT='yes' # Default: yes => request user input on decisions. mach=${COMPILER} diff --git a/sette/sette_list_avail_cfg.sh b/sette/sette_list_avail_cfg.sh index 1f0878d3..08fcdd3a 100755 --- a/sette/sette_list_avail_cfg.sh +++ b/sette/sette_list_avail_cfg.sh @@ -5,9 +5,9 @@ printf "%-15s \n" GYRE_PISCES printf "%-15s \n" ORCA2_ICE_PISCES printf "%-15s \n" ORCA2_OFF_PISCES printf "%-15s \n" AMM12 -printf "%-15s \n" SAS +printf "%-15s \n" ORCA2_SAS_ICE printf "%-15s \n" ORCA2_ICE_OBS -printf "%-15s \n" AGRIF +printf "%-15s \n" AGRIF_DEMO printf "%-15s \n" WED025 echo '' echo 'Test cases available are named :' diff --git a/sette/sette_reference-configurations.sh b/sette/sette_reference-configurations.sh index f5ea3374..4c3d1527 100755 --- a/sette/sette_reference-configurations.sh +++ b/sette/sette_reference-configurations.sh @@ -130,10 +130,10 @@ cp BATCH_TEMPLATE/${JOB_PREFIX}-${COMPILER} job_batch_template || exit # ORCA2_ICE_PISCES : # ORCA2_OFF_PISCES : # AMM12 : -# SAS : aka ORCA2_SAS_ICE +# ORCA2_SAS_ICE : # ORCA2_ICE_OBS : -# AGRIF : AGRIF_DEMO: test AGRIF in a double zoom configuration in the nordic seas + 1 zoom in the eq. Pacific and -# AGRIF_DEMO_NOAGRIF: check that key_agrif without zoom = no key_agrif +# AGRIF_DEMO : test AGRIF in a double zoom configuration in the nordic seas + 1 zoom in the eq. Pacific and +# AGRIF_DEMO_NOAGRIF: check that key_agrif without zoom = no key_agrif # WED025 : regional configuration including sea-ice and tides (Spitzbergen) . ./all_functions.sh @@ -159,7 +159,7 @@ if [ ${config} == "GYRE_PISCES" ] ; then sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # # GYRE uses linssh so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r GYRE_PISCES ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r GYRE_PISCES ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}" fi if [ ${config} == "GYRE_PISCES" ] && [ ${DO_RESTART} == "1" ] ; then ## Restartability tests for GYRE_PISCES @@ -305,7 +305,7 @@ if [ ${config} == "ORCA2_ICE_PISCES" ] ; then clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_ICE_PISCES ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_ICE_PISCES ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" fi if [ ${config} == "ORCA2_ICE_PISCES" ] && [ ${DO_RESTART} == "1" ] ; then ## Restartability tests for ORCA2_ICE_PISCES @@ -593,7 +593,7 @@ if [ ${config} == "ORCA2_OFF_PISCES" ] ; then sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # # ORCA2_OFF_PISCES uses linssh so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_OFF_PISCES ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_OFF_PISCES ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}" fi if [ ${config} == "ORCA2_OFF_PISCES" ] && [ ${DO_RESTART} == "1" ] ; then ## Restartability tests for ORCA2_OFF_PISCES @@ -769,7 +769,7 @@ if [ ${config} == "AMM12" ] ; then clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AMM12 ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AMM12 ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" fi if [ ${config} == "AMM12" ] && [ ${DO_RESTART} == "1" ] ; then ## Restartability tests for AMM12 @@ -888,7 +888,7 @@ fi # --------- # ORCA2_SAS_ICE # --------- -if [ ${config} == "SAS" ] ; then +if [ ${config} == "ORCA2_SAS_ICE" ] ; then SETTE_CONFIG="ORCA2_SAS_ICE"${SETTE_STG} if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]] then @@ -904,9 +904,9 @@ if [ ${config} == "SAS" ] ; then sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # # ORCA2_SAS_ICE uses linssh so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_SAS_ICE ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_SAS_ICE ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}" fi -if [ ${config} == "SAS" ] && [ ${DO_RESTART} == "1" ] ; then +if [ ${config} == "ORCA2_SAS_ICE" ] && [ ${DO_RESTART} == "1" ] ; then ## Restartability tests export TEST_NAME="LONG" cd ${SETTE_DIR} @@ -969,7 +969,7 @@ if [ ${config} == "SAS" ] && [ ${DO_RESTART} == "1" ] ; then fi -if [ ${config} == "SAS" ] && [ ${DO_REPRO} == "1" ] ; then +if [ ${config} == "ORCA2_SAS_ICE" ] && [ ${DO_REPRO} == "1" ] ; then ## Reproducibility tests if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]] then @@ -1051,7 +1051,7 @@ if [ ${config} == "ORCA2_ICE_OBS" ] ; then clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_ICE_PISCES -d "OCE ICE" ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "key_asminc ${ADD_KEYS}" del_key "key_top ${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_ICE_PISCES -d "OCE ICE" ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "key_asminc ${ADD_KEYS}" del_key "key_top ${DEL_KEYS}" fi if [ ${config} == "ORCA2_ICE_OBS" ] && [ ${DO_RESTART} == "1" ] ; then ## Reproducibility tests @@ -1155,9 +1155,9 @@ if [ ${config} == "ORCA2_ICE_OBS" ] && [ ${DO_RESTART} == "1" ] ; then fi # ------------ -# AGRIF ICE +# AGRIF_DEMO # ----------- -if [ ${config} == "AGRIF" ] ; then +if [ ${config} == "AGRIF_DEMO" ] ; then SETTE_CONFIG="AGRIF_DEMO"${SETTE_STG} if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]] then @@ -1175,9 +1175,9 @@ if [ ${config} == "AGRIF" ] ; then clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" fi -if [ ${config} == "AGRIF" ] && [ ${DO_RESTART} == "1" ] ; then +if [ ${config} == "AGRIF_DEMO" ] && [ ${DO_RESTART} == "1" ] ; then ## Restartability tests export TEST_NAME="LONG" cd ${SETTE_DIR} @@ -1325,7 +1325,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_RESTART} == "1" ] ; then fi -if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ; then +if [ ${config} == "AGRIF_DEMO" ] && [ ${DO_REPRO} == "1" ] ; then ## Reproducibility tests export TEST_NAME="REPRO_2_8" cd ${MAIN_DIR} @@ -1438,7 +1438,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_REPRO} == "1" ] ; then fi -if [ ${config} == "AGRIF" ] && [ ${DO_CORRUPT} == "1" ] ; then +if [ ${config} == "AGRIF_DEMO" ] && [ ${DO_CORRUPT} == "1" ] ; then ## test code corruption with AGRIF (phase 1) ==> Compile with key_agrif but run with no zoom if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM_L} =~ ("debug"|"dbg") ]] then @@ -1481,7 +1481,7 @@ fi ## test code corruption with AGRIF (phase 2) ==> Compile without key_agrif (to be compared with AGRIF_DEMO_ST/ORCA2) -if [ ${config} == "AGRIF" ] && [ ${DO_CORRUPT} == "1" ] ; then +if [ ${config} == "AGRIF_DEMO" ] && [ ${DO_CORRUPT} == "1" ] ; then SETTE_CONFIG="AGRIF_DEMO_NOAGRIF"${SETTE_STG} export TEST_NAME="ORCA2" cd ${MAIN_DIR} @@ -1490,7 +1490,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_CORRUPT} == "1" ] ; then clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "key_agrif ${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "key_agrif ${DEL_KEYS}" cd ${SETTE_DIR} . ./prepare_exe_dir.sh set_valid_dir @@ -1538,7 +1538,7 @@ if [ ${config} == "WED025" ] ; then sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # # WED025 uses ln_hpg_isf so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r WED025 ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r WED025 ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}" fi if [ ${config} == "WED025" ] && [ ${DO_RESTART} == "1" ] ; then ## Restartability tests diff --git a/sette/sette_rpt.sh b/sette/sette_rpt.sh index 4baa2e9c..3740c091 100755 --- a/sette/sette_rpt.sh +++ b/sette/sette_rpt.sh @@ -8,7 +8,6 @@ ######################################################################################### ######################### Start of function definitions ################################# ## - function get_dorv() { if [ $lastchange == 'old' ] ; then dorv=`ls -1rt $vdir/$mach/ | tail -1l ` @@ -475,8 +474,6 @@ function identictest(){ MAIN_DIR=$(dirname $SETTE_DIR) . ./param.cfg TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]:-${TEST_CONFIGS[@]}} # Workaround for some dated param.cfgs files - TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]/SAS /ORCA2_SAS_ICE } # Workaround for some dated param.cfgs files - TEST_CONFIGS_AVAILABLE=${TEST_CONFIGS_AVAILABLE[@]/AGRIF /AGRIF_DEMO } # Workaround for some dated param.cfgs files if [ -z $USER_INPUT ] ; then USER_INPUT='yes' ; fi # Default: yes => request user input on decisions. # (but may br inherited/imported from sette.sh) diff --git a/sette/sette_test-cases.sh b/sette/sette_test-cases.sh index e1649645..d15a095c 100755 --- a/sette/sette_test-cases.sh +++ b/sette/sette_test-cases.sh @@ -158,7 +158,7 @@ if [ ${config} == "OVERFLOW" ] ; then clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a OVERFLOW ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a OVERFLOW ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" fi if [ ${config} == "OVERFLOW" ] && [ ${DO_RESTART} == "1" ] ; then ## Restartability tests for OVERFLOW @@ -274,7 +274,7 @@ if [ ${config} == "LOCK_EXCHANGE" ] ; then clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a LOCK_EXCHANGE ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a LOCK_EXCHANGE ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" fi if [ ${config} == "LOCK_EXCHANGE" ] && [ ${DO_RESTART} == "1" ] ; then ## Restartability tests for LOCK_EXCHANGE @@ -393,7 +393,7 @@ if [ ${config} == "VORTEX" ] ; then clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a VORTEX ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a VORTEX ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" fi if [ ${config} == "VORTEX" ] && [ ${DO_RESTART} == "1" ] ; then ## Restartability tests for VORTEX @@ -587,7 +587,7 @@ if [ ${config} == "ICE_AGRIF" ] ; then sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # # ICE_AGRIF uses linssh so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a ICE_AGRIF ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a ICE_AGRIF ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}" fi if [ ${config} == "ICE_AGRIF" ] && [ ${DO_RESTART} == "1" ] ; then ## Restartability tests for ICE_AGRIF @@ -784,7 +784,7 @@ if [ ${config} == "ISOMIP+" ] ; then sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # # ISOMIP+ uses ln_hpg_isf so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a ISOMIP+ ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a ISOMIP+ ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_qco/}" del_key "${DEL_KEYS}" fi if [ ${config} == "ISOMIP+" ] && [ ${DO_RESTART} == "1" ] ; then ## Restartability tests @@ -927,7 +927,7 @@ if [ ${config} == "SWG" ] && [ ${USING_QCO} == "yes" ] ; then clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a SWG ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" + ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a SWG ${CUSTOM_DIR:+-t ${CMP_DIR}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS}" del_key "${DEL_KEYS}" fi if [ ${config} == "SWG" ] && [ ${DO_RESTART} == "1" ] && [ ${USING_QCO} == "yes" ] ; then ## Restartability tests for SWG diff --git a/tools/maketools b/tools/maketools index cc420971..33ed7352 100755 --- a/tools/maketools +++ b/tools/maketools @@ -1,6 +1,6 @@ #!/bin/bash -#set -x set -o posix +#set -x #set -u #set -e #+ @@ -35,7 +35,7 @@ set -o posix # # From user input # -# - NEW_CONF : configuration to be created +# - CUR_CONF : configuration to be created # - CMP_NAM : compiler name # - NBR_PRC : number of processes used to compile # @@ -57,8 +57,6 @@ set -o posix # TODO # ==== # -# option debug -# # # EVOLUTIONS # ========== @@ -73,23 +71,24 @@ set -o posix #- Local variables --- b_n=$(basename ${0}) -export TOOLS_DIR=$(cd $(dirname "$0"); pwd) -export MAIN_DIR=${TOOLS_DIR%/tools} -export COMPIL_DIR=${MAIN_DIR}/mk -export NEMO_DIR=${MAIN_DIR}/NEMO +TOOLS_DIR=$(cd $(dirname "$0"); pwd) +MAIN_DIR=${TOOLS_DIR%/tools} +COMPIL_DIR=${MAIN_DIR}/mk +NEMO_DIR=${MAIN_DIR}/NEMO #- #- FCM and functions location --- -export PATH=${MAIN_DIR}/ext/FCM/bin:$PATH +PATH=${MAIN_DIR}/ext/FCM/bin:$PATH #- #- Choice of the options --- x_h=""; x_n=""; x_m=""; +x_b=""; x_t=""; x_c=""; x_j=1; -while getopts :hm:n:r:j:t: V +while getopts :hbm:n:r:j:t: V do case $V in (h) x_h=${OPTARG}; @@ -99,6 +98,7 @@ while getopts :hm:n:r:j:t: V echo " -h institute : specific help for consortium members"; echo " -n name : tool name, [-n help] to list existing tools"; echo " -m arch : choose compiler, [-m help] to list exiting compilers"; + echo " -b : compile with debug options"; echo " -j No : number of processes used to compile (0=nocompilation)"; echo " -t dir : remporary directory for compilation" echo ""; @@ -113,6 +113,7 @@ while getopts :hm:n:r:j:t: V exit 0;; (n) x_n=${OPTARG};; (m) x_m=${OPTARG};; + (b) x_b=1;; (j) x_j=${OPTARG};; (t) x_t=${OPTARG};; (:) echo ${b_n}" : -"${OPTARG}" option : missing value" 1>&2; @@ -128,80 +129,72 @@ shift $(($OPTIND-1)); [[ "${#@}" -ne 0 && "${@}" != clean ]] && echo "Invalid option "$@" " && exit [ "${#@}" -ne 0 ] && x_c="--$@" -#- -#- Go to NEMOGCM/tools directory --- -cd ${TOOLS_DIR} - #- #- Initialisation from input --- -export NEW_CONF=${x_n} +CUR_CONF=${x_n} NBR_PRC=${x_j} CMP_NAM=${x_m} -NEMO_TDIR=${x_t:-$NEMO_TDIR} -export NEMO_TDIR=${NEMO_TDIR:-$TOOLS_DIR} +NEMO_TDIR=${x_t:-$TOOLS_DIR} #- Check if the tool or the compiler exist or list it -[ "${NEW_CONF}" == help ] && printf "%s\n" "Available tools :" `ls ${TOOLS_DIR}|grep -v COMPILE | grep -v maketools` && exit -[ "${CMP_NAM}" == help ] && . ${COMPIL_DIR}/Flist_archfile.sh all && exit +[ "${CUR_CONF}" == help ] && printf "%s\n" "Available tools :" `ls ${TOOLS_DIR}|grep -v COMPILE | grep -v maketools` && exit +[ "${CMP_NAM}" == help ] && ${COMPIL_DIR}/Flist_archfile.sh ${MAIN_DIR} && exit 0 #- Choose a default tool if needed --- #- REBUILD or last one used --- -. ${COMPIL_DIR}/Fcheck_config.sh ${TOOLS_DIR}/tools.txt ${NEW_CONF} || exit +${COMPIL_DIR}/Fcheck_config.sh ${TOOLS_DIR}/tools.txt ${CUR_CONF} || exit #- Save new configuration --- -echo "${NEW_CONF} " > ${TOOLS_DIR}/tools.txt +echo "${CUR_CONF} " > ${TOOLS_DIR}/tools.txt #- Make the building directory -. ${COMPIL_DIR}/Fmake_tools_bld.sh ${TOOLS_DIR} ${NEW_CONF} ${NEMO_TDIR} || exit +${COMPIL_DIR}/Fmake_tools_bld.sh ${TOOLS_DIR} ${CUR_CONF} ${NEMO_TDIR} || exit #- At this stage cpp keys have been updated. we can check the arch file #- When used for the first time, choose a compiler --- -. ${COMPIL_DIR}/Fcheck_archfile.sh ${TOOLS_DIR}/${NEW_CONF}/BLD/arch_tools.fcm ${TOOLS_DIR}/${NEW_CONF}/BLD/cpp_tools.fcm ${CMP_NAM} || exit +${COMPIL_DIR}/Fcheck_archfile.sh ${TOOLS_DIR}/${CUR_CONF}/BLD/arch_tools.fcm ${TOOLS_DIR}/${CUR_CONF}/BLD/cpp_tools.fcm ${MAIN_DIR}/arch/arch-${CMP_NAM}.fcm ${x_b} || exit #- At this stage the configuration has beeen chosen #- We coose the default light file -export USEBLD=bldxag_tools.cfg +USEBLD=bldxag_tools.cfg -#- We look after agrif -grep key_agrif ${TOOLS_DIR}/${NEW_CONF}/BLD/cpp_tools.fcm && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/} +#_ END OF CONFIGURATION PHASE -. ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${TOOLS_DIR} arch_tools.fcm|| exit 3 -#- -#_ END OF CONFIGURATION PHASE -#_ - -#- #- Compile --- if [ "${NBR_PRC}" -gt 0 ]; then -cd ${TOOLS_DIR}/${NEW_CONF} || cd - ## if AGRIF we do a first preprocessing - if [[ ${#x_c} -eq 0 && "$AGRIFUSE" -eq 1 ]]; then - fcm build --ignore-lock -j 1 ${COMPIL_DIR}/bld_preproagr_tools.cfg ||{ cd - ; exit 1 ;} - echo '' + grep key_agrif ${TOOLS_DIR}/${CUR_CONF}/BLD/cpp_tools.fcm && USEBLD=${USEBLD/xag/} + if [[ ${#x_c} -eq 0 && ! ${USEBLD} =~ "xag" ]]; then + ${COMPIL_DIR}/Fprep_agrif.sh ${MAIN_DIR} ${TOOLS_DIR}/${CUR_CONF} || exit 3 + + # compile & copy conv + sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~NEMO_TDIR~${NEMO_TDIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/conv.cfg > ${NEMO_TDIR}/${CUR_CONF}/BLD/conv.cfg + fcm build ${NEMO_TDIR}/${CUR_CONF}/BLD/conv.cfg || exit 1 + cp -fa ${MAIN_DIR}/ext/AGRIF/agrif_oce.in $2/$1/AGRIFLIB/bin/conv ${NEMO_TDIR}/${CUR_CONF}/NEMOFILES/. + + sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~TOOLS_DIR~${TOOLS_DIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/bld_preproagr_tools.cfg > ${NEMO_TDIR}/${CUR_CONF}/BLD/bld_preproagr_tools.cfg + fcm build --ignore-lock -j 1 ${NEMO_TDIR}/${CUR_CONF}/BLD/bld_preproagr_tools.cfg || exit 1 + echo echo "---------------------------------" echo "CONV preprocessing successfull !!" echo "---------------------------------" - echo '' + echo fi - fcm build ${x_c} --ignore-lock -v 1 -j ${NBR_PRC} ${COMPIL_DIR}/${USEBLD} || cd - - if [ -n "$(ls ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/*.exe)" ]; then - for i in `ls ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/*.exe` + sed -e "s~MAIN_DIR~${MAIN_DIR}~; s~TOOLS_DIR~${TOOLS_DIR}~; s~CUR_CONF~${CUR_CONF}~; s~COMPIL_DIR~${COMPIL_DIR}~" ${COMPIL_DIR}/${USEBLD} > ${NEMO_TDIR}/${CUR_CONF}/BLD/${USEBLD} + fcm build ${x_c} --ignore-lock -v 1 -j ${NBR_PRC} ${NEMO_TDIR}/${CUR_CONF}/BLD/${USEBLD} + + if ls ${NEMO_TDIR}/${CUR_CONF}/BLD/bin/*.exe 2>/dev/null && [ -z "${x_c}" ]; then + for i in ${NEMO_TDIR}/${CUR_CONF}/BLD/bin/*.exe do - ln -sf ${i} ${TOOLS_DIR}/${NEW_CONF}/. + ln -sfv ${i} ${TOOLS_DIR}/${CUR_CONF}/. done fi fi -#- -#- Come back to original directory --- -cd - -#- -#- Unset variables -${COMPIL_DIR}/Fclean_var.sh -exit 0; +exit 0 -- GitLab