source: trunk/NEMOGCM/SETTE/fcm_job.sh @ 2769

Last change on this file since 2769 was 2687, checked in by flavoni, 10 years ago

add input cfg file for POMME, and move ice_evolu in NEMO_VALIDATION_DIR, see ticket #752

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 8.9 KB
Line 
1#####################################################
2# Author : Simona Flavoni for NEMO
3# Contact : sflod@locean-ipsl.upmc.fr
4#
5# Some scripts called by sette.sh
6# fcm_job.sh   : simple job to run NEMO with fcm
7######################################################
8#set -x
9set -o posix
10#set -u
11#set -e
12#+
13#
14# ================
15# fcm_job.sh
16# ================
17#
18# --------------------------
19# Simple job for NEMO tests
20# --------------------------
21#
22# SYNOPSIS
23# ========
24#
25# ::
26#
27#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME
28#
29#
30# DESCRIPTION
31# ===========
32#
33#
34# Simple job for SET TESTS for NEMO (SETTE)
35#
36# this job creates tree of validation in NEMO_VALIDATION_DIR as follows :
37#
38# NEMO_VALIDATION_DIR/WCONFIG_NAME/WCOMPILER_NAME/TEST_NAME/REVISION_NUMBER(or DATE)
39#
40# NEMO_VALIDATION_DIR      : is choosen in param.cfg
41#
42# WCONFIG_NAME       : set by makenemo at the moment of compilation
43#
44# WCOMPILER_NAME     : set by makenemo at the moment of compilation
45#
46# TEST_NAME       : convention is LONG=10 days run, SHORT=5 days run
47#
48# REVISION_NUMBER(or DATE) : revision number by svn info, if problems with svn date is taken
49#
50# EXAMPLES
51# ========
52#
53# ::
54#
55#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME
56#
57#  run a job of config GYRE with 1 processor test REPRODUCTINILITY
58#  $ ./fcm_job.sh input_GYRE.cfg 1 SHORT
59#
60#  run a job of config ORCA2_LIM_PISCES   with 8 processors test RESTARTABILITY
61#  $ ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 LONG
62#
63#
64# TODO
65# ====
66#
67# option debug
68#
69#
70# EVOLUTIONS
71# ==========
72#
73# $Id$
74#
75#
76#
77#   * creation
78#
79#-
80#
81
82usage=" Usage : ./fcm_job.sh input_CONFIG_NAME.cfg  NUMBER_OF_PROCS TEST_NAME"
83usage=" example : ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 RUN"
84
85
86minargcount=3
87        if [ ${#} -lt ${minargcount} ]
88        then
89                echo "not enought arguments for fcm_job.sh script"
90                echo "control number of argument of fcm_job.sh in sette.sh"
91                echo "${usage}"
92        exit 1
93        fi
94        unset minargcount
95   if [ ! -f ${SETTE_DIR}/output.sette ] ; then
96           touch ${SETTE_DIR}/output.sette
97   fi
98       
99echo "date: `date`" >> ${SETTE_DIR}/output.sette
100echo "" >> ${SETTE_DIR}/output.sette
101echo "running config: ${NEW_CONF}" >> ${SETTE_DIR}/output.sette
102echo "" >> ${SETTE_DIR}/output.sette
103echo "list of cpp_keys: " >> ${SETTE_DIR}/output.sette
104echo "`more ../CONFIG/${NEW_CONF}/cpp_${NEW_CONF}.fcm`" >> ${SETTE_DIR}/output.sette
105echo "" >> ${SETTE_DIR}/output.sette
106echo "compiling with: ${CMP_NAM}" >> ${SETTE_DIR}/output.sette
107echo "" >> ${SETTE_DIR}/output.sette
108echo "executing script : \"fcm_job $@\" " >> ${SETTE_DIR}/output.sette
109echo "            " >> ${SETTE_DIR}/output.sette
110
111################################################################
112# SET INPUT
113# get the input tarfile if needed
114tar_file=$(sed -ne "1,1p" $1)
115if [ "$(cat $1 | grep -c ".tar" )" -ne 0 ] ; then
116   echo "looking for tar file" >> ${SETTE_DIR}/output.sette
117   echo "            " >> ${SETTE_DIR}/output.sette
118   cp ${FORCING_DIR}/${tar_file} ${INPUT_DIR}/.
119   if [ ! -f ${INPUT_DIR}/${tar_file} ] ; then
120      echo "PROBLEM during copy of tar file" >> ${SETTE_DIR}/output.sette
121      echo "tar file IS NOT present in ${INPUT_DIR} directory " >> ${SETTE_DIR}/output.sette
122      echo "            " >> ${SETTE_DIR}/output.sette
123      echo "PROBLEM during copy of tar file" 
124      exit 1
125   else 
126      cd ${INPUT_DIR} ; tar xvof ${INPUT_DIR}/*.tar ; gunzip -f *gz
127   fi
128fi
129
130if [ -f ${INPUT_DIR}/namelist_ice_lim2 ] ; then
131   echo "choosing for namelist ice " >> ${SETTE_DIR}/output.sette
132   echo "            " >> ${SETTE_DIR}/output.sette
133   cp ${INPUT_DIR}/namelist_ice_lim2 ${INPUT_DIR}/namelist_ice
134elif  [ -f ${INPUT_DIR}/namelist_ice_lim3 ] ; then
135   cp ${INPUT_DIR}/namelist_ice_lim3 ${INPUT_DIR}/namelist_ice
136fi
137
138
139if [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "agrif" )" -ne 0 ] ; then
140   #- Namelist for ocean and ice (agrif fine grid)
141      echo "choosing for namelist for AGRIF" >> ${SETTE_DIR}/output.sette
142      echo "            " >> ${SETTE_DIR}/output.sette
143   cp ${INPUT_DIR}/1_namelist_ice_lim2 ${INPUT_DIR}/1_namelist_ice
144fi
145################################################################
146
147################################################################
148# RUN OPA
149cd ${INPUT_DIR}
150NB_PROC=$2
151if [ ! -r ${INPUT_DIR}/opa ]
152    then
153    echo "executable opa does not exist"
154    echo "executable opa does not exist, exit"  >> ${SETTE_DIR}/output.sette
155    exit 1
156fi
157if [ ${NB_PROC} == 1 ] ; then
158    echo "running opa" >> ${SETTE_DIR}/output.sette
159    echo "            " >> ${SETTE_DIR}/output.sette
160    ./opa
161else
162    echo "running opa in MPI" >> ${SETTE_DIR}/output.sette
163    echo "            " >> ${SETTE_DIR}/output.sette
164# example for brodie (NEC SX8) machine
165#  mpirun -np ${NB_PROC} opa
166# example for dedale machine
167#  mpirun --mca btl self,tcp -np ${NB_PROC} opa
168# example for vargas (IBM Power6) machine
169    mpiexec -n ${NB_PROC} opa
170fi
171################################################################
172# SMALL DEBUG
173# echo "control that time.step exists
174if [ ! -r ${INPUT_DIR}/time.step ]
175    then
176    echo "file time.step does not exist"   >> ${SETTE_DIR}/output.sette
177    echo "some problems during execution of model"  >> ${SETTE_DIR}/output.sette
178    exit 1
179else
180    echo "file time.step exists"  >> ${SETTE_DIR}/output.sette
181    echo "ok model run"   >> ${SETTE_DIR}/output.sette
182fi
183################################################################
184
185################################################################
186# SAVE OUTPUT, DEBUG & RESTART FILES
187echo "saving ocean & ice output, debug & restart files" >> ${SETTE_DIR}/output.sette
188echo "            " >> ${SETTE_DIR}/output.sette
189[ ! -d ${OUTPUT_DIR} ] && mkdir ${OUTPUT_DIR}
190[ -f *ocean.output ] && mv *ocean.output ${OUTPUT_DIR}/.
191[ -f *solver.stat ] && mv *solver.stat ${OUTPUT_DIR}/.
192[ -n "$(ls *_grid_*)" ] && mv *_grid_*.nc ${OUTPUT_DIR}/.
193[ -n "$(ls *_ptrc_*)" ] && mv *_ptrc_*.nc ${OUTPUT_DIR}/.
194[ -n "$(ls *_diad_*)" ] && mv *_diad_*.nc ${OUTPUT_DIR}/.
195[ -n "`ls *restart*`" ] && cp *restart*.nc ${OUTPUT_DIR}/.
196[ -f ice_evolu ] && mv ice_evolu ${OUTPUT_DIR}/.
197[ -n "`ls *icemod*`" ] && mv *icemod* ${OUTPUT_DIR}/.
198#- Save ftrace file
199[ -f ftrace.out* ] && cp ftrace.out* ${OUTPUT_DIR}/.
200################################################################
201
202################################################################
203# SAVE IN NEMO_VALIDATION tree
204export LANG=en_US
205cd ${CONFIG_DIR}
206cd ../
207REVISION_NB=`svn info | grep -i "Revision:" | sed -e "s/ //" | cut -d ":" -f 2`
208if [ ${#REVISION_NB} -eq 0 ]
209then
210   echo "some problems with svn info command"
211   echo "some problems with svn info command" >> ${SETTE_DIR}/output.sette
212   REVISION_NB=`date +%Y%m%d`
213   echo "put in ${REVISION_NB} date"
214   echo "put in ${REVISION_NB} date" >> ${SETTE_DIR}/output.sette
215else
216echo "value of revision number of NEMOGCM: ${REVISION_NB}"
217fi
218cd ${NEMO_VALIDATION_DIR}
219export TEST_NAME=$3
220`mkdir -p ${NEMO_VALIDATION_DIR}/W${NEW_CONF}/${CMP_NAM}/${REVISION_NB}/${TEST_NAME}`
221NEMO_VALID=${NEMO_VALIDATION_DIR}/W${NEW_CONF}/${CMP_NAM}/${REVISION_NB}/${TEST_NAME}
222if [ -d ${NEMO_VALID} ] ; then
223   echo "created ${NEMO_VALID} directory"   >> ${SETTE_DIR}/output.sette
224else
225   echo "problems in creating ${NEMO_VALID} directory"   >> ${SETTE_DIR}/output.sette
226   echo "EXIT,"
227   exit 1
228fi
229[ -f ${OUTPUT_DIR}/*ocean.output ] && mv ${OUTPUT_DIR}/*ocean.output ${NEMO_VALID}/.
230[ -f ${OUTPUT_DIR}/*solver.stat ] && mv ${OUTPUT_DIR}/*solver.stat ${NEMO_VALID}/.
231[ -n "`ls ${OUTPUT_DIR}/*restart*`" ] && mv ${OUTPUT_DIR}/*restart* ${NEMO_VALID}/.
232[ -f ${OUTPUT_DIR}/ice_evolu ] && mv ${OUTPUT_DIR}/ice_evolu ${NEMO_VALID}/.
233if [ -n "$(ls ${NEMO_VALID}/*solver*)" ] ; then
234   echo "moved solver.stat in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
235   echo "moved solver.stat in ${NEMO_VALID} directory" 
236else
237   echo "problem in looking for solver.stat file in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
238   echo "solver.stat IS NOT in ${NEMO_VALID} directory" 
239fi
240if [ -n "$(ls ${NEMO_VALID}/*ocean.output*)" ] ; then
241   echo "moved ocean.output in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
242   echo "moved ocean.output in ${NEMO_VALID} directory" 
243else
244   echo "problem in looking for ocean.output file in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
245   echo "ocean.output IS NOT in ${NEMO_VALID} directory" 
246fi
247if [ -n "`ls ${NEMO_VALID}/*restart*`" ] ; then
248   echo "moved restart files in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
249   echo "moved restart files in ${NEMO_VALID} directory" 
250else
251   echo "problem in looking for restart files in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
252   echo "restart files ARE NOT in ${NEMO_VALID} directory" 
253fi
254if [ -n "$(ls ${NEMO_VALID}/ice_evolu)" ] ; then
255        echo "moved ice_evolu in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
256        echo "moved ice_evolu in ${NEMO_VALID} directory"
257else
258        echo "problem looking for ice_evolu file in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
259        echo "ice_evolu IS NOT in ${NEMO_VALID} directory"
260fi
261################################################################
Note: See TracBrowser for help on using the repository browser.