From 8a0d67854477ad8d63e2ae23ba8f5c337ce39845 Mon Sep 17 00:00:00 2001 From: ribes Date: Tue, 21 Apr 2009 09:51:30 +0000 Subject: [PATCH] - First step for A GetFittingResources for PaCO++ containers --- src/ResourcesManager/ResourcesManager.cxx | 32 ++++++++++++++++++- src/ResourcesManager/ResourcesManager.hxx | 4 ++- .../SALOME_ResourcesManager.cxx | 2 ++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/ResourcesManager/ResourcesManager.cxx b/src/ResourcesManager/ResourcesManager.cxx index 52247dc11..062ea9124 100644 --- a/src/ResourcesManager/ResourcesManager.cxx +++ b/src/ResourcesManager/ResourcesManager.cxx @@ -130,7 +130,7 @@ ResourcesManager_cpp::~ResourcesManager_cpp() std::vector ResourcesManager_cpp::GetFittingResources(const machineParams& params, - const std::vector& componentList) throw(ResourcesException) + const std::vector& componentList) throw(ResourcesException) { vector vec; @@ -141,6 +141,36 @@ ResourcesManager_cpp::GetFittingResources(const machineParams& params, cerr << "GetFittingResources " << hostname << " " << Kernel_Utils::GetHostname().c_str() << endl; #endif + // PaCO++ parallel container case + std::string parallelLib(params.parallelLib); + if (params.nb_component_nodes > 0 and parallelLib != "") + { +#if defined(_DEBUG_) || defined(_DEBUG) + std::cerr << "[GetFittingResources] ParallelContainer case" << std::endl; + std::cerr << "[GetFittingResources] parallelLib is " << parallelLib << std::endl; + std::cerr << "[GetFittingResources] nb_component_nodes is " << params.nb_component_nodes << std::endl; +#endif + + // Currently we only support parallel containers that define a hostname target + if (hostname[0] != '\0') + { + // Special case of localhost -> put containers into the real computer name + if (strcmp(hostname, "localhost") == 0) + vec.push_back(Kernel_Utils::GetHostname().c_str()); + else + { + // Try find the resource into the map + if (_resourcesList.find(hostname) != _resourcesList.end()) + vec.push_back(hostname); + else + std::cerr << "[GetFittingResources] ParallelContainer hostname does not exist into the resource list !" << std::endl; + } + } + else + std::cerr << "[GetFittingResources] ParallelContainer hostname is empty -> cannot find a possible resource" << std::endl; + return vec; + } + if (hostname[0] != '\0'){ if ( strcmp(hostname, "localhost") == 0 || diff --git a/src/ResourcesManager/ResourcesManager.hxx b/src/ResourcesManager/ResourcesManager.hxx index d736036aa..ecd1db6c3 100644 --- a/src/ResourcesManager/ResourcesManager.hxx +++ b/src/ResourcesManager/ResourcesManager.hxx @@ -41,10 +41,12 @@ struct machineParams{ std::string hostname; std::string OS; + std::string parallelLib; unsigned int nb_node; unsigned int nb_proc_per_node; unsigned int cpu_clock; unsigned int mem_mb; + unsigned int nb_component_nodes; }; class RESOURCESMANAGER_EXPORT ResourcesException @@ -109,7 +111,7 @@ class RESOURCESMANAGER_EXPORT ResourcesManager_cpp MapOfParserResourcesType _resourcesList; //! will contain the informations on the data type catalog(after parsing) -MapOfParserResourcesType _resourcesBatchList; + MapOfParserResourcesType _resourcesBatchList; SALOME_LoadRateManager _dynamicResourcesSelecter; diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index 408c2250a..f55839341 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -153,6 +153,8 @@ SALOME_ResourcesManager::GetFittingResources(const Engines::MachineParameters& p p.nb_proc_per_node = params.nb_proc_per_node; p.cpu_clock = params.cpu_clock; p.mem_mb = params.mem_mb; + p.parallelLib = params.parallelLib; + p.nb_component_nodes = params.nb_component_nodes; vector cl; for(unsigned int i=0;i