Salome HOME
Fix compilation with parallel extensions (PaCO and MPI) V7_5_BR rbe/fix-contmanager-parallel V7_5_1 V7_5_1rc3
authorRenaud Barate <renaud.barate@edf.fr>
Wed, 28 Jan 2015 10:34:32 +0000 (11:34 +0100)
committerRenaud Barate <renaud.barate@edf.fr>
Wed, 28 Jan 2015 10:34:32 +0000 (11:34 +0100)
idl/SALOME_ResourcesManager.idl
src/Container/SALOME_ContainerManager.cxx
src/ResourcesManager/SALOME_ResourcesManager.cxx
src/ResourcesManager/SALOME_ResourcesManager.hxx
src/ResourcesManager/SALOME_ResourcesManager_Client.cxx
src/ResourcesManager/SALOME_ResourcesManager_Client.hxx

index 8938ba4cbb1c834e41b38664d54fc7334d25c292..e5b8793fa7a854dd8ed6e8b958293e7cf069c4ca 100644 (file)
@@ -156,6 +156,10 @@ interface ResourcesManager
     */
   void RemoveResource(in string resource_name, in boolean write, in string xml_file) 
     raises (SALOME::SALOME_Exception);
+
+  //! Create a machine file for PaCO container
+  string getMachineFile(in string resource_name, in long nb_procs, in string parallelLib)
+    raises (SALOME::SALOME_Exception);
 };
 
 };
index ee9a30adc2710627815a117ffc8ca6bdc992964a..29a4fa0e2e3d40b27d58b77f95f7ea9c858464b2 100644 (file)
@@ -1410,7 +1410,7 @@ SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters
   INFOS("[StartPaCOPPContainer] on resource : " << resource_selected);
 
   // Step 2 : Get a MachineFile for the parallel container
-  std::string machine_file_name = _ResManager->getMachineFile(resource_selected, 
+  std::string machine_file_name = _resManager->getMachineFile(resource_selected,
                                                               params.nb_proc,
                                                               params.parallelLib.in());
 
@@ -1564,8 +1564,8 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::C
   std::string nb_proc_str = tmp_string.str();
 
   // Get resource definition
-  Engines::ResourceDefinition_var resource_definition = 
-    _ResManager->GetResourceDefinition(params.resource_params.name);
+  ParserResourcesType resource_definition =
+      _resManager->GetResourceDefinition(params.resource_params.name.in());
 
   // Choose hostname
   std::string hostname;
@@ -1607,11 +1607,11 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::C
     ASSERT(GetenvThreadSafe("NSHOST"));
     ASSERT(GetenvThreadSafe("NSPORT"));
 
-    command << resource_definition->protocol.in();
+    command << resource_definition.getAccessProtocolTypeStr();
     command << " -l ";
-    command << resource_definition->username.in();
+    command << resource_definition.UserName;
     command << " " << hostname;
-    command << " " << resource_definition->applipath.in();
+    command << " " << resource_definition.AppliPath;
     command << "/runRemote.sh ";
     command << GetenvThreadSafe("NSHOST") << " "; // hostname of CORBA name server
     command << GetenvThreadSafe("NSPORT") << " "; // port of CORBA name server
@@ -1648,9 +1648,9 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::Co
   nb_proc_stream << params.nb_proc;
 
   // Get resource definition
-  Engines::ResourceDefinition_var resource_definition = 
-    _ResManager->GetResourceDefinition(params.resource_params.name);
-  
+  ParserResourcesType resource_definition =
+      _resManager->GetResourceDefinition(params.resource_params.name.in());
+
   // Log environnement
   std::string log_type("");
   char * get_val = GetenvThreadSafe("PARALLEL_LOG");
@@ -1695,11 +1695,11 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::Co
         ASSERT(GetenvThreadSafe("NSHOST"));
         ASSERT(GetenvThreadSafe("NSPORT"));
 
-        command_node_stream << resource_definition->protocol.in();
+        command_node_stream << resource_definition.getAccessProtocolTypeStr();
         command_node_stream << " -l ";
-        command_node_stream << resource_definition->username.in();
+        command_node_stream << resource_definition.UserName;
         command_node_stream << " " << hostname;
-        command_node_stream << " " << resource_definition->applipath.in();
+        command_node_stream << " " << resource_definition.AppliPath;
         command_node_stream << "/runRemote.sh ";
         command_node_stream << GetenvThreadSafe("NSHOST") << " "; // hostname of CORBA name server
         command_node_stream << GetenvThreadSafe("NSPORT") << " "; // port of CORBA name server
@@ -1740,14 +1740,13 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::Co
     if (last == std::string::npos)
       last = -1;
 
-    std::string protocol = resource_definition->protocol.in();
-    if (protocol == "rsh")
+    if (resource_definition.Protocol == rsh)
       command_remote_stream << "rcp ";
     else 
       command_remote_stream << "scp ";
     command_remote_stream << machine_file_name << " ";
-    command_remote_stream << resource_definition->username.in() << "@";
-    command_remote_stream << hostname << ":" << resource_definition->applipath.in();
+    command_remote_stream << resource_definition.UserName << "@";
+    command_remote_stream << hostname << ":" << resource_definition.AppliPath;
     command_remote_stream <<  "/" << machine_file_name.substr(last+1);
 
     int status = SystemThreadSafe(command_remote_stream.str().c_str());
@@ -1772,17 +1771,17 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::Co
       ASSERT(GetenvThreadSafe("NSHOST"));
       ASSERT(GetenvThreadSafe("NSPORT"));
 
-      command_nodes << resource_definition->protocol.in();
+      command_nodes << resource_definition.getAccessProtocolTypeStr();
       command_nodes << " -l ";
-      command_nodes << resource_definition->username.in();
+      command_nodes << resource_definition.UserName;
       command_nodes << " " << hostname;
-      command_nodes << " " << resource_definition->applipath.in();
+      command_nodes << " " << resource_definition.AppliPath;
       command_nodes << "/runRemote.sh ";
       command_nodes << GetenvThreadSafe("NSHOST") << " "; // hostname of CORBA name server
       command_nodes << GetenvThreadSafe("NSPORT") << " "; // port of CORBA name server
     }
 
-    if (std::string(resource_definition->mpiImpl.in()) == "lam")
+    if (resource_definition.mpi == lam)
     {
       command_nodes << "mpiexec -ssi boot ";
       command_nodes << "-machinefile "  << machine_file_name << " "; 
index 661eed5b81a4be57d4d625215dc173d45e7aca71..ee0e654a0c7627e6ecfbbe22fd2c081fbea31038 100644 (file)
@@ -262,20 +262,20 @@ SALOME_ResourcesManager::RemoveResource(const char * resource_name,
   }
 }
 
-std::string 
-SALOME_ResourcesManager::getMachineFile(std::string resource_name, 
+char *
+SALOME_ResourcesManager::getMachineFile(const char * resource_name,
                                         CORBA::Long nb_procs, 
-                                        std::string parallelLib)
+                                        const char * parallelLib)
 {
   std::string machine_file_name("");
 
-  if (parallelLib == "Dummy")
+  if (std::string(parallelLib) == "Dummy")
   {
     MESSAGE("[getMachineFile] parallelLib is Dummy");
     MapOfParserResourcesType resourcesList = _rm.GetList();
-    if (resourcesList.find(resource_name) != resourcesList.end())
+    if (resourcesList.find(std::string(resource_name)) != resourcesList.end())
     {
-      ParserResourcesType resource = resourcesList[resource_name];
+      ParserResourcesType resource = resourcesList[std::string(resource_name)];
 
       // Check if resource is cluster or not
       if (resource.ClusterMembersList.empty())
@@ -327,14 +327,14 @@ SALOME_ResourcesManager::getMachineFile(std::string resource_name,
     else
       INFOS("[getMachineFile] Error resource_name not found in resourcesList -> " << resource_name);
   }
-  else if (parallelLib == "Mpi")
+  else if (std::string(parallelLib) == "Mpi")
   {
     MESSAGE("[getMachineFile] parallelLib is Mpi");
 
     MapOfParserResourcesType resourcesList = _rm.GetList();
-    if (resourcesList.find(resource_name) != resourcesList.end())
+    if (resourcesList.find(std::string(resource_name)) != resourcesList.end())
     {
-      ParserResourcesType resource = resourcesList[resource_name];
+      ParserResourcesType resource = resourcesList[std::string(resource_name)];
       // Check if resource is cluster or not
       if (resource.ClusterMembersList.empty())
       {
@@ -398,5 +398,5 @@ SALOME_ResourcesManager::getMachineFile(std::string resource_name,
   else
     INFOS("[getMachineFile] Error parallelLib is not handled -> " << parallelLib);
 
-  return machine_file_name;
+  return CORBA::string_dup(machine_file_name.c_str());
 }
index fbbdba5157808d0c1db4248c4ca490295c886c50..d5a940ac7d59c6e53d5628f901f082c61ecf1c78 100644 (file)
@@ -69,13 +69,13 @@ class SALOMERESOURCESMANAGER_EXPORT SALOME_ResourcesManager:
     void RemoveResource(const char * resource_name,
                         CORBA::Boolean write,
                         const char * xml_file);
+    char* getMachineFile(const char * resource_name,
+                         CORBA::Long nb_procs,
+                         const char * parallelLib);
 
     // Cpp Methods
     void Shutdown();
     ResourcesManager_cpp *GetImpl() { return &_rm; }
-    std::string getMachineFile(std::string resource_name, 
-                               CORBA::Long nb_procs,
-                               std::string parallelLib);
 
 
     static const char *_ResourcesManagerNameInNS;
index 5b0ea027ac2b75fdb2ce4a16c5f470b8470e5c30..a1a412c8346b92c5ea0551d382b483b7fd8e36f6 100644 (file)
@@ -62,3 +62,14 @@ ParserResourcesType SALOME_ResourcesManager_Client::GetResourceDefinition(const
   ParserResourcesType res = resourceDefinition_CORBAtoCPP(corba_res);
   return res;
 }
+
+string SALOME_ResourcesManager_Client::getMachineFile(const string & resource_name,
+                                                      long nb_procs,
+                                                      const string & parallelLib)
+{
+  CORBA::String_var corba_res = _rm->getMachineFile(resource_name.c_str(),
+                                                    nb_procs,
+                                                    parallelLib.c_str());
+  string res = corba_res.in();
+  return res;
+}
index ae6a291bc9408d6d449ff27506e9f6d0eafa1047..e04b7d6e962c544de1077580d0d019888bd4c601 100644 (file)
@@ -42,6 +42,9 @@ public:
   ParserResourcesType GetResourceDefinition(const std::string & name);
   //void AddResource(const ParserResourcesType & new_resource, bool write, const std::string & xml_file);
   //void RemoveResource(const std::string & name, bool write, const std::string & xml_file);
+  std::string getMachineFile(const std::string & resource_name,
+                             long nb_procs,
+                             const std::string & parallelLib);
 
 protected: