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_valid.ksh in branches/dev_001_GM/VALID/2INSTALL – NEMO

source: branches/dev_001_GM/VALID/2INSTALL/ins_valid.ksh @ 4328

Last change on this file since 4328 was 698, checked in by ctlod, 17 years ago

NVTK installation

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