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.
fcm_job.sh in branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE – NEMO

source: branches/dev_r2586_dynamic_mem/NEMOGCM/SETTE/fcm_job.sh @ 2678

Last change on this file since 2678 was 2678, checked in by rblod, 12 years ago

Phasing branch dev_r2586_dynamic_mem with revision 2675 off the trunk

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 8.4 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 "executing script : \"fcm_job $@\" " >> ${SETTE_DIR}/output.sette
107echo "            " >> ${SETTE_DIR}/output.sette
108
109################################################################
110# SET INPUT
111# get the input tarfile if needed
112tar_file=$(sed -ne "1,1p" $1)
113if [ "$(cat $1 | grep -c ".tar" )" -ne 0 ] ; then
114   echo "looking for tar file" >> ${SETTE_DIR}/output.sette
115   echo "            " >> ${SETTE_DIR}/output.sette
116   cp ${FORCING_DIR}/${tar_file} ${INPUT_DIR}/.
117   if [ ! -f ${INPUT_DIR}/${tar_file} ] ; then
118      echo "PROBLEM during copy of tar file" >> ${SETTE_DIR}/output.sette
119      echo "tar file IS NOT present in ${INPUT_DIR} directory " >> ${SETTE_DIR}/output.sette
120      echo "            " >> ${SETTE_DIR}/output.sette
121      echo "PROBLEM during copy of tar file" 
122      exit 1
123   else 
124      cd ${INPUT_DIR} ; tar xvof ${INPUT_DIR}/*.tar ; gunzip -f *gz
125   fi
126fi
127
128if [ -f ${INPUT_DIR}/namelist_ice_lim2 ] ; then
129   echo "choosing for namelist ice " >> ${SETTE_DIR}/output.sette
130   echo "            " >> ${SETTE_DIR}/output.sette
131   cp ${INPUT_DIR}/namelist_ice_lim2 ${INPUT_DIR}/namelist_ice
132elif  [ -f ${INPUT_DIR}/namelist_ice_lim3 ] ; then
133   cp ${INPUT_DIR}/namelist_ice_lim3 ${INPUT_DIR}/namelist_ice
134fi
135
136
137if [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "agrif" )" -ne 0 ] ; then
138   #- Namelist for ocean and ice (agrif fine grid)
139      echo "choosing for namelist for AGRIF" >> ${SETTE_DIR}/output.sette
140      echo "            " >> ${SETTE_DIR}/output.sette
141   cp ${INPUT_DIR}/1_namelist_ice_lim2 ${INPUT_DIR}/1_namelist_ice
142fi
143################################################################
144
145################################################################
146# RUN OPA
147cd ${INPUT_DIR}
148NB_PROC=$2
149if [ ! -r ${INPUT_DIR}/opa ]
150    then
151    echo "executable opa does not exist"
152    echo "executable opa does not exist, exit"  >> ${SETTE_DIR}/output.sette
153    exit 1
154fi
155if [ ${NB_PROC} == 1 ] ; then
156    echo "running opa" >> ${SETTE_DIR}/output.sette
157    echo "            " >> ${SETTE_DIR}/output.sette
158    ./opa
159else
160    echo "running opa in MPI" >> ${SETTE_DIR}/output.sette
161    echo "            " >> ${SETTE_DIR}/output.sette
162# example for brodie (NEC SX8) machine
163#  mpirun -np ${NB_PROC} opa
164# example for dedale machine
165#  mpirun --mca btl self,tcp -np ${NB_PROC} opa
166# example for vargas (IBM Power6) machine
167    mpiexec -n ${NB_PROC} opa
168fi
169################################################################
170# SMALL DEBUG
171# echo "control that time.step exists
172if [ ! -r ${INPUT_DIR}/time.step ]
173    then
174    echo "file time.step does not exist"   >> ${SETTE_DIR}/output.sette
175    echo "some problems during execution of model"  >> ${SETTE_DIR}/output.sette
176    exit 1
177else
178    echo "file time.step exists"  >> ${SETTE_DIR}/output.sette
179    echo "ok model run"   >> ${SETTE_DIR}/output.sette
180fi
181################################################################
182
183################################################################
184# SAVE OUTPUT, DEBUG & RESTART FILES
185echo "saving ocean & ice output, debug & restart files" >> ${SETTE_DIR}/output.sette
186echo "            " >> ${SETTE_DIR}/output.sette
187[ ! -d ${OUTPUT_DIR} ] && mkdir ${OUTPUT_DIR}
188[ -f *ocean.output ] && mv *ocean.output ${OUTPUT_DIR}/.
189[ -f *solver.stat ] && mv *solver.stat ${OUTPUT_DIR}/.
190[ -n "$(ls *_grid_*)" ] && mv *_grid_*.nc ${OUTPUT_DIR}/.
191[ -n "$(ls *_ptrc_*)" ] && mv *_ptrc_*.nc ${OUTPUT_DIR}/.
192[ -n "$(ls *_diad_*)" ] && mv *_diad_*.nc ${OUTPUT_DIR}/.
193[ -n "`ls *restart*`" ] && cp *restart*.nc ${OUTPUT_DIR}/.
194[ -f ice_evolu ] && mv ice_evolu ${OUTPUT_DIR}/.
195[ -n "`ls *icemod*`" ] && mv *icemod* ${OUTPUT_DIR}/.
196#- Save ftrace file
197[ -f ftrace.out* ] && cp ftrace.out* ${OUTPUT_DIR}/.
198################################################################
199
200################################################################
201# SAVE IN NEMO_VALIDATION tree
202export LANG=en_US
203cd ${CONFIG_DIR}
204cd ../
205REVISION_NB=`svn info | grep -i "Revision:" | sed -e "s/ //" | cut -d ":" -f 2`
206if [ ${#REVISION_NB} -eq 0 ]
207then
208   echo "some problems with svn info command"
209   echo "some problems with svn info command" >> ${SETTE_DIR}/output.sette
210   ${REVISION_NB}=`date +%Y%m%d`
211   echo "put in ${REVISION_NB} date"
212   echo "put in ${REVISION_NB} date" >> ${SETTE_DIR}/output.sette
213else
214echo "value of revision number of NEMOGCM: ${REVISION_NB}"
215fi
216cd ${NEMO_VALIDATION_DIR}
217export TEST_NAME=$3
218`mkdir -p ${NEMO_VALIDATION_DIR}/W${NEW_CONF}/${CMP_NAM}/${REVISION_NB}/${TEST_NAME}`
219NEMO_VALID=${NEMO_VALIDATION_DIR}/W${NEW_CONF}/${CMP_NAM}/${REVISION_NB}/${TEST_NAME}
220if [ -d ${NEMO_VALID} ] ; then
221   echo "created ${NEMO_VALID} directory"   >> ${SETTE_DIR}/output.sette
222else
223   echo "problems in creating ${NEMO_VALID} directory"   >> ${SETTE_DIR}/output.sette
224   echo "EXIT,"
225   exit 1
226fi
227[ -f ${OUTPUT_DIR}/*ocean.output ] && mv ${OUTPUT_DIR}/*ocean.output ${NEMO_VALID}/.
228[ -f ${OUTPUT_DIR}/*solver.stat ] && mv ${OUTPUT_DIR}/*solver.stat ${NEMO_VALID}/.
229[ -n "`ls ${OUTPUT_DIR}/*restart*`" ] && mv ${OUTPUT_DIR}/*restart* ${NEMO_VALID}/.
230if [ -n "$(ls ${NEMO_VALID}/*solver*)" ] ; then
231   echo "moved solver.stat in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
232   echo "moved solver.stat in ${NEMO_VALID} directory" 
233else
234   echo "problem in looking for solver.stat file in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
235   echo "solver.stat IS NOT in ${NEMO_VALID} directory" 
236fi
237if [ -n "$(ls ${NEMO_VALID}/*ocean.output*)" ] ; then
238   echo "moved ocean.output in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
239   echo "moved ocean.output in ${NEMO_VALID} directory" 
240else
241   echo "problem in looking for ocean.output file in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
242   echo "ocean.output IS NOT in ${NEMO_VALID} directory" 
243fi
244if [ -n "`ls ${NEMO_VALID}/*restart*`" ] ; then
245   echo "moved restart files in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
246   echo "moved restart files in ${NEMO_VALID} directory" 
247else
248   echo "problem in looking for restart files in ${NEMO_VALID} directory"  >> ${SETTE_DIR}/output.sette
249   echo "restart files ARE NOT in ${NEMO_VALID} directory" 
250fi
251################################################################
Note: See TracBrowser for help on using the repository browser.