1 | #!/bin/ksh |
---|
2 | # $Id$ |
---|
3 | ###################################################### |
---|
4 | # Original : C. Talandier for NEMO team |
---|
5 | # Contact : nemo_st@locean-ipsl.upmc.fr |
---|
6 | # |
---|
7 | # This script aims to (for each standard configuration) : |
---|
8 | # - I. Take into account specific files changes |
---|
9 | # - ./modipsl/util/ins_make |
---|
10 | # - ./modipsl/config/NAME_CONFIG/AA_make* |
---|
11 | # - ./modipsl/config/NAME_CONFIG/scripts/BB_make.ldef |
---|
12 | # - II. Build configuration's environment & dependencies |
---|
13 | # - ./modipsl/config/NAME_CONFIG/WORK |
---|
14 | # - ./modipsl/config/NAME_CONFIG/MY_SRC |
---|
15 | # - ./modipsl/config/NAME_CONFIG/scripts/BB_make |
---|
16 | # - III. Build results sub-directories in the OUTDIR |
---|
17 | # directory specified by user just below |
---|
18 | # NEMO_VALID/WNAME_CONFIG/ |
---|
19 | # |-- mon --> MONO run |
---|
20 | # | |-- 1_SHORT |
---|
21 | # | |-- 2_SHORT |
---|
22 | # | |-- LONG |
---|
23 | # | `-- GTIME |
---|
24 | # |-- mpi --> MPI run |
---|
25 | # | |-- 1_SHORT |
---|
26 | # | |-- 2_SHORT |
---|
27 | # | |-- LONG |
---|
28 | # | `-- GTIME |
---|
29 | # `-- omp --> Open-MP run |
---|
30 | # |-- 1_SHORT |
---|
31 | # |-- 2_SHORT |
---|
32 | # |-- LONG |
---|
33 | # `-- GTIME |
---|
34 | # |
---|
35 | # - IV. Modify lance_batch.ksh & assessment.ksh scripts |
---|
36 | # - V. Preliminary compilations |
---|
37 | ###################################################### |
---|
38 | |
---|
39 | #set -xv |
---|
40 | |
---|
41 | ########################################################## |
---|
42 | ##### Begin Users modifications |
---|
43 | ########################################################## |
---|
44 | # OUTDIR : working directory from which jobs will be launched |
---|
45 | # & results stored |
---|
46 | # INPUTD : directory where to get ORCA2_LIM_nemo_v2.tar |
---|
47 | # REFDAT : directory where to get results from reference tags |
---|
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=/u/rech/eee/reee831/IO_NEMO_ORCA2_LIM |
---|
53 | REFDAT=/u/rech/eee/reee831/NEMO_VALIDATION |
---|
54 | MAIL="ctlod@locean-ipsl.upmc.fr" |
---|
55 | UAGRIF=yes |
---|
56 | ########################################################## |
---|
57 | ##### End Users modifications |
---|
58 | ########################################################## |
---|
59 | |
---|
60 | |
---|
61 | # Standard configurations |
---|
62 | NBCFG=7 |
---|
63 | CONF[0]=ORCA2_LIM |
---|
64 | CONF[1]=ORCA2_LIM3 |
---|
65 | CONF[2]=GYRE |
---|
66 | CONF[3]=GYRE_LOBSTER |
---|
67 | CONF[4]=ORCA2_LIM_PISCES |
---|
68 | CONF[5]=ORCA2_OFF_PISCES |
---|
69 | CONF[6]=ZAGRIF |
---|
70 | LCLDIR=`pwd` |
---|
71 | |
---|
72 | # Use a modified modipsl script: ins_make |
---|
73 | # which allows to build Makefiles of a specific configuration |
---|
74 | # using the following syntax: ins_make -w NAME_CONF |
---|
75 | cp ./MODIPSL_FILES/ins_make ../../../util/. |
---|
76 | |
---|
77 | # Get the current target name |
---|
78 | LOCTARG=`../../../util/w_i_h` |
---|
79 | |
---|
80 | # Set following variable in AA_make.ldef script And master Makefile |
---|
81 | # - WWDIR = directory where to store results and jobs |
---|
82 | CAR_WORK_tmp=$( grep 'WWDIR=' ./CONFIG_FILES/AA_make.ldef ) |
---|
83 | CAR_WORK=`echo $CAR_WORK_tmp | cut -f 1 -d " " ` |
---|
84 | CAR_TARG_tmp=$( grep 'HPCTAR=' ./CONFIG_FILES/AA_make.ldef ) |
---|
85 | CAR_TARG=`echo $CAR_TARG_tmp` |
---|
86 | sed -e "s?${CAR_WORK}?WWDIR=${OUTDIR}?" -e "s?${CAR_TARG}?HPCTAR=${LOCTARG}?" \ |
---|
87 | ./CONFIG_FILES/AA_make.ldef > ./CONFIG_FILES/AA_make.ldef.$$ |
---|
88 | mv ./CONFIG_FILES/AA_make.ldef.$$ ./CONFIG_FILES/AA_make.ldef && rm -f ./CONFIG_FILES/AA_make.ldef.$$ |
---|
89 | |
---|
90 | sed -e "s?DELFIL?${OUTDIR}?" ../Makefile > ../Makefile.$$ |
---|
91 | mv ../Makefile.$$ ../Makefile && rm -f ../Makefile.$$ |
---|
92 | |
---|
93 | # Loop over each standard configuration |
---|
94 | # ##################################### |
---|
95 | ind=0 |
---|
96 | while [ $ind -lt ${NBCFG} ] |
---|
97 | do |
---|
98 | # I. Take into account specific changes |
---|
99 | # ##################################### |
---|
100 | # Set following variables in job_NAME_CONF.ksh script |
---|
101 | # - MAINDIR = directory where to get namelist input files |
---|
102 | # - WORK = directory where to store results |
---|
103 | # - REF_OD = directory where Are stored results from previous tags |
---|
104 | cd ../../../.. ; NAME_ARCH=$( pwd ) ; |
---|
105 | cd ${LCLDIR} |
---|
106 | echo ${NAME_ARCH} |
---|
107 | CAR_MAIN_tmp=$( grep 'MAINDIR=' ./JOBS/job_${CONF[${ind}]}.ksh ) |
---|
108 | CAR_MAIN=`echo $CAR_MAIN_tmp | cut -f 1 -d " " ` |
---|
109 | CAR_WORK_tmp=$( grep 'WORK=' ./JOBS/job_${CONF[${ind}]}.ksh ) |
---|
110 | CAR_WORK=`echo $CAR_WORK_tmp | cut -f 1 -d " " ` |
---|
111 | CAR_REFO_tmp=$( grep 'REF_OD=' ./JOBS/job_${CONF[${ind}]}.ksh | head -1 ) |
---|
112 | CAR_REFO=`echo $CAR_REFO_tmp | cut -f 1 -d " " ` |
---|
113 | sed -e "s?${CAR_MAIN}?MAINDIR=${NAME_ARCH}?" -e "s?${CAR_WORK}?WORK=${OUTDIR}?" \ |
---|
114 | -e "s?${CAR_REFO}?REF_OD=${REFDAT}?" ./JOBS/job_${CONF[${ind}]}.ksh > ./JOBS/job_tmp.$$ |
---|
115 | mv ./JOBS/job_tmp.$$ ./JOBS/job_${CONF[${ind}]}.ksh && rm -f ./JOBS/job_tmp.$$ |
---|
116 | |
---|
117 | # II. Build configuration environment |
---|
118 | # ################################### |
---|
119 | (cd ../ ; ./use_cfg -n ${CONF[${ind}]} ;) |
---|
120 | echo ' ' |
---|
121 | echo ' >>>>>>>> Configuration directories have been built:' |
---|
122 | echo " ./config/${CONF[${ind}]}/WORK" |
---|
123 | echo " ./config/${CONF[${ind}]}/MY_SRC" |
---|
124 | echo ' ' |
---|
125 | |
---|
126 | cp ./CONFIG_FILES/AA_make* ../../${CONF[${ind}]}/. |
---|
127 | cp ./CONFIG_FILES/BB_make.ldef_${CONF[${ind}]} ../../${CONF[${ind}]}/scripts/BB_make.ldef |
---|
128 | |
---|
129 | # Configuration dependencies |
---|
130 | (cd ../../${CONF[${ind}]} ; ../NVTK/fait_AA_make ; ) |
---|
131 | echo ' ' |
---|
132 | echo " >>>>>>>> Dependencies file ./config/${CONF[${ind}]}/BB_make have been re-built" |
---|
133 | |
---|
134 | # III. Build output sub-directories |
---|
135 | # ################################# |
---|
136 | # Directories from where Jobs will be launched |
---|
137 | # and where results will be stored before analysed |
---|
138 | cd ${OUTDIR} |
---|
139 | if [ ! -d 'NEMO_VALID' ] ; then |
---|
140 | mkdir NEMO_VALID |
---|
141 | fi |
---|
142 | cd NEMO_VALID |
---|
143 | mkdir -p W${CONF[${ind}]}/infos/inter |
---|
144 | mkdir -p W${CONF[${ind}]}/mon/LONG |
---|
145 | mkdir -p W${CONF[${ind}]}/mon/GTIME |
---|
146 | mkdir -p W${CONF[${ind}]}/mon/1_SHORT |
---|
147 | mkdir -p W${CONF[${ind}]}/mon/2_SHORT |
---|
148 | # |
---|
149 | mkdir -p W${CONF[${ind}]}/mpi/LONG |
---|
150 | mkdir -p W${CONF[${ind}]}/mpi/GTIME |
---|
151 | mkdir -p W${CONF[${ind}]}/mpi/1_SHORT |
---|
152 | mkdir -p W${CONF[${ind}]}/mpi/2_SHORT |
---|
153 | # |
---|
154 | mkdir -p W${CONF[${ind}]}/omp/LONG |
---|
155 | mkdir -p W${CONF[${ind}]}/omp/GTIME |
---|
156 | mkdir -p W${CONF[${ind}]}/omp/1_SHORT |
---|
157 | mkdir -p W${CONF[${ind}]}/omp/2_SHORT |
---|
158 | # |
---|
159 | echo ' ' |
---|
160 | echo ' >>>>>>>> The following sub-directories have been built ' |
---|
161 | echo ' under main directory '$( pwd ) |
---|
162 | echo ' They are dedicated to store results' |
---|
163 | find W${CONF[${ind}]} -type d |
---|
164 | echo ' ' |
---|
165 | |
---|
166 | cd ${LCLDIR} |
---|
167 | |
---|
168 | let ind=$ind+1 |
---|
169 | done |
---|
170 | |
---|
171 | |
---|
172 | # IV. Modify lance_batch.ksh & assessment.ksh scripts |
---|
173 | # ################################################### |
---|
174 | # Set following variables in lance_batch.ksh script |
---|
175 | # - IODIR = directory where to get ORCA2_LIM_nemo_v2.tar |
---|
176 | # - PRC = total number of processors which will be used |
---|
177 | |
---|
178 | CAR_INPU_tmp=$( grep 'IODIR=' ./JOBS/lance_batch.ksh ) |
---|
179 | CAR_INPU=`echo $CAR_INPU_tmp | cut -f 1 -d " " ` |
---|
180 | CAR_TARG_tmp=$( grep 'TARGET=' ./JOBS/lance_batch.ksh | head -1) |
---|
181 | CAR_TARG=`echo $CAR_TARG_tmp | cut -f 1 -d " " ` |
---|
182 | sed -e "s?${CAR_INPU}?IODIR=${INPUTD}?" -e "s/${CAR_TARG}/TARGET=${LOCTARG}/" \ |
---|
183 | ./JOBS/lance_batch.ksh > ./JOBS/lance_batch.$$ |
---|
184 | mv ./JOBS/lance_batch.$$ ./JOBS/lance_batch.ksh && rm -f ./JOBS/lance_batch.$$ |
---|
185 | chmod 744 ./JOBS/lance_batch.ksh |
---|
186 | |
---|
187 | # Set following variables in assessment.ksh script |
---|
188 | # - TARGET = the current plateform |
---|
189 | # - MAIL = your e-mail |
---|
190 | CAR_TARG_tmp=$( grep 'TARGET=' ./JOBS/assessment.ksh ) |
---|
191 | CAR_TARG=`echo $CAR_TARG_tmp | cut -f 1 -d " " ` |
---|
192 | CAR_MAIL_tmp=$( grep 'EMAIL=' ./JOBS/assessment.ksh ) |
---|
193 | CAR_MAIL=`echo $CAR_MAIL_tmp | cut -f 1 -d " " ` |
---|
194 | sed -e "s/${CAR_TARG}/TARGET=${LOCTARG}/" -e "s/${CAR_MAIL}/EMAIL='${MAIL}'/" \ |
---|
195 | ./JOBS/assessment.ksh > ./JOBS/assessment.$$ |
---|
196 | mv ./JOBS/assessment.$$ ./JOBS/assessment.ksh && rm -f ./JOBS/assessment.$$ |
---|
197 | chmod 744 ./JOBS/assessment.ksh |
---|
198 | |
---|
199 | # V. Preliminary compilations |
---|
200 | # ########################### |
---|
201 | |
---|
202 | # IOIPSL compilation |
---|
203 | ../../../util/ins_make -w IOIPSL |
---|
204 | if [ ${LOCTARG} = 'sx8brodie' -o ${LOCTARG} = 'sx8mercure' ] ; then |
---|
205 | (cd ../../../modeles/IOIPSL/src ; sxgmake ;) |
---|
206 | else |
---|
207 | (cd ../../../modeles/IOIPSL/src ; gmake ;) |
---|
208 | fi |
---|
209 | echo ' ' |
---|
210 | echo ' >>>>>>>> IOIPSL Makefile and compilation done' |
---|
211 | echo ' ' |
---|
212 | |
---|
213 | # AGRIF compilation |
---|
214 | if [ ${UAGRIF} = 'yes' ] ; then |
---|
215 | ../../../util/ins_make -w AGRIF |
---|
216 | (cd ../../../modeles/AGRIF/ ; gmake ;) |
---|
217 | echo ' ' |
---|
218 | echo ' AGRIF Makefile and compilation done' |
---|
219 | echo ' ' |
---|
220 | fi |
---|
221 | |
---|
222 | |
---|
223 | echo ' ' |
---|
224 | echo ' #############################################################' |
---|
225 | echo ' >>>>>>>> Following configuration(s) can be used with NVTK:' |
---|
226 | ind=0 |
---|
227 | while [ $ind -lt ${NBCFG} ] |
---|
228 | do |
---|
229 | echo " # ${CONF[${ind}]}" |
---|
230 | let ind=$ind+1 |
---|
231 | done |
---|
232 | echo ' ###########################################################' |
---|
233 | echo ' ' |
---|