New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
job_ZAGRIF.ksh in trunk/NVTK/INSTALL/JOBS – NEMO

source: trunk/NVTK/INSTALL/JOBS/job_ZAGRIF.ksh @ 1365

Last change on this file since 1365 was 1365, checked in by cetlod, 15 years ago

Adding a new target platform : mercure, see ticket:393

  • Property svn:keywords set to Id
File size: 12.2 KB
Line 
1# $Id$
2set -xv
3
4CONF=ZAGRIF
5# Variables changed by lance_batch.ksh script
6RUN=xxx
7NB_PROCS=xxx
8LAUNCH=xxx
9LEXE=xxx
10CPERF=xxx
11D_INPUT=xxx
12D_GET=xxx
13REF_TAG=xxx
14MYO_EXP=xxx
15TSYMB=xxx
16
17# Variables changed by ins_valid.ksh script
18MAINDIR=/workdir/rech/eee/reee534/AUTRE
19WORK=/workdir/rech/eee/reee534/AUTRE/modipsl/config/
20REF_OD=/u/rech/eee/reee831/NEMO_VALIDATION
21
22# Arguments
23# type = 'long' or '1_short' or '2_short'
24type=$1
25
26case ${type} in
27        'long' ) 
28             DIROUT='LONG'
29             ITERATIONS=210
30             NOUTPUT=75 ;;
31             
32        '1_short' ) 
33             DIROUT='1_SHORT'
34             ITERATIONS=105
35             NOUTPUT=75 ;;
36             
37        '2_short' ) 
38             DIROUT='2_SHORT'
39             ITERATIONS=105
40             NOUTPUT=75 ;;
41
42        'gtime' ) 
43             DIROUT='GTIME'
44             ITERATIONS=5475
45             NOUTPUT=75 ;;
46esac
47
48# Working directory
49cd ${TMPDIR}
50
51##############################################################
52##############################################################
53##############################################################
54###             Input files
55##############################################################
56##############################################################
57##############################################################
58# Local function to copy namelists files
59get_namelist () {
60    if [ -a $1/$2_$3 ] ; then
61        cp $1/$2_$3 $4
62    else
63        echo '                ###############################################################'
64        echo '                ######################## W A R N I N G ########################'
65        echo '                ######################## W A R N I N G ########################'
66        echo '                ######################## W A R N I N G ########################'
67        echo '                ###############################################################'
68        echo "              $2_$3 file doesn't exist, we use the standard $2"
69        echo '                ###############################################################'
70        echo '                ######################## W A R N I N G ########################'
71        echo '                ######################## W A R N I N G ########################'
72        echo '                ######################## W A R N I N G ########################'
73        echo '                ###############################################################'
74        cp $1/$2 $4
75    fi
76}
77
78# Local function to find namelists parameters
79supergrep () {
80    grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%"
81}
82
83# Ocean namelist
84LOC_NAM=${MAINDIR}/modipsl/config/${CONF}/EXP00
85get_namelist ${LOC_NAM} namelist ${MYO_EXP} namelist
86get_namelist ${LOC_NAM} 1_namelist ${MYO_EXP} 1_namelist
87
88# Sea-Ice namelist
89get_namelist ${LOC_NAM} namelist_ice_lim2 ${MYO_EXP} namelist_ice
90get_namelist ${LOC_NAM} 1_namelist_ice_lim2 ${MYO_EXP} 1_namelist_ice
91
92# AGRIF file
93cp ${LOC_NAM}/AGRIF_FixedGrids.in AGRIF_FixedGrids.in
94
95# Local function to find namelists parameters
96supergrep () {
97    grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%"
98}
99
100for CHGFILE in `ls *namelist`
101do
102     # namelist modifications
103     PAT_NIT000=$( supergrep nit000             ${CHGFILE} )
104     PAT_NITEND=$( supergrep nitend             ${CHGFILE} )
105     PAT_NSTOCK=$( supergrep nstock             ${CHGFILE} )
106     PAT_NWRITE=$( supergrep nwrite             ${CHGFILE} )
107     PAT_NRSTDT=$( supergrep nrstdt             ${CHGFILE} )
108     PAT_NBITCM=$( supergrep nbit_cmp           ${CHGFILE} )
109     PAT_TRACEN=$( supergrep ln_traadv_cen2     ${CHGFILE} )
110     PAT_TRATVD=$( supergrep ln_traadv_tvd      ${CHGFILE} )
111     PAT_N_CLAA=$( supergrep n_cla              ${CHGFILE} )
112     PAT_NSOLVV=$( supergrep nsolv              ${CHGFILE} )
113     PAT_RESTAR=$( supergrep ln_rstart          ${CHGFILE} )
114     PAT_RESMLD=$( supergrep ln_trdmld_restart  ${CHGFILE} )
115     PAT_NAMECF=$( supergrep cexper             ${CHGFILE} )
116
117    if [ ${CHGFILE} = 'namelist' ] ; then
118        ORCA_NITEND=$(( $ITERATIONS   ))
119        ORCA_NSTOCK=$(( $NOUTPUT   ))
120        PAT_NAMECF_tmp="   cexper     =     \"${CONF}\""
121    else
122        ORCA_NITEND=$(( $ITERATIONS*2 ))
123        ORCA_NSTOCK=$(( $NOUTPUT*2   ))
124        PAT_NAMECF_tmp="$PAT_NAMECF"
125    fi
126
127     sed -e "s%$PAT_RESTAR%   ln_rstart   =  .false.%"           \
128         -e "s%$PAT_NAMECF%$PAT_NAMECF_tmp%"                     \
129         -e "s%$PAT_NIT000%   nit000     =     1   %"            \
130         -e "s%$PAT_NITEND%   nitend     =     ${ORCA_NITEND} %" \
131         -e "s%$PAT_NSTOCK%   nstock     =     ${ORCA_NITEND} %" \
132         -e "s%$PAT_NWRITE%   nwrite     =     ${ORCA_NSTOCK} %" \
133         -e "s%$PAT_NRSTDT%   nrstdt     =     0   %"            \
134         -e "s%$PAT_NBITCM%   nbit_cmp =     1%"                 \
135         -e "s%$PAT_TRACEN%   ln_traadv_cen2   =  .false.%"      \
136         -e "s%$PAT_TRATVD%   ln_traadv_tvd    =  .true.%"       \
137         -e "s%$PAT_N_CLAA%   n_cla   = 0%"                      \
138         -e "s%$PAT_NSOLVV%   nsolv     =      2%"               \
139         -e "s%$PAT_RESMLD%   ln_trdmld_restart =  .false.%" ${CHGFILE} > nam.$$
140     
141     mv nam.$$ ${CHGFILE} && rm -f nam.$$
142done
143
144# Get forcing files
145${D_GET} ${D_INPUT}/ORCA2_LIM_nemo_v3.1.tar ORCA2_LIM_nemo_v3.1.tar
146tar xvf ORCA2_LIM_nemo_v3.1.tar
147rm -rf ORCA2_LIM_nemo_v3.1.tar
148
149# Get restarts files if needed
150if [ $type = '2_short' ]
151then
152    if [ ${RUN} = 'mon' -o ${RUN} = 'omp' ] ; then
153        cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/ZAGRI*_restart.nc restart.nc
154        cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/1_*restart.nc 1_restart.nc
155        cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/ZAGRI*restart_ice.nc restart_ice_in.nc
156        cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/1_*restart_ice.nc 1_restart_ice_in.nc
157        cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart_mld.nc restart_mld.nc
158    fi
159
160    if [ ${RUN} = 'mpi' ] ; then
161        typeset -Z4 i=0
162        while [ $i -lt $NB_PROCS ]
163        do
164           cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/ZAGRI*_restart_${i}.nc restart_${i}.nc
165           cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/1_*restart_${i}.nc 1_restart_${i}.nc
166           cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/ZAGRI*_restart_ice_${i}.nc restart_ice_in_${i}.nc
167           cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/1_*restart_ice_${i}.nc 1_restart_ice_in_${i}.nc
168           cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart_mld_${i}.nc restart_mld_${i}.nc
169           let i=$i+1
170        done
171    fi
172
173    for CHGFILE in `ls *namelist`
174    do
175        # namelist modifications
176        PAT_NIT000=$( supergrep nit000             ${CHGFILE} )
177        PAT_NITEND=$( supergrep nitend             ${CHGFILE} )
178        PAT_NRSTDT=$( supergrep nrstdt             ${CHGFILE} )
179        PAT_RESTAR=$( supergrep ln_rstart          ${CHGFILE} )
180        PAT_RESMLD=$( supergrep ln_trdmld_restart  ${CHGFILE} )
181
182        if [ ${CHGFILE} = 'namelist' ] ; then
183            ORCA_NIT000=$(( $ITERATIONS + 1 ))
184            ORCA_NITEND=$(( $ITERATIONS*2   ))
185        else
186            ORCA_NIT000=$(( $ITERATIONS*2 + 1 ))
187            ORCA_NITEND=$(( $ITERATIONS*4 ))
188        fi
189       
190        sed -e "s%$PAT_RESTAR%   ln_rstart   =  .true.%"          \
191            -e "s%$PAT_NIT000%   nit000     =     $ORCA_NIT000 %" \
192            -e "s%$PAT_NITEND%   nitend     =     $ORCA_NITEND %" \
193            -e "s%$PAT_NRSTDT%   nrstdt     =     2%"             \
194            -e "s%$PAT_RESMLD%   ln_trdmld_restart =  .true.%" ${CHGFILE} > nam.$$
195       
196        mv nam.$$ ${CHGFILE} && rm -f nam.$$
197    done
198
199fi
200
201##############################################################
202##############################################################
203##############################################################
204###             Launch run
205##############################################################
206##############################################################
207##############################################################
208
209cp ${WORK}/NEMO_VALID/W${CONF}/opa_${CONF}_${RUN}_${MYO_EXP} opa_${CONF}_${RUN}_${MYO_EXP}
210cp ${WORK}/NEMO_VALID/W${CONF}/opa_${CONF}_memo_${MYO_EXP} opa_${CONF}_memo_${MYO_EXP}
211chmod 777 opa_${CONF}_${RUN}_${MYO_EXP}
212chmod 777 opa_${CONF}_memo_${MYO_EXP}
213
214#
215# Profiling & Executable memory size
216####################################
217touch memory_size.txt
218
219case ${RUN} in
220        'mon' ) 
221#-T- sx8brodie export F_PROGINF=detail
222#-T- sx8brodie echo "Stack memory: $( (size opa_${CONF}_${RUN}_${MYO_EXP}) )"    >> memory_size.txt
223#-T- sx8brodie echo "Static memory: $( (size opa_${CONF}_memo_${MYO_EXP}) )"   >> memory_size.txt  ;;
224#-T- sx8mercure export F_PROGINF=detail
225#-T- sx8mercure echo "Stack memory: $( (size opa_${CONF}_${RUN}_${MYO_EXP}) )"    >> memory_size.txt
226#-T- sx8mercure echo "Static memory: $( (size opa_${CONF}_memo_${MYO_EXP}) )"   >> memory_size.txt  ;;
227#-T- aix6     ;;
228#-T- ax6_mono echo "Stack memory: $( (size opa_${CONF}_memo_${MYO_EXP}) )"    >> memory_size.txt
229#-T- ax6_mono echo "Static memory: $( (size opa_${CONF}_${RUN}_${MYO_EXP}) )"   >> memory_size.txt ;;
230        'mpi' ) 
231#-T- sx8brodie export MPIPROGINF=detail ;;
232#-T- sx8mercure export MPIPROGINF=detail ;;
233#-T- aix6     ;;
234#-T- ax6_mono ;;
235        'omp' ) 
236#-T- sx8brodie export F_PROGINF=detail
237#-T- sx8brodie export OMP_NUM_THREADS=${NB_PROCS} ;;
238#-T- sx8mercure export F_PROGINF=detail
239#-T- sx8mercure export OMP_NUM_THREADS=${NB_PROCS} ;;
240#-T- aix6     ;;
241#-T- ax6_mono ;;
242esac
243#
244# >>>>>> EXECUTION < < < <
245##########################
246
247case ${RUN} in
248        'mon' | 'omp' ) 
249              ${CPERF} ./opa_${CONF}_${RUN}_${MYO_EXP} ;;
250        'mpi' ) 
251#-T- sx8brodie         ${CPERF} ${LEXE} ./opa_${CONF}_${RUN}_${MYO_EXP} ;;
252#-T- sx8mercure         ${CPERF} ${LEXE} ./opa_${CONF}_${RUN}_${MYO_EXP} ;;
253#-T- aix6              ${CPERF} ${LEXE} ./opa_${CONF}_${RUN}_${MYO_EXP} ;;
254esac
255
256ls -l
257#
258
259##############################################################
260##############################################################
261##############################################################
262###             Save output files
263##############################################################
264##############################################################
265##############################################################
266case ${RUN} in
267   'mon' | 'omp' )
268               liste_files=' *abort* memory* *namelist* perfs* solver.stat ocean.output 1_Agulhas* layout* ZAGRIF* restart* mono*' ;;
269   'mpi' )
270               liste_files=' *abort* *namelist* solver.stat perfs* ocean.output* layout* 1_Agulhas* ZAGRIF* restart* mpp*' ;;
271esac
272
273# Ensure that all files saved are coming from the current run
274ind=1
275for k in $liste_files
276do
277   echo $k > temp
278   var=$( ( awk '{printf("%-.4s", varin ) } ' varin=$k temp ) )
279   if [ ${ind} = 1 -a ${var} = 'perf' ] ; then
280       kc='perf*'
281       rm -f ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/${MYO_EXP}/${kc}
282       ind=0
283   fi
284   cp $k ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/${MYO_EXP}/$k
285done
286
287##############################################################
288##############################################################
289##############################################################
290###             Retrieve some reference run files
291##############################################################
292##############################################################
293##############################################################
294if [ ${REF_TAG} ]
295then
296   STORE_DATA=${REF_OD}/${CONF}/${REF_TAG}/${RUN}/${DIROUT}
297   LFILES="solver.stat memory_size.txt ocean.output ${RUN}${CONF}_err"
298   for ref_file in ${LFILES}
299   do
300       ${D_GET} ${STORE_DATA}/${TSYMB}${ref_file} ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/REF/${ref_file}
301   done
302fi
303
304##############################################################
305##############################################################
306##############################################################
307###             Launch restart job
308##############################################################
309##############################################################
310##############################################################
311if [ $type = '1_short' ] ; then
312    cd ${WORK}/NEMO_VALID/W${CONF}/${RUN}/2_SHORT/${MYO_EXP}
313    ${LAUNCH}job_${RUN}_2_short_${MYO_EXP}.ksh
314fi
Note: See TracBrowser for help on using the repository browser.