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

Last change on this file since 6625 was 6588, checked in by acosce, 11 months ago

add new suffix for ce0l exe in IPSLCM7 (because we don't use inca for its compilation)

  • Property svn:executable set to *
File size: 23.0 KB
Line 
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)
21nemotop=y
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=""
40# choose radiative code compilation option
41rad=rrtm
42opt_rad=""
43#choose chemistry inca configuration
44optchimie=GES
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
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
60
61echo "create out_compile_ipslcm7 link "
62rm -f out_compile_ipslcm7
63ln -s ${outfile} out_compile_ipslcm7
64
65
66
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
87          (Resolution atmos: nbp40 )
88./compile_ipslcm7.sh
89
90Example 2: Default resolution (LR) compiled in debug mode
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.
97           The dimension can be changed to any other 3d dimension. DYNAMICO is also compiled as default.
98./compile_ipslcm7.sh -regular_latlon 144x142x79
99
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
106
107Example 6: compilation of a specific chemistry for INCA (default is GES)
108./compile_ipslcm7.sh -chimie NMHC_AER_S
109
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 ;;
125        "-full_dyna")  full_dyna="-full" ; shift ;;     
126        "-cleannemo")  full_nemo=y ; shift ;;
127        "-rad")        rad=$2; shift ; shift ;;
128        "-orch22")     orchversion="orch22"; orchcomp=orchidee2.1; shift ;;
129        "-orch4")      orchversion="orch4"; orchcomp=orchideetrunk; shift ;;
130        "-chimie")     optchimie=$2; shift ; shift;;
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 
137echo "   resol_atm=${resol_atm}, resol_oce=${resol_oce}, icemodel=${icemodel}, nemotop=${nemotop}" >> $outfile 
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*)
151            fcm_arch=X64_JEANZAY;;
152        irene170|irene171|irene190|irene191|irene192|irene193)
153            fcm_arch=X64_IRENE;;
154        irene172|irene173|irene194|irene195)
155            fcm_arch=X64_IRENE-AMD;;
156        asterix*|obelix*)
157            fcm_arch=ifort_LSCE
158            if [ "${parallel}" == "mpi_omp" ] ; then
159                echo "Warning!! Currently at Obelix hybrid mode is not possible."
160                echo "          Option -parallel mpi_omp is now changed to -parallel mpi"
161                echo ""
162                parallel=mpi
163            else
164                echo "You used -parallel" $parallel
165            fi ;;
166        spirit*)
167            fcm_arch=ifort_MESOIPSL;;
168        ciclad*|climserv*|loholt*|camelot*)
169            fcm_arch=ifort_CICLAD;;
170        *)
171            echo Current host is not known. You must use option -arch to specify which architecuture files to use.
172            echo Exit now.
173            exit
174    esac
175fi
176
177# Set a link to arch.env if arch-${fcm_arch}.env file exist for current fcm_arch.
178# The link arch.env is also set in config.card and will be used by libIGCM to ensure the same running environnement.
179if [ -f ARCH/arch-${fcm_arch}.env ] ; then
180    echo >> $outfile
181    echo "The file ARCH/arch-${fcm_arch}.env will now be sourced with modules needed for compilation for all components."
182    echo "Note that this new environement might be kept after compilation."
183    echo "If this is the case, source again your personal environment after compilation."
184    echo " Personal module list before sourcing of ARCH/arch.env file:"    >> $outfile 
185    module list   >> $outfile 2>&1
186    svn_version=$(module list -t | grep subversion)
187       
188    # Make a link to this file, to be used also in config.card
189    rm -f ARCH/arch.env
190    ln -s arch-${fcm_arch}.env ARCH/arch.env
191
192    # Source the file
193    source ARCH/arch.env   >> $outfile 2>&1
194    if [ X$svn_version != X ] ; then
195        module load ${svn_version}
196    fi
197    echo >> $outfile
198    echo " New module list after sourcing of ARCH/arch.env file:"    >> $outfile 
199    module list   >> $outfile 2>&1
200fi
201
202
203#### Clean if full_orch
204# If full recompilation of ORCHIDEE then first clean modipsl/lib folder
205if [ X${full_orch} == X"-full" ] ; then
206   rm -f $modipsl/lib/*
207fi
208
209#### 2 Do the compilation
210## 2.1 Compile ioipsl
211cd $modipsl/modeles/IOIPSL
212echo; echo "NOW COMPILE IOIPSL"
213echo >> $outfile ; echo " NOW COMPILE IOIPSL"   >> $outfile 
214
215echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag   >> $outfile 
216     ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag   >> $outfile 2>&1
217# Test if compiling succeded
218if [[ $? != 0 ]] ; then
219    echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP"
220    exit
221fi
222
223## 2.2 Compile oasis3-mct
224cd $modipsl/oasis3-mct/util/make_dir
225echo; echo "NOW COMPILE OASIS3-MCT"
226echo >> $outfile ; echo " NOW COMPILE OASIS3-MCT"   >> $outfile
227cp $mysrc_path/OASIS3-MCT/make_${fcm_arch} make.inc
228
229echo make -f TopMakefileOasis3 >> $outfile
230     make -f TopMakefileOasis3 >> $outfile 2>&1
231
232
233## 2.3 Compile xios
234cd $modipsl/modeles/XIOS
235echo; echo "NOW COMPILE XIOS"
236echo >> $outfile ; echo " NOW COMPILE XIOS"   >> $outfile 
237echo ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios   >> $outfile 
238     ./make_xios --use_oasis oasis3_mct --$optmode --arch $fcm_arch --arch_path $arch_path ${netcdf_lib} --job 4 $full_xios   >> $outfile 2>&1
239# Test if compiling succeded
240if [[ $? != 0 ]] ; then
241    echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP"
242    exit
243fi
244# Move executables to modipsl/bin
245if [ -f $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then
246    mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/xios_server_${optmode}.exe
247else
248    echo "THERE IS A PROBLEM IN XIOS COMPILATION EXECUTABLE MISSING - STOP"
249    exit
250fi
251
252
253## 2.4 Compile ORCHIDEE
254# Choose ORCHIDEE version to compile and create a link to generic folder name ORCHIDEE.
255# This link is needed for the compilation of ICOSA_LMDZ for it to find the orchidee librarie.
256cd $modipsl/modeles
257rm -f ORCHIDEE
258if [ $orchversion == orch22 ] ; then
259    ln -s ORCHIDEE_2_2 ORCHIDEE
260    cd $modipsl/modeles/ORCHIDEE_2_2
261    echo; echo "NOW COMPILE ORCHIDEE_2_2"
262    echo >> $outfile ; echo " NOW COMPILE ORCHIDEE_2_2"   >> $outfile 
263else
264    ln -s ORCHIDEE_trunk ORCHIDEE
265    cd $modipsl/modeles/ORCHIDEE_trunk
266    echo; echo "NOW COMPILE ORCHIDEE_trunk v4"
267    echo >> $outfile ; echo " NOW COMPILE ORCHIDEE_trunk v4"   >> $outfile 
268fi
269
270# Check if the compilation of ORCHIDEE was previsouly interupted prematured.
271# In that case, the files fcm.bld.lock exist. If the file exist, it is here removed to avoid makeorchidee_fcm
272# to ask question and wait for interactivly answer from the user.
273if [ -f build/fcm.bld.lock ] ; then
274    echo >> $outfile
275    echo " WARNING!! The file ORCHIDEE/build/fcm.bld.lock exist. "   >> $outfile
276    echo "           This means that the compilation is either currently on going in another terminal was previous interupted before the end."   >> $outfile
277    echo "           The file will now be removed. "   >> $outfile
278    echo >> $outfile
279    rm -f build/fcm.bld.lock
280fi
281
282echo    ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch  >> $outfile 
283        ./makeorchidee_fcm -j 8 -xios -parallel $parallel -$optmode -arch ${fcm_arch} -arch_path $arch_path $full_orch  >> $outfile 2>&1
284# Test if compiling finished
285if [[ $? != 0 ]] ; then
286    echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP"
287    exit
288fi
289
290# Rename exetubles for ORCHIDEE offline driver with suffix version
291cd $modipsl/bin
292if [ -f orchideedriver ] ; then mv orchideedriver orchideedriver.$orchversion ; fi
293if [ -f orchidee_ol ] ; then mv orchidee_ol orchidee_ol.$orchversion ; fi
294
295
296## 2.5 Compile NEMO
297nemo_root=$modipsl/modeles/NEMO
298cfg_ref=ORCA2_ICE_PISCES
299cfg_wrk=ORCA_ICE_TRC
300addkeys="key_oasis3 key_top key_si3 key_isf"
301delkeys=""
302
303if [ ${nemotop} == n ] ; then
304   cfg_wrk=ORCA_ICE
305   delkeys="key_top"
306fi
307
308if [ ${nemotop} == n ] ; then
309   echo; echo "NOW COMPILE NEMO with ice model SI3 without passive tracer model TOP"
310   echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 without passive tracer model TOP"   >> $outfile
311else
312   echo; echo "NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP"
313   echo >> $outfile ; echo " NOW COMPILE NEMO with ice model SI3 and passive tracer model TOP"   >> $outfile
314fi
315
316echo >> $outfile ; echo cd $nemo_root  >> $outfile
317echo >> $outfile ; echo cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/.   >> $outfile
318echo >> $outfile
319
320cd $nemo_root ; cp $mysrc_path/NEMO/arch-${fcm_arch}.fcm arch/CNRS/.
321
322# creation of config
323echo >> $outfile ; echo cd $nemo_root  >> $outfile
324echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j0 add_key "$addkeys"  del_key "$delkeys"   >> $outfile
325echo >> $outfile
326cd $nemo_root
327./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j0  add_key "$addkeys"  del_key "$delkeys"  >> $outfile 2>&1
328
329
330# Copy of specfic source files
331echo >> $outfile ; echo cp $mysrc_path/NEMO/*.*90  $nemo_root/cfgs/$cfg_wrk/MY_SRC/.   >> $outfile
332echo >> $outfile
333cp $mysrc_path/NEMO/*.*90  $nemo_root/cfgs/$cfg_wrk/MY_SRC/.
334
335
336if [ $full_nemo == y ] ; then
337   # To make a full compilation, first make a clean to remove all files produced during previous compilation
338   echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref clean   >> $outfile
339   echo >> $outfile
340   ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref clean  >> $outfile 2>&1
341fi
342echo ./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j8  >> $outfile
343echo >> $outfile
344./makenemo -m ${fcm_arch} -n $cfg_wrk -r $cfg_ref -j8  >> $outfile 2>&1
345
346echo >> $outfile
347echo "Move nemo executable to modipsl/bin" >> $outfile
348echo ls -lrt $nemo_root/cfgs/$cfg_wrk/BLD/bin   >> $outfile
349ls -lrt $nemo_root/cfgs/$cfg_wrk/BLD/bin  >> $outfile
350echo >> $outfile
351
352if [ -f $nemo_root/cfgs/$cfg_wrk/BLD/bin/nemo.exe ] ; then
353   mv $nemo_root/cfgs/$cfg_wrk/BLD/bin/nemo.exe $modipsl/bin/opa_${optmode}.exe
354else
355    echo "ERROR nemo.exe executable does not exist."
356    echo "THERE IS A PROBLEM IN NEMO COMPILATION - STOP"
357    exit
358fi
359
360
361##2.6  Compile INCA
362    cd $modipsl/modeles/INCA
363
364    echo; echo "NOW COMPILE INCA ${optchimie}"
365    echo >> $outfile ; echo " NOW COMPILE INCA ${optchimie}"   >> $outfile 
366   
367    echo ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp -j 8 -arch ${fcm_arch}  -arch_path $arch_path $full_flag  >> $outfile
368    ./makeinca_fcm -chimie ${optchimie} -$optmode -xios -parallel mpi_omp  -j 8 -arch ${fcm_arch} -arch_path $arch_path  $full_flag >> $outfile 2>&1
369
370    # Test if compiling finished
371    if [[ $? != 0 ]] ; then
372        echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP"
373        echo "ALL INFORMATION IN FILE $outfile"
374        exit
375    fi
376
377    echo "Move inca.dat modipsl/bin"
378    if [[ -f $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat ]] ;  then 
379        mv $modipsl/modeles/INCA/SIMULATIONS/${optchimie}/inca.dat $modipsl/bin/inca_${optchimie}.dat ;
380    else
381        echo "THERE IS A PROBLEM IN INCA COMPILATION - STOP"
382        echo "ALL INFORMATION IN FILE $outfile"
383        exit   
384    fi
385
386    echo "Move tracer.def to  modipsl/bin"
387    if [[ -f $modipsl/modeles/INCA/tracer.def ]] ;  then
388        mv $modipsl/modeles/INCA/tracer.def $modipsl/bin/tracer_${optchimie}.def ;
389    fi
390
391
392
393## 2.7 Compile LMDZ
394cd $modipsl/modeles/LMDZ
395# Compile LMDZ as library to couple to DYNAMICO
396echo; echo "NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO"
397echo >> $outfile ; echo " NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO"   >> $outfile 
398
399# Retrieve the final svn release number, needed for radiative code suffix of executable
400lmdzsvn=`svnversion . | egrep -o "[0-9]+"  | awk 'NR==1'`
401# Temporary use of SOURCES/LMDZ to handle modifications needed by IPSLCM7
402cp $mysrc_path/LMDZ/phylmd/*.*90  libf/phylmd/.
403cp $mysrc_path/LMDZ/dyn3d_common/*.*90  libf/dyn3d_common/.
404
405# Check if the compilation of LMDZ was previsouly interupted prematured.
406# In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm
407# to ask question and wait for interactivly answer from the user.
408if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then
409  echo >> $outfile
410  echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. "   >> $outfile
411  echo "           This means that the compilation is either currently on going in another terminal was previous interupted before the end."   >> $outfile
412  echo "           The files dimension.h and .lock will now be removed. "   >> $outfile
413  echo >> $outfile
414  rm -f libf/grid/dimensions.h
415  rm -f .lock
416fi
417
418# Need to define the proper option for radiative code compilation. By default, we use rrtm
419case $rad in
420    oldrad) opt_rad="" ;;
421    rrtm)   if [ $lmdzsvn -le 4185 ] ; then opt_rad="-rrtm true" ; else opt_rad="-rad rrtm" ; fi ;;
422    ecrad)  opt_rad="-rad ecrad" ;;
423    *) echo Only oldrad rrtm ecrad for rad option ; exit
424esac
425
426if [ $lmdzsvn -le 4185 -a $rad = "ecrad" ] ; then echo "ecrad only available for LMDZ rev starting with 4186 " ; exit ; fi
427
428echo ./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 
429     ./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
430# Test if compiling finished
431if [[ $? != 0 ]] ; then
432    echo "THERE IS A PROBLEM IN LMDZ PHYSICS COMPILATION - STOP"
433    exit
434fi
435
436
437## 2.8 Compile DYNAMICO
438cd $modipsl/modeles/DYNAMICO
439echo; echo "NOW COMPILE DYNAMICO "
440echo >> $outfile ; echo " NOW COMPILE DYNAMICO"   >> $outfile 
441
442echo ./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 
443     ./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
444# Test if compiling finished
445if [[ $? != 0 ]] ; then
446    echo "THERE IS A PROBLEM IN DYNAMICO COMPILATION - STOP"
447    exit
448fi
449
450
451## 2.9 Compile interface ICOSA_LMDZ
452cd $modipsl/modeles/ICOSA_LMDZ
453echo; echo "NOW COMPILE ICOSA_LMDZ "
454echo >> $outfile ; echo " NOW COMPILE ICOSA_LMDZ"   >> $outfile 
455
456echo ./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 
457     ./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
458# Test if compiling finished
459if [[ $? != 0 ]] ; then
460    echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION - STOP"
461    exit
462fi
463# Move executables to modipsl/bin
464if [ -f $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe ] ; then
465    mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe
466    #create link to be use by IPSLCM and LMDZOR without any change in the executable name
467    cd  $modipsl/bin
468    rm -f icosa_lmdz_${orchversion}_${optmode}.exe
469    ln -s icosa_lmdz_${orchversion}_${optmode}_${optchimie}.exe icosa_lmdz_${orchversion}_${optmode}.exe
470else
471    echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION EXECUTABLE MISSING - STOP"
472    exit
473fi
474
475
476
477## 2.10 Compile LMDZ for regular latlon configuration
478if [ $regular_latlon = yes ] ; then
479
480    cd $modipsl/modeles/LMDZ
481    # Compile LMDZ regular lat-lon exectuable
482    echo; echo "NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}"
483    echo >> $outfile ; echo " NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${resol_atm}"   >> $outfile 
484    # Check if the compilation of LMDZ was previsouly interupted prematured.
485    # In that case, the files dimension.h and .lock exist. If the files exist, they are here removed to avoid makelmdz_fcm
486    # to ask question and wait for interactivly answer from the user.
487    if [ -f libf/grid/dimensions.h ] || [ -f .lock ] ; then
488        echo >> $outfile
489        echo " WARNING!! The file LMDZ/libf/grid/dimension.h and/or the LMDZ/.lock exist. "   >> $outfile
490        echo "           This means that the compilation is either currently on going in another terminal was previous interupted before the end."   >> $outfile
491        echo "           The files dimension.h and .lock will now be removed. "   >> $outfile
492        echo >> $outfile
493        rm -f libf/grid/dimensions.h
494        rm -f .lock
495    fi
496    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 
497         ./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
498    # Test if compiling finished
499    if [[ $? != 0 ]] ; then
500        echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP"
501        exit
502    fi
503
504    # Find executable suffix
505    suffix=_${resol_atm}_phylmd
506    if [ $lmdzsvn -ge 4186 ] ; then suffix=${suffix}_${rad} ; fi
507    if [ $parallel == seq ] || [ $parallel == none ] ; then
508        suffix=${suffix}_seq_orch_inca.e
509    else
510        suffix=${suffix}_para_mem_orch_couple_inca.e
511    fi
512    echo gcm suffix = $suffix
513   
514    # Move executables to modipsl/bin folder
515    echo "Move gcm.e executable to modipsl/bin"
516    if [ -f $modipsl/modeles/LMDZ/bin/gcm${suffix} ] ;  then
517        mv $modipsl/modeles/LMDZ/bin/gcm${suffix} $modipsl/bin/gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e
518        #create link to be use by IPSLCM and LMDZOR without any change in the executable name
519        cd $modipsl/bin
520        rm -f gcm_${resol_atm}_${orchversion}_${optmode}.e
521        ln -s gcm_${resol_atm}_${orchversion}_${optmode}_${optchimie}.e gcm_${resol_atm}_${orchversion}_${optmode}.e
522    else
523        echo "ERROR gcm${suffix} executable does not exist." 
524        echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP"
525        exit
526    fi   
527
528    # Find executable suffix
529    suffix=_${resol_atm}_phylmd
530    if [ $lmdzsvn -ge 4186 ] ; then suffix=${suffix}_${rad} ; fi
531    if [ $parallel == seq ] || [ $parallel == none ] ; then
532        suffix=${suffix}_seq_orch.e
533    else
534        suffix=${suffix}_para_mem_orch_couple.e
535    fi
536    echo ce0l suffix = $suffix
537 
538    # Compile ce0l initialization program for LMDZ regular lat-lon exectuable
539    cd $modipsl/modeles/LMDZ
540    echo; echo "NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}"
541    echo >> $outfile ; echo " NOW COMPILE CE0L OF LMDZ. Resolution = ${resol_atm}"   >> $outfile 
542
543    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 
544         ./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
545    # Test if compiling finished
546    if [[ $? != 0 ]] ; then
547        echo "THERE IS A PROBLEM IN CE0L (LMDZ) REGULAR LATLON COMPILATION - STOP"
548        exit
549    fi
550   
551 
552    # Move executable ce0l to modipsl/bin folder
553    echo "Move ce0l executable to modipsl/bin"
554    if [ -f $modipsl/modeles/LMDZ/bin/ce0l${suffix} ] ;  then
555        mv $modipsl/modeles/LMDZ/bin/ce0l${suffix} $modipsl/bin/ce0l_${resol_atm}_${optmode}.e
556    else
557        echo "ERROR ce0l${suffix} executable does not exist." 
558        echo "THERE IS A PROBLEM IN LMDZ REGULAR LATLON COMPILATION - STOP"
559        exit
560    fi
561fi
562
563echo >>$outfile ; echo "ALL COMPILING FINISHED" >> $outfile
564echo ls -lrt modipsl/bin >> $outfile
565ls -lrt $modipsl/bin >> $outfile
566
567echo; echo "ALL COMPILING FINISHED" ; echo
568echo "Executables are found in modipsl/bin"
569echo "Check that executable names correspond with the name set in config.card before launching the job"
570echo ls -lrt modipsl/bin
571ls -lrt $modipsl/bin
572
573date
574
575exit
576
577
Note: See TracBrowser for help on using the repository browser.