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

Last change on this file since 1402 was 1365, checked in by cetlod, 15 years ago

Adding a new target platform : mercure, see ticket:393

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