Salome HOME
Fixed nb_proc_per_node for LoadLeveler jobs
[tools/libbatch.git] / src / LoadLeveler / Batch_BatchManager_eLL.cxx
index 3b348fdd688e401ec02adfdb04dd9420acff65af..a04322add4eb6e1e2c32ec4a9af0f44d647a93b4 100644 (file)
@@ -26,6 +26,7 @@
  *  Author : Renaud BARATE - EDF R&D
  */
 
+#include <cstdlib>
 #include <iostream>
 #include <fstream>
 
@@ -43,7 +44,8 @@ namespace Batch {
                                      CommunicationProtocolType protocolType, const char * mpiImpl,
                                      int nb_proc_per_node)
     : BatchManager(parent, host),
-      BatchManager_eClient(parent, host, username, protocolType, mpiImpl)
+      BatchManager_eClient(parent, host, username, protocolType, mpiImpl),
+      _nb_proc_per_node(nb_proc_per_node)
   {
     // Nothing to do
   }
@@ -143,10 +145,30 @@ namespace Batch {
     tempOutputFile << "#!/bin/bash" << endl;
     tempOutputFile << "# @ output = " << workDir << "/logs/output.log." << rootNameToExecute << endl;
     tempOutputFile << "# @ error = " << workDir << "/logs/error.log." << rootNameToExecute << endl;
+    tempOutputFile << "# @ node_usage = not_shared" << endl;
+
+    if (params.find(NAME) != params.end())
+      tempOutputFile << "# @ job_name = " << params[NAME] << endl;
 
     // Optional parameters
+    int nbproc = 1;
+    if (params.find(NBPROC) != params.end())
+      nbproc = params[NBPROC];
+    //if (nbproc == 1)
+    //  tempOutputFile << "# @ job_type = serial" << endl;
+    //else {
+      //  tempOutputFile << "# @ job_type = parallel" << endl;
+      int nodes_requested = (nbproc + _nb_proc_per_node -1) / _nb_proc_per_node;
+      tempOutputFile << "# @ job_type = mpich" << endl;
+      tempOutputFile << "# @ node = " << nodes_requested << endl;
+      tempOutputFile << "# @ tasks_per_node = " << _nb_proc_per_node << endl;
+    //}
+    //tempOutputFile << "# @ job_type = bluegene" << endl;
+
     if (params.find(MAXWALLTIME) != params.end())
       tempOutputFile << "# @ wall_clock_limit = " << params[MAXWALLTIME] << ":00" << endl;
+    if (params.find(MAXRAMSIZE) != params.end())
+      tempOutputFile << "# @ as_limit = " << params[MAXRAMSIZE] << "mb" << endl;
     if (params.find(QUEUE) != params.end())
       tempOutputFile << "# @ class = " << params[QUEUE] << endl;
 
@@ -161,7 +183,6 @@ namespace Batch {
       tempOutputFile << endl;
     }
 
-    tempOutputFile << "# @ job_type = bluegene" << endl;
     tempOutputFile << "# @ queue" << endl;
 
     // generate nodes file