source: CONFIG/UNIFORM/v7/ICOLMDZOR_v7/compile_icolmdzor.sh @ 4275

Last change on this file since 4275 was 4275, checked in by jgipsl, 2 years ago

Move gloabl ARCH folder to be search for in current folder. Note that the ARCH folder is still on the HEAT svn.

  • Property svn:executable set to *
File size: 6.1 KB
Line 
1#!/bin/bash
2#set -vx
3# Default options
4#
5#
6#
7#### 1  Set up the compiling options
8#### Define some directories
9submitdir=$( pwd )
10modipsl=$submitdir/../..
11echo modipsl=$modipsl 
12echo submitdir=$submitdir
13arch_path=$submitdir/ARCH
14export ROOT=$modipsl/modeles/DYNAMICO
15
16#### 1.1 Set default options
17# Optimization mode
18# optmode=prod/dev/debug
19optmode=prod
20# Resolution if compiling LMDZ in regular mode without DYNAMICO
21regular_latlon=no
22# fcm_arch
23fcm_arch=default
24# Default values to be overritten
25parallel=mpi
26export fcm_arch parallel xios
27full_flag=""
28
29#### 1.2 Read arguments
30# Loop over all arguments to modify default set up
31while (($# > 0)) ; do
32case $1 in
33"-h") cat <<fin
34
35########################################################################
36# Usage of the script compile_config
37#
38########################################################################
39
40./compile_config [Options]
41
42Options
43....
44
45Example 1 : ...
46...
47
48fin
49exit;;
50
51"-parallel")
52parallel=$2 ; shift ; shift ;;
53               
54"-arch")
55fcm_arch="$2" ; shift ; shift ;;
56
57"-xios")
58xios="$2" ; shift ; shift ;;
59
60"-optmode")
61optmode=$2 ; shift ; shift ;;
62
63"-regular_latlon")
64regular_latlon=$2 ; shift ; shift ;;
65
66"-full")
67full_flag="-full"; shift ;;
68*)
69echo "unknown option "$2" , exiting..."
70exit
71esac
72done
73echo full_flag=$full_flag
74
75### 1.3 Read host dependent default values
76###     These variables will not be changed if they were set as argument
77###./host.sh $host
78# Later : Following lines should be set in host.sh file
79# begin host.sh
80if [ $fcm_arch == default ] ; then
81# Find out current host and source specific paths and commands for the host
82case $( hostname -s ) in
83ada*)
84fcm_arch=X64_ADA;;
85irene*)
86fcm_arch=X64_IRENE;
87source /ccc/cont003/home/igcmg/igcmg/MachineEnvironment/irene/env_irene ;;
88asterix*|obelix*)
89fcm_arch=ifort_LSCE;;
90*)
91echo Current host is not known. You must use option -fcm_arch to specify which architecuture files to use.
92echo Exit now.
93exit
94esac
95fi
96
97##### End host.sh
98echo
99echo Following arguments are set in current compiling:
100echo "   optmode = $optmode, parallel = $parallel, fcm_arch = $fcm_arch, full_flag=$full regular_latlon=$regular_latlon"
101
102#### 2 Do the compilation
103## 2.1 Compile ioipsl
104cd $modipsl/modeles/IOIPSL
105echo; echo NOW COMPILE IOIPSL
106echo ./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag
107./makeioipsl_fcm -$optmode -parallel -arch ${fcm_arch} -arch_path $arch_path -j 8 $full_flag
108# Test if compiling succeded
109if [[ $? != 0 ]] ; then
110  echo "THERE IS A PROBLEM IN IOIPSL COMPILATION - STOP"
111  exit
112fi
113
114## 2.2 Compile xios
115cd $modipsl/modeles/XIOS
116echo; echo NOW COMPILE XIOS
117echo ./make_xios --$optmode --arch $fcm_arch --arch_path $arch_path --job 8 $full_flag
118./make_xios --$optmode --arch $fcm_arch --arch_path $arch_path --job 8 $full_flag
119# Test if compiling succeded
120if [[ $? != 0 ]] ; then
121  echo "THERE IS A PROBLEM IN XIOS COMPILATION - STOP"
122  exit
123fi
124
125## 2.3 Compile orchidee
126cd $modipsl/modeles/ORCHIDEE
127echo; echo NOW COMPILE ORCHIDEE
128echo    ./makeorchidee_fcm -j 8 -parallel $parallel -$optmode -arch ${fcm_arch} $full_flag -driver
129./makeorchidee_fcm -j 8 -parallel $parallel -$optmode -arch ${fcm_arch} $full_flag -driver
130# Test if compiling finished
131if [[ $? != 0 ]] ; then
132    echo "THERE IS A PROBLEM IN ORCHIDEE COMPILATION - STOP"
133    exit
134fi
135
136
137## 2.5 Compile lmdz
138cd $modipsl/modeles/LMDZ
139if [ ${regular_latlon} = no ] ; then
140    # Compile as library to couple to DYNAMICO
141    echo; echo NOW COMPILE LMDZ FOR COUPLING TO DYNAMICO
142    echo ./makelmdz_fcm -p lmd -rrtm true -$optmode -mem -parallel $parallel -libphy -v orchidee2.1 -io xios -arch $fcm_arch -j 8 $full_flag
143    ./makelmdz_fcm -p lmd -rrtm true -$optmode -mem -parallel $parallel -libphy -v orchidee2.1 -io xios -arch $fcm_arch -j 8 $full_flag
144else
145    # Compile regular lat-lon exectuable
146    echo; echo NOW COMPILE LMDZ REGULAR LAT-LON MODE. Resolution = ${regular_latlon}
147    echo ./makelmdz_fcm -d ${regular_latlon} -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_flag gcm
148    ./makelmdz_fcm -d ${regular_latlon} -p lmd -rrtm true -$optmode -mem -parallel $parallel -io xios -v orchidee2.1 -arch $fcm_arch -arch_path $arch_path -j 8 $full_flag gcm
149fi
150
151# Test if compiling finished
152if [[ $? != 0 ]] ; then
153    echo "THERE IS A PROBLEM IN LMDZ COMPILATION - STOP"
154    exit
155fi
156
157# Compile DYNAMICO
158echo; echo NOW COMPILE DYNAMICO
159cd $modipsl/modeles/DYNAMICO
160echo ./make_icosa -$optmode -parallel $parallel -external_ioipsl -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_flag
161./make_icosa -$optmode -parallel $parallel -external_ioipsl -with_xios -arch $fcm_arch -arch_path $arch_path -job 8 $full_flag
162# Test if compiling finished
163if [[ $? != 0 ]] ; then
164  echo "THERE IS A PROBLEM IN DYNAMICO COMPILATION - STOP"
165  exit
166fi
167
168# Compile interface ICOSA_LMDZ
169echo; echo NOW COMPILE ICOSA_LMDZ
170cd $modipsl/modeles/ICOSA_LMDZ
171echo ./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_orchidee -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_flag
172
173./make_icosa_lmdz -nodeps -p lmd -$optmode -parallel $parallel -with_orchidee -arch ${fcm_arch} -arch_path ${arch_path} -job 8 $full_flag
174# Test if compiling finished
175if [[ $? != 0 ]] ; then
176  echo "THERE IS A PROBLEM IN ICOSA_LMDZ COMPILATION - STOP"
177  exit
178fi
179
180# Move executables to modipsl/bin folder
181echo "Move executables to modipsl/bin"
182if [ $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe ] ; then mv $modipsl/modeles/ICOSA_LMDZ/bin/icosa_lmdz.exe $modipsl/bin/. ; fi
183if [ $modipsl/modeles/XIOS/bin/xios_server.exe ] ; then mv $modipsl/modeles/XIOS/bin/xios_server.exe $modipsl/bin/. ; fi
184
185
186# Write resolution into .resol file
187if [ $regular_latlon != no ] ; then
188    # Copy executable
189# Find executable suffix
190if [ $parallel == seq ] || [ $parallel == none ] ; then
191    suffix=_seq
192else
193    suffix=_para
194fi
195suffix=${suffix}_orch
196echo suffix = $suffix
197   
198
199    # Write .resol file
200    cd $submitdir   
201    resol2D=$( echo ${regular_latlon} | awk '-Fx' '{print $1}' )$( echo ${regular_latlon} | awk '-Fx' '{print $2}' )
202    echo "noORCAxLMD$resol2D" >.resol
203    echo "RESOL_ATM_3D=${regular_latlon}" >>.resol
204fi
205
206echo
207echo ALL COMPILING FINISHED
208echo
209exit
210
211
Note: See TracBrowser for help on using the repository browser.