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

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

change test in fcm_job.sh, see ticket #752

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 5.1 KB
Line 
1######################################################
2# Author : Simona Flavoni for NEMO
3# Contact : sflod@locean-ipsl.upmc.fr
4#
5# ----------------------------------------------------------------------
6# NEMO/SETTE , NEMO Consortium (2010)
7# Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
8# ----------------------------------------------------------------------
9#
10# Some scripts called by sette.sh
11# fcm_job.sh   : simple job to run NEMO with fcm
12######################################################
13#set -x
14set -o posix
15#set -u
16#set -e
17#+
18#
19# ================
20# fcm_job.sh
21# ================
22#
23# --------------------------
24# Simple job for NEMO tests
25# --------------------------
26#
27# SYNOPSIS
28# ========
29#
30# ::
31#
32#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC
33#
34#
35# DESCRIPTION
36# ===========
37#
38#
39# Simple job for SET TESTS for NEMO (SETTE)
40#
41#
42# EXAMPLES
43# ========
44#
45# ::
46#
47#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME       NUMBER_PROC
48#
49#  run a job of config GYRE with 1 processor
50#  $ ./fcm_job.sh input_GYRE.cfg                     1
51#
52#  run a job of config ORCA2_LIM_PISCES with 8 processors
53#  $ ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg         8
54#
55#
56# TODO
57# ====
58#
59# option debug
60#
61#
62# EVOLUTIONS
63# ==========
64#
65# $Id$
66#
67#
68#
69#   * creation
70#
71#-
72#
73
74usage=" Usage : ./fcm_job.sh input_CONFIG_NAME.cfg  NUMBER_OF_PROCS"
75usage=" example : ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8"
76
77
78minargcount=2
79        if [ ${#} -lt ${minargcount} ]
80        then
81                echo "not enought arguments for fcm_job.sh script"
82                echo "control number of argument of fcm_job.sh in sette.sh"
83                echo "${usage}"
84        exit 1
85        fi
86        unset minargcount
87   if [  -f ${SETTE_DIR}/output.sette ] ; then
88           echo "file output already present. Append comments"
89           echo "`ls ${SETTE_DIR}/output.sette`"
90   else
91           echo "file output not present"
92           touch ${SETTE_DIR}/output.sette
93           echo "`ls ${SETTE_DIR}/output.sette`"
94   fi
95   echo "executing script : fcm_job $@" >> ${SETTE_DIR}/output.sette
96   echo "            " >> ${SETTE_DIR}/output.sette
97
98# SET INPUT
99# get the input tarfile if needed
100tar_file=$(sed -ne "1,1p" $1)
101if [ "$(cat $1 | grep -c ".tar" )" -ne 0 ] ; then
102   echo "looking for tar file" >> ${SETTE_DIR}/output.sette
103   echo "            " >> ${SETTE_DIR}/output.sette
104   cp ${FORCING_DIR}/${tar_file} ${INPUT_DIR}/.
105   cd ${INPUT_DIR} ; tar xvf ${INPUT_DIR}/*.tar ; gunzip *gz
106fi
107
108if [ -f ${INPUT_DIR}/namelist_ice_lim2 ] ; then
109   echo "choosing for namelist ice " >> ${SETTE_DIR}/output.sette
110   echo "            " >> ${SETTE_DIR}/output.sette
111   cp ${INPUT_DIR}/namelist_ice_lim2 ${INPUT_DIR}/namelist_ice
112elif  [ -f ${INPUT_DIR}/namelist_ice_lim3 ] ; then
113   cp ${INPUT_DIR}/namelist_ice_lim3 ${INPUT_DIR}/namelist_ice
114fi
115
116
117if [ "$(cat ${CONFIG_DIR}/${NEW_CONF}/cpp_${NEW_CONF}.fcm | grep -c "agrif" )" -ne 0 ] ; then
118   #- Namelist for ocean and ice (agrif fine grid)
119      echo "choosing for namelist for AGRIF" >> ${SETTE_DIR}/output.sette
120      echo "            " >> ${SETTE_DIR}/output.sette
121   cp ${INPUT_DIR}/1_namelist_ice_lim2 ${INPUT_DIR}/1_namelist_ice
122fi
123################################################################
124
125################################################################
126# RUN OPA
127cd ${INPUT_DIR}
128NB_PROC=$2
129if [! -r ${INPUT_DIR}/opa ]
130   then
131   echo "executable opa does not exist"
132   exit 1
133fi
134if [ ${NB_PROC} == 1 ] ; then
135 opa_command='./opa'  # !! to test if executable is created
136          type ${opa_command}
137          status_type=${?}
138          if [ ${status_type} -ne 0 ]
139          then
140              echo "opa not found"
141              exit 1
142          fi
143   echo "running opa" >> ${SETTE_DIR}/output.sette
144   echo "            " >> ${SETTE_DIR}/output.sette
145   ./opa
146else
147opa_command='mpirun'  # !! to test if executable is created
148          type ${opa_command}
149          status_type=${?}
150          if [ ${status_type} -ne 0 ]
151          then
152              echo "mpi opa not found"
153              exit 1
154          fi
155# example for brodie (NEC SX8) machine
156   echo "running opa in MPI" >> ${SETTE_DIR}/output.sette
157   echo "            " >> ${SETTE_DIR}/output.sette
158   mpirun -np ${NB_PROC} opa
159# example for dedale machine
160#  mpirun --mca btl self,tcp -np ${NB_PROC} opa
161# example for vargas (IBM Power6) machine
162#  mpiexec -n ${NB_PROC} opa
163fi
164################################################################
165
166################################################################
167## -- Save output files
168
169#- Save ocean output files
170echo "saving ocean & ice output, debug & restarts files" >> ${SETTE_DIR}/output.sette
171echo "            " >> ${SETTE_DIR}/output.sette
172[ ! -d ${OUTPUT_DIR} ] && mkdir ${OUTPUT_DIR}
173[ -f *ocean.output ] && mv *ocean.output ${OUTPUT_DIR}/.
174[ -f *solver.stat ] && mv *solver.stat ${OUTPUT_DIR}/.
175[ -n "$(ls *_grid_*)" ] && mv *_grid_*.nc ${OUTPUT_DIR}/.
176[ -f restart* ] && cp restart* ${OUTPUT_DIR}/.
177[ -f ice_evolu ] && mv ice_evolu ${OUTPUT_DIR}/.
178[ -n "$(ls *icemod*)" ] && mv *icemod* ${OUTPUT_DIR}/.
179#- Save ftrace file
180[ -f ftrace.out* ] && cp ftrace.out* ${OUTPUT_DIR}/.
181################################################################
182
Note: See TracBrowser for help on using the repository browser.