New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 2354 – NEMO

Changeset 2354


Ignore:
Timestamp:
2010-11-04T15:40:10+01:00 (13 years ago)
Author:
flavoni
Message:

first draft for SETTE (SET tests for NEMO), a new version of NVTK, see ticket #752

Location:
branches/nemo_v3_3_beta/NEMOGCM
Files:
8 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • branches/nemo_v3_3_beta/NEMOGCM/CONFIG/makenemo

    r2324 r2354  
    7979#- Local variables --- 
    8080b_n=$(basename ${0}) 
    81 export MAIN_DIR=${PWD%/CONFIG*} 
    82 export CONFIG_DIR=${MAIN_DIR}/CONFIG 
    83 export TOOLS_DIR=${MAIN_DIR}/TOOLS 
    84 export COMPIL_DIR=${MAIN_DIR}/TOOLS/COMPILE 
    85 export NEMO_DIR=${MAIN_DIR}/NEMO 
    86 export AGRIFUSE=10 
    87  
    88 declare -a TAB 
     81   OPTIND=1 
     82   MAIN_DIR=$(cd $(dirname "$0"); pwd) 
     83   MAIN_DIR=${MAIN_DIR%/SETTE*} 
     84   MAIN_DIR=${MAIN_DIR%/TOOLS*} 
     85   MAIN_DIR=${MAIN_DIR%/CONFIG*} 
     86   export MAIN_DIR 
     87# 
     88   export CONFIG_DIR=${MAIN_DIR}/CONFIG 
     89   export TOOLS_DIR=${MAIN_DIR}/TOOLS 
     90   export COMPIL_DIR=${MAIN_DIR}/TOOLS/COMPILE 
     91   export NEMO_DIR=${MAIN_DIR}/NEMO 
     92   export AGRIFUSE=10 
     93 
     94   declare -a TAB 
    8995#- 
    9096#- FCM and functions location --- 
    91 export PATH=${MAIN_DIR}/EXTERNAL/fcm/bin:$PATH 
     97   export PATH=${MAIN_DIR}/EXTERNAL/fcm/bin:$PATH 
    9298 
    9399#- 
    94100#- Choice of the options --- 
    95 x_d=""; 
    96 x_n=""; 
    97 x_r=""; 
    98 x_m=""; 
    99 x_t=""; 
    100 x_c=""; 
    101 x_j=1; 
    102 while getopts :hd:n:r:m:j:t: V 
    103   do 
    104     case $V in 
    105       (h)  echo "Usage   : "${b_n} \ 
    106                 " [-h] [-n name] [-m arch] [-d "dir1 dir2"] [-r conf] [-j No]"; 
    107            echo " -h  : help"; 
    108            echo " -n name : config name, [-n help] to list existing configurations"; 
    109            echo " -m arch : choose compiler, [-m help] to list existing compilers"; 
    110            echo " -d dir  : choose NEMO sub-directories"; 
    111            echo " -r conf : choose reference configuration"; 
    112            echo " -j No  : number of processes used to compile (0=nocompilation)"; 
    113            echo " -t dir  : temporary directory for compilation" 
    114            echo ""; 
    115            echo "Example to install a new configuration MY_CONFIG"; 
    116            echo "with OPA_SRC and LIM_SRC_2 "; 
    117            echo "makenemo -n MY_CONFIG -d \"OPA_SRC LIM_SRC_2\""; 
    118            echo ""; 
    119                           echo "Available configurations :"; cat ${COMPIL_DIR}/cfg.txt;  
    120            echo ""; 
    121            echo "Example to remove bad configuration "; 
    122            echo "./makenemo -n MY_CONFIG clean_config"; 
    123                           echo ""; 
    124            echo "Example to clean "; 
    125            echo "./makenemo clean"; 
    126                           echo ""; 
    127            echo "Example to add and remove keys"; 
    128            echo "./makenemo add_key \"key_iomput key_mpp_mpi\" del_key \"key_agrif\" "; 
    129                           echo ""; 
    130            echo "Example to add and remove keys for a new configuration, and do not compile"; 
    131            echo "./makenemo -n MY_CONFIG -j0 add_key \"key_iomput key_mpp_mpi\" del_key \"key_agrif\" "; 
    132                           echo ""; 
    133                           . ${COMPIL_DIR}/Flist_archfile.sh  ; 
    134                           echo ""; 
    135                           echo "Default : previous configuration and compiler"; 
    136            exit 0;; 
    137       (d)  x_d=${OPTARG};; 
    138       (n)  x_n=${OPTARG};; 
    139       (r)  x_r=${OPTARG};; 
    140       (m)  x_m=${OPTARG};; 
    141       (j)  x_j=${OPTARG};; 
    142       (t)  x_t=${OPTARG};; 
    143       (:)  echo ${b_n}" : -"${OPTARG}" option : missing value" 1>&2; 
    144            exit 2;; 
    145       (\?) echo ${b_n}" : -"${OPTARG}" option : not supported" 1>&2; 
    146            exit 2;; 
    147     esac 
    148   done 
     101   x_d=""; 
     102   x_n=""; 
     103   x_r=""; 
     104   x_m=""; 
     105   x_t=""; 
     106   x_c=""; 
     107   x_j=1; 
     108   while getopts :hd:n:r:m:j:t: V 
     109   do 
     110   case $V in 
     111   (h)  echo "Usage   : "${b_n} \ 
     112      " [-h] [-n name] [-m arch] [-d "dir1 dir2"] [-r conf] [-j No]"; 
     113echo " -h    : help"; 
     114echo " -n name : config name, [-n help] to list existing configurations"; 
     115echo " -m arch : choose compiler, [-m help] to list existing compilers"; 
     116echo " -d dir  : choose NEMO sub-directories"; 
     117echo " -r conf : choose reference configuration"; 
     118echo " -j No    : number of processes used to compile (0=nocompilation)"; 
     119echo " -t dir  : temporary directory for compilation" 
     120echo ""; 
     121echo "Example to install a new configuration MY_CONFIG"; 
     122echo "with OPA_SRC and LIM_SRC_2 "; 
     123echo "makenemo -n MY_CONFIG -d \"OPA_SRC LIM_SRC_2\""; 
     124echo ""; 
     125echo "Available configurations :"; cat ${COMPIL_DIR}/cfg.txt;  
     126echo ""; 
     127echo "Example to remove bad configuration "; 
     128echo "./makenemo -n MY_CONFIG clean_config"; 
     129echo ""; 
     130echo "Example to clean "; 
     131echo "./makenemo clean"; 
     132echo ""; 
     133echo "Example to add and remove keys"; 
     134echo "./makenemo add_key \"key_iomput key_mpp_mpi\" del_key \"key_agrif\" "; 
     135echo ""; 
     136echo "Example to add and remove keys for a new configuration, and do not compile"; 
     137echo "./makenemo -n MY_CONFIG -j0 add_key \"key_iomput key_mpp_mpi\" del_key \"key_agrif\" "; 
     138echo ""; 
     139. ${COMPIL_DIR}/Flist_archfile.sh  ; 
     140echo ""; 
     141echo "Default : previous configuration and compiler"; 
     142exit 0;; 
     143(d)  x_d=${OPTARG};; 
     144(n)  x_n=${OPTARG};; 
     145(r)  x_r=${OPTARG};; 
     146(m)  x_m=${OPTARG};; 
     147(j)  x_j=${OPTARG};; 
     148(t)  x_t=${OPTARG};; 
     149(:)  echo ${b_n}" : -"${OPTARG}" option : missing value" 1>&2; 
     150exit 2;; 
     151(\?) echo ${b_n}" : -"${OPTARG}" option : not supported" 1>&2; 
     152exit 2;; 
     153esac 
     154done 
    149155shift $(($OPTIND-1)); 
    150156 
    151157while [ ${#1} -gt 0 ]   # Get clean, clean_config options 
    152158do 
    153     case "$1" in 
    154    clean) 
    155       x_c="--$1" 
    156          ;; 
    157    clean_config) 
    158       . ${COMPIL_DIR}/Fclean_config.sh 
    159       exit 
    160          ;; 
    161    add_key) 
    162       list_add_key=$2 
    163       export ${list_add_key} 
    164       shift 
    165          ;; 
    166    del_key) 
    167       list_del_key=$2 
    168       export ${list_del_key} 
    169       shift 
    170          ;; 
    171    *) 
    172          echo " \"$1\" BAD OPTION"  
    173       exit 
    174          ;; 
    175  
    176    esac 
     159case "$1" in 
     160clean) 
     161x_c="--$1" 
     162;; 
     163clean_config) 
     164. ${COMPIL_DIR}/Fclean_config.sh 
     165exit 
     166;; 
     167add_key) 
     168list_add_key=$2 
     169export ${list_add_key} 
     170shift 
     171;; 
     172del_key) 
     173list_del_key=$2 
     174export ${list_del_key} 
     175shift 
     176;; 
     177*) 
     178echo " \"$1\" BAD OPTION"  
     179exit 
     180;; 
     181 
     182esac 
    177183shift 
    178184done 
     
    195201#- Check if the tool or the compiler exist or list it 
    196202if [ "${NEW_CONF}" == help ] ; then 
    197  echo "Available configurations :"  
    198  cat ${COMPIL_DIR}/cfg.txt 
     203echo "Available configurations :"  
     204cat ${COMPIL_DIR}/cfg.txt 
    199205exit 
    200206fi 
     
    209215. ${COMPIL_DIR}/Fcheck_config.sh cfg.txt ${NEW_CONF} || exit  
    210216 
     217 
    211218if [ ${#NEW_CONF} -eq 0 ] ; then 
    212    if [ ${#NEM_SUBDIR} -eq 0 -a ${#REF_CONF} -eq 0 ]; then 
    213       echo "You are  installing a new configuration" 
    214       ind=0 
    215       . ${COMPIL_DIR}/Fread_dir.sh OPA_SRC   YES  
    216       . ${COMPIL_DIR}/Fread_dir.sh LIM_SRC_2   YES  
    217       . ${COMPIL_DIR}/Fread_dir.sh LIM_SRC_3    NO   
    218       . ${COMPIL_DIR}/Fread_dir.sh TOP_SRC    NO   
    219       . ${COMPIL_DIR}/Fread_dir.sh C1D_SRC   YES  
    220       . ${COMPIL_DIR}/Fread_dir.sh NST_SRC   YES  
    221       . ${COMPIL_DIR}/Fread_dir.sh OFF_SRC    NO   
    222       REF_CONF=ORCA2_LIM 
    223    elif [ ${#NEM_SUBDIR} -gt 0 ] && [ ${#REF_CONF} -eq 0 ]; then 
    224       echo "You are  installing a new configuration" 
    225       TAB=( ${NEM_SUBDIR} ) 
    226       REF_CONF=ORCA2_LIM 
     219if [ ${#NEM_SUBDIR} -eq 0 -a ${#REF_CONF} -eq 0 ]; then 
     220echo "You are  installing a new configuration" 
     221ind=0 
     222. ${COMPIL_DIR}/Fread_dir.sh OPA_SRC   YES  
     223. ${COMPIL_DIR}/Fread_dir.sh LIM_SRC_2   YES  
     224. ${COMPIL_DIR}/Fread_dir.sh LIM_SRC_3    NO   
     225. ${COMPIL_DIR}/Fread_dir.sh TOP_SRC    NO   
     226. ${COMPIL_DIR}/Fread_dir.sh C1D_SRC   YES  
     227. ${COMPIL_DIR}/Fread_dir.sh NST_SRC   YES  
     228. ${COMPIL_DIR}/Fread_dir.sh OFF_SRC    NO   
     229REF_CONF=ORCA2_LIM 
     230elif [ ${#NEM_SUBDIR} -gt 0 ] && [ ${#REF_CONF} -eq 0 ]; then 
     231   echo "You are  installing a new configuration" 
     232TAB=( ${NEM_SUBDIR} ) 
     233   REF_CONF=ORCA2_LIM 
    227234   elif [ ${#NEM_SUBDIR} -eq 0 ] && [ ${#REF_CONF} -gt 0 ]; then 
    228       echo "You are  installing a new configuration based on ${REF_CONF}" 
    229       . ${COMPIL_DIR}/Fcopy_dir.sh ${REF_CONF}   
     235   echo "You are  installing a new configuration based on ${REF_CONF}" 
     236   . ${COMPIL_DIR}/Fcopy_dir.sh ${REF_CONF}   
    230237   fi 
    231238   NEW_CONF=${x_n} 
    232     . ${COMPIL_DIR}/Fmake_config.sh ${NEW_CONF} ${REF_CONF} 
    233 else 
     239   . ${COMPIL_DIR}/Fmake_config.sh ${NEW_CONF} ${REF_CONF} 
     240   else 
    234241   sed -e "/${NEW_CONF} /d"  ${COMPIL_DIR}/cfg.txt >  ${COMPIL_DIR}/cfg.tmp 
    235242   \mv  ${COMPIL_DIR}/cfg.tmp  ${COMPIL_DIR}/cfg.txt 
    236 fi 
     243   fi 
    237244 
    238245#- 
    239246#- Save new configuration and directories names --- 
    240 echo ${NEW_CONF} ${TAB[*]} >> ${COMPIL_DIR}/cfg.txt 
     247   echo ${NEW_CONF} ${TAB[*]} >> ${COMPIL_DIR}/cfg.txt 
    241248 
    242249#- 
     
    244251#- Clean links and librairies --- 
    245252#- Creating the good links, at first on OPA_SRC --- 
    246 . ${COMPIL_DIR}/Fmake_WORK.sh ${NEW_CONF} ${TAB[*]} || exit 
    247  
    248 . ${COMPIL_DIR}/Fmake_bld.sh ${CONFIG_DIR} ${NEW_CONF}  ${NEMO_TDIR} || exit 
     253   . ${COMPIL_DIR}/Fmake_WORK.sh ${NEW_CONF} ${TAB[*]} || exit 
     254 
     255   . ${COMPIL_DIR}/Fmake_bld.sh ${CONFIG_DIR} ${NEW_CONF}  ${NEMO_TDIR} || exit 
    249256 
    250257#- At this stage new configuration has been added, 
    251258#- We add or remove keys 
    252 if [ ${#list_add_key} -ne 0 ] ; then 
     259   if [ ${#list_add_key} -ne 0 ] ; then 
    253260   . ${COMPIL_DIR}/Fadd_keys.sh ${NEW_CONF} add_key ${list_add_key}  
    254 fi 
    255  
    256 if [ ${#list_del_key} -ne 0 ] ; then 
     261   fi 
     262 
     263   if [ ${#list_del_key} -ne 0 ] ; then 
    257264   . ${COMPIL_DIR}/Fdel_keys.sh ${NEW_CONF} del_key ${list_del_key} 
    258 fi 
     265   fi 
    259266 
    260267#- At this stage the configuration has beeen chosen 
    261268#- We look after agrif 
    262 grep key_agrif ${COMPIL_DIR}/cpp.fcm && export AGRIFUSE=1 
    263 . ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} || exit 
     269   grep key_agrif ${COMPIL_DIR}/cpp.fcm && export AGRIFUSE=1 
     270   . ${COMPIL_DIR}/Fprep_agrif.sh ${NEW_CONF} ${NEMO_TDIR} || exit 
    264271 
    265272#- and test whether we need to build the ioserver 
    266 export USEBLD=bldxio.cfg 
    267 grep key_iomput ${COMPIL_DIR}/cpp.fcm && export USEBLD=bld.cfg 
     273   export USEBLD=bldxio.cfg 
     274   grep key_iomput ${COMPIL_DIR}/cpp.fcm && export USEBLD=bld.cfg 
    268275 
    269276#- 
     
    274281#- Compile --- 
    275282 
    276 if [ "${NBR_PRC}" -gt 0 ]; then 
    277    cd ${NEMO_TDIR}/${NEW_CONF} || cd - 
    278  
    279    #if AGRIF we do a first preprocessing 
    280    if [ ${#x_c} -eq 0 ]; then 
    281       [ "$AGRIFUSE" == 1 ] && fcm build --ignore-lock -s 2 ${COMPIL_DIR}/$USEBLD  
    282       [ "$AGRIFUSE" == 1 ] && rm -rf  ${NEMO_TDIR}/${NEW_CONF}/BLD/* 
    283    fi 
    284    fcm build ${x_c} --ignore-lock -v 1 -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || cd - 
    285    [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ] && ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe  ${CONFIG_DIR}/${NEW_CONF}/EXP00/opa 
    286    [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/server.exe ] && ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/server.exe  ${CONFIG_DIR}/${NEW_CONF}/EXP00/server.exe 
    287  
    288    #add remove for clean option 
    289    if  [ ${#x_c} -ne 0 ]; then 
    290    rm -rf ${NEMO_TDIR}/${NEW_CONF}/WORK 
    291    rm -rf ${NEMO_TDIR}/${NEW_CONF}/BLD 
    292    rm -rf ${NEMO_TDIR}/${NEW_CONF}/EXP00/opa 
    293    rm -rf ${NEMO_TDIR}/${NEW_CONF}/EXP00/server.exe 
    294    echo "cleaning ${NEW_CONF} WORK, BLD" 
    295   fi 
    296        
     283   if [ "${NBR_PRC}" -gt 0 ]; then 
     284   cd ${NEMO_TDIR}/${NEW_CONF} || cd - 
     285 
     286#if AGRIF we do a first preprocessing 
     287   if [ ${#x_c} -eq 0 ]; then 
     288   [ "$AGRIFUSE" == 1 ] && fcm build --ignore-lock -s 2 ${COMPIL_DIR}/$USEBLD  
     289   [ "$AGRIFUSE" == 1 ] && rm -rf  ${NEMO_TDIR}/${NEW_CONF}/BLD/* 
     290                               fi 
     291                               fcm build ${x_c} --ignore-lock -v 1 -j ${NBR_PRC} ${COMPIL_DIR}/$USEBLD || cd - 
     292                               [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe ] && ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/nemo.exe  ${CONFIG_DIR}/${NEW_CONF}/EXP00/opa 
     293                               [ -f ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/server.exe ] && ln -sf ${NEMO_TDIR}/${NEW_CONF}/BLD/bin/server.exe  ${CONFIG_DIR}/${NEW_CONF}/EXP00/server.exe 
     294 
     295#add remove for clean option 
     296if  [ ${#x_c} -ne 0 ]; then 
     297rm -rf ${NEMO_TDIR}/${NEW_CONF}/WORK 
     298rm -rf ${NEMO_TDIR}/${NEW_CONF}/BLD 
     299rm -rf ${NEMO_TDIR}/${NEW_CONF}/EXP00/opa 
     300rm -rf ${NEMO_TDIR}/${NEW_CONF}/EXP00/server.exe 
     301echo "cleaning ${NEW_CONF} WORK, BLD" 
     302fi 
     303 
    297304fi 
    298305 
     
    306313 
    307314 
    308 exit 0; 
Note: See TracChangeset for help on using the changeset viewer.