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 @ 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:executable set to *
  • Property svn:keywords set to Id
File size: 10.2 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       # III. Build output sub-directories
123       # #################################
124       # Directories from where Jobs will be launched
125       # and where results will be stored before analysed
126       cd ${OUTDIR}
127       if [ ! -d 'NEMO_VALID' ] ;  then
128           mkdir  NEMO_VALID
129       fi
130           cd NEMO_VALID
131       if [ ! -d W${CONF[${ind}]} ] ;  then
132           mkdir W${CONF[${ind}]}
133       fi
134       if [ ! -d W${CONF[${ind}]}/mon ] ;  then
135           mkdir W${CONF[${ind}]}/mon
136       fi
137       if [ ! -d W${CONF[${ind}]}/mon/LONG ] ;  then
138           mkdir W${CONF[${ind}]}/mon/LONG
139           mkdir W${CONF[${ind}]}/mon/LONG/REF
140       fi
141       if [ ! -d W${CONF[${ind}]}/mon/GTIME ] ;  then
142           mkdir W${CONF[${ind}]}/mon/GTIME
143           mkdir W${CONF[${ind}]}/mon/GTIME/REF
144       fi
145       if [ ! -d W${CONF[${ind}]}/mon/1_SHORT ] ;  then
146           mkdir W${CONF[${ind}]}/mon/1_SHORT
147           mkdir W${CONF[${ind}]}/mon/1_SHORT/REF
148       fi
149       if [ ! -d W${CONF[${ind}]}/mon/2_SHORT ] ;  then
150           mkdir W${CONF[${ind}]}/mon/2_SHORT
151           mkdir W${CONF[${ind}]}/mon/2_SHORT/REF
152       fi
153       if [ ! -d W${CONF[${ind}]}/mpi ] ;  then
154           mkdir W${CONF[${ind}]}/mpi
155       fi
156       if [ ! -d W${CONF[${ind}]}/mpi/LONG ] ;  then
157           mkdir W${CONF[${ind}]}/mpi/LONG
158           mkdir W${CONF[${ind}]}/mpi/LONG/REF
159       fi
160       if [ ! -d W${CONF[${ind}]}/mpi/GTIME ] ;  then
161           mkdir W${CONF[${ind}]}/mpi/GTIME
162           mkdir W${CONF[${ind}]}/mpi/GTIME/REF
163       fi
164       if [ ! -d W${CONF[${ind}]}/mpi/1_SHORT ] ;  then
165           mkdir W${CONF[${ind}]}/mpi/1_SHORT
166           mkdir W${CONF[${ind}]}/mpi/1_SHORT/REF
167       fi
168       if [ ! -d W${CONF[${ind}]}/mpi/2_SHORT ] ;  then
169           mkdir W${CONF[${ind}]}/mpi/2_SHORT
170           mkdir W${CONF[${ind}]}/mpi/2_SHORT/REF
171       fi
172       if [ ! -d W${CONF[${ind}]}/omp ] ;  then
173           mkdir W${CONF[${ind}]}/omp
174       fi
175       if [ ! -d W${CONF[${ind}]}/omp/LONG ] ;  then
176           mkdir W${CONF[${ind}]}/omp/LONG
177           mkdir W${CONF[${ind}]}/omp/LONG/REF
178       fi
179       if [ ! -d W${CONF[${ind}]}/omp/GTIME ] ;  then
180           mkdir W${CONF[${ind}]}/omp/GTIME
181           mkdir W${CONF[${ind}]}/omp/GTIME/REF
182       fi
183       if [ ! -d W${CONF[${ind}]}/omp/1_SHORT ] ;  then
184           mkdir W${CONF[${ind}]}/omp/1_SHORT
185           mkdir W${CONF[${ind}]}/omp/1_SHORT/REF
186       fi
187       if [ ! -d W${CONF[${ind}]}/omp/2_SHORT ] ;  then
188           mkdir W${CONF[${ind}]}/omp/2_SHORT
189           mkdir W${CONF[${ind}]}/omp/2_SHORT/REF
190       fi
191echo '         '
192echo '        >>>>>>>>   The following sub-directories have been built '
193echo '                        under main directory '$( pwd )
194echo '         They are dedicated to store results'
195       find W${CONF[${ind}]} -type d
196echo '         '
197
198       cd ${LCLDIR}
199
200       let ind=$ind+1
201done
202
203
204# IV. Modify lance_batch.ksh & assessment.ksh scripts
205# ###################################################
206# Set following variables in lance_batch.ksh script
207# - IODIR = directory where to get ORCA2_LIM_nemo_v2.tar
208# - PRC   = total number of processors which will be used
209
210CAR_INPU_tmp=$( grep 'IODIR=' ./JOBS/lance_batch.ksh )
211CAR_INPU=`echo $CAR_INPU_tmp | cut -f 1 -d " " `
212CAR_PROC_tmp=$( grep 'PRC=' ./JOBS/lance_batch.ksh )
213CAR_PROC=`echo $CAR_PROC_tmp | cut -f 1 -d " " `
214CAR_TARG_tmp=$( grep 'TARGET=' ./JOBS/lance_batch.ksh | head -1)
215CAR_TARG=`echo $CAR_TARG_tmp | cut -f 1 -d " " `
216sed -e "s?${CAR_INPU}?IODIR=${INPUTD}?" -e "s?${CAR_PROC}?PRC=${DECOMP}?" \
217-e "s/${CAR_TARG}/TARGET=${LOCTARG}/" ./JOBS/lance_batch.ksh > ./JOBS/lance_batch.$$
218mv ./JOBS/lance_batch.$$  ./JOBS/lance_batch.ksh && rm -f ./JOBS/lance_batch.$$
219chmod 744 ./JOBS/lance_batch.ksh
220
221# Set following variables in assessment.ksh script
222# - TARGET = the current plateform
223# - MAIL   = your e-mail
224CAR_TARG_tmp=$( grep 'TARGET=' ./JOBS/assessment.ksh )
225CAR_TARG=`echo $CAR_TARG_tmp | cut -f 1 -d " " `
226CAR_MAIL_tmp=$( grep 'EMAIL=' ./JOBS/assessment.ksh )
227CAR_MAIL=`echo $CAR_MAIL_tmp | cut -f 1 -d " " `
228sed -e "s/${CAR_TARG}/TARGET=${LOCTARG}/" -e "s/${CAR_MAIL}/EMAIL='${MAIL}'/" \
229./JOBS/assessment.ksh > ./JOBS/assessment.$$
230mv ./JOBS/assessment.$$  ./JOBS/assessment.ksh && rm -f ./JOBS/assessment.$$
231chmod 744 ./JOBS/assessment.ksh
232
233# V. Preliminary compilations
234# ###########################
235
236# IOIPSL compilation
237../../../util/ins_make -w IOIPSL
238if [ ${LOCTARG} = 'sx8brodie' ] ; then
239    (cd ../../../modeles/IOIPSL/src ; sxgmake ;)
240else
241    (cd ../../../modeles/IOIPSL/src ; gmake ;)
242fi
243echo '         '
244echo '        >>>>>>>>   IOIPSL Makefile and compilation done'
245echo '         '
246
247# AGRIF compilation
248if [ ${UAGRIF} = 'yes' ] ;  then
249    ../../../util/ins_make -w AGRIF
250    (cd ../../../modeles/AGRIF/ ; gmake ;)
251    echo '        '
252    echo '        AGRIF Makefile and compilation done'
253    echo '        '
254fi
255
256
257echo '         '
258echo '         #############################################################'
259echo '             >>>>>>>>   Now set "by hand" the mpi domain decomposition indices jpni, '
260echo '                        jpnj & jpnij in par_oce.F90_keep files (keeping the "_keep" extension) '
261echo "                        in coherence with the ${DECOMP} total number of processors you just set "
262echo '                        Make this modification in the following directories:         '
263ind=0
264while [ $ind -lt ${NBCFG} ]
265do
266echo "                        ../config/${CONF[${ind}]}/MY_SRC"
267let ind=$ind+1
268done
269echo '         ###########################################################'
270echo '         '
Note: See TracBrowser for help on using the repository browser.