1 | #!/bin/ksh |
---|
2 | ###################################################### |
---|
3 | # Original : C. Talandier for ESOPA |
---|
4 | # Contact : opatlod@locean-ipsl.upmc.fr |
---|
5 | # |
---|
6 | # This script aims to (for each standard configuration) : |
---|
7 | # - I. Take into account specific files changes |
---|
8 | # - ./modipsl/util/ins_make |
---|
9 | # - ./modipsl/config/NAME_CONFIG/AA_make* |
---|
10 | # - ./modipsl/config/NAME_CONFIG/scripts/BB_make.ldef |
---|
11 | # - II. Build configuration's environment & dependencies |
---|
12 | # - ./modipsl/config/NAME_CONFIG/WORK |
---|
13 | # - ./modipsl/config/NAME_CONFIG/MY_SRC |
---|
14 | # - ./modipsl/config/NAME_CONFIG/scripts/BB_make |
---|
15 | # - III. Build results sub-directories in the OUTDIR |
---|
16 | # directory specified by user just below |
---|
17 | # NEMO_VALID/WNAME_CONFIG/ |
---|
18 | # |-- mon --> MONO run |
---|
19 | # | |-- 1_SHORT |
---|
20 | # | |-- 2_SHORT |
---|
21 | # | |-- LONG |
---|
22 | # | `-- GTIME |
---|
23 | # |-- mpi --> MPI run |
---|
24 | # | |-- 1_SHORT |
---|
25 | # | |-- 2_SHORT |
---|
26 | # | |-- LONG |
---|
27 | # | `-- GTIME |
---|
28 | # `-- omp --> Open-MP run |
---|
29 | # |-- 1_SHORT |
---|
30 | # |-- 2_SHORT |
---|
31 | # |-- LONG |
---|
32 | # `-- GTIME |
---|
33 | # |
---|
34 | # - IV. Modify lance_batch.ksh & assessment.ksh scripts |
---|
35 | # - V. Preliminary compilations |
---|
36 | ###################################################### |
---|
37 | |
---|
38 | #set -xv |
---|
39 | |
---|
40 | ########################################################## |
---|
41 | ##### Begin Users modifications |
---|
42 | ########################################################## |
---|
43 | # OUTDIR : working directory from which jobs will be launched |
---|
44 | # & results stored |
---|
45 | # INPUTD : directory where to get ORCA2_LIM_nemo_v2.tar |
---|
46 | # REFDAT : directory where to get results from reference tags |
---|
47 | # DECOMP : total number of processors which will be used |
---|
48 | # MAIL : give your e-mail |
---|
49 | # UAGRIF : one of the standard configurations is based on AGRIF yes/no |
---|
50 | ########################################################## |
---|
51 | OUTDIR=/Users/ctlod/WORK/AZE/modipsl/config |
---|
52 | INPUTD=/Volumes/FENUA/ORCA2_LIM_nemo_v2_IO |
---|
53 | REFDAT=/Volumes/FENUA/ORCA2_LIM_nemo_v2_IO |
---|
54 | DECOMP=8 |
---|
55 | MAIL="ctlod@locean-ipsl.upmc.fr" |
---|
56 | UAGRIF=yes |
---|
57 | ########################################################## |
---|
58 | ##### End Users modifications |
---|
59 | ########################################################## |
---|
60 | |
---|
61 | |
---|
62 | # Standard configurations |
---|
63 | NBCFG=3 |
---|
64 | CONF[0]=ORCA2_LIM |
---|
65 | CONF[1]=GYRE |
---|
66 | CONF[2]=ZAGRIF |
---|
67 | LCLDIR=`pwd` |
---|
68 | |
---|
69 | # Use a modified modipsl script: ins_make |
---|
70 | # which allows to build Makefiles of a specific configuration |
---|
71 | # using the following syntax: ins_make -w NAME_CONF |
---|
72 | cp ./MODIPSL_FILES/ins_make ../../../util/. |
---|
73 | |
---|
74 | # Set following variable in AA_make.ldef script |
---|
75 | # - WWDIR = directory where to store results and jobs |
---|
76 | CAR_WORK_tmp=$( grep 'WWDIR=' ./CONFIG_FILES/AA_make.ldef ) |
---|
77 | CAR_WORK=`echo $CAR_WORK_tmp | cut -f 1 -d " " ` |
---|
78 | sed -e "s?${CAR_WORK}?WWDIR=${OUTDIR}?" ./CONFIG_FILES/AA_make.ldef > ./CONFIG_FILES/AA_make.ldef.$$ |
---|
79 | mv ./CONFIG_FILES/AA_make.ldef.$$ ./CONFIG_FILES/AA_make.ldef && rm -f ./CONFIG_FILES/AA_make.ldef.$$ |
---|
80 | |
---|
81 | # Get the current target name |
---|
82 | LOCTARG=`../../../util/w_i_h` |
---|
83 | |
---|
84 | # Loop over each standard configuration |
---|
85 | # ##################################### |
---|
86 | ind=0 |
---|
87 | while [ $ind -lt ${NBCFG} ] |
---|
88 | do |
---|
89 | # I. Take into account specific changes |
---|
90 | # ##################################### |
---|
91 | # Set following variables in job_NAME_CONF.ksh script |
---|
92 | # - MAINDIR = directory where to get namelist input files |
---|
93 | # - WORK = directory where to store results |
---|
94 | # - REF_OD = directory where Are stored results from previous tags |
---|
95 | cd ../../../.. ; NAME_ARCH=$( pwd ) ; |
---|
96 | cd ${LCLDIR} |
---|
97 | echo ${NAME_ARCH} |
---|
98 | CAR_MAIN_tmp=$( grep 'MAINDIR=' ./JOBS/job_${CONF[${ind}]}.ksh ) |
---|
99 | CAR_MAIN=`echo $CAR_MAIN_tmp | cut -f 1 -d " " ` |
---|
100 | CAR_WORK_tmp=$( grep 'WORK=' ./JOBS/job_${CONF[${ind}]}.ksh ) |
---|
101 | CAR_WORK=`echo $CAR_WORK_tmp | cut -f 1 -d " " ` |
---|
102 | CAR_REFO_tmp=$( grep 'REF_OD=' ./JOBS/job_${CONF[${ind}]}.ksh | head -1 ) |
---|
103 | CAR_REFO=`echo $CAR_REFO_tmp | cut -f 1 -d " " ` |
---|
104 | sed -e "s?${CAR_MAIN}?MAINDIR=${NAME_ARCH}?" -e "s?${CAR_WORK}?WORK=${OUTDIR}?" \ |
---|
105 | -e "s?${CAR_REFO}?REF_OD=${REFDAT}?" ./JOBS/job_${CONF[${ind}]}.ksh > ./JOBS/job_tmp.$$ |
---|
106 | mv ./JOBS/job_tmp.$$ ./JOBS/job_${CONF[${ind}]}.ksh && rm -f ./JOBS/job_tmp.$$ |
---|
107 | |
---|
108 | # II. Build configuration environment |
---|
109 | # ################################### |
---|
110 | (cd ../ ; ./use_cfg -n ${CONF[${ind}]} ;) |
---|
111 | echo ' ' |
---|
112 | echo ' >>>>>>>> Configuration directories have been built:' |
---|
113 | echo " ./config/${CONF[${ind}]}/WORK" |
---|
114 | echo " ./config/${CONF[${ind}]}/MY_SRC" |
---|
115 | echo ' ' |
---|
116 | |
---|
117 | cp ./CONFIG_FILES/AA_make* ../../${CONF[${ind}]}/. |
---|
118 | cp ./CONFIG_FILES/BB_make.ldef_${CONF[${ind}]} ../../${CONF[${ind}]}/scripts/BB_make.ldef |
---|
119 | |
---|
120 | # Configuration dependencies |
---|
121 | (cd ../../${CONF[${ind}]} ; ../VALID/fait_AA_make ; ) |
---|
122 | echo ' ' |
---|
123 | echo " >>>>>>>> Dependencies file ./config/${CONF[${ind}]}/BB_make have been re-built" |
---|
124 | echo ' ' |
---|
125 | |
---|
126 | # III. Build output sub-directories |
---|
127 | # ################################# |
---|
128 | # Directories from where Jobs will be launched |
---|
129 | # and where results will be stored before analysed |
---|
130 | cd ${OUTDIR} |
---|
131 | if [ ! -d 'NEMO_VALID' ] ; then |
---|
132 | mkdir NEMO_VALID |
---|
133 | fi |
---|
134 | cd NEMO_VALID |
---|
135 | if [ ! -d W${CONF[${ind}]} ] ; then |
---|
136 | mkdir W${CONF[${ind}]} |
---|
137 | fi |
---|
138 | if [ ! -d W${CONF[${ind}]}/mon ] ; then |
---|
139 | mkdir W${CONF[${ind}]}/mon |
---|
140 | fi |
---|
141 | if [ ! -d W${CONF[${ind}]}/mon/LONG ] ; then |
---|
142 | mkdir W${CONF[${ind}]}/mon/LONG |
---|
143 | mkdir W${CONF[${ind}]}/mon/LONG/REF |
---|
144 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mon/LONG/RUN ; fi |
---|
145 | fi |
---|
146 | if [ ! -d W${CONF[${ind}]}/mon/GTIME ] ; then |
---|
147 | mkdir W${CONF[${ind}]}/mon/GTIME |
---|
148 | mkdir W${CONF[${ind}]}/mon/GTIME/REF |
---|
149 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mon/GTIME/RUN ; fi |
---|
150 | fi |
---|
151 | if [ ! -d W${CONF[${ind}]}/mon/1_SHORT ] ; then |
---|
152 | mkdir W${CONF[${ind}]}/mon/1_SHORT |
---|
153 | mkdir W${CONF[${ind}]}/mon/1_SHORT/REF |
---|
154 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mon/1_SHORT/RUN ; fi |
---|
155 | fi |
---|
156 | if [ ! -d W${CONF[${ind}]}/mon/2_SHORT ] ; then |
---|
157 | mkdir W${CONF[${ind}]}/mon/2_SHORT |
---|
158 | mkdir W${CONF[${ind}]}/mon/2_SHORT/REF |
---|
159 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mon/2_SHORT/RUN ; fi |
---|
160 | fi |
---|
161 | if [ ! -d W${CONF[${ind}]}/mpi ] ; then |
---|
162 | mkdir W${CONF[${ind}]}/mpi |
---|
163 | fi |
---|
164 | if [ ! -d W${CONF[${ind}]}/mpi/LONG ] ; then |
---|
165 | mkdir W${CONF[${ind}]}/mpi/LONG |
---|
166 | mkdir W${CONF[${ind}]}/mpi/LONG/REF |
---|
167 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mpi/LONG/RUN ; fi |
---|
168 | fi |
---|
169 | if [ ! -d W${CONF[${ind}]}/mpi/GTIME ] ; then |
---|
170 | mkdir W${CONF[${ind}]}/mpi/GTIME |
---|
171 | mkdir W${CONF[${ind}]}/mpi/GTIME/REF |
---|
172 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mpi/GTIME/RUN ; fi |
---|
173 | fi |
---|
174 | if [ ! -d W${CONF[${ind}]}/mpi/1_SHORT ] ; then |
---|
175 | mkdir W${CONF[${ind}]}/mpi/1_SHORT |
---|
176 | mkdir W${CONF[${ind}]}/mpi/1_SHORT/REF |
---|
177 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mpi/1_SHORT/RUN ; fi |
---|
178 | fi |
---|
179 | if [ ! -d W${CONF[${ind}]}/mpi/2_SHORT ] ; then |
---|
180 | mkdir W${CONF[${ind}]}/mpi/2_SHORT |
---|
181 | mkdir W${CONF[${ind}]}/mpi/2_SHORT/REF |
---|
182 | if [ ${LOCTARG} = 'osxxlf' ] ; then mkdir W${CONF[${ind}]}/mpi/2_SHORT/RUN ; fi |
---|
183 | fi |
---|
184 | if [ ! -d W${CONF[${ind}]}/omp ] ; then |
---|
185 | mkdir W${CONF[${ind}]}/omp |
---|
186 | fi |
---|
187 | if [ ! -d W${CONF[${ind}]}/omp/LONG ] ; then |
---|
188 | mkdir W${CONF[${ind}]}/omp/LONG |
---|
189 | mkdir W${CONF[${ind}]}/omp/LONG/REF |
---|
190 | fi |
---|
191 | if [ ! -d W${CONF[${ind}]}/omp/GTIME ] ; then |
---|
192 | mkdir W${CONF[${ind}]}/omp/GTIME |
---|
193 | mkdir W${CONF[${ind}]}/omp/GTIME/REF |
---|
194 | fi |
---|
195 | if [ ! -d W${CONF[${ind}]}/omp/1_SHORT ] ; then |
---|
196 | mkdir W${CONF[${ind}]}/omp/1_SHORT |
---|
197 | mkdir W${CONF[${ind}]}/omp/1_SHORT/REF |
---|
198 | fi |
---|
199 | if [ ! -d W${CONF[${ind}]}/omp/2_SHORT ] ; then |
---|
200 | mkdir W${CONF[${ind}]}/omp/2_SHORT |
---|
201 | mkdir W${CONF[${ind}]}/omp/2_SHORT/REF |
---|
202 | fi |
---|
203 | echo ' ' |
---|
204 | echo ' >>>>>>>> The following sub-directories have been built ' |
---|
205 | echo ' under main directory '$( pwd ) |
---|
206 | echo ' They are dedicated to store results' |
---|
207 | tree W${CONF[${ind}]} |
---|
208 | echo ' ' |
---|
209 | |
---|
210 | cd ${LCLDIR} |
---|
211 | |
---|
212 | let ind=$ind+1 |
---|
213 | done |
---|
214 | |
---|
215 | |
---|
216 | # IV. Modify lance_batch.ksh & assessment.ksh scripts |
---|
217 | # ################################################### |
---|
218 | # Set following variables in lance_batch.ksh script |
---|
219 | # - IODIR = directory where to get ORCA2_LIM_nemo_v2.tar |
---|
220 | # - PRC = total number of processors which will be used |
---|
221 | |
---|
222 | CAR_INPU_tmp=$( grep 'IODIR=' ./JOBS/lance_batch.ksh ) |
---|
223 | CAR_INPU=`echo $CAR_INPU_tmp | cut -f 1 -d " " ` |
---|
224 | CAR_PROC_tmp=$( grep 'PRC=' ./JOBS/lance_batch.ksh ) |
---|
225 | CAR_PROC=`echo $CAR_PROC_tmp | cut -f 1 -d " " ` |
---|
226 | CAR_TARG_tmp=$( grep 'TARGET=' ./JOBS/lance_batch.ksh | head -1) |
---|
227 | CAR_TARG=`echo $CAR_TARG_tmp | cut -f 1 -d " " ` |
---|
228 | sed -e "s?${CAR_INPU}?IODIR=${INPUTD}?" -e "s?${CAR_PROC}?PRC=${DECOMP}?" \ |
---|
229 | -e "s/${CAR_TARG}/TARGET=${LOCTARG}/" ./JOBS/lance_batch.ksh > ./JOBS/lance_batch.$$ |
---|
230 | mv ./JOBS/lance_batch.$$ ./JOBS/lance_batch.ksh && rm -f ./JOBS/lance_batch.$$ |
---|
231 | chmod 744 ./JOBS/lance_batch.ksh |
---|
232 | |
---|
233 | # Set following variables in assessment.ksh script |
---|
234 | # - TARGET = the current plateform |
---|
235 | # - MAIL = your e-mail |
---|
236 | CAR_TARG_tmp=$( grep 'TARGET=' ./JOBS/assessment.ksh ) |
---|
237 | CAR_TARG=`echo $CAR_TARG_tmp | cut -f 1 -d " " ` |
---|
238 | CAR_MAIL_tmp=$( grep 'EMAIL=' ./JOBS/assessment.ksh ) |
---|
239 | CAR_MAIL=`echo $CAR_MAIL_tmp | cut -f 1 -d " " ` |
---|
240 | sed -e "s/${CAR_TARG}/TARGET=${LOCTARG}/" -e "s/${CAR_MAIL}/EMAIL='${MAIL}'/" \ |
---|
241 | ./JOBS/assessment.ksh > ./JOBS/assessment.$$ |
---|
242 | mv ./JOBS/assessment.$$ ./JOBS/assessment.ksh && rm -f ./JOBS/assessment.$$ |
---|
243 | chmod 744 ./JOBS/assessment.ksh |
---|
244 | |
---|
245 | # V. Preliminary compilations |
---|
246 | # ########################### |
---|
247 | |
---|
248 | # IOIPSL compilation |
---|
249 | ../../../util/ins_make -w IOIPSL |
---|
250 | if [ ${LOCTARG} = 'sx8brodie' ] ; then |
---|
251 | (cd ../../../modeles/IOIPSL/src ; sxgmake ;) |
---|
252 | else |
---|
253 | (cd ../../../modeles/IOIPSL/src ; gmake ;) |
---|
254 | fi |
---|
255 | echo ' ' |
---|
256 | echo ' >>>>>>>> IOIPSL Makefile and compilation done' |
---|
257 | echo ' ' |
---|
258 | |
---|
259 | # AGRIF compilation |
---|
260 | if [ ${UAGRIF} = 'yes' ] ; then |
---|
261 | ../../../util/ins_make -w AGRIF |
---|
262 | (cd ../../../modeles/AGRIF/ ; gmake ;) |
---|
263 | echo ' ' |
---|
264 | echo ' AGRIF Makefile and compilation done' |
---|
265 | echo ' ' |
---|
266 | fi |
---|
267 | |
---|
268 | |
---|
269 | echo ' ' |
---|
270 | echo ' #############################################################' |
---|
271 | echo ' >>>>>>>> Now set "by hand" the mpi domain decomposition indices jpni, ' |
---|
272 | echo ' jpnj & jpnij in par_oce.F90_keep files (keeping the "_keep" extension) ' |
---|
273 | echo " in coherence with the ${DECOMP} total number of processors you just set " |
---|
274 | echo ' Make this modification in the following directories: ' |
---|
275 | ind=0 |
---|
276 | while [ $ind -lt ${NBCFG} ] |
---|
277 | do |
---|
278 | echo " ../config/${CONF[${ind}]}/MY_SRC" |
---|
279 | let ind=$ind+1 |
---|
280 | done |
---|
281 | echo ' ###########################################################' |
---|
282 | echo ' ' |
---|