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_ORCA2_LIM.ksh in branches/dev_004_VVL/NVTK/INSTALL/JOBS – NEMO

source: branches/dev_004_VVL/NVTK/INSTALL/JOBS/job_ORCA2_LIM.ksh @ 1639

Last change on this file since 1639 was 1359, checked in by smasson, 15 years ago

first implementation of iom_put, see ticket:387

  • Property svn:keywords set to Id
File size: 10.8 KB
Line 
1# $Id$
2set -xv
3
4CONF=ORCA2_LIM
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             
31        '1_short' ) 
32             DIROUT='1_SHORT'
33             ITERATIONS=105 ;;
34             
35        '2_short' ) 
36             DIROUT='2_SHORT'
37             ITERATIONS=105 ;;
38
39        'gtime' ) 
40             DIROUT='GTIME'
41             ITERATIONS=5475 ;;
42esac
43
44# Working directory
45cd ${TMPDIR}
46#-T- osxxlf mkdir -p ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/${MYO_EXP}/RUN
47#-T- osxxlf cd ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/${MYO_EXP}/RUN
48#-T- osxxlf zback=$?
49#-T- osxxlf if [ ${zback} = 0 ] ; then rm -rf namelist* *.nc memory* solver.stat ocean.output* mpp.output* mono.output* ; fi
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
86
87# Sea-Ice namelist
88get_namelist ${LOC_NAM} namelist_ice_lim2 ${MYO_EXP} namelist_ice
89
90# iom_put xml file
91get_namelist ${LOC_NAM} iodef.xml ${MYO_EXP} iodef.xml
92
93# Local function to find namelists parameters
94supergrep () {
95    grep "^ *$1 *=" $2 | sed -e "s% *\!.*%%"
96}
97
98# namelist modifications
99PAT_NIT000=$( supergrep nit000             namelist )
100PAT_NITEND=$( supergrep nitend             namelist )
101PAT_NSTOCK=$( supergrep nstock             namelist )
102PAT_NWRITE=$( supergrep nwrite             namelist )
103PAT_NRSTDT=$( supergrep nrstdt             namelist )
104PAT_NBITCM=$( supergrep nbit_cmp           namelist )
105PAT_TRACEN=$( supergrep ln_traadv_cen2     namelist )
106PAT_TRATVD=$( supergrep ln_traadv_tvd      namelist )
107PAT_N_CLAA=$( supergrep n_cla              namelist )
108PAT_NSOLVV=$( supergrep nsolv              namelist )
109PAT_RESTAR=$( supergrep ln_rstart          namelist )
110PAT_RESMLD=$( supergrep ln_trdmld_restart  namelist )
111
112sed -e "s%$PAT_RESTAR%   ln_rstart   =  .false.%"          \
113    -e "s%$PAT_NIT000%   nit000     =     1   %"           \
114    -e "s%$PAT_NITEND%   nitend     =     ${ITERATIONS} %" \
115    -e "s%$PAT_NSTOCK%   nstock     =     ${ITERATIONS} %" \
116    -e "s%$PAT_NWRITE%   nwrite     =     75  %"           \
117    -e "s%$PAT_NRSTDT%   nrstdt     =     0   %"           \
118    -e "s%$PAT_NBITCM%   nbit_cmp   =     1%"              \
119    -e "s%$PAT_TRACEN%   ln_traadv_cen2   =  .false.%"     \
120    -e "s%$PAT_TRATVD%   ln_traadv_tvd    =  .true.%"      \
121    -e "s%$PAT_N_CLAA%   n_cla   = 0%"                     \
122    -e "s%$PAT_NSOLVV%   nsolv     =      2%"              \
123    -e "s%$PAT_RESMLD%   ln_trdmld_restart =  .false.%" namelist > nam.tmp
124
125mv nam.tmp namelist
126
127# Get forcing files
128${D_GET} ${D_INPUT}/ORCA2_LIM_nemo_v3.1.tar ORCA2_LIM_nemo_v3.1.tar
129tar xvf ORCA2_LIM_nemo_v3.1.tar
130rm -rf ORCA2_LIM_nemo_v3.1.tar
131
132# Get restarts files if needed
133if [ $type = '2_short' ]
134then
135    if [ ${RUN} = 'mon' -o ${RUN} = 'omp' ] ; then
136        cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart.nc restart.nc
137        cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*restart_ice.nc restart_ice_in.nc
138        cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart_mld.nc restart_mld.nc
139    fi
140
141    if [ ${RUN} = 'mpi' ] ; then
142        typeset -Z4 i=0
143        while [ $i -lt $NB_PROCS ]
144        do
145           cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart_${i}.nc restart_${i}.nc
146           cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*restart_ice_${i}.nc restart_ice_in_${i}.nc
147           cp ${WORK}/NEMO_VALID/W${CONF}/${RUN}/1_SHORT/${MYO_EXP}/*_restart_mld_${i}.nc restart_mld_${i}.nc
148           let i=$i+1
149        done
150    fi
151
152    # Ocean namelist modifications
153    PAT_NIT000=$( supergrep nit000             namelist )
154    PAT_NITEND=$( supergrep nitend             namelist )
155    PAT_NRSTDT=$( supergrep nrstdt             namelist )
156    PAT_RESTAR=$( supergrep ln_rstart          namelist )
157    PAT_RESMLD=$( supergrep ln_trdmld_restart  namelist )
158    ORCA_NIT000=$(( $ITERATIONS + 1 ))
159    ORCA_NITEND=$(( $ITERATIONS*2 ))
160   
161    sed  -e "s%$PAT_RESTAR%   ln_rstart   =  .true.%"          \
162         -e "s%$PAT_NIT000%   nit000     =     $ORCA_NIT000 %" \
163         -e "s%$PAT_NITEND%   nitend     =     $ORCA_NITEND %" \
164         -e "s%$PAT_NRSTDT%   nrstdt     =     2%"             \
165         -e "s%$PAT_RESMLD%   ln_trdmld_restart =  .true.%" namelist > nam.tmp
166   
167    mv nam.tmp namelist
168
169fi
170
171##############################################################
172##############################################################
173##############################################################
174###             Launch run
175##############################################################
176##############################################################
177##############################################################
178
179cp ${WORK}/NEMO_VALID/W${CONF}/opa_${CONF}_${RUN}_${MYO_EXP} opa_${CONF}_${RUN}_${MYO_EXP}
180cp ${WORK}/NEMO_VALID/W${CONF}/opa_${CONF}_memo_${MYO_EXP} opa_${CONF}_memo_${MYO_EXP}
181chmod 777 opa_${CONF}_${RUN}_${MYO_EXP}
182chmod 777 opa_${CONF}_memo_${MYO_EXP}
183
184#
185# Profiling & Executable memory size
186####################################
187touch memory_size.txt
188
189case ${RUN} in
190        'mon' ) 
191#-T- sx8brodie export F_PROGINF=detail
192#-T- sx8brodie echo "Stack memory: $( (size opa_${CONF}_${RUN}_${MYO_EXP}) )"    >> memory_size.txt
193#-T- sx8brodie echo "Static memory: $( (size opa_${CONF}_memo_${MYO_EXP}) )"   >> memory_size.txt  ;;
194#-T- aix6     ;;
195#-T- ax6_mono echo "Stack memory: $( (size opa_${CONF}_memo_${MYO_EXP}) )"    >> memory_size.txt
196#-T- ax6_mono echo "Static memory: $( (size opa_${CONF}_${RUN}_${MYO_EXP}) )"   >> memory_size.txt ;;
197#-T- osxxlf echo "Stack memory: $( (size opa_${CONF}_memo_${MYO_EXP}) )"    >> memory_size.txt
198#-T- osxxlf echo "Static memory: $( (size opa_${CONF}_${RUN}_${MYO_EXP}) )"   >> memory_size.txt ;;
199        'mpi' ) 
200#-T- sx8brodie export MPIPROGINF=detail ;;
201#-T- aix6     ;;
202#-T- ax6_mono ;;
203#-T- osxxlf   ;;
204        'omp' ) 
205#-T- sx8brodie export F_PROGINF=detail
206#-T- sx8brodie export OMP_NUM_THREADS=${NB_PROCS} ;;
207#-T- aix6     ;;
208#-T- ax6_mono ;;
209#-T- osxxlf   ;;
210esac
211#
212# >>>>>> EXECUTION < < < <
213##########################
214
215case ${RUN} in
216        'mon' | 'omp' ) 
217              ${CPERF} ./opa_${CONF}_${RUN}_${MYO_EXP} ;;
218        'mpi' ) 
219#-T- sx8brodie              ${CPERF} ${LEXE} ./opa_${CONF}_${RUN}_${MYO_EXP} ;;
220#-T- aix6              ${CPERF} ${LEXE} ./opa_${CONF}_${RUN}_${MYO_EXP} ;;
221#-T- osxxlf   mpd&
222#-T- osxxlf   sleep 5
223#-T- osxxlf   ${CPERF} ${LEXE} ./opa_${CONF}_${RUN}_${MYO_EXP}
224#-T- osxxlf   mpdallexit ;;
225esac
226
227ls -l
228#
229
230##############################################################
231##############################################################
232##############################################################
233###             Save output files
234##############################################################
235##############################################################
236##############################################################
237case ${RUN} in
238   'mon' | 'omp' )
239               liste_files='*abort* memory* namelist* perfs* solver.stat ocean.output layout* ORCA2* restart* mono*' ;;
240   'mpi' )
241               liste_files='*abort* namelist* solver.stat perfs* ocean.output* layout* ORCA2* restart* mpp*' ;;
242esac
243
244# Ensure that all files saved are coming from the current run
245ind=1
246for k in $liste_files
247do
248   echo $k > temp
249   var=$( ( awk '{printf("%-.4s", varin ) } ' varin=$k temp ) )
250   if [ ${ind} = 1 -a ${var} = 'perf' ] ; then
251       kc='perf*'
252       rm -f ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/${MYO_EXP}/${kc}
253       ind=0
254   fi
255   cp $k ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/${MYO_EXP}/$k
256done
257
258##############################################################
259##############################################################
260##############################################################
261###             Retrieve some reference run files
262##############################################################
263##############################################################
264##############################################################
265if [ ${REF_TAG} ]
266then
267   STORE_DATA=${REF_OD}/${CONF}/${REF_TAG}/${RUN}/${DIROUT}
268   LFILES="solver.stat memory_size.txt ocean.output ${RUN}${CONF}_err"
269   for ref_file in ${LFILES}
270   do
271       ${D_GET} ${STORE_DATA}/${TSYMB}${ref_file} ${WORK}/NEMO_VALID/W${CONF}/${RUN}/${DIROUT}/REF/${ref_file}
272   done
273fi
274
275##############################################################
276##############################################################
277##############################################################
278###             Launch restart job
279##############################################################
280##############################################################
281##############################################################
282if [ $type = '1_short' ] ; then
283    cd ${WORK}/NEMO_VALID/W${CONF}/${RUN}/2_SHORT/${MYO_EXP}
284    ${LAUNCH}job_${RUN}_2_short_${MYO_EXP}.ksh
285fi
Note: See TracBrowser for help on using the repository browser.