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

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

NVTK: allow to manage multiple experiences in parallel, see ticket: #514

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 8.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# 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=/u/rech/eee/reee831/IO_NEMO_ORCA2_LIM
53REFDAT=/u/rech/eee/reee831/NEMO_VALIDATION
54MAIL="ctlod@locean-ipsl.upmc.fr"
55UAGRIF=yes
56##########################################################
57##### End   Users modifications
58##########################################################
59
60
61# Standard configurations
62NBCFG=7
63CONF[0]=ORCA2_LIM
64CONF[1]=ORCA2_LIM3
65CONF[2]=GYRE
66CONF[3]=GYRE_LOBSTER
67CONF[4]=ORCA2_LIM_PISCES
68CONF[5]=ORCA2_OFF_PISCES
69CONF[6]=ZAGRIF
70LCLDIR=`pwd`
71
72# Use a modified modipsl script: ins_make
73# which allows to build Makefiles of a specific configuration
74# using the following syntax: ins_make -w NAME_CONF
75cp ./MODIPSL_FILES/ins_make ../../../util/.
76
77# Set following variable in AA_make.ldef script And master Makefile
78# - WWDIR = directory where to store results and jobs
79CAR_WORK_tmp=$( grep 'WWDIR=' ./CONFIG_FILES/AA_make.ldef )
80CAR_WORK=`echo $CAR_WORK_tmp | cut -f 1 -d " " `
81sed -e "s?${CAR_WORK}?WWDIR=${OUTDIR}?" ./CONFIG_FILES/AA_make.ldef > ./CONFIG_FILES/AA_make.ldef.$$ 
82mv ./CONFIG_FILES/AA_make.ldef.$$  ./CONFIG_FILES/AA_make.ldef && rm -f ./CONFIG_FILES/AA_make.ldef.$$
83
84sed -e "s?DELFIL?${OUTDIR}?" ../Makefile > ../Makefile.$$ 
85mv ../Makefile.$$  ../Makefile && rm -f ../Makefile.$$
86
87# Get the current target name
88LOCTARG=`../../../util/w_i_h`
89
90# Loop over each standard configuration
91# #####################################
92ind=0
93while [ $ind -lt ${NBCFG} ]
94do
95       # I. Take into account specific changes
96       # #####################################
97       # Set following variables in job_NAME_CONF.ksh script
98       # - MAINDIR = directory where to get namelist input files
99       # - WORK    = directory where to store results
100       # - REF_OD  = directory where Are stored results from previous tags
101       cd ../../../.. ; NAME_ARCH=$( pwd ) ;
102       cd ${LCLDIR}
103       echo ${NAME_ARCH}
104       CAR_MAIN_tmp=$( grep 'MAINDIR=' ./JOBS/job_${CONF[${ind}]}.ksh )
105       CAR_MAIN=`echo $CAR_MAIN_tmp | cut -f 1 -d " " `
106       CAR_WORK_tmp=$( grep 'WORK=' ./JOBS/job_${CONF[${ind}]}.ksh )
107       CAR_WORK=`echo $CAR_WORK_tmp | cut -f 1 -d " " `
108       CAR_REFO_tmp=$( grep 'REF_OD=' ./JOBS/job_${CONF[${ind}]}.ksh  | head -1 )
109       CAR_REFO=`echo $CAR_REFO_tmp | cut -f 1 -d " " `
110       sed -e "s?${CAR_MAIN}?MAINDIR=${NAME_ARCH}?" -e "s?${CAR_WORK}?WORK=${OUTDIR}?" \
111       -e "s?${CAR_REFO}?REF_OD=${REFDAT}?" ./JOBS/job_${CONF[${ind}]}.ksh > ./JOBS/job_tmp.$$
112       mv ./JOBS/job_tmp.$$  ./JOBS/job_${CONF[${ind}]}.ksh && rm -f ./JOBS/job_tmp.$$
113
114       # II. Build configuration environment
115       # ###################################
116       (cd ../ ; ./use_cfg -n ${CONF[${ind}]} ;)
117echo '         '
118echo '        >>>>>>>>   Configuration directories have been built:'
119echo "         ./config/${CONF[${ind}]}/WORK"
120echo "         ./config/${CONF[${ind}]}/MY_SRC"
121echo '         '
122
123       cp ./CONFIG_FILES/AA_make* ../../${CONF[${ind}]}/.
124       cp ./CONFIG_FILES/BB_make.ldef_${CONF[${ind}]} ../../${CONF[${ind}]}/scripts/BB_make.ldef
125
126       # Configuration dependencies
127       (cd ../../${CONF[${ind}]} ; ../NVTK/fait_AA_make ; )
128echo '                  '
129echo "             >>>>>>>>   Dependencies file ./config/${CONF[${ind}]}/BB_make have been re-built"
130
131       # III. Build output sub-directories
132       # #################################
133       # Directories from where Jobs will be launched
134       # and where results will be stored before analysed
135       cd ${OUTDIR}
136       if [ ! -d 'NEMO_VALID' ] ;  then
137           mkdir  NEMO_VALID
138       fi
139       cd NEMO_VALID
140       mkdir -p W${CONF[${ind}]}/infos/inter
141       mkdir -p W${CONF[${ind}]}/mon/LONG
142       mkdir -p W${CONF[${ind}]}/mon/GTIME
143       mkdir -p W${CONF[${ind}]}/mon/1_SHORT
144       mkdir -p W${CONF[${ind}]}/mon/2_SHORT
145       #
146       mkdir -p W${CONF[${ind}]}/mpi/LONG
147       mkdir -p W${CONF[${ind}]}/mpi/GTIME
148       mkdir -p W${CONF[${ind}]}/mpi/1_SHORT
149       mkdir -p W${CONF[${ind}]}/mpi/2_SHORT
150       #
151       mkdir -p W${CONF[${ind}]}/omp/LONG
152       mkdir -p W${CONF[${ind}]}/omp/GTIME
153       mkdir -p W${CONF[${ind}]}/omp/1_SHORT
154       mkdir -p W${CONF[${ind}]}/omp/2_SHORT
155       #
156echo '         '
157echo '        >>>>>>>>   The following sub-directories have been built '
158echo '                        under main directory '$( pwd )
159echo '         They are dedicated to store results'
160       find W${CONF[${ind}]} -type d
161echo '         '
162
163       cd ${LCLDIR}
164
165       let ind=$ind+1
166done
167
168
169# IV. Modify lance_batch.ksh & assessment.ksh scripts
170# ###################################################
171# Set following variables in lance_batch.ksh script
172# - IODIR = directory where to get ORCA2_LIM_nemo_v2.tar
173# - PRC   = total number of processors which will be used
174
175CAR_INPU_tmp=$( grep 'IODIR=' ./JOBS/lance_batch.ksh )
176CAR_INPU=`echo $CAR_INPU_tmp | cut -f 1 -d " " `
177CAR_TARG_tmp=$( grep 'TARGET=' ./JOBS/lance_batch.ksh | head -1)
178CAR_TARG=`echo $CAR_TARG_tmp | cut -f 1 -d " " `
179sed -e "s?${CAR_INPU}?IODIR=${INPUTD}?" -e "s/${CAR_TARG}/TARGET=${LOCTARG}/" \
180./JOBS/lance_batch.ksh > ./JOBS/lance_batch.$$
181mv ./JOBS/lance_batch.$$  ./JOBS/lance_batch.ksh && rm -f ./JOBS/lance_batch.$$
182chmod 744 ./JOBS/lance_batch.ksh
183
184# Set following variables in assessment.ksh script
185# - TARGET = the current plateform
186# - MAIL   = your e-mail
187CAR_TARG_tmp=$( grep 'TARGET=' ./JOBS/assessment.ksh )
188CAR_TARG=`echo $CAR_TARG_tmp | cut -f 1 -d " " `
189CAR_MAIL_tmp=$( grep 'EMAIL=' ./JOBS/assessment.ksh )
190CAR_MAIL=`echo $CAR_MAIL_tmp | cut -f 1 -d " " `
191sed -e "s/${CAR_TARG}/TARGET=${LOCTARG}/" -e "s/${CAR_MAIL}/EMAIL='${MAIL}'/" \
192./JOBS/assessment.ksh > ./JOBS/assessment.$$
193mv ./JOBS/assessment.$$  ./JOBS/assessment.ksh && rm -f ./JOBS/assessment.$$
194chmod 744 ./JOBS/assessment.ksh
195
196# V. Preliminary compilations
197# ###########################
198
199# IOIPSL compilation
200../../../util/ins_make -w IOIPSL
201if [ ${LOCTARG} = 'sx8brodie' -o ${LOCTARG} = 'sx8mercure' ] ; then
202    (cd ../../../modeles/IOIPSL/src ; sxgmake ;)
203else
204    (cd ../../../modeles/IOIPSL/src ; gmake ;)
205fi
206echo '         '
207echo '        >>>>>>>>   IOIPSL Makefile and compilation done'
208echo '         '
209
210# AGRIF compilation
211if [ ${UAGRIF} = 'yes' ] ;  then
212    ../../../util/ins_make -w AGRIF
213    (cd ../../../modeles/AGRIF/ ; gmake ;)
214    echo '        '
215    echo '        AGRIF Makefile and compilation done'
216    echo '        '
217fi
218
219
220echo '         '
221echo '         #############################################################'
222echo '             >>>>>>>>   Following configuration(s) can be used with NVTK:'
223ind=0
224while [ $ind -lt ${NBCFG} ]
225do
226echo "                        # ${CONF[${ind}]}"
227let ind=$ind+1
228done
229echo '         ###########################################################'
230echo '         '
Note: See TracBrowser for help on using the repository browser.