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 4258 for branches/2013/dev_r3858_NOC_ZTC/NEMOGCM/TOOLS – NEMO

Ignore:
Timestamp:
2013-11-19T16:54:37+01:00 (11 years ago)
Author:
acc
Message:

Branch 2013/dev_r3858_NOC_ZTC, #863. Merge in trunk changes from 3858 to 4119; resolve conflicts and check in prior to compiling and testing

Location:
branches/2013/dev_r3858_NOC_ZTC/NEMOGCM/TOOLS
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2013/dev_r3858_NOC_ZTC/NEMOGCM/TOOLS/COMPILE/Fcheck_archfile.sh

    r3862 r4258  
    4040# :: 
    4141# 
    42 #  $ ./Fcheck_archfile.sh ARCHFILE COMPILER 
     42#  $ ./Fcheck_archfile.sh ARCHFILE CPPFILE COMPILER 
    4343# 
    4444# 
     
    5959# 
    6060#- 
     61cpeval ()  
     62{ 
     63    cat > $2 << EOF 
    6164 
    62 if [ ${#2} -eq 0 ]; then 
    63    if [ ! -f ${COMPIL_DIR}/$1 ]; then 
    64    echo "Warning !!!" 
    65    echo "NO compiler chosen" 
    66    echo "Try makenemo -h for help" 
    67    echo "EXITING..." 
    68    exit 1  
    69    fi 
     65#========================================================== 
     66#    Automatically generated by Fcheck_archfile.sh from 
     67#    $1 
     68#========================================================== 
     69 
     70EOF 
     71    while read line   
     72    do   
     73   eval "echo \"$line\" >> $2" 
     74    done < $1 
     75} 
     76# cleaning related to the old version 
     77rm -f $( find ${COMPIL_DIR} -type l -name $1 -print ) 
     78# 
     79if [ ${#3} -eq 0 ]; then # arch not specified 
     80    if [ ! -f ${COMPIL_DIR}/arch.history ]; then 
     81   echo "Warning !!!" 
     82   echo "NO compiler chosen" 
     83   echo "Try makenemo -h for help" 
     84   echo "EXITING..." 
     85   exit 1  
     86    else # use the arch file defined in arch.history 
     87   myarch=$( cat ${COMPIL_DIR}/arch.history )    
     88   if [ ! -f $myarch ]; then 
     89       echo "Warning !!!" 
     90       echo "previously used arch file no more found:" 
     91       echo $myarch 
     92       echo "EXITING..." 
     93       exit 1  
     94   else 
     95       if [ -f ${COMPIL_DIR}/$1 ]; then 
     96      if [ "$2" != "nocpp" ]  
     97      then 
     98          # has the cpp keys file been changed since we copied the arch file in ${COMPIL_DIR}? 
     99          mycpp=$( ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" ) 
     100          if [ "$mycpp" != "$( cat ${COMPIL_DIR}/cpp.history )" ]; then 
     101         echo $mycpp > ${COMPIL_DIR}/cpp.history 
     102         cpeval ${myarch} ${COMPIL_DIR}/$1 
     103          fi 
     104          # has the cpp keys file been updated since we copied the arch file in ${COMPIL_DIR}? 
     105          mycpp=$( find -L ${COMPIL_DIR} -cnewer ${COMPIL_DIR}/$1 -name $2 -print ) 
     106          [ ${#mycpp} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 
     107      fi 
     108      # has myarch file been updated since we copied it in ${COMPIL_DIR}? 
     109      myarchdir=$( dirname ${myarch} ) 
     110      myarchname=$( basename ${myarch} ) 
     111      myarch=$( find -L $myarchdir -cnewer ${COMPIL_DIR}/$1 -name $myarchname -print ) 
     112      [ ${#myarch} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 
     113       else 
     114      cpeval ${myarch} ${COMPIL_DIR}/$1 
     115       fi 
     116   fi 
     117    fi 
     118else  
     119    nb=$( find ${MAIN_DIR}/ARCH -name arch-${3}.fcm -print | wc -l ) 
     120    if [ $nb -eq 0 ]; then # no arch file found 
     121   echo "Warning !!!" 
     122   echo "Compiler not existing" 
     123   echo "Try makenemo -h for help" 
     124   echo "EXITING..." 
     125   exit 1        
     126    fi 
     127    if [ $nb -gt 1 ]; then # more than 1 arch file found 
     128   echo "Warning !!!" 
     129   echo "more than 1 arch file for the same compiler have been found" 
     130   find ${MAIN_DIR}/ARCH -name arch-${3}.fcm -print 
     131   echo "keep only 1" 
     132   echo "EXITING..." 
     133   exit 1        
     134    fi 
     135    myarch=$( find ${MAIN_DIR}/ARCH -name arch-${3}.fcm -print ) 
     136    # we were already using this arch file ? 
     137    if [ "$myarch" == "$( cat ${COMPIL_DIR}/arch.history )" ]; then  
     138   if [ -f ${COMPIL_DIR}/$1 ]; then 
     139       if [ "$2" != "nocpp" ]  
     140       then 
     141      # has the cpp keys file been changed since we copied the arch file in ${COMPIL_DIR}? 
     142      mycpp=$( ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" ) 
     143      if [ "$mycpp" != "$( cat ${COMPIL_DIR}/cpp.history )" ]; then 
     144          echo $mycpp > ${COMPIL_DIR}/cpp.history 
     145          cpeval ${myarch} ${COMPIL_DIR}/$1 
     146      fi 
     147      # has the cpp keys file been updated since we copied the arch file in ${COMPIL_DIR}? 
     148      mycpp=$( find -L ${COMPIL_DIR} -cnewer ${COMPIL_DIR}/$1 -name $2 -print ) 
     149      [ ${#mycpp} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 
     150       fi 
     151       # has myarch file been updated since we copied it in ${COMPIL_DIR}? 
     152       myarch=$( find -L ${MAIN_DIR}/ARCH -cnewer ${COMPIL_DIR}/$1 -name arch-${3}.fcm -print ) 
     153       [ ${#myarch} -ne 0 ] && cpeval ${myarch} ${COMPIL_DIR}/$1 
     154   else 
     155       cpeval ${myarch} ${COMPIL_DIR}/$1 
     156   fi 
     157    else 
     158   if [ "$2" != "nocpp" ]  
     159   then 
     160       ls -l ${COMPIL_DIR}/$2 | sed -e "s/.* -> //" > ${COMPIL_DIR}/cpp.history 
     161   fi 
     162   echo ${myarch} > ${COMPIL_DIR}/arch.history 
     163   cpeval ${myarch} ${COMPIL_DIR}/$1 
     164    fi 
     165fi 
     166 
     167#- do we need xios library? 
     168if [ "$2" != "nocpp" ]  
     169then 
     170    use_iom=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$2 | grep -c key_iomput ) 
    70171else 
    71    myfile=$( find -L ${MAIN_DIR}/ARCH -name arch-${2}.fcm -print ) 
    72    if [ ${#myfile} -gt 0 ]; then 
    73       ln -sf  ${myfile} ${COMPIL_DIR}/$1 
    74    else 
    75       echo "Warning !!!" 
    76       echo "Compiler not existing" 
    77       echo "Try makenemo -h for help" 
    78       echo "EXITING..." 
    79       pwd 
    80       echo "find ${MAIN_DIR}/ARCH -name arch-${2}.fcm -print" 
    81       exit 1        
    82    fi    
     172    use_iom=0 
    83173fi 
     174have_lxios=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-lxios" ) 
     175if [[ ( $use_iom -eq 0 ) && ( $have_lxios -ge 1 ) ]] 
     176then  
     177    sed -e "s/-lxios//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$ 
     178    mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1 
     179fi 
     180 
     181#- do we need oasis libraries? 
     182if [ "$2" != "nocpp" ]  
     183then 
     184    use_oasis=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$2 | grep -c key_oasis3 ) 
     185else 
     186    use_oasis=0 
     187fi 
     188for liboa in psmile.MPI1 mct mpeu scrip mpp_io 
     189do 
     190    have_liboa=$( sed -e "s/#.*$//" ${COMPIL_DIR}/$1 | grep -c "\-l${liboa}" ) 
     191    if [[ ( $use_oasis -eq 0 ) && ( $have_liboa -ge 1 ) ]] 
     192    then  
     193   sed -e "s/-l${liboa}//g" ${COMPIL_DIR}/$1 > ${COMPIL_DIR}/tmp$$ 
     194   mv -f ${COMPIL_DIR}/tmp$$ ${COMPIL_DIR}/$1 
     195    fi 
     196done 
     197 
  • branches/2013/dev_r3858_NOC_ZTC/NEMOGCM/TOOLS/COMPILE/Flist_archfile.sh

    r3294 r4258  
    6161 
    6262echo "Available compilers for -m option :" 
    63 for file in  $(ls ${MAIN_DIR}/ARCH | grep fcm ) 
     63for file in  $(ls ${MAIN_DIR}/ARCH | grep "fcm$" ) 
    6464do 
    6565zvar1=${file#arch-} 
     
    7171 
    7272if [ "$1" == "all" ]; then 
    73    for dir  in  $(ls ${MAIN_DIR}/ARCH | grep -v fcm ) 
     73   for dir  in  $(ls ${MAIN_DIR}/ARCH | grep -v "fcm$" ) 
    7474   do  
    7575      echo "Available compilers at ${dir} :" 
    76       for file in  $(ls ${MAIN_DIR}/ARCH/${dir} | grep  fcm ) 
     76      for file in  $(ls ${MAIN_DIR}/ARCH/${dir} | grep "fcm$" ) 
    7777      do 
    7878      zvar1=${file#arch-} 
     
    8484elif [ -d ${MAIN_DIR}/ARCH/${1} ]; then 
    8585      echo "Available compilers at $1 :" 
    86       for file in  $(ls ${MAIN_DIR}/ARCH/$1 | grep fcm ) 
     86      for file in  $(ls ${MAIN_DIR}/ARCH/$1 | grep "fcm$" ) 
    8787      do 
    8888      zvar1=${file#arch-} 
     
    9393else 
    9494      echo "Available consortium member sub-directories :" 
    95       for dir  in  $(ls ${MAIN_DIR}/ARCH | grep -v fcm ) 
     95      for dir  in  $(ls ${MAIN_DIR}/ARCH | grep -v "fcm$" ) 
    9696      do 
    9797         echo ${dir} 
  • branches/2013/dev_r3858_NOC_ZTC/NEMOGCM/TOOLS/MISCELLANEOUS/chk_iomput.sh

    r2404 r4258  
    3535       echo ' --insrc              only print all variable definitions found in the source code' 
    3636       echo 'Examples' 
    37        echo '      chk_iomput.sh' 
    38        echo '      chk_iomput.sh --help' 
    39        echo '      chk_iomput.sh ../../CONFIG/ORCA2_LIM/EXP00/iodef.xml "../../NEMO/OPA_SRC/ ../../NEMO/LIM_SRC_2/"' 
     37       echo '      ./chk_iomput.sh' 
     38       echo '      ./chk_iomput.sh --help' 
     39       echo '      ./chk_iomput.sh ../../CONFIG/ORCA2_LIM/EXP00/iodef.xml "../../NEMO/OPA_SRC/ ../../NEMO/LIM_SRC_2/"' 
    4040       echo 
    4141       exit ;; 
     
    5959#------------------------------------------------ 
    6060# 
    61 [ $inxml -eq 1 ] && grep "< *field * id *=" $xmlfile 
     61external=$( grep -c "<field_definition  *\([^ ].* \)*src=" $xmlfile ) 
     62if [ $external -eq 1 ] 
     63then 
     64    xmlfield_def=$( grep "<field_definition  *\([^ ].* \)*src=" $xmlfile | sed -e 's/.*src="\([^"]*\)".*/\1/' ) 
     65    xmlfield_def=$( dirname $xmlfile )/$xmlfield_def    
     66else 
     67    xmlfield_def=$xmlfile 
     68fi 
     69[ $inxml -eq 1 ] && grep "< *field  *\([^ ].* \)*id *=" $xmlfield_def 
    6270[ $insrc -eq 1 ] && find $srcdir -name "*.[Ffh]90" -exec grep -iH "^[^\!]*call  *iom_put *(" {} \; 
    6371[ $(( $insrc + $inxml )) -ge 1 ] && exit 
     
    7179# list of variables used in "CALL iom_put" 
    7280# 
    73 varlistsrc=$( find $srcdir -name "*.[Ffh]90" -exec grep -i  "^[^\!]*call  *iom_put *(" {} \; | sed -e "s/.*iom_put *( *[\"\']\([^\"\']*\)[\"\'] *,.*/\1/" | sort -d ) 
     81badvarsrc=$( find $srcdir -name "*.[Ffh]90" -exec grep -i  "^[^\!]*call  *iom_put *(" {} \; | sed -e "s/.*iom_put *( *[\"\']\([^\"\']*\)[\"\'] *,.*/\1/" | grep -ic iom_put ) 
     82if [ $badvarsrc -ne 0 ] 
     83then 
     84    echo "The following call to iom_put cannot be checked" 
     85    echo 
     86    find $srcdir -name "*.[Ffh]90" -exec grep -i  "^[^\!]*call  *iom_put *(" {} \; | sed -e "s/.*iom_put *( *[\"\']\([^\"\']*\)[\"\'] *,.*/\1/" | grep -i iom_put | sort -d  
     87    echo 
     88fi 
     89varlistsrc=$( find $srcdir -name "*.[Ffh]90" -exec grep -i  "^[^\!]*call  *iom_put *(" {} \; | sed -e "s/.*iom_put *( *[\"\']\([^\"\']*\)[\"\'] *,.*/\1/" | grep -vi iom_put | sort -d ) 
    7490# 
    7591# list of variables defined in the xml file 
    7692# 
    77 varlistxml=$( grep "< *field * id *=" $xmlfile  | sed -e "s/^.*< *field * id *= *[\"\']\([^\"\']*\)[\"\'].*/\1/" | sort -d ) 
     93varlistxml=$( grep "< *field  *\([^ ].* \)*id *=" $xmlfield_def  | sed -e "s/^.*< *field .*id *= *[\"\']\([^\"\']*\)[\"\'].*/\1/" | sort -d ) 
    7894# 
    7995# list of variables to be outputed in the xml file 
    8096# 
    81 varlistout=$( grep "< *field * ref *=" $xmlfile  | sed -e "s/^.*< *field * ref *= *[\"\']\([^\"\']*\)[\"\'].*/\1/" | sort -d ) 
     97varlistout=$( grep "< *field  *\([^ ].* \)*field_ref *=" $xmlfile  | sed -e "s/^.*< *field .*field_ref *= *[\"\']\([^\"\']*\)[\"\'].*/\1/" | sort -d ) 
    8298# 
    8399echo "--------------------------------------------------" 
    84100echo  check if all iom_put found in $srcdir 
    85 echo  have a corresponding variable definition in $xmlfile 
     101echo  have a corresponding variable definition in $xmlfield_def 
    86102echo "--------------------------------------------------" 
    87103for var in $varlistsrc 
     
    90106    if [ $tst -ne 1 ]  
    91107    then 
    92    echo "problem with $var: $tst lines corresponding to its definition in $xmlfile, but defined in the code in" 
     108   echo "problem with $var: $tst lines corresponding to its definition in $xmlfield_def, but defined in the code in" 
    93109   for f in $srclist 
    94110   do 
  • branches/2013/dev_r3858_NOC_ZTC/NEMOGCM/TOOLS/maketools

    r3294 r4258  
    146146 
    147147#- When used for the first time, choose a compiler --- 
    148 . ${COMPIL_DIR}/Fcheck_archfile.sh arch_tools.fcm ${CMP_NAM} || exit 
     148. ${COMPIL_DIR}/Fcheck_archfile.sh arch_tools.fcm nocpp ${CMP_NAM} || exit 
    149149 
    150150#- Choose a default tool if needed --- 
Note: See TracChangeset for help on using the changeset viewer.