source: CONFIG/UNIFORM/v7/IPSLCM7/compile_ipslcm7.sh @ 6629

Last change on this file since 6629 was 6629, checked in by falletti, 10 months ago

Adding a compilation check on Jean-Zay, to be sure that we compile on jean-za-pp (_work configurations)

  • Property svn:executable set to *
File size: 23.2 KB
RevLine 
[5479]1#!/bin/bash
2# Default options
3#
4#
5#
6date
7#### 1  Set up the compiling options
8#### Define some directories
9submitdir=$( pwd )
10modipsl=$submitdir/../..
11arch_path=$submitdir/ARCH
12mysrc_path=$submitdir/SOURCES
13export ROOT=$modipsl/modeles/DYNAMICO
14#### Set default options
15# Resolution if compiling LMDZ in regular mode without DYNAMICO
16# Use for example following "./compile_icolmdzor.sh -regular_latlon 144x142x79"
17regular_latlon=no
18# Atmospheric resolution, for LMDZ/ORCHIDEE in regular mode
19resol_atm=144x142x79
20# Coupled with ocean biogeochemistry (y/n)
[6346]21nemotop=y
[5479]22# Optimization mode
23# optmode=prod/dev/debug
24optmode=prod
25# Resolution if compiling LMDZ in regular mode without DYNAMICO
26# Use for example following "./compile_icolmdzor.sh -regular_latlon 144x142x79"
27regular_latlon=no
28# fcm_arch
29fcm_arch=default
30# Default values to be overritten
31parallel=mpi_omp
32export fcm_arch parallel xios
33full_flag=""
34full_nemo=n
35full_inca=""
36full_xios=""
37full_lmdz=""
38full_orch=""
39full_dyna=""
[6296]40# choose radiative code compilation option
41rad=rrtm
42opt_rad=""
[6544]43#choose chemistry inca configuration
44optchimie=GES
[6462]45
46# orchversion tells if ORCHIDEE_2_2 or ORCHIDEE_trunk is compiled. This is used as argument and also in the suffix of the executables.
47# orchcomp is the key word needed for LMDZ for the compilation of coherent interface. Only used internal to the compilation script.
48orchversion=orch22
49orchcomp=orchidee2.1
50
[5479]51# Default netcdf_lib is used for XIOS but can be change by argument
52netcdf_lib=""
53
54# Output text file for compilation of each component
55datestr=`LC_ALL=C date +"%Y%m%dT%H%M"`
56outfile=$submitdir/out_compile_ipslcm7.$datestr
57echo > $outfile
58echo; echo "Text output from compilation will be stored in file out_compile_ipslcm7.$datestr"; echo
59
[6538]60
61echo "create out_compile_ipslcm7 link "
62rm -f out_compile_ipslcm7
63ln -s ${outfile} out_compile_ipslcm7
64
65
66
[5479]67#### Read arguments
68# Loop over all arguments to modify default set up
69while (($# > 0)) ; do
70    case $1 in
71        "-h") cat <<end_help
72########################################################################
73# Usage of the script compile_ipslcm7.sh
74#
75########################################################################
76
77./compile_ipslcm7.sh [Options]
78
79
80Options: [-full] Full recompilation of all components. This option can be added to all other options.
81         [-cleannemo] Full recompilation of NEMO component only.
82         [-regular_latlon]
83         [-debug / -dev / -prod] Level of optimization. One of these can be added to all other compile options. Default: -prod.
84
85
86Example 1: Default compilation of IPSLCM7 for resolution LR
[6346]87          (Resolution atmos: nbp40 )
[5479]88./compile_ipslcm7.sh
89
[6346]90Example 2: Default resolution (LR) compiled in debug mode
[5479]91./compile_ipslcm7.sh -debug
92
93Example 3: Default compilation with full recompilation of all components. No clean is needed.
94./compile_ipslcm7.sh -full
95
96Example 4: Compilation of LMDZ in regular lat-lon for dimension 144x142x79.
[6462]97           The dimension can be changed to any other 3d dimension. DYNAMICO is also compiled as default.
[5479]98./compile_ipslcm7.sh -regular_latlon 144x142x79
99
[6462]100Example 5: Compiltion of ORCHIDEE_trunk version
101           Note that for compiling ORCHIDEE trunk you must first have extracted ORCHIDEE_trunk folder in modeles.
102           modeles/ORCHIDEE_2_2 folder can be kept at the same time.
103./compile_ipslcm7.sh -orch4
104./compile_ipslcm7.sh -regular_latlon 144x142x79 -orch4
105
[6544]106
107Example 6: compilation of a specific chemistry for INCA (default is GES)
108./compile_ipslcm7.sh -chimie NMHC_AER_S
109
[5479]110end_help
111            exit;;
112
113        "-parallel")   parallel=$2 ; shift ; shift ;;
114        "-arch")       fcm_arch="$2" ; shift ; shift ;;
115        "-debug")      optmode=debug ; shift ;;
116        "-dev")        optmode=dev ; shift ;;
117        "-prod")       optmode=prod ; shift ;;
118        "-regular_latlon")  regular_latlon=yes ; resol_atm=$2 ; shift ; shift ;;
119        "-full")       full_flag="-full"; full_nemo=y ; full_xios="--full" ; full_lmdz="-full" ; full_orch="-full" ; shift ;;
120        "-full_xios")  full_xios="--full" ; shift ;;  # Note only full_xios is using double dash: --full
121        "-full_lmdz")  full_lmdz="-full"  ; shift ;;
122        "-full_orch")  full_orch="-full"  ; shift ;;
123        "-full_nemo")  full_nemo=y ; shift ;;
124        "-full_inca")  full_inca="-clean"; shift ;;
[6560]125        "-full_dyna")  full_dyna="-full" ; shift ;;     
[5479]126        "-cleannemo")  full_nemo=y ; shift ;;
[6296]127        "-rad")        rad=$2; shift ; shift ;;
[6472]128        "-orch22")     orchversion="orch22"; orchcomp=orchidee2.1; shift ;;
129        "-orch4")      orchversion="orch4"; orchcomp=orchideetrunk; shift ;;
[6544]130        "-chimie")     optchimie=$2; shift ; shift;;
[5479]131        *)             echo "unknown option "$1" , exiting..." ; exit
132    esac
133done
134
135echo "Following options are set in current compiling:" >> $outfile
136echo "   regular_latlon=$regular_latlon (if yes, then resol_atm=${resol_atm})" >> $outfile 
[6346]137echo "   resol_atm=${resol_atm}, resol_oce=${resol_oce}, icemodel=${icemodel}, nemotop=${nemotop}" >> $outfile 
[5479]138echo "   optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch " >> $outfile 
139echo "   full_flag=$full_flag, full_xios=$full_xios, full_lmdz=$full_lmdz, full_orch=$full_orch, full_nemo=$full_nemo, full_dyna=$full_dyna" >> $outfile 
140echo >> $outfile
141
142### Read host dependent default values
143### These variables will not be changed if they were set as argument
144###./host.sh $host
145# Later : Following lines should be set in host.sh file
146# begin host.sh
147if [ $fcm_arch == default ] ; then
148    # Find out current host and source specific paths and commands for the host
149    case $( hostname -s ) in
150        jean-zay*)
[6629]151            if [[ $( hostname -s ) != *"pp"* ]] ; then
152                echo "Warning! You MUST compile on jean-zay-pp."
153                echo "EXIT"
154                exit
155            else
156                fcm_arch=X64_JEANZAY
157            fi ;;
[5479]158        irene170|irene171|irene190|irene191|irene192|irene193)
159            fcm_arch=X64_IRENE;;
160        irene172|irene173|irene194|irene195)
161            fcm_arch=X64_IRENE-AMD;;
162        asterix*|obelix*)
163            fcm_arch=ifort_LSCE
164            if [ "${parallel}" == "mpi_omp" ] ; then
165                echo "Warning!! Currently at Obelix hybrid mode is not possible."
166                echo "          Option -parallel mpi_omp is now changed to -parallel mpi"
167                echo ""
168                parallel=mpi
169            else
170                echo "You used -parallel" $parallel
171            fi ;;
[6296]172        spirit*)
173            fcm_arch=ifort_MESOIPSL;;
[5479]174        ciclad*|climserv*|loholt*|camelot*)
175            fcm_arch=ifort_CICLAD;;
176        *)
177            echo Current host is not known. You must use option -arch to specify which architecuture files to use.
178            echo Exit now.
179            exit
180    esac
181fi
182
183# Set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch.
184# The link arch.env is also set in config.card and will be used by libIGCM to ensure the same running environnement.
185if [ -f ARCH/arch-${fcm_arch}.env ] ; then
186    echo >> $outfile
187    echo "The file ARCH/arch-${fcm_arch}.env will now be sourced with modules needed for compilation for all components."
[6296]188    echo "Note that this new environement might be kept after compilation."
189    echo "If this is the case, source again your personal environment after compilation."
190    echo " Personal module list before sourcing of ARCH/arch.env file:"    >> $outfile 
191    module list   >> $outfile 2>&1
192    svn_version=$(module list -t | grep subversion)
193       
[5479]194    # Make a link to this file, to be used also in config.card
195    rm -f ARCH/arch.env
196    ln -s arch-${fcm_arch}.env ARCH/arch.env
197
198    # Source the file
[6296]199    source ARCH/arch.env   >> $outfile 2>&1
200    if [ X$svn_version != X ] ; then
201        module load ${svn_version}
202    fi
203    echo >> $outfile
204    echo " New module list after sourcing of ARCH/arch.env file:"    >> $outfile 
205    module list   >> $outfile 2>&1
[5479]206fi
207
[6462]208
209#### Clean if full_orch
210# If full recompilation of ORCHIDEE then first clean modipsl/lib folder
211if [ X${full_orch} == X"-full" ] ; then
212   rm -f $modipsl/lib/*
213fi
214
[5479]215#### 2 Do the compilation
216## 2.1 Compile ioipsl
217cd $modipsl/modeles/IOIPSL
218echo; echo "NOW COMPILE IOIPSL"
219echo >> $outfile ; echo " NOW COMPILE IOIPSL"   >> $outfile 
220
221echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag   >> $outfile 
222     ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag   >> $outfile 2>&1
223# Test if compiling succeded
224if [[ $? != 0 ]] ; then
225    echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP"
226    exit
227fi
228
229## 2.2 Compile oasis3-mct
230cd $modipsl/oasis3-mct/util/make_dir
231echo; echo "NOW COMPILE OASIS3-MCT"
232echo >> $outfile ; echo " NOW COMPILE OASIS3-MCT"   >> $outfile
233cp $mysrc_path/OASIS3-MCT/make_${fcm_arch} make.inc
234
235echo make -f TopMakefileOasis3 >> $outfile
236     make -f TopMakefileOasis3 >> $outfile 2>&1
237
238
239## 2.3 Compile xios
240cd $modipsl/modeles/XIOS
241echo; echo "NOW COMPILE XIOS"
242echo >> $outfile ; echo " NOW COMPILE XIOS"   >> $outfile 
243echo ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios   >> $outfile 
244     ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios   >> $outfile 2>&1
245# Test if compiling succeded
246if [[ $? != 0 ]] ; then
247    echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP"
248    exit
249fi
250# Move executables to modipsl/bin
251if [ -f $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then
252    mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/xios_server_${optmode}.exe
253else
254    echo "THERE IS A PROBLEM IN XIOS COMPILATION EXECUTABLE MISSING - STOP"
255    exit
256fi
257
258
[6462]259## 2.4 Compile ORCHIDEE
260# Choose ORCHIDEE version to compile and create a link to generic folder name ORCHIDEE.
261# This link is needed for the compilation of ICOSA_LMDZ for it to find the orchidee librarie.
262cd $modipsl/modeles
263rm -f ORCHIDEE
264if [ $orchversion == orch22 ] ; then
265    ln -s ORCHIDEE_2_2 ORCHIDEE
266    cd $modipsl/modeles/ORCHIDEE_2_2
267    echo; echo "NOW COMPILE ORCHIDEE_2_2"
268    echo >> $outfile ; echo " NOW COMPILE ORCHIDEE_2_2"   >> $outfile 
269else
270    ln -s ORCHIDEE_trunk ORCHIDEE
271    cd $modipsl/modeles/ORCHIDEE_trunk
272    echo; echo "NOW COMPILE ORCHIDEE_trunk v4"
273    echo >> $outfile ; echo " NOW COMPILE ORCHIDEE_trunk v4"   >> $outfile 
274fi
[5479]275
276# Check if the compilation of ORCHIDEE was previsouly interupted prematured.
277# In that case, the files fcm.bld.lock exist. If the file exist, it is here removed to avoid makeorchidee_fcm
278# to ask question and wait for interactivly answer from the user.
279if [ -f build/fcm.bld.lock ] ; then
280    echo >> $outfile
281    echo " WARNING!! The file ORCHIDEE/build/fcm.bld.lock exist. "   >> $outfile
282    echo "           This means that the compilation is either currently on going in another terminal was previous interupted before the end."   >> $outfile
283    echo "           The file will now be removed. "   >> $outfile
284    echo >> $outfile
285    rm -f build/fcm.bld.lock
286fi
287
[6462]288echo    ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch  >> $outfile 
289        ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch  >> $outfile 2>&1
[5479]290# Test if compiling finished
291if [[ $? != 0 ]] ; then
292    echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP"
293    exit
294fi
295
[6462]296# Rename exetubles for ORCHIDEE offline driver with suffix version
297cd $modipsl/bin
298if [ -f orchideedriver ] ; then mv orchideedriver orchideedriver.$orchversion ; fi
299if [ -f orchidee_ol ] ; then mv orchidee_ol orchidee_ol.$orchversion ; fi
[5479]300
[6462]301
[5479]302## 2.5 Compile NEMO
[6346]303nemo_root=$modipsl/modeles/NEMO
304cfg_ref=ORCA2_ICE_PISCES
305cfg_wrk=ORCA_ICE_TRC
306addkeys="key_oasis3 key_top key_si3 key_isf"
307delkeys=""
308
309if [ ${nemotop} == n ] ; then
310   cfg_wrk=ORCA_ICE
311   delkeys="key_top"
[5479]312fi
313
[6346]314if [ ${nemotop} == n ] ; then
315   echo; echo "NOW COMPILE NEMO with ice model SI3 without passive tracer model TOP"
316   echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 without passive tracer model TOP"   >> $outfile
[5479]317else
[6346]318   echo; echo "NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP"
319   echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP"   >> $outfile
[5479]320fi
[6346]321
[5479]322echo >> $outfile ; echo cd $nemo_root  >> $outfile
[6346]323echo >> $outfile ; echo cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/.   >> $outfile
[5479]324echo >> $outfile
325
[6346]326cd $nemo_root ; cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/.
[5479]327
[6346]328# creation of config
329echo >> $outfile ; echo cd $nemo_root  >> $outfile
330echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j0 add_key "$addkeys"  del_key "$delkeys"   >> $outfile
331echo >> $outfile
332cd $nemo_root
333./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j0  add_key "$addkeys"  del_key "$delkeys"  >> $outfile 2>&1
[5479]334
[6346]335
336# Copy of specfic source files
337echo >> $outfile ; echo cp $mysrc_path/NEMO/*.*90  $nemo_root/cfgs/$cfg_wrk/MY_SRC/.   >> $outfile
[5479]338echo >> $outfile
[6346]339cp $mysrc_path/NEMO/*.*90  $nemo_root/cfgs/$cfg_wrk/MY_SRC/.
[5479]340
[6346]341
[5479]342if [ $full_nemo == y ] ; then
343   # To make a full compilation, first make a clean to remove all files produced during previous compilation
[6346]344   echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref clean   >> $outfile
[5479]345   echo >> $outfile
[6346]346   ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref clean  >> $outfile 2>&1
[5479]347fi
[6346]348echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j8  >> $outfile
[5479]349echo >> $outfile
[6346]350./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j8  >> $outfile 2>&1
[5479]351
352echo >> $outfile
353echo "Move nemo executable to modipsl/bin" >> $outfile
[6346]354echo ls -lrt $nemo_root/cfgs/$cfg_wrk/BLD/bin   >> $outfile
355ls -lrt $nemo_root/cfgs/$cfg_wrk/BLD/bin  >> $outfile
[5479]356echo >> $outfile
357
[6346]358if [ -f $nemo_root/cfgs/$cfg_wrk/BLD/bin/nemo.exe ] ; then
359   mv $nemo_root/cfgs/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa_${optmode}.exe
360else
361    echo "ERROR nemo.exe executable does not exist."
362    echo "THERE IS A PROBLEM IN NEMO COMPILATION - STOP"
363    exit
[5479]364fi
365
[6462]366
[6544]367##2.6  Compile INCA
368    cd $modipsl/modeles/INCA
369
370    echo; echo "NOW COMPILE INCA ${optchimie}"
[6588]371    echo >> $outfile ; echo " NOW COMPILE INCA ${optchimie}"   >> $outfile 
372   
[6544]373    echo ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch}  -arch_path $arch_path $full_flag  >> $outfile
374    ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp  -j 8 -arch ${fcm_arch} -arch_path $arch_path  $full_flag >> $outfile 2>&1
375
376    # Test if compiling finished
377    if [[ $? != 0 ]] ; then
378        echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP"
379        echo "ALL INFORMATION IN FILE $outfile"
380        exit
381    fi
382
383    echo "Move inca.dat modipsl/bin"
384    if [[ -f $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat ]] ;  then 
385        mv $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat $modipsl/bin/inca_${optchimie}.dat ;
386    else
387        echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP"
388        echo "ALL INFORMATION IN FILE $outfile"
389        exit   
390    fi
391
392    echo "Move tracer.def to  modipsl/bin"
393    if [[ -f $modipsl/modeles/INCA/tracer.def ]] ;  then
394        mv $modipsl/modeles/INCA/tracer.def $modipsl/bin/tracer_${optchimie}.def ;
395    fi
396
397
398
399## 2.7 Compile LMDZ
[5479]400cd $modipsl/modeles/LMDZ
401# Compile LMDZ as library to couple to DYNAMICO
402echo; echo "NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO"
403echo >> $outfile ; echo " NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO"   >> $outfile 
[6462]404
[6296]405# Retrieve the final svn release number, needed for radiative code suffix of executable
406lmdzsvn=`svnversion . | egrep -o "[0-9]+"  | awk 'NR==1'`
[5479]407# Temporary use of SOURCES/LMDZ to handle modifications needed by IPSLCM7
[6565]408cp $mysrc_path/LMDZ/phylmd/*.*90  libf/phylmd/.
409cp $mysrc_path/LMDZ/dyn3d_common/*.*90  libf/dyn3d_common/.
[5479]410
411# Check if the compilation of LMDZ was previsouly interupted prematured.
412# In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm
413# to ask question and wait for interactivly answer from the user.
414if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then
415  echo >> $outfile
416  echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. "   >> $outfile
417  echo "           This means that the compilation is either currently on going in another terminal was previous interupted before the end."   >> $outfile
418  echo "           The files dimension.h and .lock will now be removed. "   >> $outfile
419  echo >> $outfile
420  rm -f libf/grid/dimensions.h
421  rm -f .lock
422fi
423
[6296]424# Need to define the proper option for radiative code compilation. By default, we use rrtm
425case $rad in
426    oldrad) opt_rad="" ;;
427    rrtm)   if [ $lmdzsvn -le 4185 ] ; then opt_rad="-rrtm true" ; else opt_rad="-rad rrtm" ; fi ;;
428    ecrad)  opt_rad="-rad ecrad" ;;
429    *) echo Only oldrad rrtm ecrad for rad option ; exit
430esac
431
432if [ $lmdzsvn -le 4185 -a $rad = "ecrad" ] ; then echo "ecrad only available for LMDZ rev starting with 4186 " ; exit ; fi
433
[6544]434echo ./makelmdz_fcm -p lmd -c OMCT $opt_rad -$optmode -mem -parallel $parallel -libphy -v $orchcomp -chimie INCA  -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz    >> $outfile 
435     ./makelmdz_fcm -p lmd -c OMCT $opt_rad -$optmode -mem -parallel $parallel -libphy -v $orchcomp -chimie INCA  -io xios -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz    >> $outfile 2>&1
[5479]436# Test if compiling finished
437if [[ $? != 0 ]] ; then
438    echo "THERE IS A PROBLEM IN LMDZ PHYSICS COMPILATION - STOP"
439    exit
440fi
441
442
[6544]443## 2.8 Compile DYNAMICO
[5479]444cd $modipsl/modeles/DYNAMICO
445echo; echo "NOW COMPILE DYNAMICO "
446echo >> $outfile ; echo " NOW COMPILE DYNAMICO"   >> $outfile 
447
[6296]448echo ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl -with_oasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna    >> $outfile 
449     ./make_icosa -$optmode -with_fcm1 -parallel $parallel -external_ioipsl -with_oasis -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_dyna    >> $outfile 2>&1
[5479]450# Test if compiling finished
451if [[ $? != 0 ]] ; then
452    echo "THERE IS A PROBLEM IN DYNAMICO COMPILATION - STOP"
453    exit
454fi
455
[6462]456
[6544]457## 2.9 Compile interface ICOSA_LMDZ
[5479]458cd $modipsl/modeles/ICOSA_LMDZ
459echo; echo "NOW COMPILE ICOSA_LMDZ "
460echo >> $outfile ; echo " NOW COMPILE ICOSA_LMDZ"   >> $outfile 
461
[6544]462echo ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_oasis -with_orchidee -with_inca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna    >> $outfile 
463     ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_oasis -with_orchidee -with_inca -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_dyna    >> $outfile 2>&1
[5479]464# Test if compiling finished
465if [[ $? != 0 ]] ; then
466    echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION - STOP"
467    exit
468fi
469# Move executables to modipsl/bin
470if [ -f $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe ] ; then
[6544]471    mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe
472    #create link to be use by IPSLCM and LMDZOR without any change in the executable name
473    cd  $modipsl/bin
474    rm -f icosa_lmdz_${orchversion}_${optmode}.exe
475    ln -s icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe icosa_lmdz_${orchversion}_${optmode}.exe
[5479]476else
477    echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION EXECUTABLE MISSING - STOP"
478    exit
479fi
480
481
482
[6544]483## 2.10 Compile LMDZ for regular latlon configuration
[5479]484if [ $regular_latlon = yes ] ; then
485
486    cd $modipsl/modeles/LMDZ
487    # Compile LMDZ regular lat-lon exectuable
488    echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}"
489    echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}"   >> $outfile 
490    # Check if the compilation of LMDZ was previsouly interupted prematured.
491    # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm
492    # to ask question and wait for interactivly answer from the user.
493    if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then
494        echo >> $outfile
495        echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. "   >> $outfile
496        echo "           This means that the compilation is either currently on going in another terminal was previous interupted before the end."   >> $outfile
497        echo "           The files dimension.h and .lock will now be removed. "   >> $outfile
498        echo >> $outfile
499        rm -f libf/grid/dimensions.h
500        rm -f .lock
501    fi
[6544]502    echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -p lmd $opt_rad -$optmode -mem -parallel $parallel -chimie INCA  -io xios -v $orchcomp -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 
503         ./makelmdz_fcm -d ${resol_atm} -c OMCT -p lmd $opt_rad -$optmode -mem -parallel $parallel -chimie INCA  -io xios -v $orchcomp -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz gcm    >> $outfile 2>&1
[5479]504    # Test if compiling finished
505    if [[ $? != 0 ]] ; then
506        echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP"
507        exit
508    fi
509
[6457]510    # Find executable suffix
511    suffix=_${resol_atm}_phylmd
512    if [ $lmdzsvn -ge 4186 ] ; then suffix=${suffix}_${rad} ; fi
513    if [ $parallel == seq ] || [ $parallel == none ] ; then
[6544]514        suffix=${suffix}_seq_orch_inca.e
[6457]515    else
[6544]516        suffix=${suffix}_para_mem_orch_couple_inca.e
[6457]517    fi
518    echo gcm suffix = $suffix
519   
[6462]520    # Move executables to modipsl/bin folder
[6457]521    echo "Move gcm.e executable to modipsl/bin"
522    if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ;  then
[6544]523        mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e
524        #create link to be use by IPSLCM and LMDZOR without any change in the executable name
525        cd $modipsl/bin
526        rm -f gcm_${resol_atm}_${orchversion}_${optmode}.e
527        ln -s gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e gcm_${resol_atm}_${orchversion}_${optmode}.e
[6457]528    else
529        echo "ERROR gcm${suffix} executable does not exist." 
530        echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP"
531        exit
[6462]532    fi   
533
[6588]534    # Find executable suffix
535    suffix=_${resol_atm}_phylmd
536    if [ $lmdzsvn -ge 4186 ] ; then suffix=${suffix}_${rad} ; fi
537    if [ $parallel == seq ] || [ $parallel == none ] ; then
538        suffix=${suffix}_seq_orch.e
539    else
540        suffix=${suffix}_para_mem_orch_couple.e
541    fi
542    echo ce0l suffix = $suffix
543 
[5479]544    # Compile ce0l initialization program for LMDZ regular lat-lon exectuable
[6544]545    cd $modipsl/modeles/LMDZ
[5479]546    echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}"
547    echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}"   >> $outfile 
548
[6536]549    echo ./makelmdz_fcm -d ${resol_atm} -c OMCT -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $orchcomp -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 
550         ./makelmdz_fcm -d ${resol_atm} -c OMCT -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v $orchcomp -arch $fcm_arch -arch_path $arch_path -j 8 $full_lmdz ce0l    >> $outfile 2>&1
[5479]551    # Test if compiling finished
552    if [[ $? != 0 ]] ; then
553        echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP"
554        exit
555    fi
[6462]556   
557 
[6457]558    # Move executable ce0l to modipsl/bin folder
559    echo "Move ce0l executable to modipsl/bin"
[5479]560    if [ -f $modipsl/modeles/LMDZ/bin/ce0l${suffix} ] ;  then
561        mv $modipsl/modeles/LMDZ/bin/ce0l${suffix} $modipsl/bin/ce0l_${resol_atm}_${optmode}.e
562    else
563        echo "ERROR ce0l${suffix} executable does not exist." 
564        echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP"
565        exit
566    fi
567fi
568
569echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile
570echo ls -lrt modipsl/bin >> $outfile
571ls -lrt $modipsl/bin >> $outfile
572
573echo; echo "ALL COMPILING FINISHED" ; echo
574echo "Executables are found in modipsl/bin"
575echo "Check that executable names correspond with the name set in config.card before launching the job"
576echo ls -lrt modipsl/bin
577ls -lrt $modipsl/bin
578
579date
580
581exit
582
583
Note: See TracBrowser for help on using the repository browser.