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 trunk/NEMOGCM/SETTE – NEMO

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

Last change on this file since 2657 was 2657, checked in by flavoni, 12 years ago

add comments in sette_beginner.sh, and added TEST_NAME in fcm_job.sh, see ticket #752

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