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

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

NVTK: few changes to allow NVTK to manage properly MPI runs, see ticket: #513

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