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

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

add svn Id

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