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 @ 1302

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

correct minor bugs, see ticket: #240

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