From: Renaud Barate Date: Wed, 28 Jan 2015 10:34:32 +0000 (+0100) Subject: Fix compilation with parallel extensions (PaCO and MPI) X-Git-Tag: V7_5_1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9ab6c548d2ad18d7c51e35dde1d2ae101e1f8b5d;p=modules%2Fkernel.git Fix compilation with parallel extensions (PaCO and MPI) --- diff --git a/idl/SALOME_ResourcesManager.idl b/idl/SALOME_ResourcesManager.idl index 8938ba4cb..e5b8793fa 100644 --- a/idl/SALOME_ResourcesManager.idl +++ b/idl/SALOME_ResourcesManager.idl @@ -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); }; }; diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index ee9a30adc..29a4fa0e2 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -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 << " "; diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index 661eed5b8..ee0e654a0 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -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()); } diff --git a/src/ResourcesManager/SALOME_ResourcesManager.hxx b/src/ResourcesManager/SALOME_ResourcesManager.hxx index fbbdba515..d5a940ac7 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.hxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.hxx @@ -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; diff --git a/src/ResourcesManager/SALOME_ResourcesManager_Client.cxx b/src/ResourcesManager/SALOME_ResourcesManager_Client.cxx index 5b0ea027a..a1a412c83 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager_Client.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager_Client.cxx @@ -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; +} diff --git a/src/ResourcesManager/SALOME_ResourcesManager_Client.hxx b/src/ResourcesManager/SALOME_ResourcesManager_Client.hxx index ae6a291bc..e04b7d6e9 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager_Client.hxx +++ b/src/ResourcesManager/SALOME_ResourcesManager_Client.hxx @@ -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: