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

source: trunk/NVTK/INSTALL/ins_nvtk.ksh @ 1141

Last change on this file since 1141 was 1141, checked in by ctlod, 16 years ago

trunk: NVTK directory re-organization, rename ins_valid.ksh into ins_nvtk.ksh, see ticket: #220

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