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

source: branches/2011/dev_LOCEAN_2011/NEMOGCM/SETTE/fcm_job.sh @ 3021

Last change on this file since 3021 was 3021, checked in by cetlod, 12 years ago

branch dev_LOCEAN_2011:Merge in changes between rev 2757:3020 of branch 2011/dev_r2855_LOCEAN7_SETTE/NEMOGCM/SETTE subdirectory, see ticket #877

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 6.5 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# Simple job for SET TESTS for NEMO (SETTE)
34#
35#   get input files (if needed) : tar file 
36#  (note this job needs to have an input_CONFIG.cfg in which can be found input tar file name)
37#
38#   runs job in interactive or batch mode : all jobs using 1 process are run interactive, and all MPP jobs are
39#
40#   run in batch (MPI_INTERACT="no") or interactive (MPI_INTERACT="yes") see sette.sh and BATCH_TEMPLATE directory
41#
42#   and call post_test_tidyup function (that moves in NEMO_VALIDATION_DIR solver.stat, tracer.stat (for LOBSTER & PISCES) & ocean.output)
43#
44# EXAMPLES
45# ========
46#
47# ::
48#
49#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME
50#
51#  run a job of config GYRE with 1 processor SHORT test ( 5 days )
52#  $ ./fcm_job.sh input_GYRE.cfg 1 SHORT
53#
54#  run a job of config ORCA2_LIM_PISCES   with 8 processors test RESTARTABILITY
55#  $ ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 LONG
56#
57#
58# TODO
59# ====
60#
61# option debug
62#
63#
64# EVOLUTIONS
65# ==========
66#
67# $Id$
68#
69#
70#
71#   * creation
72#
73#-
74#
75
76usage=" Usage : ./fcm_job.sh input_CONFIG_NAME.cfg  NUMBER_OF_PROCS TEST_NAME"
77usage=" example : ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 SHORT"
78
79
80minargcount=3
81        if [ ${#} -lt ${minargcount} ]
82        then
83                echo "not enought arguments for fcm_job.sh script"
84                echo "control number of argument of fcm_job.sh in sette.sh"
85                echo "${usage}"
86        exit 1
87        fi
88        unset minargcount
89   if [ ! -f ${SETTE_DIR}/output.sette ] ; then
90           touch ${SETTE_DIR}/output.sette
91   fi
92       
93#
94# set and export TEST_NAME. It will be used within the post_test_tidyup function
95#
96export TEST_NAME=$3
97
98# export EXE_DIR. This directory is used to execute model
99#
100export EXE_DIR
101#
102#
103echo "date: `date`" >> ${SETTE_DIR}/output.sette
104echo "" >> ${SETTE_DIR}/output.sette
105echo "running config: ${NEW_CONF}" >> ${SETTE_DIR}/output.sette
106echo "" >> ${SETTE_DIR}/output.sette
107echo "list of cpp_keys: " >> ${SETTE_DIR}/output.sette
108echo "`more ../CONFIG/${NEW_CONF}/cpp_${NEW_CONF}.fcm`" >> ${SETTE_DIR}/output.sette
109echo "" >> ${SETTE_DIR}/output.sette
110echo "compiling with: ${CMP_NAM}" >> ${SETTE_DIR}/output.sette
111echo "" >> ${SETTE_DIR}/output.sette
112echo "executing script : \"fcm_job $@\" " >> ${SETTE_DIR}/output.sette
113echo "            " >> ${SETTE_DIR}/output.sette
114
115################################################################
116# SET INPUT
117# get the input tarfile if needed
118tar_file=$(sed -ne "1,1p" $1)
119if [ "$(cat $1 | grep -c ".tar" )" -ne 0 ] ; then
120   echo "looking for tar file" >> ${SETTE_DIR}/output.sette
121   echo "            " >> ${SETTE_DIR}/output.sette
122   cp ${FORCING_DIR}/${tar_file} ${INPUT_DIR}/.
123   echo "file in ${INPUT_DIR}"
124   if [ ! -f ${INPUT_DIR}/${tar_file} ] ; then
125      echo "PROBLEM during copy of tar file" >> ${SETTE_DIR}/output.sette
126      echo "tar file IS NOT present in ${INPUT_DIR} directory " >> ${SETTE_DIR}/output.sette
127      echo "            " >> ${SETTE_DIR}/output.sette
128      echo "PROBLEM during copy of tar file" 
129      exit 1
130   else 
131      cd ${EXE_DIR} ; tar xvof ${INPUT_DIR}/*.tar ; gunzip -f *gz
132   fi
133fi
134
135if [ ! -f ${EXE_DIR}/namelist_ice ] ; then
136if [ -f ${EXE_DIR}/namelist_ice_lim2 ] ; then
137   echo "choosing for namelist ice " >> ${SETTE_DIR}/output.sette
138   echo "            " >> ${SETTE_DIR}/output.sette
139   cp ${EXE_DIR}/namelist_ice_lim2 ${EXE_DIR}/namelist_ice
140elif  [ -f ${EXE_DIR}/namelist_ice_lim3 ] ; then
141   cp ${EXE_DIR}/namelist_ice_lim3 ${EXE_DIR}/namelist_ice
142fi
143fi
144
145
146if [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "agrif" )" -ne 0 ] ; then
147   #- Namelist for ocean and ice (agrif fine grid)
148      echo "choosing for namelist for AGRIF" >> ${SETTE_DIR}/output.sette
149      echo "            " >> ${SETTE_DIR}/output.sette
150   cp ${EXE_DIR}/1_namelist_ice_lim2 ${EXE_DIR}/1_namelist_ice
151fi
152################################################################
153
154################################################################
155# RUN OPA
156cd ${EXE_DIR}
157NB_PROC=$2
158if [ ! -r ${EXE_DIR}/opa ]
159    then
160    echo "executable opa does not exist"
161    echo "executable opa does not exist, exit"  >> ${SETTE_DIR}/output.sette
162    exit 1
163fi
164if [ ${NB_PROC} == 1 ] ; then
165    echo "running opa" >> ${SETTE_DIR}/output.sette
166    echo "            " >> ${SETTE_DIR}/output.sette
167    ./opa
168#
169# Tidy out output from this test and populate the NEMO_VALIDATION_DIR tree
170#
171    post_test_tidyup
172else
173    echo "running opa in MPI" >> ${SETTE_DIR}/output.sette
174    echo "            " >> ${SETTE_DIR}/output.sette
175
176    if [ ${MPI_INTERACT} == "yes" ] ; then
177   #
178   # example for brodie (NEC SX8) machine
179   #  mpirun -np ${NB_PROC} opa
180   # example for dedale machine
181   #  mpirun --mca btl self,tcp -np ${NB_PROC} opa
182   # example for vargas (IBM Power6) machine
183   mpiexec -n ${NB_PROC} opa
184   #
185   post_test_tidyup
186    fi
187#
188# example for NOCS Altix system using PBS batch submission (requires ${SETTE_DIR}/sette_batch_template file)
189#
190    if [ ${MPI_INTERACT} == "no" ] ; then
191      case ${COMPILER} in
192         ALTIX_NAUTILUS_MPT)
193               if [ ${NB_REM} == 0 ] ; then
194               # number of processes required is an integer multiple of 4
195               #
196               NB_NODES=$( echo $NB_PROC | awk '{print $1 / 4}')
197            else
198               #
199               # number of processes required is not an integer multiple of 4
200               # round up the number of nodes required.
201               #
202               NB_NODES=$( echo $NB_PROC | awk '{printf("%d",$1 / 4 + 1 )}')
203                  fi
204            ;;
205         *)
206            NB_NODES=${NB_PROC}
207            ;;
208
209      esac
210#
211# Pass settings into job file by using sed to edit predefined strings
212#
213        cat ${SETTE_DIR}/job_batch_template | sed -e"s/NODES/${NB_NODES}/" -e"s/NPROCS/${NB_PROC}/" \
214             -e"s:DEF_SETTE_DIR:${SETTE_DIR}:" -e"s:DEF_INPUT_DIR:${INPUT_DIR}:" \
215             -e"s:DEF_EXE_DIR:${EXE_DIR}:" \
216             -e"s:DEF_CONFIG_DIR:${CONFIG_DIR}:" \
217             -e"s:DEF_NEMO_VALIDATION:${NEMO_VALIDATION_DIR}:" -e"s:DEF_NEW_CONF:${NEW_CONF}:" \
218             -e"s:DEF_CMP_NAM:${CMP_NAM}:" -e"s:DEF_TEST_NAME:${TEST_NAME}:" > run_sette_test.job
219#
220# submit job to batch system
221   ${BATCH_COMMAND} run_sette_test.job
222    fi
223
224fi
Note: See TracBrowser for help on using the repository browser.