Salome HOME
Deal with rounding issues(PBS).
[tools/libbatch.git] / src / PBS / BatchManager_PBS.cxx
index ae18c2329b96edb8d68cb64f7d415cee952ee24b..b0a26da0dd4e763c619eac1e2b22aa9626f6ef08 100644 (file)
@@ -1,23 +1,23 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 /*
  * BatchManager_PBS.cxx : emulation of PBS client
@@ -60,14 +60,11 @@ namespace Batch {
   }
 
   // Methode pour le controle des jobs : soumet un job au gestionnaire
-  const JobId BatchManager_PBS::submitJob(const Job & job)
+  const JobId BatchManager_PBS::runJob(const Job & job)
   {
     Parametre params = job.getParametre();
     const std::string workDir = params[WORKDIR];
 
-    // export input files on cluster
-    exportInputFiles(job);
-
     // build batch script for job
     string scriptFile = buildSubmissionScript(job);
 
@@ -131,7 +128,7 @@ namespace Batch {
   }
 
   // Methode pour le controle des jobs : teste si un job est present en machine
-  bool BatchManager_PBS::isRunning(const JobId & jobid)
+  bool BatchManager_PBS::isRunning(const JobId & /*jobid*/)
   {
     throw NotYetImplementedException("BatchManager_PBS::isRunning");
   }
@@ -157,9 +154,22 @@ namespace Batch {
     int nbproc = 1;
     if (params.find(NBPROC) != params.end())
       nbproc = params[NBPROC];
-    int nbprocpernode = 1;
+    int nbprocpernode = 0;
     if (params.find(NBPROCPERNODE) != params.end())
       nbprocpernode = params[NBPROCPERNODE];
+    int nbnode = 0;
+    if (params.find(NBNODE) != params.end())
+    {
+      nbnode = params[NBNODE];
+      if(nbnode > 0 && nbprocpernode == 0)
+      {
+        nbprocpernode = nbproc / nbnode;
+        if(nbprocpernode * nbnode < nbproc)
+          ++nbprocpernode;
+      }
+    }
+    if(nbprocpernode == 0) // if not defined
+      nbprocpernode = 1;
     int edt = 0;
     if (params.find(MAXWALLTIME) != params.end()) 
       edt = params[MAXWALLTIME];