Changeset 1279 for LMDZ4/trunk/makelmdz_fcm
- Timestamp:
- Dec 10, 2009, 10:02:56 AM (15 years ago)
- Location:
- LMDZ4/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ4/trunk
- Property svn:mergeinfo changed
/LMDZ4/branches/LMDZ4-dev merged: 1150-1162,1164-1193,1195-1231,1234-1235,1237-1240,1242-1274,1276
- Property svn:mergeinfo changed
-
LMDZ4/trunk/makelmdz_fcm
r1146 r1279 1 #!/bin/ csh2 # 3 # $Header$4 # 1 #!/bin/bash 2 # $Id$ 3 # This is a script in Bash. 4 5 5 # FH : on ne crée plus le fichier arch.mk qui est supposé exister par 6 6 # FH : ailleurs. … … 11 11 # FH : arch.mk en lançant une première fois makegcm. 12 12 # 13 set verbose echo 13 ##set -x 14 14 ######################################################################## 15 15 # options par defaut pour la commande make 16 16 ######################################################################## 17 17 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 18 dim="96x72x19" 19 physique=lmd 20 filtre=filtrez 21 grille=reg 22 couple=false 23 veget=false 24 chimie=false 25 parallel=none 26 compil_mod=prod 27 io=ioipsl 28 LIBPREFIX="" 29 fcm_path=none 30 cosp=false 31 32 LMDGCM=`/bin/pwd` 33 LIBOGCM=$LMDGCM/libo 34 LIBFGCM=$LMDGCM/libf 34 35 35 36 ######################################################################## … … 37 38 ######################################################################## 38 39 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="" 40 CPP_KEY="" 41 INCLUDE="" 42 LIB="" 43 adjnt="" 44 COMPIL_FFLAGS="%PROD_FFLAGS" 45 PARA_FFLAGS="" 46 PARA_LD="" 47 EXT_SRC="" 46 48 47 49 ######################################################################## … … 49 51 ######################################################################## 50 52 51 top: 52 if ($#argv > 0) then 53 switch ($1:q) 54 55 case -h: 56 cat <<fin 53 while (($# > 0)) 54 do 55 case $1 in 56 "-h") cat <<fin 57 57 manuel complet sur http://... 58 58 Usage : … … 74 74 [-link LINKS] : liens optionels avec d'autres librairies 75 75 [-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 76 77 -arch nom_arch : nom de l'architecture cible 77 78 exec : exécutable généré 78 79 fin 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 152 done 147 153 148 154 ############################################################### 149 155 # mettre le chemin du fcm dans le path 150 156 ############################################################### 151 if ( "$fcm_path" != 'none' ) then 152 setenv PATH ${fcm_path}:${PATH} 153 endif 157 if [[ "$fcm_path" != "none" ]] 158 then 159 export PATH=${fcm_path}:${PATH} 160 fi 154 161 155 162 echo "Chemin du fcm utlise :" … … 159 166 # lecture des chemins propres à l'architecture de la machine # 160 167 ############################################################### 161 162 rm -f ./arch.path 163 ln -s ./arch/arch-${arch}.path ./arch.path 168 rm -f .void_file 169 echo > .void_file 170 rm -f arch.path 171 ln -s arch/arch-${arch}.path ./arch.path 164 172 source arch.path 165 173 … … 169 177 ######################################################################## 170 178 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 179 if [[ "$compil_mod" == "prod" ]] 180 then 181 COMPIL_FFLAGS="%PROD_FFLAGS" 182 elif [[ "$compil_mod" == "dev" ]] 183 then 184 COMPIL_FFLAGS="%DEV_FFLAGS" 185 elif [[ "$compil_mod" == "debug" ]] 186 then 187 COMPIL_FFLAGS="%DEBUG_FFLAGS" 188 fi 189 190 if [[ "$physique" != "nophys" ]] 191 then 182 192 #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" 194 fi 195 196 if [[ "$chimie" == "INCA" ]] 197 then 198 CPP_KEY="$CPP_KEY INCA" 199 INCLUDE="$INCLUDE -I${INCA_INCDIR}" 200 LIB="$LIB -L${INCA_LIBDIR} -lchimie" 201 fi 202 203 if [[ "$couple" != "false" ]] 204 then 205 CPP_KEY="$CPP_KEY CPP_COUPLE" 206 INCLUDE="$INCLUDE -I${OASIS_INCDIR}" 207 LIB="$LIB -L${OASIS_LIBDIR} -lpsmile.${couple} -lmpp_io" 208 fi 209 210 if [[ "$parallel" == "mpi" ]] 211 then 212 CPP_KEY="$CPP_KEY CPP_PARA CPP_MPI" 213 PARA_FFLAGS="%MPI_FFLAGS" 214 PARA_LD="%MPI_LD" 215 elif [[ "$parallel" == "omp" ]] 216 then 217 CPP_KEY="$CPP_KEY CPP_PARA CPP_OMP" 218 PARA_FFLAGS="%OMP_FFLAGS" 219 PARA_LD="%OMP_LD" 220 elif [[ "$parallel" == "mpi_omp" ]] 221 then 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" 225 fi 226 227 if [[ ( "$parallel" == "omp" || "$parallel" == "mpi_omp" ) \ 228 && "$compil_mod" == "debug" ]] 229 then 230 echo "Usually, parallelization with OpenMP requires some optimization." 231 echo "We suggest switching to \"-dev\"." 232 fi 233 234 if [[ "$veget" == "true" ]] 235 then 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" 239 fi 240 241 if [[ $io == ioipsl ]] 242 then 243 CPP_KEY="$CPP_KEY CPP_IOIPSL" 244 INCLUDE="$INCLUDE -I${IOIPSL_INCDIR}" 245 LIB="$LIB -L${IOIPSL_LIBDIR} -l${LIBPREFIX}ioipsl" 246 fi 247 if [[ "$cosp" == "true" ]] 248 then 249 CPP_KEY="$CPP_KEY CPP_COSP" 250 INCLUDE="$INCLUDE -I$(LIBFGCM)/cosp" 251 # LIB="${LIB} -l${LIBPREFIX}cosp" 252 fi 253 INCLUDE="$INCLUDE -I${NETCDF_INCDIR}" 254 LIB="$LIB -L${NETCDF_LIBDIR} -lnetcdf" 226 255 227 256 ######################################################################## … … 230 259 231 260 232 setdim_full=$dim233 setdim=`echo $dim | sed -e 's/[^0-9]/ /g'`234 set dimc=`echo $dim | wc -w`235 261 dim_full=$dim 262 dim=`echo $dim | sed -e 's/[^0-9]/ /g'` 263 set $dim 264 dimc=$# 236 265 echo calcul de la dimension 237 266 echo dim $dim … … 254 283 ######################################################################## 255 284 256 setdimension=`echo $dim | wc -w`285 dimension=`echo $dim | wc -w` 257 286 echo dimension $dimension 258 287 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 288 if (( $dimension == 3 )) 289 then 265 290 cd $LIBFGCM/grid 266 291 \rm fxyprim.h 267 292 cp -p fxy_${grille}.h fxyprim.h 268 endif 293 else 294 echo "Probleme dans les dimensions de la dynamique !!" 295 echo "Non reactive pour l'instant !!!" 296 fi 269 297 270 298 ###################################################################### … … 273 301 ###################################################################### 274 302 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 277 307 # \rm -f $libf/phy$physique/raddim.h 278 308 # cp -p $libf/phy$physique/raddim.$dimh.h $libf/phy$physique/raddim.h … … 283 313 # echo le fichier $libf/phy$physique/raddim.$dimh.h 284 314 # \cp -p $libf/phy$physique/raddim.defaut.h $libf/phy$physique/raddim.h 285 # endif286 # endif315 # fi 316 #fi 287 317 288 318 ###################################################################### … … 290 320 ###################################################################### 291 321 292 if ( `expr $dimc \> 2` == 1 ) then 293 set filtre="FILTRE=$filtre" 322 if (( `expr $dimc \> 2` == 1 )) 323 then 324 filtre="FILTRE=$filtre" 294 325 else 295 setfiltre="FILTRE= L_FILTRE= "296 endif 326 filtre="FILTRE= L_FILTRE= " 327 fi 297 328 echo MACRO FILTRE $filtre 298 329 … … 306 337 307 338 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 339 SUFF_NAME=_${dim_full} 340 SUFF_NAME=${SUFF_NAME}_phy${physique} 341 342 if [[ "$parallel" != "none" ]] 343 then 344 SUFF_NAME=${SUFF_NAME}_para 345 DYN=dyn${dimc}dpar 314 346 else 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 349 fi 350 351 if [[ $veget == "true" ]] 352 then 353 SUFF_NAME=${SUFF_NAME}_orch 354 fi 355 356 if [[ $couple != "false" ]] 357 then 358 SUFF_NAME=${SUFF_NAME}_couple 359 fi 360 361 if [[ $chimie == "INCA" ]] 362 then 363 SUFF_NAME=${SUFF_NAME}_inca 364 fi 330 365 331 366 cd $LMDGCM 332 setconfig_fcm="config.fcm"367 config_fcm="config.fcm" 333 368 rm -f $config_fcm 334 369 touch $config_fcm 335 370 rm -f bin/${code}${SUFF_NAME}.e 336 371 rm -f arch.fcm 372 rm -f arch.opt 337 373 338 374 echo "%ARCH $arch" >> $config_fcm … … 350 386 echo "%PARA_FFLAGS $PARA_FFLAGS" >> $config_fcm 351 387 echo "%PARA_LD $PARA_LD" >> $config_fcm 388 echo "%EXT_SRC $EXT_SRC" >> $config_fcm 352 389 353 390 354 391 355 392 ln -s arch/arch-${arch}.fcm arch.fcm 393 if test -f arch/arch-${arch}.opt && [ $compil_mod = "prod" ] 394 then 395 ln -s arch/arch-${arch}.opt arch.opt 396 else 397 ln -s .void_file arch.opt 398 fi 399 400 356 401 rm -f $LIBOGCM/${arch}${SUFF_NAME}/.config/fcm.bld.lock 357 402 ./build_gcm 358 403 359 rm - f tmp_src360 rm - f config404 rm -rf tmp_src 405 rm -rf config 361 406 ln -s $LIBOGCM/${arch}${SUFF_NAME}/.config config 362 407 ln -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.