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_GYRE_LOBSTER.ksh in trunk/NVTK/INSTALL/JOBS – NEMO

source: trunk/NVTK/INSTALL/JOBS/job_GYRE_LOBSTER.ksh @ 1301

Last change on this file since 1301 was 1301, checked in by ctlod, 15 years ago

improvements of NVTK environnement, see ticket: #240

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