Index: trunk/libIGCM/libIGCM_sys/libIGCM_sys_jeanzay.ksh
===================================================================
--- trunk/libIGCM/libIGCM_sys/libIGCM_sys_jeanzay.ksh	(revision 1492)
+++ trunk/libIGCM/libIGCM_sys/libIGCM_sys_jeanzay.ksh	(revision 1493)
@@ -1136,29 +1136,16 @@
     sed -e "/::openMPthreads::/d"                  \
         -e "s/::JobNumProcTot::/${coreNumber}/"    \
-        -e "/#MSUB -x/d"                           \
-        -e "/--cpu_bind=none/d"                    \
       ${file} > ${file}.tmp
 
   elif [ ${executionType} -eq 2 ] ; then
-    # MPMD + MPI + OMP : mpirun/ccc_mprun/error
-    if ( [ "X${config_UserChoices_ExecutionModeOnCurie}" = "Xmpirun" ] ) ; then
-      sed -e "/::openMPthreads::/d"                  \
-          -e "s/::JobNumProcTot::/${coreNumber}/"    \
-        ${file} > ${file}.tmp
-    elif ( [ "X${config_UserChoices_ExecutionModeOnCurie}" = "X" ] || [ "X${config_UserChoices_ExecutionModeOnCurie}" = "Xccc_mprun" ] ) ; then
-      sed -e "/::openMPthreads::/d"                  \
-          -e "s/::JobNumProcTot::/${coreNumber}/"    \
-          -e "/--cpu_bind=none/d"                    \
-        ${file} > ${file}.tmp
-    else
-     IGCM_debug_Print 1 "You have to set ExecutionModeOnCurie=ccc_mprun or mpirun in config.card"
-     IGCM_debug_Exit "IGCM_sys_updateHeaders"
-    fi
+    # MPMD + MPI + OMP
+      sed -e "s/::openMPthreads::/${openMPthreads}/" \
+          -e "s/::JobNumProcTot::/${mpiTasks}/"    \
+          ${file} > ${file}.tmp
+
   elif [ ${executionType} -eq 3 ] ; then
     # SPMD + MPI/OMP
     sed -e "s/::openMPthreads::/${openMPthreads}/" \
         -e "s/::JobNumProcTot::/${mpiTasks}/"      \
-        -e "/#MSUB -x/d"                           \
-        -e "/--cpu_bind=none/d"                    \
       ${file} > ${file}.tmp
 
@@ -1167,6 +1154,4 @@
     sed -e "s/::JobNumProcTot::/${mpiTasks}/"      \
         -e "/::openMPthreads::/d"                  \
-        -e "/#MSUB -x/d"                           \
-        -e "/--cpu_bind=none/d"                    \
       ${file} > ${file}.tmp
 
@@ -1175,6 +1160,4 @@
     sed -e "s/::openMPthreads::/${openMPthreads}/" \
         -e "/::JobNumProcTot::/d"                  \
-        -e "/#MSUB -x/d"                           \
-        -e "/--cpu_bind=none/d"                    \
       ${file} > ${file}.tmp
 
@@ -1183,6 +1166,4 @@
     sed -e "s/::JobNumProcTot::/1/"                \
         -e "/::openMPthreads::/d"                  \
-        -e "/#MSUB -x/d"                           \
-        -e "/--cpu_bind=none/d"                    \
       ${file} > ${file}.tmp
 
@@ -1220,5 +1201,5 @@
     echo "IGCM_sys_build_execution_scripts " $@
   fi
-
+  IGCM_debug_Print 1 "executionType= ${executionType}"
   EXECUTION=${HOST_MPIRUN_COMMAND}
 
@@ -1226,7 +1207,6 @@
 
     # MPMD mode
-    # 1 MPI only
-    # 2 MPI/OpenMP mpirun method
-    # 3 MPI/OpenMP ccc_mprun method
+    # 1 MPI only : executionType=1
+    # 2 MPI/OpenMP : executionType=2
 
     if [ -f run_file ] ; then
@@ -1264,36 +1244,15 @@
       fi
 
-    elif ( [ "X${config_UserChoices_ExecutionModeOnCurie}" = "Xmpirun" ] ) ; then
-
-    # 2 MPI/OpenMP mpirun method
-
-      # Use of mpirun instead of ccc_mprun
-      EXECUTION="time mpirun"
-
-      #  Hosts treatment
-      ${EXECUTION} hostname | sort | uniq > hosts.tmp
-
-      i=0
-      rm -f hosts rankfile
-      IGCM_debug_Print 1 "sys Irene, Hosts available :"
-      for nodes in `cat hosts.tmp`
-      do
-        host[$i]=$nodes
-        echo "${host[$i]}" >> hosts
-        IGCM_debug_Print 1 ${host[$i]}
-        i=$((i+1))
-      done
-      rm -f hosts.tmp
-
-      listnodes=${host[*]}
-
-      EXECUTION="${EXECUTION} -hostfile hosts -rankfile rankfile"
-
-      # Initialisation
-      rank=0
+    else 
+
+    # 2 MPI/OpenMP : executionType=2
+
+    # MPI-OpenMP (MPMD)
+    # example of run_file
+    # 0-70   env OMP_NUM_THREADS=8 ./script_lmdz.x.ksh
+    # 71-71  env OMP_NUM_THREADS=1 ./script_xios.x.ksh
+
+      # Loop on the components to build run_file and script_exec files
       current_core=0
-      init_exec=n
-
-      # Loop on the components
       for comp in ${config_ListOfComponents[*]} ; do
 
@@ -1313,141 +1272,24 @@
           eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
           eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
-	  eval comp_proc_nod_loc=\${${comp}_PROC_NOD}
+
+          # Build script files
 
           echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
           echo ""  >> script_${ExeNameOut}.ksh
           if [ ${comp_proc_omp_loc} -gt 1 ] ; then
-
-            # Check if the number of threads is correct
-            case ${comp_proc_omp_loc} in
-            2|4|8|16)
-              IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads"
-              ;;
-            *)
-              IGCM_debug_Exit "ERROR with OMP parameters !"
-              IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads"
-              IGCM_debug_Print 2 "Only 2,4,8,16 as number of OMP threads are possible "
-              IGCM_debug_Verif_Exit
-              ;;
-            esac
-            echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
-            echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
-            echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
-            echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh
-          fi
-
-          #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
-          echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK )) " >> script_${ExeNameOut}.ksh
-          echo "MYMPIRANK=\$(printf '%3.3d\n' \${MYMPIRANK})" >> script_${ExeNameOut}.ksh
-          echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}" >> script_${ExeNameOut}.ksh
-          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
-
-          if [ ${init_exec} = y ] ; then
-            EXECUTION="${EXECUTION} : -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh"
-          else
-            EXECUTION="${EXECUTION} -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh"
-            init_exec=y
-          fi
-
-          # Build rankfile : method used to assign cores and nodes for the MPI process
-          # Ex :
-          #rank 0=curie5296 slot=0,1,2,3
-          #rank 1=curie5296 slot=4,5,6,7
-          # Example of final command :
-          # mpirun -hostfile hosts -rankfile rankfile -np 27 ./script_lmdz.x.ksh : -np 5 ./script_opa.xx.ksh
-          # with script_lmdz.x.ksh :
-          # #!/bin/ksh
-          #export KMP_STACKSIZE=3g
-          #export KMP_LIBRARY=turnaround
-          #export MKL_SERIAL=YES
-          #OMP_NUM_THREADS=4
-          #./lmdz.x
-	  if [ ${comp_proc_nod_loc} -gt 1 ] ; then
-              (( offset_comp_proc_loc =  NB_CORE_PER_NODE / (comp_proc_mpi_loc / comp_proc_nod_loc) ))
-	  else
-	      (( offset_comp_proc_loc =  comp_proc_omp_loc ))
-	  fi
-          for nb_proc_mpi in `seq 0 $(($comp_proc_mpi_loc-1))`; do
-	     (( index_host = current_core / NB_CORE_PER_NODE ))
-	     host_value=${host[${index_host}]}
-	     (( slot =  current_core % NB_CORE_PER_NODE ))
-	     virg=","
-	     string_final=""
-	     for index in `seq $slot $(($slot+$comp_proc_omp_loc-1))`; do
-	         string=$index$virg
-	         string_final=$string_final$string
-             done
-             string_final=$( echo $string_final | sed "s/.$//" )
-             echo "rank $rank=$host_value slot=$string_final" >> rankfile
-             (( rank = rank + 1 ))
-             (( current_core = current_core + offset_comp_proc_loc ))
-          done
-        fi
-      done
-
-    elif ( [ "X${config_UserChoices_ExecutionModeOnCurie}" = "X" ] || [ "X${config_UserChoices_ExecutionModeOnCurie}" = "Xccc_mprun" ] ) ; then
-
-    # 3 MPI/OpenMP ccc_mprun method
-
-    # MPI-OpenMP (MPMD)
-    # example of run_file
-    # 71-8 env OMP_NUM_THREADS=8 ./script_lmdz.x.ksh
-    # 480-1 env OMP_NUM_THREADS=1 ./script_opa.xx.ksh
-    # 1-1 env OMP_NUM_THREADS=1 ./script_xios.x.ksh
-
-      # Loop on the components
-      for comp in ${config_ListOfComponents[*]} ; do
-
-        eval ExeNameIn=\${config_Executable_${comp}[0]}
-        eval ExeNameOut=\${config_Executable_${comp}[1]}
-
-        # Not possible if oasis has an executable (i.e old version of oasis3)
-        if ( [ "X${ExeNameOut}" != X\"\" ] &&  [ "X${comp}" = "XCPL" ] ) ; then
-          IGCM_debug_Exit "ERROR MPMD with hybrid MPI-OpenMP is not available with oasis3 version"
-          IGCM_debug_Print 2 "Only available with oasis3-MCT version coupler"
-          IGCM_debug_Verif_Exit
-        fi
-
-        # Only if we really have an executable for the component :
-        if [ "X${ExeNameOut}" != X\"\" ] ; then
-
-          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
-          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
-
-          # Build script files
-
-          echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
-          echo ""  >> script_${ExeNameOut}.ksh
-          if [ ${comp_proc_omp_loc} -gt 1 ] ; then
-
-            # Check if the number of threads is correct
-            case ${comp_proc_omp_loc} in
-            2|4|8|12|16|24)
-              IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads"
-              ;;
-            *)
-              IGCM_debug_Exit "ERROR with OMP parameters !"
-              IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads"
-              IGCM_debug_Print 2 "Only 2,4,8,12,16,24 as number of OMP threads are possible "
-              IGCM_debug_Verif_Exit
-              ;;
-            esac
-            ### only for LMDZ?
-            echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
-            echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
-            echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
-            echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh
-
+            echo "export OMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
+            echo "export OMP_PLACES=cores"  >> script_${ExeNameOut}.ksh
           fi
 
           # to have out/err per process on different files
           echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${SLURM_PROCID} 2>out_${ExeNameOut}.err.\${SLURM_PROCID}" >> script_${ExeNameOut}.ksh
-          #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
 
           IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
 
           # Complete run_file
-
-          echo "${comp_proc_mpi_loc}-${comp_proc_omp_loc} env OMP_NUM_THREADS=${comp_proc_omp_loc} ./script_${ExeNameOut}.ksh " >>run_file
+          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
+          (( end_core = ${current_core} + ${comp_proc_mpi_loc} - 1 ))
+          echo "${current_core}-${end_core}  env OMP_NUM_THREADS=${comp_proc_omp_loc} ./script_${ExeNameOut}.ksh " >> run_file
+          (( current_core = ${end_core} + 1 ))
 
         fi
@@ -1458,10 +1300,5 @@
       export SLURM_WAIT=60
 
-      ## module advised by TGCC (instead of 2 variables)
-      module load feature/bridge/heterogenous_mpmd
-
-      # set EXECUTION for ccc_mprun case (similar to #1 : MPI only MPMD method) 
-
-      EXECUTION="${HOST_MPIRUN_COMMAND} -f ./run_file"
+      EXECUTION="${HOST_MPIRUN_COMMAND} --multi-prog ./run_file"
 
       IGCM_sys_Chmod u+x run_file
@@ -1471,12 +1308,8 @@
       fi
 
-    else
-
-      IGCM_debug_Print 1 "sys Curie :  choose mpirun or ccc_mprun in config.card for ExecutionModeOnCurie"
-
-    fi # 1 2 or 3 if ${OK_PARA_MPMD}
+    fi # if ${OK_PARA_MPMD}
 
   else
-  # Only one executable (SPMD mode).
+  # Only one executable (SPMD mode):  executionType=3, 4, 5 and 6
 
     for comp in ${config_ListOfComponents[*]} ; do
@@ -1495,24 +1328,14 @@
           eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
           echo ""  >> script_${ExeNameOut}.ksh
-          echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
-          echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
-          echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
+          echo "export OMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
+          echo "export OMP_PLACES=cores"  >> script_${ExeNameOut}.ksh
           echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh
         fi
 
-        if  ( ${OK_PARA_MPI} ) ; then
-          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
-          # Default : ccc_mprun used if nb_proc gt 1
-          # to have out/err per process on different files
-          echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${SLURM_PROCID} 2>out_${ExeNameOut}.err.\${SLURM_PROCID}"  >> script_${ExeNameOut}.ksh
-          #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
-          EXECUTION="${HOST_MPIRUN_COMMAND} -n ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh"
-        else
-          # Default : ccc_mprun is NOT used if nb_proc eq 1
-          # to have out/err per process on different files
-          echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh
-          #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
-          EXECUTION="/usr/bin/time ./script_${ExeNameOut}.ksh"
-        fi
+        eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
+        
+        # To have out/err per process on different files
+        echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${SLURM_PROCID} 2>out_${ExeNameOut}.err.\${SLURM_PROCID}"  >> script_${ExeNameOut}.ksh
+        EXECUTION="${HOST_MPIRUN_COMMAND} ./script_${ExeNameOut}.ksh"
 
         IGCM_debug_Print 1 "sys Irene : script_${ExeNameOut}.ksh contains"
