Index: branches/2012/dev_NOC_MERCATOR_2012/NEMOGCM/SETTE/prepare_job.sh
===================================================================
--- branches/2012/dev_NOC_MERCATOR_2012/NEMOGCM/SETTE/prepare_job.sh	(revision 3651)
+++ branches/2012/dev_NOC_MERCATOR_2012/NEMOGCM/SETTE/prepare_job.sh	(revision 3661)
@@ -11,9 +11,9 @@
 # prepare_job.sh   : creates the job script for running job 
 ######################################################
-#set -x
+#set -vx
 set -o posix
 #set -u
 #set -e
-#
+#+
 #
 # ================
@@ -30,5 +30,5 @@
 # ::
 #
-#  $ ./prepare_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPI_INTERACT MPI_FLAG
+#  $ ./prepare_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPI_FLAG JOB_FILE
 #
 #
@@ -36,14 +36,7 @@
 # ===========
 #
-# Simple job for SET TESTS for NEMO (SETTE)
+# Part of the SETTE package to run tests for NEMO
 # 
-#   get input files (if needed) : tar file  
-#  (note this job needs to have an input_CONFIG.cfg in which can be found input tar file name)
-#
-#   runs job in interactive or batch mode : all jobs using 1 process are run interactive, and all MPP jobs are
-#
-#   run in batch (MPI_INTERACT="no") or interactive (MPI_INTERACT="yes") see sette.sh and BATCH_TEMPLATE directory
-#
-#   and call post_test_tidyup function (that moves in NEMO_VALIDATION_DIR solver.stat, tracer.stat (for LOBSTER & PISCES) & ocean.output)
+# prepare the script $JOB_FILE to run the tests 
 #
 # EXAMPLES
@@ -52,11 +45,7 @@
 # ::
 #
-#  $ ./fcm_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPI_INTERACT MPI_FLAG
-#
-#  run a job of config GYRE with 1 processor SHORT test ( 5 days ) using an interactive run without mpirun
-#  $ ./fcm_job.sh input_GYRE.cfg 1 SHORT yes no
-#
-#  run a job of config ORCA2_LIM_PISCES	with 8 processors test RESTARTABILITY submitting the job to the batch queue system and using mpirun
-#  $ ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 LONG no yes
+#  $ ./prepare_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPI_FLAG $JOB_FILE
+#
+# prepare the $JOB_FILE for execution 
 #
 #
@@ -70,5 +59,5 @@
 # ==========
 #
-# $Id: fcm_job.sh 3050 2011-11-07 14:11:34Z acc $
+# $Id: prepare_job.sh 3050 2011-11-07 14:11:34Z acc $
 #
 #
@@ -79,6 +68,6 @@
 #
 
-usage=" Usage : ./fcm_job.sh input_CONFIG_NAME.cfg  NUMBER_OF_PROCS TEST_NAME INTERACT MPI_FLAG"
-usage=" example : ./fcm_job.sh input_ORCA2_LIM_PISCES.cfg 8 SHORT no/yes no/yes"
+usage=" Usage : ./prepare_job.sh INPUT_FILE_CONFIG_NAME NUMBER_PROC TEST_NAME MPI_FLAG JOB_FILE"
+usage=" example : ./prepare_job.sh input_ORCA2_LIM_PISCES.cfg 8 SHORT no/yes $JOB_FILE"
 
 
@@ -86,6 +75,6 @@
         if [ ${#} -lt ${minargcount} ]
         then
-                echo "not enought arguments for fcm_job.sh script"
-                echo "control number of argument of fcm_job.sh in sette.sh"
+                echo "not enough arguments for prepare_job.sh script"
+                echo "control number of argument of prepare_job.sh in sette.sh"
                 echo "${usage}"
         exit 1
@@ -170,31 +159,8 @@
     exit 1
 fi
-#if [ ${NB_PROC} == 1 ] ; then
-#    echo "running opa" >> ${SETTE_DIR}/output.sette
-#    echo "            " >> ${SETTE_DIR}/output.sette
-#    ./opa
-#
-# Tidy out output from this test and populate the NEMO_VALIDATION_DIR tree
-#
-#    post_test_tidyup
-#else
-#    echo "running opa in MPI" >> ${SETTE_DIR}/output.sette
-#    echo "            " >> ${SETTE_DIR}/output.sette
-
-#    if [ ${MPI_INTERACT} == "yes" ] ; then
-#	#
-#	# example for brodie (NEC SX8) machine
-#	#	mpirun -np ${NB_PROC} opa
-#	# example for dedale machine
-#	#	mpirun --mca btl self,tcp -np ${NB_PROC} opa
-#	# example for vargas (IBM Power6) machine
-#	mpiexec -n ${NB_PROC} opa
-#	#
-#	post_test_tidyup
-#    fi
-#
+
 # example for NOCS Altix system using PBS batch submission (requires ${SETTE_DIR}/sette_batch_template file)
 #
-  #  if [ ${MPI_INTERACT} == "no" ] ; then
+  #  if [ ${MPI_FLAG} == "no" ] ; then
 		case ${COMPILER} in 
 			ALTIX_NAUTILUS_MPT)
@@ -203,5 +169,5 @@
 					# number of processes required is an integer multiple of 4
 					#
-					NB_NODES=$( echo $NB_PROC | awk '{print $1  $1 / 4}')
+					NB_NODES=$( echo $NB_PROC | awk '{print $1 / 4}')
 				else
 					#
@@ -215,24 +181,24 @@
                                 echo NB_PROCS ${NB_PROC}
                                 echo NB_NODES ${NB_NODES}
-                                echo  NB_PROC ${NB_PROC} 
+                                echo  NB_PROC ${NB_PROC}
                                 if [ ${NB_PROC} -eq 1 ] ; then
                                    NB_NODES=1
                                    QUEUE=monoproc
-                                   NB_PROC_NODE=${NB_PROC} 
+                                   NB_PROC_NODE=${NB_PROC}
                                 else
-                                   if [ ${NB_PROC} -le 8 ] ; then 
+                                   if [ ${NB_PROC} -le 8 ] ; then
                                       NB_NODES=1
                                       QUEUE=mono
-                                      NB_PROC_NODE=${NB_PROC} 
+                                      NB_PROC_NODE=${NB_PROC}
                                    else
                                       NB_NODES=$( echo $NB_PROC | awk '{print $1 - $1 % 8}'  | awk '{print $1 / 8 }')
                                       QUEUE=multi
                                       NB_PROC_NODE=8
-                                  fi    
-                                fi    
+                                  fi
+                                fi
                                 echo NB_PROCS     ${NB_PROC}
                                 echo NB_NODES     ${NB_NODES}
-                                echo NB_PROC_NODE ${NB_PROC_NODE} 
-				;;
+                                echo NB_PROC_NODE ${NB_PROC_NODE}
+                                ;;
 			*)
 				NB_NODES=${NB_PROC}
@@ -243,10 +209,5 @@
 # Pass settings into job file by using sed to edit predefined strings
 #
-         ((mem=5*NB_PROC))
-         echo NB_NODES NB_PROC QUEUE ${NB_NODES} ${NB_PROC} ${QUEUE}
-        cat ${SETTE_DIR}/job_batch_template | sed -e"s/NODES/${NB_NODES}/" -e"s/NPROCSNODE/${NB_PROC_NODE}/" \
-             -e"s/NPROCS/${NB_PROC}/" \
-             -e"s/QUEUE/${QUEUE}/" -e"s/MEM/${mem}/" \
-             -e"s/QUEUE/${QUEUE}/" -e"s/MEM/${mem}/" \
+        cat ${SETTE_DIR}/job_batch_template | sed -e"s/NODES/${NB_NODES}/" -e"s/NPROCS/${NB_PROC}/" \
              -e"s:DEF_SETTE_DIR:${SETTE_DIR}:" -e"s:DEF_INPUT_DIR:${INPUT_DIR}:" \
              -e"s:DEF_EXE_DIR:${EXE_DIR}:" \
@@ -255,5 +216,9 @@
              -e"s:DEF_NEMO_VALIDATION:${NEMO_VALIDATION_DIR}:" -e"s:DEF_NEW_CONF:${NEW_CONF}:" \
              -e"s:DEF_CMP_NAM:${CMP_NAM}:" -e"s:DEF_TEST_NAME:${TEST_NAME}:" > run_sette_test.job
-	
+
+        if [ ${COMPILER} -eq 'ifort_MERCATOR_CLUSTER' ] ; then
+             cat run_sette_test.job | sed -e"s/QUEUE/${QUEUE}/" -e"s/MEM/${mem}/" > run_sette_test1.job
+             mv run_sette_test1.job run_sette_test.job
+        fi
 #
 # create the unique submission job script
@@ -272,5 +237,5 @@
 	fi
 	
-	chmod a+x $JOB_FILE
+	chmod a+x $JOB_FILE ; echo "$JOB_FILE is ready"
 
 #fi
