From fbb279e9cd1633618d15bb8d346ff0fc900a688d Mon Sep 17 00:00:00 2001 From: ribes Date: Fri, 31 Oct 2008 13:32:05 +0000 Subject: [PATCH] - Adding support gcc-4.3.2 - Bug-- in ContainerManager - Adding support for prun machines --- src/Batch/Batch_BatchManager_eClient.cxx | 2 + src/Batch/Batch_BatchManager_eSGE.cxx | 4 +- src/Batch/MpiImpl.cxx | 37 +++++++++++++++++++ src/Batch/MpiImpl.hxx | 19 ++++++++++ src/Container/SALOME_ContainerManager.cxx | 4 +- src/Launcher/Launcher.cxx | 9 ++++- .../SALOME_ResourcesCatalog_Handler.cxx | 8 ++++ .../SALOME_ResourcesCatalog_Parser.hxx | 2 +- .../SALOME_ResourcesManager.cxx | 2 + 9 files changed, 82 insertions(+), 5 deletions(-) diff --git a/src/Batch/Batch_BatchManager_eClient.cxx b/src/Batch/Batch_BatchManager_eClient.cxx index 17355739c..d7004aa65 100644 --- a/src/Batch/Batch_BatchManager_eClient.cxx +++ b/src/Batch/Batch_BatchManager_eClient.cxx @@ -203,6 +203,8 @@ namespace Batch { return new MpiImpl_OPENMPI(); else if(mpiImpl == "slurm") return new MpiImpl_SLURM(); + else if(mpiImpl == "prun") + return new MpiImpl_PRUN(); else if(mpiImpl == "nompi") throw EmulationException("you must specified an mpi implementation for batch manager"); else{ diff --git a/src/Batch/Batch_BatchManager_eSGE.cxx b/src/Batch/Batch_BatchManager_eSGE.cxx index 429f3c13d..1835e32bf 100644 --- a/src/Batch/Batch_BatchManager_eSGE.cxx +++ b/src/Batch/Batch_BatchManager_eSGE.cxx @@ -32,6 +32,8 @@ #include #include #include "Batch_BatchManager_eSGE.hxx" +#include +#include using namespace std; @@ -242,7 +244,7 @@ namespace Batch { string::size_type p1 = fileToExecute.find_last_of("/"); string::size_type p2 = fileToExecute.find_last_of("."); rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1); - fileNameToExecute = "~/" + dirForTmpFiles + "/" + string(basename(fileToExecute.c_str())); + fileNameToExecute = "~/" + dirForTmpFiles + "/" + string(basename((char *) fileToExecute.c_str())); int idx = dirForTmpFiles.find("Batch/"); filelogtemp = dirForTmpFiles.substr(idx+6, dirForTmpFiles.length()); diff --git a/src/Batch/MpiImpl.cxx b/src/Batch/MpiImpl.cxx index 2a8341e05..2d28ceaf3 100644 --- a/src/Batch/MpiImpl.cxx +++ b/src/Batch/MpiImpl.cxx @@ -244,3 +244,40 @@ string MpiImpl_SLURM::halt() return ""; } +// prun implementation +// Constructor +MpiImpl_PRUN::MpiImpl_PRUN() : MpiImpl() +{ +} + +// Destructor +MpiImpl_PRUN::~MpiImpl_PRUN() +{ +} + +string MpiImpl_PRUN::size() +{ + return "${RMS_NPROCS}"; +} + +string MpiImpl_PRUN::rank() +{ + return "${RMS_RANK}"; +} + +string MpiImpl_PRUN::boot(const string machinefile, const unsigned int nbnodes) +{ + return ""; +} + +string MpiImpl_PRUN::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute) +{ + ostringstream oss; + oss << "prun -n " << nbproc << " " << "-p mpi " << fileNameToExecute << endl; + return oss.str(); +} + +string MpiImpl_PRUN::halt() +{ + return ""; +} diff --git a/src/Batch/MpiImpl.hxx b/src/Batch/MpiImpl.hxx index 1056c2581..2bc05c018 100644 --- a/src/Batch/MpiImpl.hxx +++ b/src/Batch/MpiImpl.hxx @@ -154,4 +154,23 @@ private: }; +class BATCH_EXPORT MpiImpl_PRUN : public MpiImpl +{ +public: + // Constructeur et destructeur + MpiImpl_PRUN(); // constructor + virtual ~MpiImpl_PRUN(); //Destructor + + std::string size(); // get number of process of current job + std::string rank(); // get process number of current job + std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command + std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command + std::string halt(); // get stop command + +protected: + +private: + +}; + #endif diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index f38f8d07a..14f215489 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -308,16 +308,17 @@ StartContainer(const Engines::MachineParameters& params, // launch container with a system call int status=system(command.c_str()); - RmTmpFile(); // command file can be removed here if (status == -1){ MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " << "(system command status -1)"); + RmTmpFile(); // command file can be removed here return Engines::Container::_nil(); } else if (status == 217){ MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed " << "(system command status 217)"); + RmTmpFile(); // command file can be removed here return Engines::Container::_nil(); } else{ @@ -349,6 +350,7 @@ StartContainer(const Engines::MachineParameters& params, ret->logfilename(logFilename.c_str()); } + RmTmpFile(); // command file can be removed here return ret; } } diff --git a/src/Launcher/Launcher.cxx b/src/Launcher/Launcher.cxx index 804f8314c..15ff35ebd 100644 --- a/src/Launcher/Launcher.cxx +++ b/src/Launcher/Launcher.cxx @@ -450,6 +450,9 @@ Batch::BatchManager_eClient *Launcher_cpp::FactoryBatchManager( const ParserReso case slurm: mpi = "slurm"; break; + case prun: + mpi = "prun"; + break; case nompi: throw LauncherException("you must specified an mpi implementation for batch manager"); break; @@ -514,9 +517,9 @@ string Launcher_cpp::buildSalomeCouplingScript(const string fileToExecute, const tempOutputFile << ":$PYTHONPATH" << endl ; // Test node rank - tempOutputFile << "if test " ; + tempOutputFile << "if test \"" ; tempOutputFile << mpiImpl->rank() ; - tempOutputFile << " = 0; then" << endl ; + tempOutputFile << "\" = \"0\"; then" << endl ; // ----------------------------------------------- // Code for rank 0 : launch runAppli and a container @@ -619,6 +622,8 @@ MpiImpl *Launcher_cpp::FactoryMpiImpl(MpiImplType mpi) throw(LauncherException) return new MpiImpl_OPENMPI(); case slurm: return new MpiImpl_SLURM(); + case prun: + return new MpiImpl_PRUN(); case nompi: throw LauncherException("you must specified an mpi implementation for batch manager"); break; diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx index 60833df41..df16779b3 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx @@ -203,6 +203,8 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc) _resource.mpi = openmpi; else if (anMpi == "slurm") _resource.mpi = slurm; + else if (anMpi == "prun") + _resource.mpi = prun; else _resource.mpi = nompi; } @@ -405,6 +407,9 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc) case slurm: xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm"); break; + case prun: + xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun"); + break; default: xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST ""); } @@ -491,6 +496,9 @@ void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc) case slurm: xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm"); break; + case prun: + xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun"); + break; default: xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST ""); } diff --git a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx index b0ce1c800..def0bf556 100755 --- a/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx +++ b/src/ResourcesManager/SALOME_ResourcesCatalog_Parser.hxx @@ -42,7 +42,7 @@ enum AccessModeType {interactive, batch}; enum BatchType {none, pbs, lsf, sge}; -enum MpiImplType {nompi, lam, mpich1, mpich2, openmpi, slurm}; +enum MpiImplType {nompi, lam, mpich1, mpich2, openmpi, slurm, prun}; class RESOURCESMANAGER_EXPORT ResourceDataToSort { diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index 24df90f13..7c8ad5c66 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -219,6 +219,8 @@ Engines::MachineParameters* SALOME_ResourcesManager::GetMachineParameters(const p_ptr->mpiImpl = "openmpi"; else if( resource.mpi == slurm ) p_ptr->mpiImpl = "slurm"; + else if( resource.mpi == prun ) + p_ptr->mpiImpl = "prun"; if( resource.Batch == pbs ) p_ptr->batch = "pbs"; -- 2.39.2