From e3a0ad20dc001b44e4ae003732c6f3353ae28311 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Wed, 9 Nov 2022 12:29:23 +0100 Subject: [PATCH 01/31] fix tests dir --- sette/sette_test-cases.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sette/sette_test-cases.sh b/sette/sette_test-cases.sh index db9c81dc..ba507fe9 100755 --- a/sette/sette_test-cases.sh +++ b/sette/sette_test-cases.sh @@ -108,7 +108,7 @@ if [ ${USING_MPMD} == "no" ] fi # # Directory to run the tests -CONFIG_DIR0=${MAIN_DIR}/cfgs +CONFIG_DIR0=${MAIN_DIR}/tests TOOLS_DIR=${MAIN_DIR}/tools if [ -n "${CUSTOM_DIR}" ]; then -- GitLab From 0e03932e20a609087443afb634ce1506b9a61af1 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Wed, 9 Nov 2022 19:04:57 +0100 Subject: [PATCH 02/31] change makenemo arguments to avoid using "-t" option when not needed --- sette/sette_reference-configurations.sh | 18 +++++++++--------- sette/sette_test-cases.sh | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sette/sette_reference-configurations.sh b/sette/sette_reference-configurations.sh index 4d22ddff..90678bfd 100755 --- a/sette/sette_reference-configurations.sh +++ b/sette/sette_reference-configurations.sh @@ -157,7 +157,7 @@ if [ ${config} == "GYRE_PISCES" ] ; then clean_config GYRE_PISCES ${SETTE_CONFIG} 'cfgs' # # GYRE uses linssh so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r GYRE_PISCES -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -303,7 +303,7 @@ if [ ${config} == "ORCA2_ICE_PISCES" ] ; then sync_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' clean_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_ICE_PISCES -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -591,7 +591,7 @@ if [ ${config} == "ORCA2_OFF_PISCES" ] ; then clean_config ${SETTE_CONFIG} ORCA2_OFF_PISCES_ST 'cfgs' # # ORCA2_OFF_PISCES uses linssh so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_OFF_PISCES -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -767,7 +767,7 @@ if [ ${config} == "AMM12" ] ; then sync_config AMM12 ${SETTE_CONFIG} 'cfgs' clean_config AMM12 ${SETTE_CONFIG} 'cfgs' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AMM12 -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -902,7 +902,7 @@ if [ ${config} == "SAS" ] ; then clean_config ORCA2_SAS_ICE ${SETTE_CONFIG} 'cfgs' # # ORCA2_SAS_ICE uses linssh so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_SAS_ICE -t ${CMP_DIR:-${CONFIG_DIR0}} -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 ## Restartability tests @@ -1049,7 +1049,7 @@ if [ ${config} == "ORCA2_ICE_OBS" ] ; then sync_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' clean_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_ICE_PISCES -d "OCE ICE" -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -1175,7 +1175,7 @@ if [ ${config} == "AGRIF" ] ; then # # AGRIF_DEMO does not yet support nn_hls=2 => key_loop_fusion can not be used # . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO -j ${CMPL_CORES} add_key "${ADD_KEYS/key_loop_fusion}" del_key "${DEL_KEYS}" - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO -t ${CMP_DIR:-${CONFIG_DIR0}} -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 ## Restartability tests @@ -1491,7 +1491,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_CORRUPT} == "1" ] ; then clean_config AGRIF_DEMO ${SETTE_CONFIG} 'cfgs' # # AGRIF_DEMO does not yet support nn_hls=2 => key_loop_fusion can not be used - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO -t ${CMP_DIR:-${CONFIG_DIR0}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_loop_fusion}" 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/key_loop_fusion}" del_key "key_agrif ${DEL_KEYS}" cd ${SETTE_DIR} . ./prepare_exe_dir.sh set_valid_dir @@ -1539,7 +1539,7 @@ if [ ${config} == "WED025" ] ; then clean_config WED025 ${SETTE_CONFIG} 'cfgs' # # WED025 uses ln_hpg_isf so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r WED025 -t ${CMP_DIR:-${CONFIG_DIR0}} -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_test-cases.sh b/sette/sette_test-cases.sh index ba507fe9..34e1bf7f 100755 --- a/sette/sette_test-cases.sh +++ b/sette/sette_test-cases.sh @@ -157,7 +157,7 @@ if [ ${config} == "OVERFLOW" ] ; then # sync_config OVERFLOW ${SETTE_CONFIG} 'tests' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a OVERFLOW -t ${CMP_DIR:-${CONFIG_DIR0}} -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 # sync_config LOCK_EXCHANGE ${SETTE_CONFIG} 'tests' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a LOCK_EXCHANGE -t ${CMP_DIR:-${CONFIG_DIR0}} -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 # sync_config VORTEX ${SETTE_CONFIG} 'tests' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a VORTEX -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -588,7 +588,7 @@ if [ ${config} == "ICE_AGRIF" ] ; then sync_config ICE_AGRIF ${SETTE_CONFIG} 'tests' # # ICE_AGRIF uses linssh so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a ICE_AGRIF -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -786,7 +786,7 @@ if [ ${config} == "ISOMIP+" ] ; then sync_config ISOMIP+ ${SETTE_CONFIG} 'tests' # # ISOMIP+ uses ln_hpg_isf so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a ISOMIP+ -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -930,7 +930,7 @@ if [ ${config} == "SWG" ] && [ ${USING_QCO} == "yes" ] ; then # sync_config SWG ${SETTE_CONFIG} 'tests' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a SWG -t ${CMP_DIR:-${CONFIG_DIR0}} -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 -- GitLab From 2619bda189491bc520f9697b4d567d5364ca374d Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Thu, 10 Nov 2022 08:24:06 +0100 Subject: [PATCH 03/31] add same change to makenemo in clean_config function --- sette/all_functions.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sette/all_functions.sh b/sette/all_functions.sh index 4be4be5a..6c07afd2 100755 --- a/sette/all_functions.sh +++ b/sette/all_functions.sh @@ -153,12 +153,12 @@ clean_config() { echo '-------------------------------------------------------------------------------' echo ' CLEANING CONFIGURATION ' echo '' - echo "./makenemo -n $lCFG -a/-r $lREF -t ${CMP_DIR:-${CONFIG_DIR0}} clean" + echo "./makenemo -n $lCFG -a/-r $lREF ${CUSTOM_DIR:+-t ${CMP_DIR}} clean" echo '' if [ ${lTYP} == 'tests' ]; then - ./makenemo -n $lCFG -t ${CMP_DIR:-${CONFIG_DIR0}} -a $lREF clean + ./makenemo -n $lCFG ${CUSTOM_DIR:+-t ${CMP_DIR}} -a $lREF clean elif [ ${lTYP} == 'cfgs' ]; then - ./makenemo -n $lCFG -t ${CMP_DIR:-${CONFIG_DIR0}} -r $lREF clean + ./makenemo -n $lCFG ${CUSTOM_DIR:+-t ${CMP_DIR}} -r $lREF clean else echo 'ERROR in the cleaning process'; exit 42 fi -- GitLab From b9eb7b48c9e965a99ba31c0a69d7e70a6fb3aff2 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Thu, 10 Nov 2022 18:32:50 +0100 Subject: [PATCH 04/31] add the possibility to install a new configuration anywhere using "-t" makenemo option (continuation of #84) --- makenemo | 53 +++++++++++++++++++++------------------- mk/Fadd_keys.sh | 6 ++--- mk/Fdef_keys.sh | 2 +- mk/Fdel_keys.sh | 14 +++++------ mk/Fmake_WORK.sh | 8 +++--- mk/Fmake_bld.sh | 10 ++++---- mk/Fmake_config.sh | 11 +++++---- mk/bldxag.cfg | 2 +- sette/prepare_exe_dir.sh | 16 ++++++------ 9 files changed, 64 insertions(+), 58 deletions(-) diff --git a/makenemo b/makenemo index 8de8150e..d1a48ca3 100755 --- a/makenemo +++ b/makenemo @@ -88,18 +88,12 @@ 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 -x_name='' +#x_name='' ##- 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 @@ -195,7 +189,8 @@ EOF -d|--dirs|--comp) x_d=${2} ; shift ;; -n|--name) - x_name=${2} ; shift ;; + #x_name=${2} ; shift ;; + x_n=${2} ; shift ;; -r|--ref) x_r=${2} ; shift ;; -a|--academic|--test) @@ -229,31 +224,38 @@ EOF shift done -if [ -n "$x_name" ] # is the configuration existing in cfgs or tests? or is it a new conf? +#if [ -n "$x_name" ] # is the configuration existing in cfgs or tests? or is it a new conf? +if [ -n "$x_n" ] # is the configuration existing in cfgs or tests? or is it a new conf? then - incfg=$( find $CFGS_DIR -type d -name $x_name | wc -l ) # this configuration exists in CFGS_DIR - intst=$( find $TESTS_DIR -type d -name $x_name | wc -l ) # this configuration exists in TESTS_DIR + #incfg=$( find $CFGS_DIR -type d -name $x_name | wc -l ) # this configuration exists in CFGS_DIR + #intst=$( find $TESTS_DIR -type d -name $x_name | wc -l ) # this configuration exists in TESTS_DIR + incfg=$( find $CFGS_DIR -type d -name $x_n | wc -l ) # this configuration exists in CFGS_DIR + intst=$( find $TESTS_DIR -type d -name $x_n | wc -l ) # this configuration exists in TESTS_DIR if [ $(( $incfg + $intst )) -eq 2 ] ; then - echo -e "\033[0;31m\nERROR: the $x_name directory is found twice: in $CFGS_DIR and in $TESTS_DIR\033[0m\n" + #echo -e "\033[0;31m\nERROR: the $x_name directory is found twice: in $CFGS_DIR and in $TESTS_DIR\033[0m\n" + echo -e "\033[0;31m\nERROR: the $x_n directory is found twice: in $CFGS_DIR and in $TESTS_DIR\033[0m\n" exit 4 fi if [ $(( $incfg + $intst )) -gt 0 ] ; then if [ $x_c_cfg -eq 1 ] ; then # if we just want to clean the config (do it here as it must exist) - x_n=$x_name # must define x_n as it is used in Fclean_config.sh + #x_n=$x_name # must define x_n as it is used in Fclean_config.sh . ${COMPIL_DIR}/Fclean_config.sh exit 0 fi - [ -n "$x_r" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-r $x_r\"\n" - [ -n "$x_a" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-a $x_a\"\n" + #[ -n "$x_r" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-r $x_r\"\n" + #[ -n "$x_a" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-a $x_a\"\n" + [ -n "$x_r" ] && echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-r $x_r\"\n" + [ -n "$x_a" ] && echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-a $x_a\"\n" fi - if [ $incfg -eq 1 ] ; then - x_r=$x_name ; x_a='' # reference configuration existing -> define/overwrite x_r - elif [ $intst -eq 1 ] ; then - x_a=$x_name ; x_r='' # test configuration existing -> define/overwrite x_a - else + #if [ $incfg -eq 1 ] ; then + #x_r=$x_name ; x_a='' # reference configuration existing -> define/overwrite x_r + #elif [ $intst -eq 1 ] ; then + #x_a=$x_name ; x_r='' # test configuration existing -> define/overwrite x_a + #else + if [[ $incfg -eq 0 && $intst -eq 0 ]]; then [ ${#x_c} -ne 0 ] && echo -e "\nWARNING: Compilation cleaning of a non-existing configuration, we ignore\n" && exit 0 [ $x_c_cfg -eq 1 ] && echo -e "\nWARNING: Configuration cleaning of a non-existing configuration, we ignore\n" && exit 0 - x_n=$x_name # this is a new configuration -> define + #x_n=$x_name # this is a new configuration -> define fi fi @@ -270,7 +272,7 @@ NEMO_DBG=${x_b} ## No ref. cfg or demo selected -if [[ -z "${REF_CONF}" && -z "${DEMO_CONF}" ]]; then +if [[ -z "${REF_CONF}" && -z "${DEMO_CONF}" && $(( $incfg + $intst )) -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 @@ -332,10 +334,11 @@ echo ${NEW_CONF} "${NEM_SUBDIR}" >> ${CONFIG_DIR}/work_cfgs.txt cd ${CONFIG_DIR} ## Create new config even in existing one (mkdir with -p option, cp with -n) -${COMPIL_DIR}/Fmake_config.sh ${NEW_CONF} ${TML_CONF} +${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${TML_CONF} ## create EXP00 if needed -[ ! -d ${CONFIG_DIR}/${NEW_CONF}/EXP00 ] && \cp -R -n ${CONFIG_DIR}/${NEW_CONF}/EXPREF ${CONFIG_DIR}/${NEW_CONF}/EXP00 +[[ ! -d ${NEMO_TDIR}/${NEW_CONF}/EXP00 && -n "${REF_CONF}" ]] && \cp -R -n ${CONFIG_DIR}/${REF_CONF}/EXPREF ${NEMO_TDIR}/${NEW_CONF}/EXP00 +[[ ! -d ${NEMO_TDIR}/${NEW_CONF}/EXP00 && -n "${DEMO_CONF}" ]] && \cp -R -n ${CONFIG_DIR}/${DEMO_CONF}/EXPREF ${NEMO_TDIR}/${NEW_CONF}/EXP00 #- Create the WORK --- #- Clean links and librairies --- @@ -410,7 +413,7 @@ if [ "${NBR_PRC}" -gt 0 ]; then fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD ||{ cd - ; exit 1 ;} if [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ]; then - ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ${CONFIG_DIR}/${NEW_CONF}/EXP00/nemo + ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ${NEMO_TDIR}/${NEW_CONF}/EXP00/nemo fi ## add remove for clean option diff --git a/mk/Fadd_keys.sh b/mk/Fadd_keys.sh index 0aa554c1..e4fc8c78 100755 --- a/mk/Fadd_keys.sh +++ b/mk/Fadd_keys.sh @@ -64,11 +64,11 @@ set -o posix #- echo "Adding keys in : ${NEW_CONF}" for i in ${list_add_key} ; do - if [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "\<$i\>" )" -ne 0 ] ; then + 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}/" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp - mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm + 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 diff --git a/mk/Fdef_keys.sh b/mk/Fdef_keys.sh index f0edd7d8..bf94a481 100755 --- a/mk/Fdef_keys.sh +++ b/mk/Fdef_keys.sh @@ -58,6 +58,6 @@ set -o posix echo "Defining keys in : ${NEW_CONF}" -echo " bld::tool::fppkeys ${list_def_key}" > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm +echo " bld::tool::fppkeys ${list_def_key}" > ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm unset -v list_def_key diff --git a/mk/Fdel_keys.sh b/mk/Fdel_keys.sh index 88aafc23..ff95aa2b 100755 --- a/mk/Fdel_keys.sh +++ b/mk/Fdel_keys.sh @@ -65,14 +65,14 @@ echo "Removing keys in : ${NEW_CONF}" for i in ${list_del_key} ; do if [ "$(echo ${i} | grep -c key_nproc )" -ne 0 ]; then - sed -e "s/key_nproc[ij]=.* //" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \ - > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp - mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm + 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 ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "$i" )" -ne 0 ]; then - sed -e "s/\b${i}\b//" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \ - > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp - mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm + 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}" fi diff --git a/mk/Fmake_WORK.sh b/mk/Fmake_WORK.sh index 372bca57..780fb996 100755 --- a/mk/Fmake_WORK.sh +++ b/mk/Fmake_WORK.sh @@ -64,14 +64,14 @@ set -o posix # #- declare ZSRC=${@} -ZCONF=${NEW_CONF} +ZCONF=${NEMO_TDIR}/${NEW_CONF} ZTAB=${NEM_SUBDIR[@]} declare NDIR=${#ZTAB[@]} -echo 'Creating '${ZCONF}'/WORK = '${ZTAB[*]}' for '${ZCONF} +echo 'Creating '${ZCONF}'/WORK = '${ZTAB[*]}' for '${ZCONF##*/} -[ ! -d ${ZCONF}/MY_SRC ] && \mkdir ${ZCONF}/MY_SRC -[ -d ${ZCONF}/WORK ] || \mkdir ${ZCONF}/WORK +[ ! -d ${ZCONF}/MY_SRC ] && \mkdir -p ${ZCONF}/MY_SRC +[ -d ${ZCONF}/WORK ] || \mkdir -p ${ZCONF}/WORK for comp in ${ZTAB[*]}; do find ${NEMO_DIR}/$comp -name *.[Ffh]90 -exec ln -sf {} ${ZCONF}/WORK \; diff --git a/mk/Fmake_bld.sh b/mk/Fmake_bld.sh index 53d9f7e3..9973af3f 100755 --- a/mk/Fmake_bld.sh +++ b/mk/Fmake_bld.sh @@ -57,8 +57,8 @@ set -o posix # * creation # #- -[ ! -d ${3}/${2} ] && \mkdir ${3}/${2} -[ ! -d ${3}/${2}/BLD ] && \mkdir ${3}/${2}/BLD -[ ! -d ${1}/${2}/BLD ] && ln -sf ${3}/${2}/BLD ${1}/${2}/BLD -[ -f ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ] && ln -sf ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ${COMPIL_DIR}/cpp.fcm -rm -f ${1}/${NEW_CONF}/BLD/fcm.bld.lock +[ ! -d ${3}/${2} ] && \mkdir -p ${3}/${2} +[ ! -d ${3}/${2}/BLD ] && \mkdir -p ${3}/${2}/BLD +#[ ! -d ${1}/${2}/BLD ] && ln -sf ${3}/${2}/BLD ${1}/${2}/BLD +[ -f ${3}/${2}/cpp_${2}.fcm ] && ln -sf ${3}/${2}/cpp_${2}.fcm ${COMPIL_DIR}/cpp.fcm +rm -f ${1}/${2}/BLD/fcm.bld.lock diff --git a/mk/Fmake_config.sh b/mk/Fmake_config.sh index 12babc42..3ad6bb65 100755 --- a/mk/Fmake_config.sh +++ b/mk/Fmake_config.sh @@ -59,8 +59,9 @@ set -o posix \mkdir -p ${1} \mkdir -p ${1}/EXP00 \mkdir -p ${1}/MY_SRC -\cp -R -n ${2}/cpp_${2}.fcm ${1}/cpp_${1}.fcm -\cp -R -n ${2}/EXPREF/*namelist* ${1}/EXP00/. -\cp -R -n ${2}/EXPREF/*.xml ${1}/EXP00/. -[ -f ${2}/EXPREF/AGRIF_FixedGrids.in ] && \cp -R -n ${2}/EXPREF/AGRIF_FixedGrids.in ${1}/EXP00/. -[ -d ${2}/MY_SRC ] && \cp -n ${2}/MY_SRC/* ${1}/MY_SRC/. 2> /dev/null +\cp -R -n ${2}/cpp_${2}.fcm ${1}/cpp_${1##*/}.fcm +for f in ${2}/EXPREF/*.xml ${2}/EXPREF/*namelist*; do + if [ -L ${f} ]; then ln -sf $(readlink -f ${f}) ${1}/EXP00/$(basename ${f}); else cp -R -n ${f} ${1}/EXP00/.; fi +done +[ -f ${2}/EXPREF/AGRIF_FixedGrids.in ] && \cp -a -n ${2}/EXPREF/AGRIF_FixedGrids.in ${1}/EXP00/. +[ -d ${2}/MY_SRC ] && \cp -an ${2}/MY_SRC/* ${1}/MY_SRC/. 2> /dev/null diff --git a/mk/bldxag.cfg b/mk/bldxag.cfg index 19ea8475..5b4db893 100644 --- a/mk/bldxag.cfg +++ b/mk/bldxag.cfg @@ -13,7 +13,7 @@ inc $COMPIL_DIR/cpp.fcm search_src 1 src::ioipsl $MAIN_DIR/ext/IOIPSL/src -src::nemo $CONFIG_DIR/$NEW_CONF/WORK +src::nemo $NEMO_TDIR/$NEW_CONF/WORK src::ppr_1d $MAIN_DIR/ext/PPR/src bld::target nemo.exe diff --git a/sette/prepare_exe_dir.sh b/sette/prepare_exe_dir.sh index 47d5207f..33ede807 100755 --- a/sette/prepare_exe_dir.sh +++ b/sette/prepare_exe_dir.sh @@ -67,22 +67,24 @@ set -o posix # PREPARE EXEC_DIR #================== if [ -z "${CUSTOM_DIR}" ]; then - export EXE_DIR=${CONFIG_DIR}/${NEW_CONF}/${TEST_NAME} + EXE_DIR=${CONFIG_DIR}/${NEW_CONF} else if [[ -n "${NEMO_DEBUG}" || ${CMP_NAM,,} =~ ("debug"|"dbg") ]]; then - export EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}_DEBUG/${NEW_CONF}/${TEST_NAME} + EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}_DEBUG/${NEW_CONF} else - export EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}/${NEW_CONF}/${TEST_NAME} + EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}/${NEW_CONF} fi fi -mkdir -p ${EXE_DIR} +mkdir -p ${EXE_DIR}/${TEST_NAME} -cp -RL ${CONFIG_DIR}/${NEW_CONF}/EXP00/* ${EXE_DIR}/. -#cat ${SETTE_DIR}/iodef_sette.xml | sed -e"s;DEF_SHARED;${CONFIG_DIR0}/SHARED;" > ${EXE_DIR}/iodef.xml +#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 *//'`" + +export EXE_DIR=${EXE_DIR}/${TEST_NAME} cd ${EXE_DIR} # # Add summary of the sette.sh set-up used and the current list of keys added or deleted -COMP_KEYS="`cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | sed -e 's/.*fppkeys *//'`" echo "Summary of sette environment" > ./sette_config echo "----------------------------" >> ./sette_config echo "requested by the command : "$cmd $cmdargs >> ./sette_config -- GitLab From f1b38a32715ddeabdba1f0fcecd1493bf91d809d Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Sun, 13 Nov 2022 19:56:06 +0100 Subject: [PATCH 05/31] adapt sette to work with any path (custom or not) --- sette/all_functions.sh | 20 +++++--------- sette/prepare_job.sh | 4 +-- sette/sette_reference-configurations.sh | 36 ++++++++++++------------- sette/sette_test-cases.sh | 30 +++++++++------------ 4 files changed, 38 insertions(+), 52 deletions(-) diff --git a/sette/all_functions.sh b/sette/all_functions.sh index 6c07afd2..6eee8ebb 100755 --- a/sette/all_functions.sh +++ b/sette/all_functions.sh @@ -94,8 +94,8 @@ usage=" if value is a string ths is neede syntax : ./set_namelist namelist_name sync_config() { if [ ${SYNC_CONFIGS} == "yes" ]; then - lREF=$3/$1 # reference - lCFG=$3/$2 # target + lREF=$1 # reference + lCFG=$2 # target echo '-------------------------------------------------------------------------------' echo ' SOURCE AND CONFIG FILES SYNCHRONISATION ' @@ -146,24 +146,16 @@ sync_config() { # clean _STg config (input CFG CFG_STg TYPE (test or ref)) clean_config() { if [ ${CLEAN_CONFIGS} == "yes" ]; then - lREF=$1 - lCFG=$2 - lTYP=$3 + lCFG=$1 echo '' echo '-------------------------------------------------------------------------------' echo ' CLEANING CONFIGURATION ' echo '' - echo "./makenemo -n $lCFG -a/-r $lREF ${CUSTOM_DIR:+-t ${CMP_DIR}} clean" + echo "./makenemo -n $(basename $lCFG) ${CUSTOM_DIR:+-t ${CMP_DIR}} clean" echo '' - if [ ${lTYP} == 'tests' ]; then - ./makenemo -n $lCFG ${CUSTOM_DIR:+-t ${CMP_DIR}} -a $lREF clean - elif [ ${lTYP} == 'cfgs' ]; then - ./makenemo -n $lCFG ${CUSTOM_DIR:+-t ${CMP_DIR}} -r $lREF clean - else - echo 'ERROR in the cleaning process'; exit 42 - fi + ./makenemo -n $(basename $lCFG) ${CUSTOM_DIR:+-t ${CMP_DIR}} clean echo '' - echo "$lCFG configuration has been cleaned" + echo "$(basename $lCFG) configuration has been cleaned" echo '' echo '-------------------------------------------------------------------------------' fi diff --git a/sette/prepare_job.sh b/sette/prepare_job.sh index 335daedb..80d3fa1e 100755 --- a/sette/prepare_job.sh +++ b/sette/prepare_job.sh @@ -104,7 +104,7 @@ echo "" >> ${SETTE_DIR}/output.sette echo "running config: ${NEW_CONF}" >> ${SETTE_DIR}/output.sette echo "" >> ${SETTE_DIR}/output.sette echo "list of cpp_keys: " >> ${SETTE_DIR}/output.sette -echo "`more ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm`" >> ${SETTE_DIR}/output.sette +echo "`more ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.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,7 +269,7 @@ 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:${CONFIG_DIR}:" \ + -e"s:DEF_CONFIG_DIR:${NEMO_TDIR}:" \ -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}:" \ diff --git a/sette/sette_reference-configurations.sh b/sette/sette_reference-configurations.sh index 90678bfd..cb0b80d4 100755 --- a/sette/sette_reference-configurations.sh +++ b/sette/sette_reference-configurations.sh @@ -153,8 +153,8 @@ if [ ${config} == "GYRE_PISCES" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config GYRE_PISCES ${SETTE_CONFIG} 'cfgs' - clean_config GYRE_PISCES ${SETTE_CONFIG} 'cfgs' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + 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}" @@ -300,8 +300,8 @@ if [ ${config} == "ORCA2_ICE_PISCES" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' - clean_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' + 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}" fi @@ -587,8 +587,8 @@ if [ ${config} == "ORCA2_OFF_PISCES" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config ${SETTE_CONFIG} ORCA2_OFF_PISCES_ST 'cfgs' - clean_config ${SETTE_CONFIG} ORCA2_OFF_PISCES_ST 'cfgs' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + 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}" @@ -764,8 +764,8 @@ if [ ${config} == "AMM12" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config AMM12 ${SETTE_CONFIG} 'cfgs' - clean_config AMM12 ${SETTE_CONFIG} 'cfgs' + 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}" fi @@ -898,8 +898,8 @@ if [ ${config} == "SAS" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config ORCA2_SAS_ICE ${SETTE_CONFIG} 'cfgs' - clean_config ORCA2_SAS_ICE ${SETTE_CONFIG} 'cfgs' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + 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}" @@ -1046,8 +1046,8 @@ if [ ${config} == "ORCA2_ICE_OBS" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' - clean_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' + 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}" fi @@ -1170,8 +1170,8 @@ if [ ${config} == "AGRIF" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config AGRIF_DEMO ${SETTE_CONFIG} 'cfgs' - clean_config AGRIF_DEMO ${SETTE_CONFIG} 'cfgs' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # # AGRIF_DEMO does not yet support nn_hls=2 => key_loop_fusion can not be used # . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO -j ${CMPL_CORES} add_key "${ADD_KEYS/key_loop_fusion}" del_key "${DEL_KEYS}" @@ -1487,8 +1487,8 @@ if [ ${config} == "AGRIF" ] && [ ${DO_CORRUPT} == "1" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config AGRIF_DEMO ${SETTE_CONFIG} 'cfgs' - clean_config AGRIF_DEMO ${SETTE_CONFIG} 'cfgs' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # # AGRIF_DEMO does not yet support nn_hls=2 => key_loop_fusion can not be used . ./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/key_loop_fusion}" del_key "key_agrif ${DEL_KEYS}" @@ -1535,8 +1535,8 @@ if [ ${config} == "WED025" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config WED025 ${SETTE_CONFIG} 'cfgs' - clean_config WED025 ${SETTE_CONFIG} 'cfgs' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + 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}" diff --git a/sette/sette_test-cases.sh b/sette/sette_test-cases.sh index 34e1bf7f..aec16728 100755 --- a/sette/sette_test-cases.sh +++ b/sette/sette_test-cases.sh @@ -153,9 +153,8 @@ if [ ${config} == "OVERFLOW" ] ; then cd ${MAIN_DIR} # # - clean_config OVERFLOW ${SETTE_CONFIG} 'tests' - # - sync_config OVERFLOW ${SETTE_CONFIG} 'tests' + 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}" fi @@ -270,9 +269,8 @@ if [ ${config} == "LOCK_EXCHANGE" ] ; then # # syncronisation if target directory/file exist (not done by makenemo) # - clean_config LOCK_EXCHANGE ${SETTE_CONFIG} 'tests' - # - sync_config LOCK_EXCHANGE ${SETTE_CONFIG} 'tests' + 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}" fi @@ -389,9 +387,8 @@ if [ ${config} == "VORTEX" ] ; then # # syncronisation if target directory/file exist (not done by makenemo) # - clean_config VORTEX ${SETTE_CONFIG} 'tests' - # - sync_config VORTEX ${SETTE_CONFIG} 'tests' + 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}" fi @@ -583,9 +580,8 @@ if [ ${config} == "ICE_AGRIF" ] ; then # # syncronisation if target directory/file exist (not done by makenemo) # - clean_config ICE_AGRIF ${SETTE_CONFIG} 'tests' - # - sync_config ICE_AGRIF ${SETTE_CONFIG} 'tests' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + 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}" @@ -781,9 +777,8 @@ if [ ${config} == "ISOMIP+" ] ; then # # syncronisation if target directory/file exist (not done by makenemo) # - clean_config ISOMIP+ ${SETTE_CONFIG} 'tests' - # - sync_config ISOMIP+ ${SETTE_CONFIG} 'tests' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + 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}" @@ -926,9 +921,8 @@ if [ ${config} == "SWG" ] && [ ${USING_QCO} == "yes" ] ; then # # syncronisation if target directory/file exist (not done by makenemo) # - clean_config SWG ${SETTE_CONFIG} 'tests' - # - sync_config SWG ${SETTE_CONFIG} 'tests' + 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}" fi -- GitLab From e8d1a34e06d7a5f483191d3433905528ea820955 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Sun, 13 Nov 2022 19:57:44 +0100 Subject: [PATCH 06/31] adapt mk scripts and fcm cfg files to compile nemo completely outside nemo directory --- mk/Fcheck_archfile.sh | 99 ++++++++++++++++++++++--------------------- mk/Fmake_bld.sh | 2 +- mk/Fmake_config.sh | 2 +- mk/bldxag.cfg | 4 +- mk/bldxagxcdf.cfg | 4 +- mk/bldxcdf.cfg | 4 +- mk/conv.cfg | 2 +- 7 files changed, 59 insertions(+), 58 deletions(-) diff --git a/mk/Fcheck_archfile.sh b/mk/Fcheck_archfile.sh index b6145132..f7aad910 100755 --- a/mk/Fcheck_archfile.sh +++ b/mk/Fcheck_archfile.sh @@ -73,19 +73,20 @@ EOF eval "echo \"$line\" >> $2" done < $1 } + # cleaning related to the old version -rm -f $( find ${COMPIL_DIR} -type f -name $1 -print ) +rm -f $( find $(dirname $1) -type f -name $(basename $1) -print ) # if [ ${#3} -eq 0 ]; then # arch not specified - if [ ! -f ${COMPIL_DIR}/arch.history ]; then + if [ ! -f $(dirname $1)/arch.history ]; then echo "Warning !!!" echo "NO compiler chosen" echo "Try makenemo -h for help" echo "EXITING..." exit 1 else # use the arch file defined in arch.history - myarch=$( cat ${COMPIL_DIR}/arch.history ) + myarch=$( cat $(dirname $1)/arch.history ) if [ ! -f $myarch ]; then echo "Warning !!!" echo "previously used arch file no more found:" @@ -93,26 +94,26 @@ if [ ${#3} -eq 0 ]; then # arch not specified echo "EXITING..." exit 1 else - if [ -f ${COMPIL_DIR}/$1 ]; then - if [ "$2" != "nocpp" ] + if [ -f $1 ]; then + if [[ ! "$2" =~ "nocpp" ]] then # has the cpp keys file been changed since we copied the arch file in ${COMPIL_DIR}? - mycpp=$( ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" ) - if [ "$mycpp" != "$( cat ${COMPIL_DIR}/cpp.history )" ]; then - echo $mycpp > ${COMPIL_DIR}/cpp.history - cpeval ${myarch} ${COMPIL_DIR}/$1 + mycpp=$( ls -l $2 | sed -e "s/.* -> //" ) + if [ "$mycpp" != "$( cat $(dirname $2)/cpp.history )" ]; then + echo $mycpp > $(dirname $2)/cpp.history + cpeval ${myarch} $1 fi # has the cpp keys file been updated since we copied the arch file in ${COMPIL_DIR}? - mycpp=$( find -L ${COMPIL_DIR} -cnewer ${COMPIL_DIR}/$1 -name $2 -print ) - [ ${#mycpp} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 + mycpp=$( find -L $(dirname $2) -cnewer $(basename $1) -name $(basename $2) -print ) + [ ${#mycpp} -ne 0 ] && cpeval ${myarch} $1 fi # has myarch file been updated since we copied it in ${COMPIL_DIR}? myarchdir=$( dirname ${myarch} ) myarchname=$( basename ${myarch} ) - myarch=$( find -L $myarchdir -cnewer ${COMPIL_DIR}/$1 -name $myarchname -print ) - [ ${#myarch} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 + myarch=$( find -L $myarchdir -cnewer $(basename $1) -name $myarchname -print ) + [ ${#myarch} -ne 0 ] && cpeval ${myarch} $1 else - cpeval ${myarch} ${COMPIL_DIR}/$1 + cpeval ${myarch} $1 fi fi fi @@ -135,68 +136,68 @@ else fi myarch=$( find ${MAIN_DIR}/arch -name arch-${3}.fcm -print ) # we were already using this arch file ? - if [ "$myarch" == "$( cat ${COMPIL_DIR}/arch.history )" ]; then - if [ -f ${COMPIL_DIR}/$1 ]; then - if [ "$2" != "nocpp" ] + if [ "$myarch" == "$( cat $(dirname $1)/arch.history 2>/dev/null)" ]; then + if [ -f $1 ]; then + if [[ ! "$2" =~ "nocpp" ]] then # has the cpp keys file been changed since we copied the arch file in ${COMPIL_DIR}? - mycpp=$( ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" ) - if [ "$mycpp" != "$( cat ${COMPIL_DIR}/cpp.history )" ]; then - echo $mycpp > ${COMPIL_DIR}/cpp.history - cpeval ${myarch} ${COMPIL_DIR}/$1 + mycpp=$( ls -l $2 | sed -e "s/.* -> //" ) + if [ "$mycpp" != "$( cat $(dirname $2)/cpp.history )" ]; then + echo $mycpp > $(dirname $2)/cpp.history + cpeval ${myarch} $1 fi # has the cpp keys file been updated since we copied the arch file in ${COMPIL_DIR}? - mycpp=$( find -L ${COMPIL_DIR} -cnewer ${COMPIL_DIR}/$1 -name $2 -print ) - [ ${#mycpp} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 + mycpp=$( find -L $(dirname $2) -cnewer $(basename $1) -name $(basename $2) -print ) + [ ${#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 ${COMPIL_DIR}/$1 -name arch-${3}.fcm -print ) - [ ${#myarch} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 + myarch=$( find -L ${MAIN_DIR}/arch -cnewer $(basename $1) -name arch-${3}.fcm -print ) + [ ${#myarch} -ne 0 ] && cpeval ${myarch} $1 else - cpeval ${myarch} ${COMPIL_DIR}/$1 + cpeval ${myarch} $1 fi else - if [ "$2" != "nocpp" ] + if [[ ! "$2" =~ "nocpp" ]] then - ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" > ${COMPIL_DIR}/cpp.history + ls -l $2 | sed -e "s/.* -> //" > $(dirname $2)/cpp.history fi - echo ${myarch} > ${COMPIL_DIR}/arch.history - cpeval ${myarch} ${COMPIL_DIR}/$1 + echo ${myarch} > $(dirname $1)/arch.history + cpeval ${myarch} $1 fi fi #- do we need xios library? #- 2 cases: #- in CONFIG directory looking for key_xios or key_iomput -if [ "$1" == "arch_nemo.fcm" ] +if [ "$(basename $1)" == "arch_nemo.fcm" ] then - if [ "$2" != "nocpp" ] + if [[ ! "$2" =~ "nocpp" ]] then - use_iom=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$2 | grep -c "key_xios\|key_iomput" ) + use_iom=$( sed -e "s/#.*$//" $2 | grep -c "key_xios\|key_iomput" ) else use_iom=0 fi - have_lxios=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-lxios" ) + have_lxios=$( sed -e "s/#.*$//" $1 | grep -c "\-lxios" ) if [[ ( $use_iom -eq 0 ) && ( $have_lxios -ge 1 ) ]] then - sed -e "s/-lxios//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$ - mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1 + sed -e "s/-lxios//g" $1 > $(dirname $1)/tmp$$ + mv -f $(dirname $1)/tmp$$ $1 fi #- in TOOLS directory looking for USE xios else - use_iom=$( egrep --exclude-dir=.svn -r USE ${NEW_CONF}/src/* | grep -c xios ) - have_lxios=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-lxios" ) + use_iom=$( egrep --exclude-dir=.svn -r USE ${MAIN_DIR}/src/* | grep -c xios ) + have_lxios=$( sed -e "s/#.*$//" $1 | grep -c "\-lxios" ) if [[ ( $use_iom -eq 0 ) || ( $have_lxios != 1 ) ]] then - sed -e "s/-lxios//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$ - mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1 + sed -e "s/-lxios//g" $1 > $(dirname $1)/tmp$$ + mv -f $(dirname $1)/tmp$$ $1 fi fi #- do we need oasis libraries? -if [ "$2" != "nocpp" ] +if [[ ! "$2" =~ "nocpp" ]] then - use_oasis=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$2 | grep -c key_oasis3 ) + use_oasis=$( sed -e "s/#.*$//" $2 | grep -c key_oasis3 ) else use_oasis=0 fi @@ -206,26 +207,26 @@ if [[ ! -z "$XIOS_OASIS" ]]; then fi for liboa in psmile.MPI1 mct mpeu scrip mpp_io do - have_liboa=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-l${liboa}" ) + have_liboa=$( sed -e "s/#.*$//" $1 | grep -c "\-l${liboa}" ) if [[ ( $use_oasis -eq 0 ) && ( $have_liboa -ge 1 ) ]] then - sed -e "s/-l${liboa}//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$ - mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1 + sed -e "s/-l${liboa}//g" $1 > $(dirname $1)/tmp$$ + mv -f $(dirname $1)/tmp$$ $1 fi done # Nemo debug ? if [ -n "${NEMO_DBG}" ]; then - if (! grep -q "^%DEBUG_FCFLAGS" ${COMPIL_DIR}/$1 ); 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 fi # duplicate the lines starting with %DEBUG_XXX and replace, in the duplicated line, %DEBUG_XXX by %XXX - sed -i "/^%DEBUG_/{p;s/^%DEBUG_\([^ ]*\)/%\1/;}" ${COMPIL_DIR}/$1 + sed -i "/^%DEBUG_/{p;s/^%DEBUG_\([^ ]*\)/%\1/;}" $1 else - if (! grep -q "^%PROD_FCFLAGS" ${COMPIL_DIR}/$1 ); then + if (! grep -q "^%PROD_FCFLAGS" $1 ); then echo "WARNING: '%PROD_FCFLAGS' not defined in your arch file, makenemo will use '%FCFLAGS' instead" fi # duplicate the lines starting with %PROD_XXX and replace, in the duplicated line, %PROD_XXX by %XXX - sed -i "/^%PROD_/{p;s/^%PROD_\([^ ]*\)/%\1/;}" ${COMPIL_DIR}/$1 + sed -i "/^%PROD_/{p;s/^%PROD_\([^ ]*\)/%\1/;}" $1 fi diff --git a/mk/Fmake_bld.sh b/mk/Fmake_bld.sh index 9973af3f..ebb2e48c 100755 --- a/mk/Fmake_bld.sh +++ b/mk/Fmake_bld.sh @@ -60,5 +60,5 @@ set -o posix [ ! -d ${3}/${2} ] && \mkdir -p ${3}/${2} [ ! -d ${3}/${2}/BLD ] && \mkdir -p ${3}/${2}/BLD #[ ! -d ${1}/${2}/BLD ] && ln -sf ${3}/${2}/BLD ${1}/${2}/BLD -[ -f ${3}/${2}/cpp_${2}.fcm ] && ln -sf ${3}/${2}/cpp_${2}.fcm ${COMPIL_DIR}/cpp.fcm +[ -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_config.sh b/mk/Fmake_config.sh index 3ad6bb65..79673f0e 100755 --- a/mk/Fmake_config.sh +++ b/mk/Fmake_config.sh @@ -59,7 +59,7 @@ set -o posix \mkdir -p ${1} \mkdir -p ${1}/EXP00 \mkdir -p ${1}/MY_SRC -\cp -R -n ${2}/cpp_${2}.fcm ${1}/cpp_${1##*/}.fcm +\cp -R -n ${2}/cpp_${2##*/}.fcm ${1}/cpp_${1##*/}.fcm for f in ${2}/EXPREF/*.xml ${2}/EXPREF/*namelist*; do if [ -L ${f} ]; then ln -sf $(readlink -f ${f}) ${1}/EXP00/$(basename ${f}); else cp -R -n ${f} ${1}/EXP00/.; fi done diff --git a/mk/bldxag.cfg b/mk/bldxag.cfg index 5b4db893..78a775d5 100644 --- a/mk/bldxag.cfg +++ b/mk/bldxag.cfg @@ -7,8 +7,8 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_nemo.fcm -inc $COMPIL_DIR/cpp.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm search_src 1 diff --git a/mk/bldxagxcdf.cfg b/mk/bldxagxcdf.cfg index d562b61b..28361348 100644 --- a/mk/bldxagxcdf.cfg +++ b/mk/bldxagxcdf.cfg @@ -7,8 +7,8 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_nemo.fcm -inc $COMPIL_DIR/cpp.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm search_src 1 diff --git a/mk/bldxcdf.cfg b/mk/bldxcdf.cfg index 0d752da9..5a175b45 100644 --- a/mk/bldxcdf.cfg +++ b/mk/bldxcdf.cfg @@ -7,8 +7,8 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_nemo.fcm -inc $COMPIL_DIR/cpp.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm search_src 1 diff --git a/mk/conv.cfg b/mk/conv.cfg index 759e5f26..f8757962 100644 --- a/mk/conv.cfg +++ b/mk/conv.cfg @@ -7,7 +7,7 @@ cfg::version 1.0 # ------------------------------------------------------------------------------ # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/$MYARCH +inc $NEMO_TDIR/$NEW_CONF/BLD/$MYARCH bld::tool::cc %CC bld::tool::cflags %CFLAGS -- GitLab From cce977dcd4413ba1a5d0dad67b58166243551205 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Sun, 13 Nov 2022 20:36:43 +0100 Subject: [PATCH 07/31] adapt makenemo to compile nemo in any directory + improve "clean" option --- makenemo | 169 ++++++++++++++++++++++++------------------------------- 1 file changed, 72 insertions(+), 97 deletions(-) diff --git a/makenemo b/makenemo index d1a48ca3..dd884a5b 100755 --- a/makenemo +++ b/makenemo @@ -88,7 +88,6 @@ 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 -#x_name='' ##- Local variables --- b_n=$(basename ${0}) @@ -189,7 +188,6 @@ EOF -d|--dirs|--comp) x_d=${2} ; shift ;; -n|--name) - #x_name=${2} ; shift ;; x_n=${2} ; shift ;; -r|--ref) x_r=${2} ; shift ;; @@ -224,41 +222,6 @@ EOF shift done -#if [ -n "$x_name" ] # is the configuration existing in cfgs or tests? or is it a new conf? -if [ -n "$x_n" ] # is the configuration existing in cfgs or tests? or is it a new conf? -then - #incfg=$( find $CFGS_DIR -type d -name $x_name | wc -l ) # this configuration exists in CFGS_DIR - #intst=$( find $TESTS_DIR -type d -name $x_name | wc -l ) # this configuration exists in TESTS_DIR - incfg=$( find $CFGS_DIR -type d -name $x_n | wc -l ) # this configuration exists in CFGS_DIR - intst=$( find $TESTS_DIR -type d -name $x_n | wc -l ) # this configuration exists in TESTS_DIR - if [ $(( $incfg + $intst )) -eq 2 ] ; then - #echo -e "\033[0;31m\nERROR: the $x_name directory is found twice: in $CFGS_DIR and in $TESTS_DIR\033[0m\n" - echo -e "\033[0;31m\nERROR: the $x_n directory is found twice: in $CFGS_DIR and in $TESTS_DIR\033[0m\n" - exit 4 - fi - if [ $(( $incfg + $intst )) -gt 0 ] ; then - if [ $x_c_cfg -eq 1 ] ; then # if we just want to clean the config (do it here as it must exist) - #x_n=$x_name # must define x_n as it is used in Fclean_config.sh - . ${COMPIL_DIR}/Fclean_config.sh - exit 0 - fi - #[ -n "$x_r" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-r $x_r\"\n" - #[ -n "$x_a" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-a $x_a\"\n" - [ -n "$x_r" ] && echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-r $x_r\"\n" - [ -n "$x_a" ] && echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-a $x_a\"\n" - fi - #if [ $incfg -eq 1 ] ; then - #x_r=$x_name ; x_a='' # reference configuration existing -> define/overwrite x_r - #elif [ $intst -eq 1 ] ; then - #x_a=$x_name ; x_r='' # test configuration existing -> define/overwrite x_a - #else - if [[ $incfg -eq 0 && $intst -eq 0 ]]; then - [ ${#x_c} -ne 0 ] && echo -e "\nWARNING: Compilation cleaning of a non-existing configuration, we ignore\n" && exit 0 - [ $x_c_cfg -eq 1 ] && echo -e "\nWARNING: Configuration cleaning of a non-existing configuration, we ignore\n" && exit 0 - #x_n=$x_name # this is a new configuration -> define - fi -fi - export NEW_CONF=${x_n} NBR_PRC=${x_j} CMP_NAM=${x_m} @@ -270,21 +233,10 @@ NEMO_DBG=${x_b} [ "${CMP_NAM}" == 'all' ] && . ${COMPIL_DIR}/Flist_archfile.sh all && exit - -## No ref. cfg or demo selected -if [[ -z "${REF_CONF}" && -z "${DEMO_CONF}" && $(( $incfg + $intst )) -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 -fi -## At least one config has been requested - ## 'all' arg: list all available configurations if [[ "${REF_CONF}" == 'all' || "${DEMO_CONF}" == 'all' ]]; then ${COMPIL_DIR}/Flist_cfgs.sh exit 2 - ## Probably useless but who knows? 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" @@ -294,29 +246,62 @@ elif [ -n "${REF_CONF}" ]; then conf_file=ref_cfgs.txt ; export CONFIG_DIR=${CFGS_DIR} ; TML_CONF=${REF_CONF} elif [ -n "${DEMO_CONF}" ]; then conf_file=demo_cfgs.txt; export CONFIG_DIR=${TESTS_DIR}; TML_CONF=${DEMO_CONF} -fi - -## Reuse a working cfg -grep -q "${TML_CONF} " ${CONFIG_DIR}/work_cfgs.txt 2>/dev/null && conf_file=work_cfgs.txt - -## Test if ref. cfg or demo case does exist -if (! grep -q "${TML_CONF} " ${CONFIG_DIR}/$conf_file ); then +elif grep -q "${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt; 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} +elif ! grep -q "${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt; then echo -e "\033[0;31m\nThe reference configuration ('-r') or " echo -e "demonstration case ('-a') selected is not available!!!" echo -e "Check the option used and the available items in .txt files\033[0m" ${COMPIL_DIR}/Flist_cfgs.sh exit 2 fi +if [ -z "${NEW_CONF}" ]; then NEW_CONF=$TML_CONF; fi +export NEMO_TDIR=${x_t:-$CONFIG_DIR} -## If new cfg exists, work in it -if [ -n "${NEW_CONF}" ] -then - echo - printf "\nYou are installing a new configuration %s from %s " ${NEW_CONF} ${TML_CONF} - printf "with sub-components: %s\n" "${NEM_SUBDIR}" - echo -else - NEW_CONF=${TML_CONF} + +# check configuration existence & clean it if asked +if [ -n "$x_n" ]; then + incfg=$( find $NEMO_TDIR -type d -name $x_n | wc -l ) # this configuration exists in CFGS_DIR + if [ $incfg -eq 1 ] ; then + # CLEANING + if [ $x_c_cfg -eq 1 ] ; then + . ${COMPIL_DIR}/Fclean_config.sh + exit 0 + elif [ ${#x_c} -ne 0 ]; 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/} + # 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' + for dir in AGRIFLIB BLD LONG NEMOFILES REPRO_* SHORT WORK; do + rm -rf ${NEMO_TDIR}/${NEW_CONF}/$dir + done + for file in cpp.history cpp.fcm full_key_list.txt; do + rm -f ${NEMO_TDIR}/${NEW_CONF}/BLD/$file + done + exit 0 + fi + if [ -n "$REF_CONF" ]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-r $REF_CONF\"\n"; REF_CONF=""; fi + if [ -n "$DEMO_CONF" ]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-a $DEMO_CONF\"\n"; DEMO_CONF=""; fi + fi + if [ $incfg -eq 0 ]; then + [ $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 +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 fi ## Update sub-comps if needed @@ -324,17 +309,22 @@ if [ -z "${NEM_SUBDIR}" ]; then NEM_SUBDIR=$( grep "${TML_CONF} " ${CONFIG_DIR}/${conf_file} | awk '{$1 = ""; print $0}' ) fi -export NEMO_TDIR=${x_t:-$CONFIG_DIR} export NEM_SUBDIR="${NEM_SUBDIR}" NEW_CONF="${NEW_CONF}" +## If new cfg exists, work in it +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 + ## 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 -cd ${CONFIG_DIR} - ## Create new config even in existing one (mkdir with -p option, cp with -n) -${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${TML_CONF} +${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${CONFIG_DIR}/${TML_CONF} ## create EXP00 if needed [[ ! -d ${NEMO_TDIR}/${NEW_CONF}/EXP00 && -n "${REF_CONF}" ]] && \cp -R -n ${CONFIG_DIR}/${REF_CONF}/EXPREF ${NEMO_TDIR}/${NEW_CONF}/EXP00 @@ -349,12 +339,12 @@ ${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${TML_CONF} # 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_" ${NEW_CONF}/WORK/* ); do + for i in $( grep "^ *#.* key_" ${NEMO_TDIR}/${NEW_CONF}/WORK/* ); do echo $i | grep key_ | sed -e "s/=.*//" done \ - | sort -d | uniq > ${COMPIL_DIR}/full_key_list.txt + | sort -d | uniq > ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt - [ ${list_key} -eq 1 ] && echo && cat ${COMPIL_DIR}/full_key_list.txt && exit 0 + [ ${list_key} -eq 1 ] && echo && cat ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt && exit 0 fi #- At this stage new configuration has been added, we add or remove keys @@ -364,12 +354,12 @@ fi #- check that all keys are really existing... if [ $chk_key -eq 1 ] ; then - for kk in $( cat ${NEW_CONF}/cpp_${NEW_CONF}.fcm ); do + 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 ${COMPIL_DIR}/full_key_list.txt ) ]; then + 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 ${NEW_CONF}/WORK routines..." + echo "E R R O R : key "$kk" is not found in ${NEMO_TDIR}/${NEW_CONF}/WORK routines..." echo "we stop..." echo exit 1 @@ -380,14 +370,9 @@ 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 arch_nemo.fcm cpp.fcm ${CMP_NAM} || exit 3 - -#- At this stage the configuration has beeen chosen -#- We coose the default light file -[ $x_nocdf -eq 1 ] && export USEBLD=bldxagxcdf.cfg || export USEBLD=bldxag.cfg +. ${COMPIL_DIR}/Fcheck_archfile.sh ${NEMO_TDIR}/${NEW_CONF}/BLD/arch_nemo.fcm ${NEMO_TDIR}/${NEW_CONF}/BLD/cpp.fcm ${CMP_NAM} || exit 3 #- We look after agrif -grep key_agrif ${COMPIL_DIR}/cpp.fcm && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/} . ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} arch_nemo.fcm || exit 3 #- @@ -398,40 +383,30 @@ grep key_agrif ${COMPIL_DIR}/cpp.fcm && export AGRIFUSE=1 && export USEBLD=${USE #- Compile --- if [ "${NBR_PRC}" -gt 0 ]; then - cd ${NEMO_TDIR}/${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.cfg ||{ cd - ; exit 1 ;} + fcm build --ignore-lock -j 1 ${COMPIL_DIR}/bld_preproagr.cfg || exit 1 echo '' echo "---------------------------------" echo "CONV preprocessing successfull !!" echo "---------------------------------" echo '' fi + + # 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/} - fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD ||{ cd - ; exit 1 ;} + fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$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 fi - ## add remove for clean option - if [ ${#x_c} -ne 0 ]; then - echo -e '\nCleaning '${NEW_CONF}' building directories and variables\n' - for dir in AGRIFLIB BLD LONG NEMOFILES REPRO_* SHORT WORK; do - rm -rf ${NEMO_TDIR}/${NEW_CONF}/$dir - done - for file in cpp.history cpp.fcm full_key_list.txt; do - rm -f ${COMPIL_DIR}/$file - done - fi fi -#- Come back to original directory --- -cd - - -#- #- Unset variables ${COMPIL_DIR}/Fclean_var.sh -- GitLab From 865b28981487c07b05bb952f64eaa0e05ba0eca0 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Mon, 14 Nov 2022 12:20:08 +0100 Subject: [PATCH 08/31] agrif compilation bugfix --- makenemo | 18 ++++++++---------- mk/bld.cfg | 4 ++-- mk/bld_preproagr.cfg | 6 +++--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/makenemo b/makenemo index dd884a5b..cdddf458 100755 --- a/makenemo +++ b/makenemo @@ -263,7 +263,7 @@ export NEMO_TDIR=${x_t:-$CONFIG_DIR} # check configuration existence & clean it if asked if [ -n "$x_n" ]; then - incfg=$( find $NEMO_TDIR -type d -name $x_n | wc -l ) # this configuration exists in CFGS_DIR + incfg=$( find $NEMO_TDIR -type d -name $x_n 2>/dev/null | wc -l ) # this configuration exists in CFGS_DIR if [ $incfg -eq 1 ] ; then # CLEANING if [ $x_c_cfg -eq 1 ] ; then @@ -371,10 +371,6 @@ 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 - -#- We look after agrif -. ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} arch_nemo.fcm || exit 3 - #- #_ END OF CONFIGURATION PHASE #_ @@ -384,6 +380,13 @@ fi if [ "${NBR_PRC}" -gt 0 ]; 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}/${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 @@ -394,11 +397,6 @@ if [ "${NBR_PRC}" -gt 0 ]; then echo '' fi - # 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/} - fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || exit 1 if [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ]; then diff --git a/mk/bld.cfg b/mk/bld.cfg index 67352be6..ebc688aa 100644 --- a/mk/bld.cfg +++ b/mk/bld.cfg @@ -7,8 +7,8 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_nemo.fcm -inc $COMPIL_DIR/cpp.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm search_src 1 diff --git a/mk/bld_preproagr.cfg b/mk/bld_preproagr.cfg index e901d829..3f015aa1 100644 --- a/mk/bld_preproagr.cfg +++ b/mk/bld_preproagr.cfg @@ -7,11 +7,11 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_nemo.fcm -inc $COMPIL_DIR/cpp.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm search_src 1 -src::nemo $CONFIG_DIR/$NEW_CONF/WORK +src::nemo $NEMO_TDIR/$NEW_CONF/WORK bld::target lib_cray.f90 nemo.f90 agrif_user.f90 agrif2model.f90 -- GitLab From 2836ff662d697ff02b36ad0b9b03521fa9c0de4a Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Mon, 14 Nov 2022 12:53:44 +0100 Subject: [PATCH 09/31] fix physics tests for LOCK_EXCHANGE & OVERFLOW --- sette/sette_test-cases.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sette/sette_test-cases.sh b/sette/sette_test-cases.sh index aec16728..b55dd0c5 100755 --- a/sette/sette_test-cases.sh +++ b/sette/sette_test-cases.sh @@ -220,12 +220,12 @@ if [ ${config} == "OVERFLOW" ] && [ ${DO_PHYOPTS} == "1" ] ; then else ITEND=6120 fi - cd ${CONFIG_DIR}/${NEW_CONF}/EXP00 + cd ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/EXP00 for file in $(echo `ls namelist_*_cfg `) ; do TEST_NAME=`echo $file | sed -e "s/namelist_//" | sed -e "s/_cfg//"` TEST_NAME="EXP-${TEST_NAME}" - if [ ! -d ${CONFIG_DIR}/${NEW_CONF}/${TEST_NAME} ] ; then mkdir ${CONFIG_DIR}/${NEW_CONF}/${TEST_NAME} ; fi + if [ ! -d ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/${TEST_NAME} ] ; then mkdir -p ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/${TEST_NAME} ; fi export TEST_NAME="${TEST_NAME}" ## cd ${SETTE_DIR} @@ -237,7 +237,7 @@ if [ ${config} == "OVERFLOW" ] && [ ${DO_PHYOPTS} == "1" ] ; then if [ -f ${JOB_FILE} ] ; then \rm ${JOB_FILE} ; fi cd ${EXE_DIR} rm namelist_*_*_*_* - cp -pL ${CONFIG_DIR}/${NEW_CONF}/EXP00/$file namelist_cfg + cp -pL ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/EXP00/$file namelist_cfg set_namelist namelist_cfg nn_it000 1 set_namelist namelist_cfg nn_itend ${ITEND} set_namelist_opt namelist_cfg ln_timing ${USING_TIMING} .true. .false. @@ -335,13 +335,14 @@ if [ ${config} == "LOCK_EXCHANGE" ] && [ ${DO_PHYOPTS} == "1" ] ; then else ITEND=61200 fi - cd ${CONFIG_DIR}/${NEW_CONF}/EXP00 + cd ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/EXP00 + for file in $(echo `ls namelist_*_cfg `) ; do echo '' TEST_NAME=`echo $file | sed -e "s/namelist_//" | sed -e "s/_cfg//"` TEST_NAME="EXP-${TEST_NAME}" - `mkdir ${CONFIG_DIR}/${NEW_CONF}/${TEST_NAME}` + mkdir -p ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/${TEST_NAME} export TEST_NAME="${TEST_NAME}" ## cd ${SETTE_DIR} @@ -353,7 +354,7 @@ if [ ${config} == "LOCK_EXCHANGE" ] && [ ${DO_PHYOPTS} == "1" ] ; then if [ -f ${JOB_FILE} ] ; then \rm ${JOB_FILE} ; fi cd ${EXE_DIR} rm namelist_*_*_*_* - cp -pL ${CONFIG_DIR}/${NEW_CONF}/EXP00/$file namelist_cfg + cp -pL ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/EXP00/$file namelist_cfg set_namelist namelist_cfg nn_it000 1 set_namelist namelist_cfg nn_itend ${ITEND} set_namelist_opt namelist_cfg ln_timing ${USING_TIMING} .true. .false. -- GitLab From f462b1fa8e240d89daa2ad38c48c1cc8a39c29f5 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Tue, 29 Nov 2022 09:19:08 +0100 Subject: [PATCH 10/31] apply Simon suggestions from !178 --- makenemo | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/makenemo b/makenemo index cdddf458..96464483 100755 --- a/makenemo +++ b/makenemo @@ -246,10 +246,15 @@ elif [ -n "${REF_CONF}" ]; then conf_file=ref_cfgs.txt ; export CONFIG_DIR=${CFGS_DIR} ; TML_CONF=${REF_CONF} elif [ -n "${DEMO_CONF}" ]; then conf_file=demo_cfgs.txt; export CONFIG_DIR=${TESTS_DIR}; TML_CONF=${DEMO_CONF} -elif grep -q "${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt; then - conf_file=$( grep -l "${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt ) +elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt | 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} +elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt | wc -l ) -eq 2 ]; then + echo -e "\033[0;31m\nUser configuration 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 elif ! grep -q "${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt; then echo -e "\033[0;31m\nThe reference configuration ('-r') or " echo -e "demonstration case ('-a') selected is not available!!!" -- GitLab From fa8fd0c00e689da08aba9921ee6b6f1971411329 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Wed, 14 Dec 2022 17:01:15 +0100 Subject: [PATCH 11/31] apply Simon review --- makenemo | 62 ++++++++++++++++++++++++---------------------- mk/Fmake_config.sh | 4 +-- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/makenemo b/makenemo index 96464483..668eed08 100755 --- a/makenemo +++ b/makenemo @@ -246,35 +246,39 @@ elif [ -n "${REF_CONF}" ]; then conf_file=ref_cfgs.txt ; export CONFIG_DIR=${CFGS_DIR} ; TML_CONF=${REF_CONF} elif [ -n "${DEMO_CONF}" ]; then conf_file=demo_cfgs.txt; export CONFIG_DIR=${TESTS_DIR}; TML_CONF=${DEMO_CONF} -elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt | wc -l ) -eq 1 ]; then +elif [ $( grep -l "^${NEW_CONF} " */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} -elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt | wc -l ) -eq 2 ]; then +elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt 2> /dev/null | wc -l ) -eq 2 ]; then echo -e "\033[0;31m\nUser configuration 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 -elif ! grep -q "${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt; then +elif ! grep -q "^${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt 2> /dev/null; then echo -e "\033[0;31m\nThe reference configuration ('-r') or " echo -e "demonstration case ('-a') selected is not available!!!" echo -e "Check the option used and the available items in .txt files\033[0m" ${COMPIL_DIR}/Flist_cfgs.sh exit 2 +else + exit 2 fi + if [ -z "${NEW_CONF}" ]; then NEW_CONF=$TML_CONF; fi export NEMO_TDIR=${x_t:-$CONFIG_DIR} # check configuration existence & clean it if asked -if [ -n "$x_n" ]; then - incfg=$( find $NEMO_TDIR -type d -name $x_n 2>/dev/null | wc -l ) # this configuration exists in CFGS_DIR - if [ $incfg -eq 1 ] ; then - # CLEANING - if [ $x_c_cfg -eq 1 ] ; then - . ${COMPIL_DIR}/Fclean_config.sh - exit 0 - elif [ ${#x_c} -ne 0 ]; then +incfg=$( find $NEMO_TDIR -type d -maxdepth 1 -name ${TML_CONF} 2>/dev/null | wc -l ) # this configuration exists in CFGS_DIR +if [ $incfg -eq 1 ] ; then + # CLEANING + if [ $x_c_cfg -eq 1 ] ; then + . ${COMPIL_DIR}/Fclean_config.sh + exit 0 + elif [ ${#x_c} -ne 0 ]; then + read -p "Are you sure that you want to clean $TML_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 @@ -282,22 +286,24 @@ if [ -n "$x_n" ]; then # 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' - for dir in AGRIFLIB BLD LONG NEMOFILES REPRO_* SHORT WORK; do - rm -rf ${NEMO_TDIR}/${NEW_CONF}/$dir - done - for file in cpp.history cpp.fcm full_key_list.txt; do - rm -f ${NEMO_TDIR}/${NEW_CONF}/BLD/$file - done + echo -e '\nCleaning '${NEW_CONF}' building directories and variables\n' + for dir in AGRIFLIB BLD LONG NEMOFILES REPRO_* SHORT WORK; do + rm -rf ${NEMO_TDIR}/${NEW_CONF}/$dir + done + for file in cpp.history cpp.fcm full_key_list.txt; do + rm -f ${NEMO_TDIR}/${NEW_CONF}/BLD/$file + done exit 0 - fi - if [ -n "$REF_CONF" ]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-r $REF_CONF\"\n"; REF_CONF=""; fi - if [ -n "$DEMO_CONF" ]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-a $DEMO_CONF\"\n"; DEMO_CONF=""; fi - fi - if [ $incfg -eq 0 ]; then - [ $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 + else + echo "cleaning cancelled" + 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 + [ $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 @@ -325,16 +331,12 @@ if [ ${TML_CONF} != ${NEW_CONF} ]; then fi ## 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 +[ -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 new config even in existing one (mkdir with -p option, cp with -n) ${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${CONFIG_DIR}/${TML_CONF} -## create EXP00 if needed -[[ ! -d ${NEMO_TDIR}/${NEW_CONF}/EXP00 && -n "${REF_CONF}" ]] && \cp -R -n ${CONFIG_DIR}/${REF_CONF}/EXPREF ${NEMO_TDIR}/${NEW_CONF}/EXP00 -[[ ! -d ${NEMO_TDIR}/${NEW_CONF}/EXP00 && -n "${DEMO_CONF}" ]] && \cp -R -n ${CONFIG_DIR}/${DEMO_CONF}/EXPREF ${NEMO_TDIR}/${NEW_CONF}/EXP00 - #- Create the WORK --- #- Clean links and librairies --- #- Creating the good links, at first on OCE --- diff --git a/mk/Fmake_config.sh b/mk/Fmake_config.sh index 79673f0e..6a3e942b 100755 --- a/mk/Fmake_config.sh +++ b/mk/Fmake_config.sh @@ -59,9 +59,9 @@ set -o posix \mkdir -p ${1} \mkdir -p ${1}/EXP00 \mkdir -p ${1}/MY_SRC -\cp -R -n ${2}/cpp_${2##*/}.fcm ${1}/cpp_${1##*/}.fcm +[ "${2}/cpp_${2##*/}.fcm" != "${1}/cpp_${1##*/}.fcm" ] && \cp -R -n ${2}/cpp_${2##*/}.fcm ${1}/cpp_${1##*/}.fcm for f in ${2}/EXPREF/*.xml ${2}/EXPREF/*namelist*; do if [ -L ${f} ]; then ln -sf $(readlink -f ${f}) ${1}/EXP00/$(basename ${f}); else cp -R -n ${f} ${1}/EXP00/.; fi done -[ -f ${2}/EXPREF/AGRIF_FixedGrids.in ] && \cp -a -n ${2}/EXPREF/AGRIF_FixedGrids.in ${1}/EXP00/. +[ -f ${2}/EXPREF/AGRIF_FixedGrids.in ] && \cp -a -n ${2}/EXPREF/AGRIF_FixedGrids.in ${1}/EXP00/. [ -d ${2}/MY_SRC ] && \cp -an ${2}/MY_SRC/* ${1}/MY_SRC/. 2> /dev/null -- GitLab From 3477947b7f764545095e7bdcc1b01a5353397e77 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Wed, 9 Nov 2022 12:29:23 +0100 Subject: [PATCH 12/31] fix tests dir --- sette/sette_test-cases.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sette/sette_test-cases.sh b/sette/sette_test-cases.sh index 1d879f30..ee12e28f 100755 --- a/sette/sette_test-cases.sh +++ b/sette/sette_test-cases.sh @@ -108,7 +108,7 @@ if [ ${USING_MPMD} == "no" ] fi # # Directory to run the tests -CONFIG_DIR0=${MAIN_DIR}/cfgs +CONFIG_DIR0=${MAIN_DIR}/tests TOOLS_DIR=${MAIN_DIR}/tools if [ -n "${CUSTOM_DIR}" ]; then -- GitLab From d46abc33964ab0b15b80b64bb98c6d7fefe5c75b Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Wed, 9 Nov 2022 19:04:57 +0100 Subject: [PATCH 13/31] change makenemo arguments to avoid using "-t" option when not needed --- sette/sette_reference-configurations.sh | 18 +++++++++--------- sette/sette_test-cases.sh | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sette/sette_reference-configurations.sh b/sette/sette_reference-configurations.sh index 379ee02a..49bcbaca 100755 --- a/sette/sette_reference-configurations.sh +++ b/sette/sette_reference-configurations.sh @@ -159,7 +159,7 @@ if [ ${config} == "GYRE_PISCES" ] ; then clean_config GYRE_PISCES ${SETTE_CONFIG} 'cfgs' # # GYRE uses linssh so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r GYRE_PISCES -t ${CMP_DIR:-${CONFIG_DIR0}} -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 sync_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' clean_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_ICE_PISCES -t ${CMP_DIR:-${CONFIG_DIR0}} -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 clean_config ${SETTE_CONFIG} ORCA2_OFF_PISCES_ST 'cfgs' # # ORCA2_OFF_PISCES uses linssh so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_OFF_PISCES -t ${CMP_DIR:-${CONFIG_DIR0}} -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 sync_config AMM12 ${SETTE_CONFIG} 'cfgs' clean_config AMM12 ${SETTE_CONFIG} 'cfgs' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AMM12 -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -904,7 +904,7 @@ if [ ${config} == "SAS" ] ; then clean_config ORCA2_SAS_ICE ${SETTE_CONFIG} 'cfgs' # # ORCA2_SAS_ICE uses linssh so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_SAS_ICE -t ${CMP_DIR:-${CONFIG_DIR0}} -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 ## Restartability tests @@ -1051,7 +1051,7 @@ if [ ${config} == "ORCA2_ICE_OBS" ] ; then sync_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' clean_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r ORCA2_ICE_PISCES -d "OCE ICE" -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -1177,7 +1177,7 @@ if [ ${config} == "AGRIF" ] ; then # # AGRIF_DEMO does not yet support nn_hls=2 => key_loop_fusion can not be used # . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO -j ${CMPL_CORES} add_key "${ADD_KEYS/key_loop_fusion}" del_key "${DEL_KEYS}" - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO -t ${CMP_DIR:-${CONFIG_DIR0}} -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 ## Restartability tests @@ -1493,7 +1493,7 @@ if [ ${config} == "AGRIF" ] && [ ${DO_CORRUPT} == "1" ] ; then clean_config AGRIF_DEMO ${SETTE_CONFIG} 'cfgs' # # AGRIF_DEMO does not yet support nn_hls=2 => key_loop_fusion can not be used - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO -t ${CMP_DIR:-${CONFIG_DIR0}} -k 0 ${NEMO_DEBUG} -j ${CMPL_CORES} add_key "${ADD_KEYS/key_loop_fusion}" 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/key_loop_fusion}" del_key "key_agrif ${DEL_KEYS}" cd ${SETTE_DIR} . ./prepare_exe_dir.sh set_valid_dir @@ -1541,7 +1541,7 @@ if [ ${config} == "WED025" ] ; then clean_config WED025 ${SETTE_CONFIG} 'cfgs' # # WED025 uses ln_hpg_isf so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r WED025 -t ${CMP_DIR:-${CONFIG_DIR0}} -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_test-cases.sh b/sette/sette_test-cases.sh index ee12e28f..3a77b2e6 100755 --- a/sette/sette_test-cases.sh +++ b/sette/sette_test-cases.sh @@ -159,7 +159,7 @@ if [ ${config} == "OVERFLOW" ] ; then # sync_config OVERFLOW ${SETTE_CONFIG} 'tests' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a OVERFLOW -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -276,7 +276,7 @@ if [ ${config} == "LOCK_EXCHANGE" ] ; then # sync_config LOCK_EXCHANGE ${SETTE_CONFIG} 'tests' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a LOCK_EXCHANGE -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -395,7 +395,7 @@ if [ ${config} == "VORTEX" ] ; then # sync_config VORTEX ${SETTE_CONFIG} 'tests' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a VORTEX -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -590,7 +590,7 @@ if [ ${config} == "ICE_AGRIF" ] ; then sync_config ICE_AGRIF ${SETTE_CONFIG} 'tests' # # ICE_AGRIF uses linssh so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a ICE_AGRIF -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -788,7 +788,7 @@ if [ ${config} == "ISOMIP+" ] ; then sync_config ISOMIP+ ${SETTE_CONFIG} 'tests' # # ISOMIP+ uses ln_hpg_isf so remove key_qco if added by default - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a ISOMIP+ -t ${CMP_DIR:-${CONFIG_DIR0}} -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 @@ -932,7 +932,7 @@ if [ ${config} == "SWG" ] && [ ${USING_QCO} == "yes" ] ; then # sync_config SWG ${SETTE_CONFIG} 'tests' # - . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -a SWG -t ${CMP_DIR:-${CONFIG_DIR0}} -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 -- GitLab From afbdad111883e98348e3396a6b6a8c3c73009cc7 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Thu, 10 Nov 2022 08:24:06 +0100 Subject: [PATCH 14/31] add same change to makenemo in clean_config function --- sette/all_functions.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sette/all_functions.sh b/sette/all_functions.sh index f75cfe3d..6c99ef46 100755 --- a/sette/all_functions.sh +++ b/sette/all_functions.sh @@ -153,12 +153,12 @@ clean_config() { echo '-------------------------------------------------------------------------------' echo ' CLEANING CONFIGURATION ' echo '' - echo "./makenemo -n $lCFG -a/-r $lREF -t ${CMP_DIR:-${CONFIG_DIR0}} clean" + echo "./makenemo -n $lCFG -a/-r $lREF ${CUSTOM_DIR:+-t ${CMP_DIR}} clean" echo '' if [ ${lTYP} == 'tests' ]; then - ./makenemo -n $lCFG -t ${CMP_DIR:-${CONFIG_DIR0}} -a $lREF clean + ./makenemo -n $lCFG ${CUSTOM_DIR:+-t ${CMP_DIR}} -a $lREF clean elif [ ${lTYP} == 'cfgs' ]; then - ./makenemo -n $lCFG -t ${CMP_DIR:-${CONFIG_DIR0}} -r $lREF clean + ./makenemo -n $lCFG ${CUSTOM_DIR:+-t ${CMP_DIR}} -r $lREF clean else echo 'ERROR in the cleaning process'; exit 42 fi -- GitLab From a64f52e54cacc9bf371b102fba9c030cca6e4020 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Thu, 10 Nov 2022 18:32:50 +0100 Subject: [PATCH 15/31] add the possibility to install a new configuration anywhere using "-t" makenemo option (continuation of #84) --- makenemo | 53 +++++++++++++++++++++------------------- mk/Fadd_keys.sh | 6 ++--- mk/Fdef_keys.sh | 2 +- mk/Fdel_keys.sh | 14 +++++------ mk/Fmake_WORK.sh | 8 +++--- mk/Fmake_bld.sh | 10 ++++---- mk/Fmake_config.sh | 11 +++++---- mk/bldxag.cfg | 2 +- sette/prepare_exe_dir.sh | 14 ++++++----- 9 files changed, 63 insertions(+), 57 deletions(-) diff --git a/makenemo b/makenemo index 8de8150e..d1a48ca3 100755 --- a/makenemo +++ b/makenemo @@ -88,18 +88,12 @@ 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 -x_name='' +#x_name='' ##- 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 @@ -195,7 +189,8 @@ EOF -d|--dirs|--comp) x_d=${2} ; shift ;; -n|--name) - x_name=${2} ; shift ;; + #x_name=${2} ; shift ;; + x_n=${2} ; shift ;; -r|--ref) x_r=${2} ; shift ;; -a|--academic|--test) @@ -229,31 +224,38 @@ EOF shift done -if [ -n "$x_name" ] # is the configuration existing in cfgs or tests? or is it a new conf? +#if [ -n "$x_name" ] # is the configuration existing in cfgs or tests? or is it a new conf? +if [ -n "$x_n" ] # is the configuration existing in cfgs or tests? or is it a new conf? then - incfg=$( find $CFGS_DIR -type d -name $x_name | wc -l ) # this configuration exists in CFGS_DIR - intst=$( find $TESTS_DIR -type d -name $x_name | wc -l ) # this configuration exists in TESTS_DIR + #incfg=$( find $CFGS_DIR -type d -name $x_name | wc -l ) # this configuration exists in CFGS_DIR + #intst=$( find $TESTS_DIR -type d -name $x_name | wc -l ) # this configuration exists in TESTS_DIR + incfg=$( find $CFGS_DIR -type d -name $x_n | wc -l ) # this configuration exists in CFGS_DIR + intst=$( find $TESTS_DIR -type d -name $x_n | wc -l ) # this configuration exists in TESTS_DIR if [ $(( $incfg + $intst )) -eq 2 ] ; then - echo -e "\033[0;31m\nERROR: the $x_name directory is found twice: in $CFGS_DIR and in $TESTS_DIR\033[0m\n" + #echo -e "\033[0;31m\nERROR: the $x_name directory is found twice: in $CFGS_DIR and in $TESTS_DIR\033[0m\n" + echo -e "\033[0;31m\nERROR: the $x_n directory is found twice: in $CFGS_DIR and in $TESTS_DIR\033[0m\n" exit 4 fi if [ $(( $incfg + $intst )) -gt 0 ] ; then if [ $x_c_cfg -eq 1 ] ; then # if we just want to clean the config (do it here as it must exist) - x_n=$x_name # must define x_n as it is used in Fclean_config.sh + #x_n=$x_name # must define x_n as it is used in Fclean_config.sh . ${COMPIL_DIR}/Fclean_config.sh exit 0 fi - [ -n "$x_r" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-r $x_r\"\n" - [ -n "$x_a" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-a $x_a\"\n" + #[ -n "$x_r" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-r $x_r\"\n" + #[ -n "$x_a" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-a $x_a\"\n" + [ -n "$x_r" ] && echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-r $x_r\"\n" + [ -n "$x_a" ] && echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-a $x_a\"\n" fi - if [ $incfg -eq 1 ] ; then - x_r=$x_name ; x_a='' # reference configuration existing -> define/overwrite x_r - elif [ $intst -eq 1 ] ; then - x_a=$x_name ; x_r='' # test configuration existing -> define/overwrite x_a - else + #if [ $incfg -eq 1 ] ; then + #x_r=$x_name ; x_a='' # reference configuration existing -> define/overwrite x_r + #elif [ $intst -eq 1 ] ; then + #x_a=$x_name ; x_r='' # test configuration existing -> define/overwrite x_a + #else + if [[ $incfg -eq 0 && $intst -eq 0 ]]; then [ ${#x_c} -ne 0 ] && echo -e "\nWARNING: Compilation cleaning of a non-existing configuration, we ignore\n" && exit 0 [ $x_c_cfg -eq 1 ] && echo -e "\nWARNING: Configuration cleaning of a non-existing configuration, we ignore\n" && exit 0 - x_n=$x_name # this is a new configuration -> define + #x_n=$x_name # this is a new configuration -> define fi fi @@ -270,7 +272,7 @@ NEMO_DBG=${x_b} ## No ref. cfg or demo selected -if [[ -z "${REF_CONF}" && -z "${DEMO_CONF}" ]]; then +if [[ -z "${REF_CONF}" && -z "${DEMO_CONF}" && $(( $incfg + $intst )) -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 @@ -332,10 +334,11 @@ echo ${NEW_CONF} "${NEM_SUBDIR}" >> ${CONFIG_DIR}/work_cfgs.txt cd ${CONFIG_DIR} ## Create new config even in existing one (mkdir with -p option, cp with -n) -${COMPIL_DIR}/Fmake_config.sh ${NEW_CONF} ${TML_CONF} +${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${TML_CONF} ## create EXP00 if needed -[ ! -d ${CONFIG_DIR}/${NEW_CONF}/EXP00 ] && \cp -R -n ${CONFIG_DIR}/${NEW_CONF}/EXPREF ${CONFIG_DIR}/${NEW_CONF}/EXP00 +[[ ! -d ${NEMO_TDIR}/${NEW_CONF}/EXP00 && -n "${REF_CONF}" ]] && \cp -R -n ${CONFIG_DIR}/${REF_CONF}/EXPREF ${NEMO_TDIR}/${NEW_CONF}/EXP00 +[[ ! -d ${NEMO_TDIR}/${NEW_CONF}/EXP00 && -n "${DEMO_CONF}" ]] && \cp -R -n ${CONFIG_DIR}/${DEMO_CONF}/EXPREF ${NEMO_TDIR}/${NEW_CONF}/EXP00 #- Create the WORK --- #- Clean links and librairies --- @@ -410,7 +413,7 @@ if [ "${NBR_PRC}" -gt 0 ]; then fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD ||{ cd - ; exit 1 ;} if [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ]; then - ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ${CONFIG_DIR}/${NEW_CONF}/EXP00/nemo + ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ${NEMO_TDIR}/${NEW_CONF}/EXP00/nemo fi ## add remove for clean option diff --git a/mk/Fadd_keys.sh b/mk/Fadd_keys.sh index 0aa554c1..e4fc8c78 100755 --- a/mk/Fadd_keys.sh +++ b/mk/Fadd_keys.sh @@ -64,11 +64,11 @@ set -o posix #- echo "Adding keys in : ${NEW_CONF}" for i in ${list_add_key} ; do - if [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "\<$i\>" )" -ne 0 ] ; then + 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}/" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp - mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm + 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 diff --git a/mk/Fdef_keys.sh b/mk/Fdef_keys.sh index f0edd7d8..bf94a481 100755 --- a/mk/Fdef_keys.sh +++ b/mk/Fdef_keys.sh @@ -58,6 +58,6 @@ set -o posix echo "Defining keys in : ${NEW_CONF}" -echo " bld::tool::fppkeys ${list_def_key}" > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm +echo " bld::tool::fppkeys ${list_def_key}" > ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm unset -v list_def_key diff --git a/mk/Fdel_keys.sh b/mk/Fdel_keys.sh index 88aafc23..ff95aa2b 100755 --- a/mk/Fdel_keys.sh +++ b/mk/Fdel_keys.sh @@ -65,14 +65,14 @@ echo "Removing keys in : ${NEW_CONF}" for i in ${list_del_key} ; do if [ "$(echo ${i} | grep -c key_nproc )" -ne 0 ]; then - sed -e "s/key_nproc[ij]=.* //" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \ - > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp - mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm + 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 ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "$i" )" -ne 0 ]; then - sed -e "s/\b${i}\b//" ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm \ - > ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp - mv ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm.tmp ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm + 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}" fi diff --git a/mk/Fmake_WORK.sh b/mk/Fmake_WORK.sh index 372bca57..780fb996 100755 --- a/mk/Fmake_WORK.sh +++ b/mk/Fmake_WORK.sh @@ -64,14 +64,14 @@ set -o posix # #- declare ZSRC=${@} -ZCONF=${NEW_CONF} +ZCONF=${NEMO_TDIR}/${NEW_CONF} ZTAB=${NEM_SUBDIR[@]} declare NDIR=${#ZTAB[@]} -echo 'Creating '${ZCONF}'/WORK = '${ZTAB[*]}' for '${ZCONF} +echo 'Creating '${ZCONF}'/WORK = '${ZTAB[*]}' for '${ZCONF##*/} -[ ! -d ${ZCONF}/MY_SRC ] && \mkdir ${ZCONF}/MY_SRC -[ -d ${ZCONF}/WORK ] || \mkdir ${ZCONF}/WORK +[ ! -d ${ZCONF}/MY_SRC ] && \mkdir -p ${ZCONF}/MY_SRC +[ -d ${ZCONF}/WORK ] || \mkdir -p ${ZCONF}/WORK for comp in ${ZTAB[*]}; do find ${NEMO_DIR}/$comp -name *.[Ffh]90 -exec ln -sf {} ${ZCONF}/WORK \; diff --git a/mk/Fmake_bld.sh b/mk/Fmake_bld.sh index 53d9f7e3..9973af3f 100755 --- a/mk/Fmake_bld.sh +++ b/mk/Fmake_bld.sh @@ -57,8 +57,8 @@ set -o posix # * creation # #- -[ ! -d ${3}/${2} ] && \mkdir ${3}/${2} -[ ! -d ${3}/${2}/BLD ] && \mkdir ${3}/${2}/BLD -[ ! -d ${1}/${2}/BLD ] && ln -sf ${3}/${2}/BLD ${1}/${2}/BLD -[ -f ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ] && ln -sf ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ${COMPIL_DIR}/cpp.fcm -rm -f ${1}/${NEW_CONF}/BLD/fcm.bld.lock +[ ! -d ${3}/${2} ] && \mkdir -p ${3}/${2} +[ ! -d ${3}/${2}/BLD ] && \mkdir -p ${3}/${2}/BLD +#[ ! -d ${1}/${2}/BLD ] && ln -sf ${3}/${2}/BLD ${1}/${2}/BLD +[ -f ${3}/${2}/cpp_${2}.fcm ] && ln -sf ${3}/${2}/cpp_${2}.fcm ${COMPIL_DIR}/cpp.fcm +rm -f ${1}/${2}/BLD/fcm.bld.lock diff --git a/mk/Fmake_config.sh b/mk/Fmake_config.sh index 12babc42..3ad6bb65 100755 --- a/mk/Fmake_config.sh +++ b/mk/Fmake_config.sh @@ -59,8 +59,9 @@ set -o posix \mkdir -p ${1} \mkdir -p ${1}/EXP00 \mkdir -p ${1}/MY_SRC -\cp -R -n ${2}/cpp_${2}.fcm ${1}/cpp_${1}.fcm -\cp -R -n ${2}/EXPREF/*namelist* ${1}/EXP00/. -\cp -R -n ${2}/EXPREF/*.xml ${1}/EXP00/. -[ -f ${2}/EXPREF/AGRIF_FixedGrids.in ] && \cp -R -n ${2}/EXPREF/AGRIF_FixedGrids.in ${1}/EXP00/. -[ -d ${2}/MY_SRC ] && \cp -n ${2}/MY_SRC/* ${1}/MY_SRC/. 2> /dev/null +\cp -R -n ${2}/cpp_${2}.fcm ${1}/cpp_${1##*/}.fcm +for f in ${2}/EXPREF/*.xml ${2}/EXPREF/*namelist*; do + if [ -L ${f} ]; then ln -sf $(readlink -f ${f}) ${1}/EXP00/$(basename ${f}); else cp -R -n ${f} ${1}/EXP00/.; fi +done +[ -f ${2}/EXPREF/AGRIF_FixedGrids.in ] && \cp -a -n ${2}/EXPREF/AGRIF_FixedGrids.in ${1}/EXP00/. +[ -d ${2}/MY_SRC ] && \cp -an ${2}/MY_SRC/* ${1}/MY_SRC/. 2> /dev/null diff --git a/mk/bldxag.cfg b/mk/bldxag.cfg index 19ea8475..5b4db893 100644 --- a/mk/bldxag.cfg +++ b/mk/bldxag.cfg @@ -13,7 +13,7 @@ inc $COMPIL_DIR/cpp.fcm search_src 1 src::ioipsl $MAIN_DIR/ext/IOIPSL/src -src::nemo $CONFIG_DIR/$NEW_CONF/WORK +src::nemo $NEMO_TDIR/$NEW_CONF/WORK src::ppr_1d $MAIN_DIR/ext/PPR/src bld::target nemo.exe diff --git a/sette/prepare_exe_dir.sh b/sette/prepare_exe_dir.sh index b446a7e3..d43feec5 100755 --- a/sette/prepare_exe_dir.sh +++ b/sette/prepare_exe_dir.sh @@ -67,23 +67,25 @@ set -o posix # PREPARE EXEC_DIR #================== if [ -z "${CUSTOM_DIR}" ]; then - export EXE_DIR=${CONFIG_DIR}/${NEW_CONF}/${TEST_NAME} + 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}/${TEST_NAME} else - export EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}/${NEW_CONF}/${TEST_NAME} + EXE_DIR=${CUSTOM_DIR}/${SETTE_SUB_VAL}_${NEMO_REV}/${NEW_CONF} fi fi -mkdir -p ${EXE_DIR} +mkdir -p ${EXE_DIR}/${TEST_NAME} -cp -RL ${CONFIG_DIR}/${NEW_CONF}/EXP00/* ${EXE_DIR}/. -#cat ${SETTE_DIR}/iodef_sette.xml | sed -e"s;DEF_SHARED;${CONFIG_DIR0}/SHARED;" > ${EXE_DIR}/iodef.xml +#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 *//'`" + +export EXE_DIR=${EXE_DIR}/${TEST_NAME} cd ${EXE_DIR} # # Add summary of the sette.sh set-up used and the current list of keys added or deleted -COMP_KEYS="`cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | sed -e 's/.*fppkeys *//'`" echo "Summary of sette environment" > ./sette_config echo "----------------------------" >> ./sette_config echo "requested by the command : "$cmd $cmdargs >> ./sette_config -- GitLab From 297615941d68cd9c643cd8142b6169b469c9dad2 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Sun, 13 Nov 2022 19:56:06 +0100 Subject: [PATCH 16/31] adapt sette to work with any path (custom or not) --- sette/all_functions.sh | 20 +++++--------- sette/prepare_job.sh | 4 +-- sette/sette_reference-configurations.sh | 36 ++++++++++++------------- sette/sette_test-cases.sh | 30 +++++++++------------ 4 files changed, 38 insertions(+), 52 deletions(-) diff --git a/sette/all_functions.sh b/sette/all_functions.sh index 6c99ef46..f5befee2 100755 --- a/sette/all_functions.sh +++ b/sette/all_functions.sh @@ -94,8 +94,8 @@ usage=" if value is a string ths is neede syntax : ./set_namelist namelist_name sync_config() { if [ ${SYNC_CONFIGS} == "yes" ]; then - lREF=$3/$1 # reference - lCFG=$3/$2 # target + lREF=$1 # reference + lCFG=$2 # target echo '-------------------------------------------------------------------------------' echo ' SOURCE AND CONFIG FILES SYNCHRONISATION ' @@ -146,24 +146,16 @@ sync_config() { # clean _STg config (input CFG CFG_STg TYPE (test or ref)) clean_config() { if [ ${CLEAN_CONFIGS} == "yes" ]; then - lREF=$1 - lCFG=$2 - lTYP=$3 + lCFG=$1 echo '' echo '-------------------------------------------------------------------------------' echo ' CLEANING CONFIGURATION ' echo '' - echo "./makenemo -n $lCFG -a/-r $lREF ${CUSTOM_DIR:+-t ${CMP_DIR}} clean" + echo "./makenemo -n $(basename $lCFG) ${CUSTOM_DIR:+-t ${CMP_DIR}} clean" echo '' - if [ ${lTYP} == 'tests' ]; then - ./makenemo -n $lCFG ${CUSTOM_DIR:+-t ${CMP_DIR}} -a $lREF clean - elif [ ${lTYP} == 'cfgs' ]; then - ./makenemo -n $lCFG ${CUSTOM_DIR:+-t ${CMP_DIR}} -r $lREF clean - else - echo 'ERROR in the cleaning process'; exit 42 - fi + ./makenemo -n $(basename $lCFG) ${CUSTOM_DIR:+-t ${CMP_DIR}} clean echo '' - echo "$lCFG configuration has been cleaned" + echo "$(basename $lCFG) configuration has been cleaned" echo '' echo '-------------------------------------------------------------------------------' fi diff --git a/sette/prepare_job.sh b/sette/prepare_job.sh index 335daedb..80d3fa1e 100755 --- a/sette/prepare_job.sh +++ b/sette/prepare_job.sh @@ -104,7 +104,7 @@ echo "" >> ${SETTE_DIR}/output.sette echo "running config: ${NEW_CONF}" >> ${SETTE_DIR}/output.sette echo "" >> ${SETTE_DIR}/output.sette echo "list of cpp_keys: " >> ${SETTE_DIR}/output.sette -echo "`more ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm`" >> ${SETTE_DIR}/output.sette +echo "`more ${NEMO_TDIR}/${NEW_CONF}/cpp_${NEW_CONF}.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,7 +269,7 @@ 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:${CONFIG_DIR}:" \ + -e"s:DEF_CONFIG_DIR:${NEMO_TDIR}:" \ -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}:" \ diff --git a/sette/sette_reference-configurations.sh b/sette/sette_reference-configurations.sh index 49bcbaca..6fdae259 100755 --- a/sette/sette_reference-configurations.sh +++ b/sette/sette_reference-configurations.sh @@ -155,8 +155,8 @@ if [ ${config} == "GYRE_PISCES" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config GYRE_PISCES ${SETTE_CONFIG} 'cfgs' - clean_config GYRE_PISCES ${SETTE_CONFIG} 'cfgs' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + 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}" @@ -302,8 +302,8 @@ if [ ${config} == "ORCA2_ICE_PISCES" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' - clean_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' + 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}" fi @@ -589,8 +589,8 @@ if [ ${config} == "ORCA2_OFF_PISCES" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config ${SETTE_CONFIG} ORCA2_OFF_PISCES_ST 'cfgs' - clean_config ${SETTE_CONFIG} ORCA2_OFF_PISCES_ST 'cfgs' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + 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}" @@ -766,8 +766,8 @@ if [ ${config} == "AMM12" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config AMM12 ${SETTE_CONFIG} 'cfgs' - clean_config AMM12 ${SETTE_CONFIG} 'cfgs' + 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}" fi @@ -900,8 +900,8 @@ if [ ${config} == "SAS" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config ORCA2_SAS_ICE ${SETTE_CONFIG} 'cfgs' - clean_config ORCA2_SAS_ICE ${SETTE_CONFIG} 'cfgs' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + 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}" @@ -1048,8 +1048,8 @@ if [ ${config} == "ORCA2_ICE_OBS" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' - clean_config ORCA2_ICE_PISCES ${SETTE_CONFIG} 'cfgs' + 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}" fi @@ -1172,8 +1172,8 @@ if [ ${config} == "AGRIF" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config AGRIF_DEMO ${SETTE_CONFIG} 'cfgs' - clean_config AGRIF_DEMO ${SETTE_CONFIG} 'cfgs' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # # AGRIF_DEMO does not yet support nn_hls=2 => key_loop_fusion can not be used # . ./makenemo -m ${CMP_NAM} -n ${SETTE_CONFIG} -r AGRIF_DEMO -j ${CMPL_CORES} add_key "${ADD_KEYS/key_loop_fusion}" del_key "${DEL_KEYS}" @@ -1489,8 +1489,8 @@ if [ ${config} == "AGRIF" ] && [ ${DO_CORRUPT} == "1" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config AGRIF_DEMO ${SETTE_CONFIG} 'cfgs' - clean_config AGRIF_DEMO ${SETTE_CONFIG} 'cfgs' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + sync_config ${CONFIG_DIR0}/${config} ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} # # AGRIF_DEMO does not yet support nn_hls=2 => key_loop_fusion can not be used . ./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/key_loop_fusion}" del_key "key_agrif ${DEL_KEYS}" @@ -1537,8 +1537,8 @@ if [ ${config} == "WED025" ] ; then cd ${MAIN_DIR} # # syncronisation if target directory/file exist (not done by makenemo) - sync_config WED025 ${SETTE_CONFIG} 'cfgs' - clean_config WED025 ${SETTE_CONFIG} 'cfgs' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + 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}" diff --git a/sette/sette_test-cases.sh b/sette/sette_test-cases.sh index 3a77b2e6..eb7b5d44 100755 --- a/sette/sette_test-cases.sh +++ b/sette/sette_test-cases.sh @@ -155,9 +155,8 @@ if [ ${config} == "OVERFLOW" ] ; then cd ${MAIN_DIR} # # - clean_config OVERFLOW ${SETTE_CONFIG} 'tests' - # - sync_config OVERFLOW ${SETTE_CONFIG} 'tests' + 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}" fi @@ -272,9 +271,8 @@ if [ ${config} == "LOCK_EXCHANGE" ] ; then # # syncronisation if target directory/file exist (not done by makenemo) # - clean_config LOCK_EXCHANGE ${SETTE_CONFIG} 'tests' - # - sync_config LOCK_EXCHANGE ${SETTE_CONFIG} 'tests' + 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}" fi @@ -391,9 +389,8 @@ if [ ${config} == "VORTEX" ] ; then # # syncronisation if target directory/file exist (not done by makenemo) # - clean_config VORTEX ${SETTE_CONFIG} 'tests' - # - sync_config VORTEX ${SETTE_CONFIG} 'tests' + 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}" fi @@ -585,9 +582,8 @@ if [ ${config} == "ICE_AGRIF" ] ; then # # syncronisation if target directory/file exist (not done by makenemo) # - clean_config ICE_AGRIF ${SETTE_CONFIG} 'tests' - # - sync_config ICE_AGRIF ${SETTE_CONFIG} 'tests' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + 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}" @@ -783,9 +779,8 @@ if [ ${config} == "ISOMIP+" ] ; then # # syncronisation if target directory/file exist (not done by makenemo) # - clean_config ISOMIP+ ${SETTE_CONFIG} 'tests' - # - sync_config ISOMIP+ ${SETTE_CONFIG} 'tests' + clean_config ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG} + 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}" @@ -928,9 +923,8 @@ if [ ${config} == "SWG" ] && [ ${USING_QCO} == "yes" ] ; then # # syncronisation if target directory/file exist (not done by makenemo) # - clean_config SWG ${SETTE_CONFIG} 'tests' - # - sync_config SWG ${SETTE_CONFIG} 'tests' + 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}" fi -- GitLab From 9572960ff30122734b748b18bbc9c4edfef9e52e Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Sun, 13 Nov 2022 19:57:44 +0100 Subject: [PATCH 17/31] adapt mk scripts and fcm cfg files to compile nemo completely outside nemo directory --- mk/Fcheck_archfile.sh | 99 ++++++++++++++++++++++--------------------- mk/Fmake_bld.sh | 2 +- mk/Fmake_config.sh | 2 +- mk/bldxag.cfg | 4 +- mk/bldxagxcdf.cfg | 4 +- mk/bldxcdf.cfg | 4 +- mk/conv.cfg | 2 +- 7 files changed, 59 insertions(+), 58 deletions(-) diff --git a/mk/Fcheck_archfile.sh b/mk/Fcheck_archfile.sh index b6145132..f7aad910 100755 --- a/mk/Fcheck_archfile.sh +++ b/mk/Fcheck_archfile.sh @@ -73,19 +73,20 @@ EOF eval "echo \"$line\" >> $2" done < $1 } + # cleaning related to the old version -rm -f $( find ${COMPIL_DIR} -type f -name $1 -print ) +rm -f $( find $(dirname $1) -type f -name $(basename $1) -print ) # if [ ${#3} -eq 0 ]; then # arch not specified - if [ ! -f ${COMPIL_DIR}/arch.history ]; then + if [ ! -f $(dirname $1)/arch.history ]; then echo "Warning !!!" echo "NO compiler chosen" echo "Try makenemo -h for help" echo "EXITING..." exit 1 else # use the arch file defined in arch.history - myarch=$( cat ${COMPIL_DIR}/arch.history ) + myarch=$( cat $(dirname $1)/arch.history ) if [ ! -f $myarch ]; then echo "Warning !!!" echo "previously used arch file no more found:" @@ -93,26 +94,26 @@ if [ ${#3} -eq 0 ]; then # arch not specified echo "EXITING..." exit 1 else - if [ -f ${COMPIL_DIR}/$1 ]; then - if [ "$2" != "nocpp" ] + if [ -f $1 ]; then + if [[ ! "$2" =~ "nocpp" ]] then # has the cpp keys file been changed since we copied the arch file in ${COMPIL_DIR}? - mycpp=$( ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" ) - if [ "$mycpp" != "$( cat ${COMPIL_DIR}/cpp.history )" ]; then - echo $mycpp > ${COMPIL_DIR}/cpp.history - cpeval ${myarch} ${COMPIL_DIR}/$1 + mycpp=$( ls -l $2 | sed -e "s/.* -> //" ) + if [ "$mycpp" != "$( cat $(dirname $2)/cpp.history )" ]; then + echo $mycpp > $(dirname $2)/cpp.history + cpeval ${myarch} $1 fi # has the cpp keys file been updated since we copied the arch file in ${COMPIL_DIR}? - mycpp=$( find -L ${COMPIL_DIR} -cnewer ${COMPIL_DIR}/$1 -name $2 -print ) - [ ${#mycpp} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 + mycpp=$( find -L $(dirname $2) -cnewer $(basename $1) -name $(basename $2) -print ) + [ ${#mycpp} -ne 0 ] && cpeval ${myarch} $1 fi # has myarch file been updated since we copied it in ${COMPIL_DIR}? myarchdir=$( dirname ${myarch} ) myarchname=$( basename ${myarch} ) - myarch=$( find -L $myarchdir -cnewer ${COMPIL_DIR}/$1 -name $myarchname -print ) - [ ${#myarch} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 + myarch=$( find -L $myarchdir -cnewer $(basename $1) -name $myarchname -print ) + [ ${#myarch} -ne 0 ] && cpeval ${myarch} $1 else - cpeval ${myarch} ${COMPIL_DIR}/$1 + cpeval ${myarch} $1 fi fi fi @@ -135,68 +136,68 @@ else fi myarch=$( find ${MAIN_DIR}/arch -name arch-${3}.fcm -print ) # we were already using this arch file ? - if [ "$myarch" == "$( cat ${COMPIL_DIR}/arch.history )" ]; then - if [ -f ${COMPIL_DIR}/$1 ]; then - if [ "$2" != "nocpp" ] + if [ "$myarch" == "$( cat $(dirname $1)/arch.history 2>/dev/null)" ]; then + if [ -f $1 ]; then + if [[ ! "$2" =~ "nocpp" ]] then # has the cpp keys file been changed since we copied the arch file in ${COMPIL_DIR}? - mycpp=$( ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" ) - if [ "$mycpp" != "$( cat ${COMPIL_DIR}/cpp.history )" ]; then - echo $mycpp > ${COMPIL_DIR}/cpp.history - cpeval ${myarch} ${COMPIL_DIR}/$1 + mycpp=$( ls -l $2 | sed -e "s/.* -> //" ) + if [ "$mycpp" != "$( cat $(dirname $2)/cpp.history )" ]; then + echo $mycpp > $(dirname $2)/cpp.history + cpeval ${myarch} $1 fi # has the cpp keys file been updated since we copied the arch file in ${COMPIL_DIR}? - mycpp=$( find -L ${COMPIL_DIR} -cnewer ${COMPIL_DIR}/$1 -name $2 -print ) - [ ${#mycpp} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 + mycpp=$( find -L $(dirname $2) -cnewer $(basename $1) -name $(basename $2) -print ) + [ ${#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 ${COMPIL_DIR}/$1 -name arch-${3}.fcm -print ) - [ ${#myarch} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 + myarch=$( find -L ${MAIN_DIR}/arch -cnewer $(basename $1) -name arch-${3}.fcm -print ) + [ ${#myarch} -ne 0 ] && cpeval ${myarch} $1 else - cpeval ${myarch} ${COMPIL_DIR}/$1 + cpeval ${myarch} $1 fi else - if [ "$2" != "nocpp" ] + if [[ ! "$2" =~ "nocpp" ]] then - ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" > ${COMPIL_DIR}/cpp.history + ls -l $2 | sed -e "s/.* -> //" > $(dirname $2)/cpp.history fi - echo ${myarch} > ${COMPIL_DIR}/arch.history - cpeval ${myarch} ${COMPIL_DIR}/$1 + echo ${myarch} > $(dirname $1)/arch.history + cpeval ${myarch} $1 fi fi #- do we need xios library? #- 2 cases: #- in CONFIG directory looking for key_xios or key_iomput -if [ "$1" == "arch_nemo.fcm" ] +if [ "$(basename $1)" == "arch_nemo.fcm" ] then - if [ "$2" != "nocpp" ] + if [[ ! "$2" =~ "nocpp" ]] then - use_iom=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$2 | grep -c "key_xios\|key_iomput" ) + use_iom=$( sed -e "s/#.*$//" $2 | grep -c "key_xios\|key_iomput" ) else use_iom=0 fi - have_lxios=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-lxios" ) + have_lxios=$( sed -e "s/#.*$//" $1 | grep -c "\-lxios" ) if [[ ( $use_iom -eq 0 ) && ( $have_lxios -ge 1 ) ]] then - sed -e "s/-lxios//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$ - mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1 + sed -e "s/-lxios//g" $1 > $(dirname $1)/tmp$$ + mv -f $(dirname $1)/tmp$$ $1 fi #- in TOOLS directory looking for USE xios else - use_iom=$( egrep --exclude-dir=.svn -r USE ${NEW_CONF}/src/* | grep -c xios ) - have_lxios=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-lxios" ) + use_iom=$( egrep --exclude-dir=.svn -r USE ${MAIN_DIR}/src/* | grep -c xios ) + have_lxios=$( sed -e "s/#.*$//" $1 | grep -c "\-lxios" ) if [[ ( $use_iom -eq 0 ) || ( $have_lxios != 1 ) ]] then - sed -e "s/-lxios//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$ - mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1 + sed -e "s/-lxios//g" $1 > $(dirname $1)/tmp$$ + mv -f $(dirname $1)/tmp$$ $1 fi fi #- do we need oasis libraries? -if [ "$2" != "nocpp" ] +if [[ ! "$2" =~ "nocpp" ]] then - use_oasis=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$2 | grep -c key_oasis3 ) + use_oasis=$( sed -e "s/#.*$//" $2 | grep -c key_oasis3 ) else use_oasis=0 fi @@ -206,26 +207,26 @@ if [[ ! -z "$XIOS_OASIS" ]]; then fi for liboa in psmile.MPI1 mct mpeu scrip mpp_io do - have_liboa=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-l${liboa}" ) + have_liboa=$( sed -e "s/#.*$//" $1 | grep -c "\-l${liboa}" ) if [[ ( $use_oasis -eq 0 ) && ( $have_liboa -ge 1 ) ]] then - sed -e "s/-l${liboa}//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$ - mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1 + sed -e "s/-l${liboa}//g" $1 > $(dirname $1)/tmp$$ + mv -f $(dirname $1)/tmp$$ $1 fi done # Nemo debug ? if [ -n "${NEMO_DBG}" ]; then - if (! grep -q "^%DEBUG_FCFLAGS" ${COMPIL_DIR}/$1 ); 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 fi # duplicate the lines starting with %DEBUG_XXX and replace, in the duplicated line, %DEBUG_XXX by %XXX - sed -i "/^%DEBUG_/{p;s/^%DEBUG_\([^ ]*\)/%\1/;}" ${COMPIL_DIR}/$1 + sed -i "/^%DEBUG_/{p;s/^%DEBUG_\([^ ]*\)/%\1/;}" $1 else - if (! grep -q "^%PROD_FCFLAGS" ${COMPIL_DIR}/$1 ); then + if (! grep -q "^%PROD_FCFLAGS" $1 ); then echo "WARNING: '%PROD_FCFLAGS' not defined in your arch file, makenemo will use '%FCFLAGS' instead" fi # duplicate the lines starting with %PROD_XXX and replace, in the duplicated line, %PROD_XXX by %XXX - sed -i "/^%PROD_/{p;s/^%PROD_\([^ ]*\)/%\1/;}" ${COMPIL_DIR}/$1 + sed -i "/^%PROD_/{p;s/^%PROD_\([^ ]*\)/%\1/;}" $1 fi diff --git a/mk/Fmake_bld.sh b/mk/Fmake_bld.sh index 9973af3f..ebb2e48c 100755 --- a/mk/Fmake_bld.sh +++ b/mk/Fmake_bld.sh @@ -60,5 +60,5 @@ set -o posix [ ! -d ${3}/${2} ] && \mkdir -p ${3}/${2} [ ! -d ${3}/${2}/BLD ] && \mkdir -p ${3}/${2}/BLD #[ ! -d ${1}/${2}/BLD ] && ln -sf ${3}/${2}/BLD ${1}/${2}/BLD -[ -f ${3}/${2}/cpp_${2}.fcm ] && ln -sf ${3}/${2}/cpp_${2}.fcm ${COMPIL_DIR}/cpp.fcm +[ -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_config.sh b/mk/Fmake_config.sh index 3ad6bb65..79673f0e 100755 --- a/mk/Fmake_config.sh +++ b/mk/Fmake_config.sh @@ -59,7 +59,7 @@ set -o posix \mkdir -p ${1} \mkdir -p ${1}/EXP00 \mkdir -p ${1}/MY_SRC -\cp -R -n ${2}/cpp_${2}.fcm ${1}/cpp_${1##*/}.fcm +\cp -R -n ${2}/cpp_${2##*/}.fcm ${1}/cpp_${1##*/}.fcm for f in ${2}/EXPREF/*.xml ${2}/EXPREF/*namelist*; do if [ -L ${f} ]; then ln -sf $(readlink -f ${f}) ${1}/EXP00/$(basename ${f}); else cp -R -n ${f} ${1}/EXP00/.; fi done diff --git a/mk/bldxag.cfg b/mk/bldxag.cfg index 5b4db893..78a775d5 100644 --- a/mk/bldxag.cfg +++ b/mk/bldxag.cfg @@ -7,8 +7,8 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_nemo.fcm -inc $COMPIL_DIR/cpp.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm search_src 1 diff --git a/mk/bldxagxcdf.cfg b/mk/bldxagxcdf.cfg index d562b61b..28361348 100644 --- a/mk/bldxagxcdf.cfg +++ b/mk/bldxagxcdf.cfg @@ -7,8 +7,8 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_nemo.fcm -inc $COMPIL_DIR/cpp.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm search_src 1 diff --git a/mk/bldxcdf.cfg b/mk/bldxcdf.cfg index 0d752da9..5a175b45 100644 --- a/mk/bldxcdf.cfg +++ b/mk/bldxcdf.cfg @@ -7,8 +7,8 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_nemo.fcm -inc $COMPIL_DIR/cpp.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm search_src 1 diff --git a/mk/conv.cfg b/mk/conv.cfg index 759e5f26..f8757962 100644 --- a/mk/conv.cfg +++ b/mk/conv.cfg @@ -7,7 +7,7 @@ cfg::version 1.0 # ------------------------------------------------------------------------------ # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/$MYARCH +inc $NEMO_TDIR/$NEW_CONF/BLD/$MYARCH bld::tool::cc %CC bld::tool::cflags %CFLAGS -- GitLab From 5f40b08016c3b01a0b3bd31bad1eba7e5854d807 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Sun, 13 Nov 2022 20:36:43 +0100 Subject: [PATCH 18/31] adapt makenemo to compile nemo in any directory + improve "clean" option --- makenemo | 169 ++++++++++++++++++++++++------------------------------- 1 file changed, 72 insertions(+), 97 deletions(-) diff --git a/makenemo b/makenemo index d1a48ca3..dd884a5b 100755 --- a/makenemo +++ b/makenemo @@ -88,7 +88,6 @@ 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 -#x_name='' ##- Local variables --- b_n=$(basename ${0}) @@ -189,7 +188,6 @@ EOF -d|--dirs|--comp) x_d=${2} ; shift ;; -n|--name) - #x_name=${2} ; shift ;; x_n=${2} ; shift ;; -r|--ref) x_r=${2} ; shift ;; @@ -224,41 +222,6 @@ EOF shift done -#if [ -n "$x_name" ] # is the configuration existing in cfgs or tests? or is it a new conf? -if [ -n "$x_n" ] # is the configuration existing in cfgs or tests? or is it a new conf? -then - #incfg=$( find $CFGS_DIR -type d -name $x_name | wc -l ) # this configuration exists in CFGS_DIR - #intst=$( find $TESTS_DIR -type d -name $x_name | wc -l ) # this configuration exists in TESTS_DIR - incfg=$( find $CFGS_DIR -type d -name $x_n | wc -l ) # this configuration exists in CFGS_DIR - intst=$( find $TESTS_DIR -type d -name $x_n | wc -l ) # this configuration exists in TESTS_DIR - if [ $(( $incfg + $intst )) -eq 2 ] ; then - #echo -e "\033[0;31m\nERROR: the $x_name directory is found twice: in $CFGS_DIR and in $TESTS_DIR\033[0m\n" - echo -e "\033[0;31m\nERROR: the $x_n directory is found twice: in $CFGS_DIR and in $TESTS_DIR\033[0m\n" - exit 4 - fi - if [ $(( $incfg + $intst )) -gt 0 ] ; then - if [ $x_c_cfg -eq 1 ] ; then # if we just want to clean the config (do it here as it must exist) - #x_n=$x_name # must define x_n as it is used in Fclean_config.sh - . ${COMPIL_DIR}/Fclean_config.sh - exit 0 - fi - #[ -n "$x_r" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-r $x_r\"\n" - #[ -n "$x_a" ] && echo -e "\nWARNING: $x_name configuration is already existing, we ignore \"-a $x_a\"\n" - [ -n "$x_r" ] && echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-r $x_r\"\n" - [ -n "$x_a" ] && echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-a $x_a\"\n" - fi - #if [ $incfg -eq 1 ] ; then - #x_r=$x_name ; x_a='' # reference configuration existing -> define/overwrite x_r - #elif [ $intst -eq 1 ] ; then - #x_a=$x_name ; x_r='' # test configuration existing -> define/overwrite x_a - #else - if [[ $incfg -eq 0 && $intst -eq 0 ]]; then - [ ${#x_c} -ne 0 ] && echo -e "\nWARNING: Compilation cleaning of a non-existing configuration, we ignore\n" && exit 0 - [ $x_c_cfg -eq 1 ] && echo -e "\nWARNING: Configuration cleaning of a non-existing configuration, we ignore\n" && exit 0 - #x_n=$x_name # this is a new configuration -> define - fi -fi - export NEW_CONF=${x_n} NBR_PRC=${x_j} CMP_NAM=${x_m} @@ -270,21 +233,10 @@ NEMO_DBG=${x_b} [ "${CMP_NAM}" == 'all' ] && . ${COMPIL_DIR}/Flist_archfile.sh all && exit - -## No ref. cfg or demo selected -if [[ -z "${REF_CONF}" && -z "${DEMO_CONF}" && $(( $incfg + $intst )) -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 -fi -## At least one config has been requested - ## 'all' arg: list all available configurations if [[ "${REF_CONF}" == 'all' || "${DEMO_CONF}" == 'all' ]]; then ${COMPIL_DIR}/Flist_cfgs.sh exit 2 - ## Probably useless but who knows? 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" @@ -294,29 +246,62 @@ elif [ -n "${REF_CONF}" ]; then conf_file=ref_cfgs.txt ; export CONFIG_DIR=${CFGS_DIR} ; TML_CONF=${REF_CONF} elif [ -n "${DEMO_CONF}" ]; then conf_file=demo_cfgs.txt; export CONFIG_DIR=${TESTS_DIR}; TML_CONF=${DEMO_CONF} -fi - -## Reuse a working cfg -grep -q "${TML_CONF} " ${CONFIG_DIR}/work_cfgs.txt 2>/dev/null && conf_file=work_cfgs.txt - -## Test if ref. cfg or demo case does exist -if (! grep -q "${TML_CONF} " ${CONFIG_DIR}/$conf_file ); then +elif grep -q "${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt; 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} +elif ! grep -q "${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt; then echo -e "\033[0;31m\nThe reference configuration ('-r') or " echo -e "demonstration case ('-a') selected is not available!!!" echo -e "Check the option used and the available items in .txt files\033[0m" ${COMPIL_DIR}/Flist_cfgs.sh exit 2 fi +if [ -z "${NEW_CONF}" ]; then NEW_CONF=$TML_CONF; fi +export NEMO_TDIR=${x_t:-$CONFIG_DIR} -## If new cfg exists, work in it -if [ -n "${NEW_CONF}" ] -then - echo - printf "\nYou are installing a new configuration %s from %s " ${NEW_CONF} ${TML_CONF} - printf "with sub-components: %s\n" "${NEM_SUBDIR}" - echo -else - NEW_CONF=${TML_CONF} + +# check configuration existence & clean it if asked +if [ -n "$x_n" ]; then + incfg=$( find $NEMO_TDIR -type d -name $x_n | wc -l ) # this configuration exists in CFGS_DIR + if [ $incfg -eq 1 ] ; then + # CLEANING + if [ $x_c_cfg -eq 1 ] ; then + . ${COMPIL_DIR}/Fclean_config.sh + exit 0 + elif [ ${#x_c} -ne 0 ]; 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/} + # 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' + for dir in AGRIFLIB BLD LONG NEMOFILES REPRO_* SHORT WORK; do + rm -rf ${NEMO_TDIR}/${NEW_CONF}/$dir + done + for file in cpp.history cpp.fcm full_key_list.txt; do + rm -f ${NEMO_TDIR}/${NEW_CONF}/BLD/$file + done + exit 0 + fi + if [ -n "$REF_CONF" ]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-r $REF_CONF\"\n"; REF_CONF=""; fi + if [ -n "$DEMO_CONF" ]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-a $DEMO_CONF\"\n"; DEMO_CONF=""; fi + fi + if [ $incfg -eq 0 ]; then + [ $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 +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 fi ## Update sub-comps if needed @@ -324,17 +309,22 @@ if [ -z "${NEM_SUBDIR}" ]; then NEM_SUBDIR=$( grep "${TML_CONF} " ${CONFIG_DIR}/${conf_file} | awk '{$1 = ""; print $0}' ) fi -export NEMO_TDIR=${x_t:-$CONFIG_DIR} export NEM_SUBDIR="${NEM_SUBDIR}" NEW_CONF="${NEW_CONF}" +## If new cfg exists, work in it +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 + ## 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 -cd ${CONFIG_DIR} - ## Create new config even in existing one (mkdir with -p option, cp with -n) -${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${TML_CONF} +${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${CONFIG_DIR}/${TML_CONF} ## create EXP00 if needed [[ ! -d ${NEMO_TDIR}/${NEW_CONF}/EXP00 && -n "${REF_CONF}" ]] && \cp -R -n ${CONFIG_DIR}/${REF_CONF}/EXPREF ${NEMO_TDIR}/${NEW_CONF}/EXP00 @@ -349,12 +339,12 @@ ${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${TML_CONF} # 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_" ${NEW_CONF}/WORK/* ); do + for i in $( grep "^ *#.* key_" ${NEMO_TDIR}/${NEW_CONF}/WORK/* ); do echo $i | grep key_ | sed -e "s/=.*//" done \ - | sort -d | uniq > ${COMPIL_DIR}/full_key_list.txt + | sort -d | uniq > ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt - [ ${list_key} -eq 1 ] && echo && cat ${COMPIL_DIR}/full_key_list.txt && exit 0 + [ ${list_key} -eq 1 ] && echo && cat ${NEMO_TDIR}/${NEW_CONF}/BLD/full_key_list.txt && exit 0 fi #- At this stage new configuration has been added, we add or remove keys @@ -364,12 +354,12 @@ fi #- check that all keys are really existing... if [ $chk_key -eq 1 ] ; then - for kk in $( cat ${NEW_CONF}/cpp_${NEW_CONF}.fcm ); do + 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 ${COMPIL_DIR}/full_key_list.txt ) ]; then + 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 ${NEW_CONF}/WORK routines..." + echo "E R R O R : key "$kk" is not found in ${NEMO_TDIR}/${NEW_CONF}/WORK routines..." echo "we stop..." echo exit 1 @@ -380,14 +370,9 @@ 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 arch_nemo.fcm cpp.fcm ${CMP_NAM} || exit 3 - -#- At this stage the configuration has beeen chosen -#- We coose the default light file -[ $x_nocdf -eq 1 ] && export USEBLD=bldxagxcdf.cfg || export USEBLD=bldxag.cfg +. ${COMPIL_DIR}/Fcheck_archfile.sh ${NEMO_TDIR}/${NEW_CONF}/BLD/arch_nemo.fcm ${NEMO_TDIR}/${NEW_CONF}/BLD/cpp.fcm ${CMP_NAM} || exit 3 #- We look after agrif -grep key_agrif ${COMPIL_DIR}/cpp.fcm && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/} . ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} arch_nemo.fcm || exit 3 #- @@ -398,40 +383,30 @@ grep key_agrif ${COMPIL_DIR}/cpp.fcm && export AGRIFUSE=1 && export USEBLD=${USE #- Compile --- if [ "${NBR_PRC}" -gt 0 ]; then - cd ${NEMO_TDIR}/${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.cfg ||{ cd - ; exit 1 ;} + fcm build --ignore-lock -j 1 ${COMPIL_DIR}/bld_preproagr.cfg || exit 1 echo '' echo "---------------------------------" echo "CONV preprocessing successfull !!" echo "---------------------------------" echo '' fi + + # 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/} - fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD ||{ cd - ; exit 1 ;} + fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$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 fi - ## add remove for clean option - if [ ${#x_c} -ne 0 ]; then - echo -e '\nCleaning '${NEW_CONF}' building directories and variables\n' - for dir in AGRIFLIB BLD LONG NEMOFILES REPRO_* SHORT WORK; do - rm -rf ${NEMO_TDIR}/${NEW_CONF}/$dir - done - for file in cpp.history cpp.fcm full_key_list.txt; do - rm -f ${COMPIL_DIR}/$file - done - fi fi -#- Come back to original directory --- -cd - - -#- #- Unset variables ${COMPIL_DIR}/Fclean_var.sh -- GitLab From dca802ef6fe72cb5cff99e8bb87394cbabca5152 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Mon, 14 Nov 2022 12:20:08 +0100 Subject: [PATCH 19/31] agrif compilation bugfix --- makenemo | 18 ++++++++---------- mk/bld.cfg | 4 ++-- mk/bld_preproagr.cfg | 6 +++--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/makenemo b/makenemo index dd884a5b..cdddf458 100755 --- a/makenemo +++ b/makenemo @@ -263,7 +263,7 @@ export NEMO_TDIR=${x_t:-$CONFIG_DIR} # check configuration existence & clean it if asked if [ -n "$x_n" ]; then - incfg=$( find $NEMO_TDIR -type d -name $x_n | wc -l ) # this configuration exists in CFGS_DIR + incfg=$( find $NEMO_TDIR -type d -name $x_n 2>/dev/null | wc -l ) # this configuration exists in CFGS_DIR if [ $incfg -eq 1 ] ; then # CLEANING if [ $x_c_cfg -eq 1 ] ; then @@ -371,10 +371,6 @@ 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 - -#- We look after agrif -. ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} arch_nemo.fcm || exit 3 - #- #_ END OF CONFIGURATION PHASE #_ @@ -384,6 +380,13 @@ fi if [ "${NBR_PRC}" -gt 0 ]; 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}/${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 @@ -394,11 +397,6 @@ if [ "${NBR_PRC}" -gt 0 ]; then echo '' fi - # 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/} - fcm build ${x_c} --ignore-lock -v ${x_v} -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || exit 1 if [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ]; then diff --git a/mk/bld.cfg b/mk/bld.cfg index 67352be6..ebc688aa 100644 --- a/mk/bld.cfg +++ b/mk/bld.cfg @@ -7,8 +7,8 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_nemo.fcm -inc $COMPIL_DIR/cpp.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm search_src 1 diff --git a/mk/bld_preproagr.cfg b/mk/bld_preproagr.cfg index e901d829..3f015aa1 100644 --- a/mk/bld_preproagr.cfg +++ b/mk/bld_preproagr.cfg @@ -7,11 +7,11 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_nemo.fcm -inc $COMPIL_DIR/cpp.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/arch_nemo.fcm +inc $NEMO_TDIR/$NEW_CONF/BLD/cpp.fcm search_src 1 -src::nemo $CONFIG_DIR/$NEW_CONF/WORK +src::nemo $NEMO_TDIR/$NEW_CONF/WORK bld::target lib_cray.f90 nemo.f90 agrif_user.f90 agrif2model.f90 -- GitLab From aa6450b8aacfd8ca0fe3343d2f2ae5a2a8971156 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Mon, 14 Nov 2022 12:53:44 +0100 Subject: [PATCH 20/31] fix physics tests for LOCK_EXCHANGE & OVERFLOW --- sette/sette_test-cases.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sette/sette_test-cases.sh b/sette/sette_test-cases.sh index eb7b5d44..e76ae95b 100755 --- a/sette/sette_test-cases.sh +++ b/sette/sette_test-cases.sh @@ -222,12 +222,12 @@ if [ ${config} == "OVERFLOW" ] && [ ${DO_PHYOPTS} == "1" ] ; then else ITEND=6120 fi - cd ${CONFIG_DIR}/${NEW_CONF}/EXP00 + cd ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/EXP00 for file in $(echo `ls namelist_*_cfg `) ; do TEST_NAME=`echo $file | sed -e "s/namelist_//" | sed -e "s/_cfg//"` TEST_NAME="EXP-${TEST_NAME}" - if [ ! -d ${CONFIG_DIR}/${NEW_CONF}/${TEST_NAME} ] ; then mkdir ${CONFIG_DIR}/${NEW_CONF}/${TEST_NAME} ; fi + if [ ! -d ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/${TEST_NAME} ] ; then mkdir -p ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/${TEST_NAME} ; fi export TEST_NAME="${TEST_NAME}" ## cd ${SETTE_DIR} @@ -239,7 +239,7 @@ if [ ${config} == "OVERFLOW" ] && [ ${DO_PHYOPTS} == "1" ] ; then if [ -f ${JOB_FILE} ] ; then \rm ${JOB_FILE} ; fi cd ${EXE_DIR} rm namelist_*_*_*_* - cp -pL ${CONFIG_DIR}/${NEW_CONF}/EXP00/$file namelist_cfg + cp -pL ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/EXP00/$file namelist_cfg set_namelist namelist_cfg nn_it000 1 set_namelist namelist_cfg nn_itend ${ITEND} set_namelist_opt namelist_cfg ln_timing ${USING_TIMING} .true. .false. @@ -337,13 +337,14 @@ if [ ${config} == "LOCK_EXCHANGE" ] && [ ${DO_PHYOPTS} == "1" ] ; then else ITEND=61200 fi - cd ${CONFIG_DIR}/${NEW_CONF}/EXP00 + cd ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/EXP00 + for file in $(echo `ls namelist_*_cfg `) ; do echo '' TEST_NAME=`echo $file | sed -e "s/namelist_//" | sed -e "s/_cfg//"` TEST_NAME="EXP-${TEST_NAME}" - `mkdir ${CONFIG_DIR}/${NEW_CONF}/${TEST_NAME}` + mkdir -p ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/${TEST_NAME} export TEST_NAME="${TEST_NAME}" ## cd ${SETTE_DIR} @@ -355,7 +356,7 @@ if [ ${config} == "LOCK_EXCHANGE" ] && [ ${DO_PHYOPTS} == "1" ] ; then if [ -f ${JOB_FILE} ] ; then \rm ${JOB_FILE} ; fi cd ${EXE_DIR} rm namelist_*_*_*_* - cp -pL ${CONFIG_DIR}/${NEW_CONF}/EXP00/$file namelist_cfg + cp -pL ${CMP_DIR:-${CONFIG_DIR0}}/${SETTE_CONFIG}/EXP00/$file namelist_cfg set_namelist namelist_cfg nn_it000 1 set_namelist namelist_cfg nn_itend ${ITEND} set_namelist_opt namelist_cfg ln_timing ${USING_TIMING} .true. .false. -- GitLab From 9dff9e49c2f3da196e74f605fe7452bc374e8f90 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Tue, 29 Nov 2022 09:19:08 +0100 Subject: [PATCH 21/31] apply Simon suggestions from !178 --- makenemo | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/makenemo b/makenemo index cdddf458..96464483 100755 --- a/makenemo +++ b/makenemo @@ -246,10 +246,15 @@ elif [ -n "${REF_CONF}" ]; then conf_file=ref_cfgs.txt ; export CONFIG_DIR=${CFGS_DIR} ; TML_CONF=${REF_CONF} elif [ -n "${DEMO_CONF}" ]; then conf_file=demo_cfgs.txt; export CONFIG_DIR=${TESTS_DIR}; TML_CONF=${DEMO_CONF} -elif grep -q "${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt; then - conf_file=$( grep -l "${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt ) +elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt | 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} +elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt | wc -l ) -eq 2 ]; then + echo -e "\033[0;31m\nUser configuration 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 elif ! grep -q "${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt; then echo -e "\033[0;31m\nThe reference configuration ('-r') or " echo -e "demonstration case ('-a') selected is not available!!!" -- GitLab From fae8dc5c6113599fa0e12c2bcf8ea6811eb49b58 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Wed, 14 Dec 2022 17:01:15 +0100 Subject: [PATCH 22/31] apply Simon review --- makenemo | 62 ++++++++++++++++++++++++---------------------- mk/Fmake_config.sh | 4 +-- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/makenemo b/makenemo index 96464483..668eed08 100755 --- a/makenemo +++ b/makenemo @@ -246,35 +246,39 @@ elif [ -n "${REF_CONF}" ]; then conf_file=ref_cfgs.txt ; export CONFIG_DIR=${CFGS_DIR} ; TML_CONF=${REF_CONF} elif [ -n "${DEMO_CONF}" ]; then conf_file=demo_cfgs.txt; export CONFIG_DIR=${TESTS_DIR}; TML_CONF=${DEMO_CONF} -elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt | wc -l ) -eq 1 ]; then +elif [ $( grep -l "^${NEW_CONF} " */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} -elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt | wc -l ) -eq 2 ]; then +elif [ $( grep -l "^${NEW_CONF} " */work_cfgs.txt 2> /dev/null | wc -l ) -eq 2 ]; then echo -e "\033[0;31m\nUser configuration 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 -elif ! grep -q "${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt; then +elif ! grep -q "^${NEW_CONF} " ${CFGS_DIR}/work_cfgs.txt ${TESTS_DIR}/work_cfgs.txt 2> /dev/null; then echo -e "\033[0;31m\nThe reference configuration ('-r') or " echo -e "demonstration case ('-a') selected is not available!!!" echo -e "Check the option used and the available items in .txt files\033[0m" ${COMPIL_DIR}/Flist_cfgs.sh exit 2 +else + exit 2 fi + if [ -z "${NEW_CONF}" ]; then NEW_CONF=$TML_CONF; fi export NEMO_TDIR=${x_t:-$CONFIG_DIR} # check configuration existence & clean it if asked -if [ -n "$x_n" ]; then - incfg=$( find $NEMO_TDIR -type d -name $x_n 2>/dev/null | wc -l ) # this configuration exists in CFGS_DIR - if [ $incfg -eq 1 ] ; then - # CLEANING - if [ $x_c_cfg -eq 1 ] ; then - . ${COMPIL_DIR}/Fclean_config.sh - exit 0 - elif [ ${#x_c} -ne 0 ]; then +incfg=$( find $NEMO_TDIR -type d -maxdepth 1 -name ${TML_CONF} 2>/dev/null | wc -l ) # this configuration exists in CFGS_DIR +if [ $incfg -eq 1 ] ; then + # CLEANING + if [ $x_c_cfg -eq 1 ] ; then + . ${COMPIL_DIR}/Fclean_config.sh + exit 0 + elif [ ${#x_c} -ne 0 ]; then + read -p "Are you sure that you want to clean $TML_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 @@ -282,22 +286,24 @@ if [ -n "$x_n" ]; then # 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' - for dir in AGRIFLIB BLD LONG NEMOFILES REPRO_* SHORT WORK; do - rm -rf ${NEMO_TDIR}/${NEW_CONF}/$dir - done - for file in cpp.history cpp.fcm full_key_list.txt; do - rm -f ${NEMO_TDIR}/${NEW_CONF}/BLD/$file - done + echo -e '\nCleaning '${NEW_CONF}' building directories and variables\n' + for dir in AGRIFLIB BLD LONG NEMOFILES REPRO_* SHORT WORK; do + rm -rf ${NEMO_TDIR}/${NEW_CONF}/$dir + done + for file in cpp.history cpp.fcm full_key_list.txt; do + rm -f ${NEMO_TDIR}/${NEW_CONF}/BLD/$file + done exit 0 - fi - if [ -n "$REF_CONF" ]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-r $REF_CONF\"\n"; REF_CONF=""; fi - if [ -n "$DEMO_CONF" ]; then echo -e "\nWARNING: $x_n configuration is already existing, we ignore \"-a $DEMO_CONF\"\n"; DEMO_CONF=""; fi - fi - if [ $incfg -eq 0 ]; then - [ $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 + else + echo "cleaning cancelled" + 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 + [ $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 @@ -325,16 +331,12 @@ if [ ${TML_CONF} != ${NEW_CONF} ]; then fi ## 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 +[ -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 new config even in existing one (mkdir with -p option, cp with -n) ${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${CONFIG_DIR}/${TML_CONF} -## create EXP00 if needed -[[ ! -d ${NEMO_TDIR}/${NEW_CONF}/EXP00 && -n "${REF_CONF}" ]] && \cp -R -n ${CONFIG_DIR}/${REF_CONF}/EXPREF ${NEMO_TDIR}/${NEW_CONF}/EXP00 -[[ ! -d ${NEMO_TDIR}/${NEW_CONF}/EXP00 && -n "${DEMO_CONF}" ]] && \cp -R -n ${CONFIG_DIR}/${DEMO_CONF}/EXPREF ${NEMO_TDIR}/${NEW_CONF}/EXP00 - #- Create the WORK --- #- Clean links and librairies --- #- Creating the good links, at first on OCE --- diff --git a/mk/Fmake_config.sh b/mk/Fmake_config.sh index 79673f0e..6a3e942b 100755 --- a/mk/Fmake_config.sh +++ b/mk/Fmake_config.sh @@ -59,9 +59,9 @@ set -o posix \mkdir -p ${1} \mkdir -p ${1}/EXP00 \mkdir -p ${1}/MY_SRC -\cp -R -n ${2}/cpp_${2##*/}.fcm ${1}/cpp_${1##*/}.fcm +[ "${2}/cpp_${2##*/}.fcm" != "${1}/cpp_${1##*/}.fcm" ] && \cp -R -n ${2}/cpp_${2##*/}.fcm ${1}/cpp_${1##*/}.fcm for f in ${2}/EXPREF/*.xml ${2}/EXPREF/*namelist*; do if [ -L ${f} ]; then ln -sf $(readlink -f ${f}) ${1}/EXP00/$(basename ${f}); else cp -R -n ${f} ${1}/EXP00/.; fi done -[ -f ${2}/EXPREF/AGRIF_FixedGrids.in ] && \cp -a -n ${2}/EXPREF/AGRIF_FixedGrids.in ${1}/EXP00/. +[ -f ${2}/EXPREF/AGRIF_FixedGrids.in ] && \cp -a -n ${2}/EXPREF/AGRIF_FixedGrids.in ${1}/EXP00/. [ -d ${2}/MY_SRC ] && \cp -an ${2}/MY_SRC/* ${1}/MY_SRC/. 2> /dev/null -- GitLab From 2e0edf9379a22d15e3caca16c145ede426ac5097 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Fri, 16 Dec 2022 19:16:33 +0100 Subject: [PATCH 23/31] adapt maketools to Fcheck_archfile.sh modifications --- tools/maketools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/maketools b/tools/maketools index 99aab337..857f9643 100755 --- a/tools/maketools +++ b/tools/maketools @@ -156,7 +156,7 @@ echo "${NEW_CONF} " > ${COMPIL_DIR}/tools.txt #- 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 arch_tools.fcm cpp_tools.fcm ${CMP_NAM} || exit +. ${COMPIL_DIR}/Fcheck_archfile.sh ${COMPIL_DIR}/arch_tools.fcm ${COMPIL_DIR}/cpp_tools.fcm ${CMP_NAM} || exit #- At this stage the configuration has beeen chosen #- We coose the default light file -- GitLab From 244b4deaacf45331af8fab2acbe6caadf26fd2ab Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Mon, 19 Dec 2022 10:57:07 +0100 Subject: [PATCH 24/31] move tools.txt (generated bu maketools) to tools directory to avoid any modification of mk directory --- mk/tools.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 mk/tools.txt diff --git a/mk/tools.txt b/mk/tools.txt deleted file mode 100644 index a6cb4ae5..00000000 --- a/mk/tools.txt +++ /dev/null @@ -1 +0,0 @@ -DOMAINcfg -- GitLab From 0333f7b332234201545b57ce931b55c3433c1781 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Mon, 19 Dec 2022 10:58:05 +0100 Subject: [PATCH 25/31] cleaning --- mk/Fmake_bld.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/mk/Fmake_bld.sh b/mk/Fmake_bld.sh index ebb2e48c..bd4b331c 100755 --- a/mk/Fmake_bld.sh +++ b/mk/Fmake_bld.sh @@ -59,6 +59,5 @@ set -o posix #- [ ! -d ${3}/${2} ] && \mkdir -p ${3}/${2} [ ! -d ${3}/${2}/BLD ] && \mkdir -p ${3}/${2}/BLD -#[ ! -d ${1}/${2}/BLD ] && ln -sf ${3}/${2}/BLD ${1}/${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 -- GitLab From 7f835414a047af7c3114587528ad190b40f6d3c1 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Mon, 19 Dec 2022 10:58:36 +0100 Subject: [PATCH 26/31] harmonize Fmake_tools_bld.sh script with Fmake_bld.sh version --- mk/Fmake_tools_bld.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/Fmake_tools_bld.sh b/mk/Fmake_tools_bld.sh index b5e67c8c..3a9a5041 100755 --- a/mk/Fmake_tools_bld.sh +++ b/mk/Fmake_tools_bld.sh @@ -62,5 +62,5 @@ set -o posix [ ! -d ${1}/${2}/BLD ] && ln -sf ${3}/${2}/BLD ${1}/${2}/BLD # 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 ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ] && cp -f ${1}/${NEW_CONF}/cpp_${NEW_CONF}.fcm ${COMPIL_DIR}/cpp_tools.fcm || echo 'bld::tool::fppkeys ' > ${COMPIL_DIR}/cpp_tools.fcm +[ -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 -- GitLab From a445fe6cb2a162cf556d760bf4391afead135d22 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Mon, 19 Dec 2022 10:59:14 +0100 Subject: [PATCH 27/31] change cpp & arch files path from mk directory to BLD tools directory (as for makenemo) --- mk/bldxag_tools.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mk/bldxag_tools.cfg b/mk/bldxag_tools.cfg index 45282637..7f54517b 100644 --- a/mk/bldxag_tools.cfg +++ b/mk/bldxag_tools.cfg @@ -7,8 +7,8 @@ cfg::version 1.0 # Build information # ------------------------------------------------------------------------------ -inc $COMPIL_DIR/arch_tools.fcm -inc $COMPIL_DIR/cpp_tools.fcm +inc $TOOLS_DIR/$NEW_CONF/BLD/arch_tools.fcm +inc $TOOLS_DIR/$NEW_CONF/BLD/cpp_tools.fcm search_src 1 -- GitLab From 01ae4c2b51ccaca88c5660e8f46526217c5b86ca Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Mon, 19 Dec 2022 11:00:27 +0100 Subject: [PATCH 28/31] adjust maketools for new cpp, arch & tools.txt paths --- tools/maketools | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/maketools b/tools/maketools index 857f9643..cc420971 100755 --- a/tools/maketools +++ b/tools/maketools @@ -146,24 +146,24 @@ export NEMO_TDIR=${NEMO_TDIR:-$TOOLS_DIR} #- Choose a default tool if needed --- #- REBUILD or last one used --- -. ${COMPIL_DIR}/Fcheck_config.sh tools.txt ${NEW_CONF} || exit +. ${COMPIL_DIR}/Fcheck_config.sh ${TOOLS_DIR}/tools.txt ${NEW_CONF} || exit #- Save new configuration --- -echo "${NEW_CONF} " > ${COMPIL_DIR}/tools.txt +echo "${NEW_CONF} " > ${TOOLS_DIR}/tools.txt #- Make the building directory . ${COMPIL_DIR}/Fmake_tools_bld.sh ${TOOLS_DIR} ${NEW_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 ${COMPIL_DIR}/arch_tools.fcm ${COMPIL_DIR}/cpp_tools.fcm ${CMP_NAM} || exit +. ${COMPIL_DIR}/Fcheck_archfile.sh ${TOOLS_DIR}/${NEW_CONF}/BLD/arch_tools.fcm ${TOOLS_DIR}/${NEW_CONF}/BLD/cpp_tools.fcm ${CMP_NAM} || exit #- At this stage the configuration has beeen chosen #- We coose the default light file export USEBLD=bldxag_tools.cfg #- We look after agrif -grep key_agrif ${COMPIL_DIR}/cpp_tools.fcm && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/} +grep key_agrif ${TOOLS_DIR}/${NEW_CONF}/BLD/cpp_tools.fcm && export AGRIFUSE=1 && export USEBLD=${USEBLD/xag/} . ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${TOOLS_DIR} arch_tools.fcm|| exit 3 -- GitLab From 0f0a295b4e9455fd45d963c55797b932903b2e01 Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Mon, 19 Dec 2022 11:05:57 +0100 Subject: [PATCH 29/31] adat gitignore to mk changes --- .gitignore | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 403ab425..ab4a609c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,20 @@ -# configurations & testcases +# configurations, testcases & tools -*/work_cfgs.txt +cfgs/work_cfgs.txt cfgs/*/BLD cfgs/*/EXP00 cfgs/*/WORK cfgs/*_ST + +tests/work_cfgs.txt tests/*/BLD tests/*/EXP00 tests/*/WORK tests/*_ST +tools/*/BLD +tools/*/*.exe +tools/tools.txt + # mk -mk/arch* -mk/cpp.* mk/full_key_list.txt -- GitLab From 8dbe59be944888c67e0ad8e903c60177387ab6cc Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Mon, 19 Dec 2022 11:24:01 +0100 Subject: [PATCH 30/31] finishing applying Simon review --- makenemo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makenemo b/makenemo index 668eed08..a774d878 100755 --- a/makenemo +++ b/makenemo @@ -270,14 +270,14 @@ export NEMO_TDIR=${x_t:-$CONFIG_DIR} # check configuration existence & clean it if asked -incfg=$( find $NEMO_TDIR -type d -maxdepth 1 -name ${TML_CONF} 2>/dev/null | wc -l ) # this configuration exists in CFGS_DIR +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 if [ $x_c_cfg -eq 1 ] ; then . ${COMPIL_DIR}/Fclean_config.sh exit 0 elif [ ${#x_c} -ne 0 ]; then - read -p "Are you sure that you want to clean $TML_CONF configuration ? " -n 1 -r; echo + read -p "Are you sure that you want to clean $NEW_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 -- GitLab From 7add42f97130db23ffa26553ccc4c41b2b39875c Mon Sep 17 00:00:00 2001 From: Guillaume S Date: Mon, 19 Dec 2022 11:31:17 +0100 Subject: [PATCH 31/31] put back MAIN_DIR path modification (in case of needed by someone) --- makenemo | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/makenemo b/makenemo index a774d878..0d648679 100755 --- a/makenemo +++ b/makenemo @@ -93,6 +93,12 @@ x_nocdf=0 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 -- GitLab