Ignore:
Timestamp:
Dec 10, 2009, 10:02:56 AM (15 years ago)
Author:
Laurent Fairhead
Message:

Merged LMDZ4-dev branch changes r1241:1278 into the trunk
Running trunk and LMDZ4-dev in LMDZOR configuration on local
machine (sequential) and SX8 (4-proc) yields identical results
(restart and restartphy are identical binarily)
Log history from r1241 to r1278 is available by switching to
source:LMDZ4/branches/LMDZ4-dev-20091210

Location:
LMDZ4/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ4/trunk

  • LMDZ4/trunk/makelmdz_fcm

    r1146 r1279  
    1 #!/bin/csh
    2 #
    3 # $Header$
    4 #
     1#!/bin/bash
     2# $Id$
     3# This is a script in Bash.
     4
    55# FH : on ne crée plus le fichier arch.mk qui est supposé exister par
    66# FH : ailleurs.
     
    1111# FH : arch.mk en lançant une première fois makegcm.
    1212#
    13 set verbose echo
     13##set -x
    1414########################################################################
    1515# options par defaut pour la commande make
    1616########################################################################
    1717
    18 set dim="96x72x19"
    19 set physique=lmd
    20 set filtre=filtrez
    21 set grille=reg
    22 set couple=false
    23 set veget=false
    24 set chimie=false
    25 set parallel=none
    26 set compil_mod=prod
    27 set io=ioipsl
    28 set LIBPREFIX=""
    29 set fcm_path=none
    30 
    31 set LMDGCM=`/bin/pwd`
    32 set LIBOGCM=$LMDGCM/libo
    33 set LIBFGCM=$LMDGCM/libf
     18dim="96x72x19"
     19physique=lmd
     20filtre=filtrez
     21grille=reg
     22couple=false
     23veget=false
     24chimie=false
     25parallel=none
     26compil_mod=prod
     27io=ioipsl
     28LIBPREFIX=""
     29fcm_path=none
     30cosp=false
     31
     32LMDGCM=`/bin/pwd`
     33LIBOGCM=$LMDGCM/libo
     34LIBFGCM=$LMDGCM/libf
    3435
    3536########################################################################
     
    3738########################################################################
    3839
    39 set CPP_KEY=""
    40 set INCLUDE=""
    41 set LIB=""
    42 set adjnt=""
    43 set COMPIL_FFLAGS="%PROD_FFLAGS"
    44 set PARA_FFLAGS=""
    45 set PARA_LD=""
     40CPP_KEY=""
     41INCLUDE=""
     42LIB=""
     43adjnt=""
     44COMPIL_FFLAGS="%PROD_FFLAGS"
     45PARA_FFLAGS=""
     46PARA_LD=""
     47EXT_SRC=""
    4648
    4749########################################################################
     
    4951########################################################################
    5052
    51 top:
    52 if ($#argv > 0) then
    53     switch ($1:q)
    54 
    55     case -h:
    56 cat <<fin
     53while (($# > 0))
     54  do
     55  case $1 in
     56      "-h") cat <<fin
    5757manuel complet sur http://...
    5858Usage :
     
    7474[-link LINKS]              : liens optionels avec d'autres librairies
    7575[-fcm_path path]           : chemin pour fcm (def: le chemin est suppose deja exister dans le PATH)
     76[-ext_src path]            : chemin d'un repertoire source avec des sources externe a compiler avec le modele
    7677 -arch nom_arch            : nom de l'architecture cible
    7778 exec                      : exécutable généré
    7879fin
    79         exit
    80 
    81     case -d:
    82         set dim=$2 ; shift ; shift ; goto top
    83                        
    84     case -O:
    85         echo "option obsolete dans cette version intermediaire de makegcm"
    86         exit
    87 
    88      case -p
    89         set physique="$2" ;  shift ; shift ; goto top
    90 
    91      case -g
    92         set grille="$2" ; shift ; shift ; goto top
    93 
    94      case -c
    95         set couple="$2" ; shift ; shift ; goto top
    96 
    97      case -prod
    98         set compil_mod="prod" ; shift ; goto top
    99 
    100      case -dev
    101        set compil_mod="dev" ; shift ; goto top
    102 
    103      case -debug
    104        set compil_mod="debug" ; shift ; goto top
    105 
    106      case -io
    107         set io="$2" ; shift ; shift ; goto top
    108 
    109      case -v
    110         set veget="$2" ; shift ; shift ; goto top
    111 
    112      case -chimie
    113         set chimie="$2" ; shift ; shift ; goto top
    114 
    115      case -parallel
    116         set parallel="$2" ; shift ; shift ; goto top
    117  
    118      case -include
    119         set INCLUDE="$INCLUDE -I$2" ; shift ; shift ; goto top
    120 
    121      case -cpp
    122         set CPP_KEY="$CPP_KEY $2" ; shift ; shift ; goto top
    123 
    124      case -adjnt
    125         echo 'otpion a reactiver ';exit
    126         set opt_dep="$opt_dep adjnt" ; set adjnt="-ladjnt -ldyn3d "
    127         set optim="$optim -Dadj" ; shift ; goto top
    128 
    129 
    130      case -filtre
    131         set filtre=$2 ; shift ; shift ; goto top
    132 
    133      case -link
    134         set LIB="$LIB $2" ; shift ; shift ; goto top
    135 
    136      case -fcm_path
    137        set fcm_path=$2 ; shift ; shift ; goto top
    138 
    139      case -arch
    140        set arch=$2 ; shift ; shift ; goto top
    141 
    142      default
    143         set code="$1" ; shift ; goto top
    144 
    145    endsw
    146 endif
     80          exit;;
     81
     82      "-d")
     83          dim=$2 ; shift ; shift ;;
     84     
     85      "-O")
     86          echo "option obsolete dans cette version intermediaire de makegcm"
     87          exit;;
     88
     89      "-p")
     90          physique="$2" ;  shift ; shift ;;
     91
     92      "-g")
     93          grille="$2" ; shift ; shift ;;
     94
     95      "-c")
     96          couple="$2" ; shift ; shift ;;
     97
     98      "-prod")
     99          compil_mod="prod" ; shift ;;
     100
     101      "-dev")
     102          compil_mod="dev" ; shift ;;
     103
     104      "-debug")
     105          compil_mod="debug" ; shift ;;
     106
     107      "-io")
     108          io="$2" ; shift ; shift ;;
     109
     110      "-v")
     111          veget="$2" ; shift ; shift ;;
     112
     113      "-chimie")
     114          chimie="$2" ; shift ; shift ;;
     115
     116      "-parallel")
     117          parallel="$2" ; shift ; shift ;;
     118     
     119      "-include")
     120          INCLUDE="$INCLUDE -I$2" ; shift ; shift ;;
     121
     122      "-cpp")
     123          CPP_KEY="$CPP_KEY $2" ; shift ; shift ;;
     124
     125      "-adjnt")
     126          echo "otpion a reactiver ";exit
     127          opt_dep="$opt_dep adjnt" ; adjnt="-ladjnt -ldyn3d "
     128          optim="$optim -Dadj" ; shift ;;
     129
     130      "-cosp")
     131          cosp="$2" ; shift ; shift ;;
     132
     133
     134      "-filtre")
     135          filtre=$2 ; shift ; shift ;;
     136
     137      "-link")
     138          LIB="$LIB $2" ; shift ; shift ;;
     139
     140      "-fcm_path")
     141          fcm_path=$2 ; shift ; shift ;;
     142
     143      "-ext_src")
     144          EXT_SRC=$2 ; shift ; shift ;;
     145
     146      "-arch")
     147          arch=$2 ; shift ; shift ;;
     148
     149      *)
     150          code="$1" ; shift ;;
     151  esac
     152done
    147153
    148154###############################################################
    149155# mettre le chemin du fcm dans le path
    150156###############################################################
    151 if  ( "$fcm_path" != 'none' ) then
    152     setenv PATH ${fcm_path}:${PATH}
    153 endif
     157if  [[ "$fcm_path" != "none" ]]
     158then
     159    export PATH=${fcm_path}:${PATH}
     160fi
    154161
    155162echo "Chemin du fcm utlise :"
     
    159166# lecture des chemins propres à l'architecture de la machine #
    160167###############################################################
    161 
    162 rm -f ./arch.path
    163 ln -s ./arch/arch-${arch}.path ./arch.path
     168rm -f .void_file
     169echo > .void_file
     170rm -f arch.path
     171ln -s arch/arch-${arch}.path ./arch.path
    164172source arch.path
    165173
     
    169177########################################################################
    170178
    171 if ( "$compil_mod" == 'prod' ) then
    172   set COMPIL_FFLAGS="%PROD_FFLAGS"
    173 else if ( "$compil_mod" == 'dev' ) then
    174   set COMPIL_FFLAGS="%DEV_FFLAGS"
    175 else if ( "$compil_mod" == 'debug' ) then
    176   set COMPIL_FFLAGS="%DEBUG_FFLAGS"
    177 endif
    178 
    179 if ( "$physique" == 'nophys' ) then
    180    
    181 else
     179if [[ "$compil_mod" == "prod" ]]
     180then
     181  COMPIL_FFLAGS="%PROD_FFLAGS"
     182elif [[ "$compil_mod" == "dev" ]]
     183then
     184  COMPIL_FFLAGS="%DEV_FFLAGS"
     185elif [[ "$compil_mod" == "debug" ]]
     186then
     187  COMPIL_FFLAGS="%DEBUG_FFLAGS"
     188fi
     189
     190if [[ "$physique" != "nophys" ]]
     191then
    182192   #Default planet type is Earth
    183    set CPP_KEY="$CPP_KEY CPP_EARTH"
    184 endif
    185 
    186 if ( "$chimie" == 'INCA' ) then
    187    set CPP_KEY="$CPP_KEY INCA"
    188    set INCLUDE="$INCLUDE -I${INCA_INCDIR}"
    189    set LIB="$LIB -L${INCA_LIBDIR} -lchimie"
    190 endif
    191 
    192 if ( "$couple" != 'false' ) then
    193    set CPP_KEY="$CPP_KEY CPP_COUPLE"
    194    set INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
    195    set LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.${couple} -lmpp_io"
    196 endif
    197 
    198 if ( "$parallel" == 'mpi' ) then
    199    set CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI"
    200    set PARA_FFLAGS="%MPI_FFLAGS"
    201    set PARA_LD="%MPI_LD"
    202 else if ("$parallel" == 'omp' ) then
    203    set CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP"
    204    set PARA_FFLAGS="%OMP_FFLAGS"
    205    set PARA_LD="%OMP_LD"
    206 else if ("$parallel" == 'mpi_omp' ) then
    207    set CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP"
    208    set PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS"
    209    set PARA_LD="%MPI_LD %OMP_LD"
    210 endif
    211 
    212 if ( "$veget" == 'true' ) then
    213    set CPP_KEY="$CPP_KEY CPP_VEGET"
    214    set INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
    215    set LIB="${LIB} -L${ORCH_LIBDIR} -l${LIBPREFIX}sechiba -l${LIBPREFIX}parameters -l${LIBPREFIX}stomate -l${LIBPREFIX}parallel -l${LIBPREFIX}orglob"
    216 endif
    217 
    218 if ( $io == ioipsl ) then
    219    set CPP_KEY="$CPP_KEY CPP_IOIPSL"
    220    set INCLUDE="$INCLUDE -I${IOIPSL_INCDIR}"
    221    set LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl"
    222 endif
    223 
    224 set INCLUDE="$INCLUDE -I${NETCDF_INCDIR}"
    225 set LIB="$LIB -L${NETCDF_LIBDIR} -lnetcdf"
     193   CPP_KEY="$CPP_KEY CPP_EARTH"
     194fi
     195
     196if [[ "$chimie" == "INCA" ]]
     197then
     198   CPP_KEY="$CPP_KEY INCA"
     199   INCLUDE="$INCLUDE -I${INCA_INCDIR}"
     200   LIB="$LIB -L${INCA_LIBDIR} -lchimie"
     201fi
     202
     203if [[ "$couple" != "false" ]]
     204then
     205   CPP_KEY="$CPP_KEY CPP_COUPLE"
     206   INCLUDE="$INCLUDE -I${OASIS_INCDIR}"
     207   LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.${couple} -lmpp_io"
     208fi
     209
     210if [[ "$parallel" == "mpi" ]]
     211then
     212   CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI"
     213   PARA_FFLAGS="%MPI_FFLAGS"
     214   PARA_LD="%MPI_LD"
     215elif [[ "$parallel" == "omp" ]]
     216then
     217   CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP"
     218   PARA_FFLAGS="%OMP_FFLAGS"
     219   PARA_LD="%OMP_LD"
     220elif [[ "$parallel" == "mpi_omp" ]]
     221then
     222   CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI CPP_OMP"
     223   PARA_FFLAGS="%MPI_FFLAGS %OMP_FFLAGS"
     224   PARA_LD="%MPI_LD %OMP_LD"
     225fi
     226
     227if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \
     228   && "$compil_mod" == "debug" ]]
     229then
     230    echo "Usually, parallelization with OpenMP requires some optimization."
     231    echo "We suggest switching to \"-dev\"."
     232fi
     233
     234if [[ "$veget" == "true" ]]
     235then
     236   CPP_KEY="$CPP_KEY CPP_VEGET"
     237   INCLUDE="${INCLUDE} -I${ORCH_INCDIR}"
     238   LIB="${LIB} -L${ORCH_LIBDIR} -l${LIBPREFIX}sechiba -l${LIBPREFIX}parameters -l${LIBPREFIX}stomate -l${LIBPREFIX}parallel -l${LIBPREFIX}orglob"
     239fi
     240
     241if [[ $io == ioipsl ]]
     242then
     243   CPP_KEY="$CPP_KEY CPP_IOIPSL"
     244   INCLUDE="$INCLUDE -I${IOIPSL_INCDIR}"
     245   LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl"
     246fi
     247if [[ "$cosp" == "true" ]]
     248then
     249   CPP_KEY="$CPP_KEY CPP_COSP"
     250   INCLUDE="$INCLUDE -I$(LIBFGCM)/cosp"
     251#   LIB="${LIB} -l${LIBPREFIX}cosp"
     252fi
     253INCLUDE="$INCLUDE -I${NETCDF_INCDIR}"
     254LIB="$LIB -L${NETCDF_LIBDIR} -lnetcdf"
    226255
    227256########################################################################
     
    230259
    231260
    232 set dim_full=$dim
    233 set dim=`echo $dim | sed -e 's/[^0-9]/ /g'`
    234 set dimc=`echo $dim | wc -w`
    235 
     261dim_full=$dim
     262dim=`echo $dim | sed -e 's/[^0-9]/ /g'`
     263set $dim
     264dimc=$#
    236265echo calcul de la dimension
    237266echo dim $dim
     
    254283########################################################################
    255284
    256 set dimension=`echo $dim | wc -w`
     285dimension=`echo $dim | wc -w`
    257286echo dimension $dimension
    258287
    259 if ( $dimension != 3 ) then
    260   echo "Probleme dans les dimensions de la dynamique !!"
    261   echo "Non reactive pour l'instant !!!"
    262 endif
    263 
    264 if ( $dimension == 3 ) then
     288if (( $dimension == 3 ))
     289then
    265290  cd $LIBFGCM/grid
    266291  \rm fxyprim.h
    267292  cp -p fxy_${grille}.h fxyprim.h
    268 endif
     293else
     294  echo "Probleme dans les dimensions de la dynamique !!"
     295  echo "Non reactive pour l'instant !!!"
     296fi
    269297
    270298######################################################################
     
    273301######################################################################
    274302
    275 #if ( -f $libf/phy$physique/raddim.h ) then
    276 # if ( -f $libf/phy$physique/raddim.$dimh.h ) then
     303#if [[ -f $libf/phy$physique/raddim.h ]]
     304#then
     305# if [[ -f $libf/phy$physique/raddim.$dimh.h ]]
     306#then
    277307#  \rm -f $libf/phy$physique/raddim.h
    278308#  cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h
     
    283313#  echo le fichier $libf/phy$physique/raddim.$dimh.h
    284314#  \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h
    285 # endif
    286 #endif
     315# fi
     316#fi
    287317
    288318######################################################################
     
    290320######################################################################
    291321
    292 if ( `expr $dimc \> 2` == 1 ) then
    293    set filtre="FILTRE=$filtre"
     322if (( `expr $dimc \> 2` == 1 ))
     323then
     324   filtre="FILTRE=$filtre"
    294325else
    295    set filtre="FILTRE= L_FILTRE= "
    296 endif
     326   filtre="FILTRE= L_FILTRE= "
     327fi
    297328echo MACRO FILTRE $filtre
    298329
     
    306337
    307338
    308 set SUFF_NAME=_${dim_full}
    309 set SUFF_NAME=${SUFF_NAME}_phy${physique}
    310 
    311 if ( "$parallel" != 'none' ) then
    312   set SUFF_NAME=${SUFF_NAME}_para
    313   set DYN=dyn${dimc}dpar
     339SUFF_NAME=_${dim_full}
     340SUFF_NAME=${SUFF_NAME}_phy${physique}
     341
     342if [[ "$parallel" != "none" ]]
     343then
     344  SUFF_NAME=${SUFF_NAME}_para
     345  DYN=dyn${dimc}dpar
    314346else
    315   set SUFF_NAME=${SUFF_NAME}_seq
    316   set DYN=dyn${dimc}d
    317 endif
    318 
    319 if ( $veget == "true" ) then
    320   set SUFF_NAME=${SUFF_NAME}_orch
    321 endif
    322 
    323 if ( $couple != "false" ) then
    324   set SUFF_NAME=${SUFF_NAME}_couple
    325 endif
    326 
    327 if ( $chimie == 'INCA' ) then
    328   set SUFF_NAME=${SUFF_NAME}_inca
    329 endif
     347  SUFF_NAME=${SUFF_NAME}_seq
     348  DYN=dyn${dimc}d
     349fi
     350
     351if [[ $veget == "true" ]]
     352then
     353  SUFF_NAME=${SUFF_NAME}_orch
     354fi
     355
     356if [[ $couple != "false" ]]
     357then
     358  SUFF_NAME=${SUFF_NAME}_couple
     359fi
     360
     361if [[ $chimie == "INCA" ]]
     362then
     363  SUFF_NAME=${SUFF_NAME}_inca
     364fi
    330365
    331366cd $LMDGCM
    332 set config_fcm="config.fcm"
     367config_fcm="config.fcm"
    333368rm -f $config_fcm
    334369touch $config_fcm
    335370rm -f bin/${code}${SUFF_NAME}.e
    336371rm -f arch.fcm
     372rm -f arch.opt
    337373
    338374echo "%ARCH          $arch"          >> $config_fcm
     
    350386echo "%PARA_FFLAGS   $PARA_FFLAGS"   >> $config_fcm
    351387echo "%PARA_LD       $PARA_LD"       >> $config_fcm
     388echo "%EXT_SRC       $EXT_SRC"       >> $config_fcm
    352389
    353390
    354391
    355392ln -s arch/arch-${arch}.fcm arch.fcm
     393if test -f arch/arch-${arch}.opt &&  [ $compil_mod = "prod" ]
     394  then
     395  ln -s arch/arch-${arch}.opt arch.opt
     396else
     397  ln -s .void_file arch.opt
     398fi
     399
     400
    356401rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock
    357402./build_gcm
    358403
    359 rm -f tmp_src
    360 rm -f config
     404rm -rf tmp_src
     405rm -rf config
    361406ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config
    362407ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config/tmp tmp_src
    363 #\rm -f $libf/grid/dimensions.h
Note: See TracChangeset for help on using the changeset viewer.