Index: branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_vargas.ksh
===================================================================
--- branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_vargas.ksh	(revision 492)
+++ branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_vargas.ksh	(revision 493)
@@ -137,5 +137,5 @@
 #====================================================
 #- Max number of arguments passed to nco operator or demigration command
-UNIX_MAX_LIMIT=360
+UNIX_MAX_LIMIT=120
 
 #D-#==================================================
@@ -675,4 +675,5 @@
 	    cat out_rsync
 	fi
+	IGCM_sys_Rm out_rsync
     else
 	echo "No POST-TREATMENT avaible because ulam is down."
@@ -1127,53 +1128,4 @@
 
 ############################################################
-# Build run file
-
-function IGCM_sys_build_run_file {
-    IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
-set -x
-    if ( $DEBUG_sys ) ; then
-	echo "IGCM_sys_build_run_file " $@
-    fi
-
-    NUM_PROC_OASIS=1
-
-    # Set the number of processors for OCE here
-    NUM_PROC_OCE=5
-
-    (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - NUM_PROC_OASIS - NUM_PROC_OCE ))
-    
-    if [ $1 = MPI2 ]; then
-       echo "IGCM_sys_build_run_file : error - MPI2 not available on vargas. "
-       IGCM_debug_Exit "IGCM_sys_build_run_file"
-    elif [ $1 = MPI1 ]; then
-	cat <<EOF > run_file
-./oasis
-EOF
-
-	typeset i
-	(( i = 0 ))
-	while [ ${i} -lt ${NUM_PROC_ATM} ] ; do
-	    (( i = i + 1 ))
-	    cat <<EOF >> run_file
-./lmdz.x
-EOF
-	done
-
-        (( i = 0 ))
-        while [ ${i} -lt ${NUM_PROC_OCE} ] ; do
-            (( i = i + 1 ))
-	    cat <<EOF >> run_file
-./opa.xx
-EOF
-        done
-
-	wc -l run_file
-    fi
-set +x
-    IGCM_debug_PopStack "IGCM_sys_build_run_file"
-}
-
-
-############################################################
 # Build MPI/OMP scripts
 function IGCM_sys_build_execution_scripts 
@@ -1206,6 +1158,6 @@
 	EXECUTION="${EXECUTION} -pgmmodel mpmd -cmdfile ./runfile" 
 
-	IGCM_debug_Print 1 "sys vargas : La commande d execution est "
-	IGCM_debug_Print 1 $EXECUTION
+	IGCM_debug_Print 1 "sys vargas : execution command is "
+	IGCM_debug_Print 1 "$EXECUTION"
 
 	if ( ${OK_PARA_OMP} ) ; then
@@ -1213,5 +1165,7 @@
 # @ task_geometry={(0)(1,2,3)}
 # Nombre de processus demandes
+	    echo "Job_${config_UserChoices_JobName} includes task_geometry = \c"
 	    cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "task_geometry" | sed -e "s/[^(]*([^(]*/(/g" 
+	    echo "Job_${config_UserChoices_JobName} includes task_geometry  with NbNodes = \c"
 	    cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "task_geometry" | sed -e "s/[^(]*([^(]*/(/g" | wc -c 
 	    NbNodes_Job=$(( $( cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "task_geometry" | sed -e "s/[^(]*([^(]*/(/g" | wc -c ) - 1 ))
@@ -1227,4 +1181,5 @@
 # Pas d OpenMP
 # @ resources = ConsumableCpus(1)
+	    echo "Job_${config_UserChoices_JobName} includes total_tasks = \c"
 	    cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "total_tasks" | sed -e "s/.*total_tasks = //" 
 	    NbProc_Job=$( cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "total_tasks" | sed -e "s/.*total_tasks = //" )
@@ -1234,6 +1189,8 @@
 		exit 1
 	    fi
-	    if ( $( cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "resources = ConsumableCpus(1)" ) ) ; then
-		IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources : no ressource defined with MPI only run."
+	    if ( $( egrep '^# *@ *resources *= *ConsumableCpus\(1\)' ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} >/dev/null 2>&1 ) ) ; then
+                IGCM_debug_Print 2 "ressources =  ConsumableCpus(1) line found into Job_${config_UserChoices_JobName}"
+            else
+		IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources = line not found. Job should include resources = ConsumableCpus(1) "
 		exit 1
 	    fi		  
@@ -1247,4 +1204,5 @@
 # Then loop on the components 
 
+### oasis must be the first one
     for comp in ${config_ListOfComponents[*]} ; do
 	
@@ -1253,5 +1211,5 @@
 	    
 	# Only if we really have an executable for the component :
-	if [ "X${ExeNameOut}" != X\"\" ] ; then
+	if [ "X${ExeNameOut}" = Xoasis ] ; then
 
 	    eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
@@ -1263,7 +1221,7 @@
 		until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do
 		    if ( ${OK_PARA_OMP} ) ; then 
-			echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} > out_${ExeNameOut}.out.${mpi_count} 2>out_${ExeNameOut}.err.${mpi_count}" >> runfile
+			echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> runfile
 		    else
-			echo "./${ExeNameOut} > out_${ExeNameOut}.out.${mpi_count} 2>out_${ExeNameOut}.err.${mpi_count}" >> runfile 
+			echo "./${ExeNameOut}" >> runfile 
 		    fi
 		    (( mpi_count = mpi_count + 1 ))
@@ -1271,13 +1229,51 @@
 	    else
 		if ( ${OK_PARA_OMP} ) ; then 
-		    echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> runfile
+		    echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> runfile
 		else
-		    echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> runfile 
+		    echo "./${ExeNameOut} " >> runfile 
 		fi
 	    fi
 	fi
     done
+
+    for comp in ${config_ListOfComponents[*]} ; do
+	
+	eval ExeNameIn=\${config_Executable_${comp}[0]}
+	eval ExeNameOut=\${config_Executable_${comp}[1]}
+	    
+	# Only if we really have an executable for the component :
+	if [ "X${ExeNameOut}" != X\"\" -and "X${ExeNameOut}" != Xoasis ] ; then
+
+	    eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
+	    eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
+	    
+	    if ( ${OK_PARA_MPI} ) ; then 
+
+		(( mpi_count = 1 ))
+		until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do
+		    if ( ${OK_PARA_OMP} ) ; then 
+			echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> runfile
+		    else
+			echo "./${ExeNameOut}" >> runfile 
+		    fi
+		    (( mpi_count = mpi_count + 1 ))
+		done
+	    else
+		if ( ${OK_PARA_OMP} ) ; then 
+		    echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> runfile
+		else
+		    echo "./${ExeNameOut} " >> runfile 
+		fi
+	    fi
+	fi
+    done
     IGCM_sys_Chmod u+x runfile 
 
+    if ( $DEBUG_sys ) ; then
+        echo "runfile contains : "
+        cat runfile
+    fi
+
+
     IGCM_debug_PopStack "IGCM_sys_build_execution_scripts"
 }
