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 tags/nemo_v3_2/nemo_v3_2/NVTK/INSTALL – NEMO

source: tags/nemo_v3_2/nemo_v3_2/NVTK/INSTALL/ins_nvtk.ksh @ 1878

Last change on this file since 1878 was 1878, checked in by flavoni, 14 years ago

initial test for nemogcm

File size: 8.6 KB
Line 
1#!/bin/ksh
2# $Id: ins_nvtk.ksh 1582 2009-08-05 15:34:54Z ctlod $
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# Get the current target name
78LOCTARG=`../../../util/w_i_h`
79
80# Set following variable in AA_make.ldef script And master Makefile
81# - WWDIR = directory where to store results and jobs
82CAR_WORK_tmp=$( grep 'WWDIR=' ./CONFIG_FILES/AA_make.ldef )
83CAR_WORK=`echo $CAR_WORK_tmp | cut -f 1 -d " " `
84CAR_TARG_tmp=$( grep 'HPCTAR=' ./CONFIG_FILES/AA_make.ldef )
85CAR_TARG=`echo $CAR_TARG_tmp`
86sed -e "s?${CAR_WORK}?WWDIR=${OUTDIR}?" -e "s?${CAR_TARG}?HPCTAR=${LOCTARG}?" \
87       ./CONFIG_FILES/AA_make.ldef > ./CONFIG_FILES/AA_make.ldef.$$ 
88mv ./CONFIG_FILES/AA_make.ldef.$$  ./CONFIG_FILES/AA_make.ldef && rm -f ./CONFIG_FILES/AA_make.ldef.$$
89
90sed -e "s?DELFIL?${OUTDIR}?" ../Makefile > ../Makefile.$$ 
91mv ../Makefile.$$  ../Makefile && rm -f ../Makefile.$$
92
93# Loop over each standard configuration
94# #####################################
95ind=0
96while [ $ind -lt ${NBCFG} ]
97do
98       # I. Take into account specific changes
99       # #####################################
100       # Set following variables in job_NAME_CONF.ksh script
101       # - MAINDIR = directory where to get namelist input files
102       # - WORK    = directory where to store results
103       # - REF_OD  = directory where Are stored results from previous tags
104       cd ../../../.. ; NAME_ARCH=$( pwd ) ;
105       cd ${LCLDIR}
106       echo ${NAME_ARCH}
107       CAR_MAIN_tmp=$( grep 'MAINDIR=' ./JOBS/job_${CONF[${ind}]}.ksh )
108       CAR_MAIN=`echo $CAR_MAIN_tmp | cut -f 1 -d " " `
109       CAR_WORK_tmp=$( grep 'WORK=' ./JOBS/job_${CONF[${ind}]}.ksh )
110       CAR_WORK=`echo $CAR_WORK_tmp | cut -f 1 -d " " `
111       CAR_REFO_tmp=$( grep 'REF_OD=' ./JOBS/job_${CONF[${ind}]}.ksh  | head -1 )
112       CAR_REFO=`echo $CAR_REFO_tmp | cut -f 1 -d " " `
113       sed -e "s?${CAR_MAIN}?MAINDIR=${NAME_ARCH}?" -e "s?${CAR_WORK}?WORK=${OUTDIR}?" \
114       -e "s?${CAR_REFO}?REF_OD=${REFDAT}?" ./JOBS/job_${CONF[${ind}]}.ksh > ./JOBS/job_tmp.$$
115       mv ./JOBS/job_tmp.$$  ./JOBS/job_${CONF[${ind}]}.ksh && rm -f ./JOBS/job_tmp.$$
116
117       # II. Build configuration environment
118       # ###################################
119       (cd ../ ; ./use_cfg -n ${CONF[${ind}]} ;)
120echo '         '
121echo '        >>>>>>>>   Configuration directories have been built:'
122echo "         ./config/${CONF[${ind}]}/WORK"
123echo "         ./config/${CONF[${ind}]}/MY_SRC"
124echo '         '
125
126       cp ./CONFIG_FILES/AA_make* ../../${CONF[${ind}]}/.
127       cp ./CONFIG_FILES/BB_make.ldef_${CONF[${ind}]} ../../${CONF[${ind}]}/scripts/BB_make.ldef
128
129       # Configuration dependencies
130       (cd ../../${CONF[${ind}]} ; ../NVTK/fait_AA_make ; )
131echo '                  '
132echo "             >>>>>>>>   Dependencies file ./config/${CONF[${ind}]}/BB_make have been re-built"
133
134       # III. Build output sub-directories
135       # #################################
136       # Directories from where Jobs will be launched
137       # and where results will be stored before analysed
138       cd ${OUTDIR}
139       if [ ! -d 'NEMO_VALID' ] ;  then
140           mkdir  NEMO_VALID
141       fi
142       cd NEMO_VALID
143       mkdir -p W${CONF[${ind}]}/infos/inter
144       mkdir -p W${CONF[${ind}]}/mon/LONG
145       mkdir -p W${CONF[${ind}]}/mon/GTIME
146       mkdir -p W${CONF[${ind}]}/mon/1_SHORT
147       mkdir -p W${CONF[${ind}]}/mon/2_SHORT
148       #
149       mkdir -p W${CONF[${ind}]}/mpi/LONG
150       mkdir -p W${CONF[${ind}]}/mpi/GTIME
151       mkdir -p W${CONF[${ind}]}/mpi/1_SHORT
152       mkdir -p W${CONF[${ind}]}/mpi/2_SHORT
153       #
154       mkdir -p W${CONF[${ind}]}/omp/LONG
155       mkdir -p W${CONF[${ind}]}/omp/GTIME
156       mkdir -p W${CONF[${ind}]}/omp/1_SHORT
157       mkdir -p W${CONF[${ind}]}/omp/2_SHORT
158       #
159echo '         '
160echo '        >>>>>>>>   The following sub-directories have been built '
161echo '                        under main directory '$( pwd )
162echo '         They are dedicated to store results'
163       find W${CONF[${ind}]} -type d
164echo '         '
165
166       cd ${LCLDIR}
167
168       let ind=$ind+1
169done
170
171
172# IV. Modify lance_batch.ksh & assessment.ksh scripts
173# ###################################################
174# Set following variables in lance_batch.ksh script
175# - IODIR = directory where to get ORCA2_LIM_nemo_v2.tar
176# - PRC   = total number of processors which will be used
177
178CAR_INPU_tmp=$( grep 'IODIR=' ./JOBS/lance_batch.ksh )
179CAR_INPU=`echo $CAR_INPU_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_TARG}/TARGET=${LOCTARG}/" \
183./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.