From: secher Date: Wed, 9 May 2007 12:48:03 +0000 (+0000) Subject: improvement to take account the number of processors available for each machine for... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=be6dad8b710c29de093da7c344663f7411fd0f1f;p=modules%2Fkernel.git improvement to take account the number of processors available for each machine for a cyclic policy --- diff --git a/idl/SALOME_ContainerManager.idl b/idl/SALOME_ContainerManager.idl index 20867310f..04980beab 100644 --- a/idl/SALOME_ContainerManager.idl +++ b/idl/SALOME_ContainerManager.idl @@ -72,6 +72,8 @@ struct MachineParameters in string componentName ) raises (SALOME::SALOME_Exception); + MachineParameters GetMachineParameters( in string hostname ); + void Shutdown(); void ShutdownContainers(); diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 413934de5..33cc6c579 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -400,3 +400,7 @@ long SALOME_ContainerManager::GetIdForContainer(void) return _id; } +Engines::MachineParameters* SALOME_ContainerManager::GetMachineParameters(const char *hostname) +{ + return _ResManager->GetMachineParameters(hostname); +} diff --git a/src/Container/SALOME_ContainerManager.hxx b/src/Container/SALOME_ContainerManager.hxx index a4f7dba70..25c4c1f6e 100644 --- a/src/Container/SALOME_ContainerManager.hxx +++ b/src/Container/SALOME_ContainerManager.hxx @@ -72,6 +72,8 @@ public: char* FindFirst(const Engines::MachineList& possibleComputers); + Engines::MachineParameters* GetMachineParameters(const char *hostname); + void Shutdown(); void ShutdownContainers(); diff --git a/src/Container/TestContainerManager.cxx b/src/Container/TestContainerManager.cxx index 3d991bbdd..ca20a1057 100644 --- a/src/Container/TestContainerManager.cxx +++ b/src/Container/TestContainerManager.cxx @@ -125,15 +125,21 @@ int main (int argc, char * argv[]) int cmax=0; int fmin=10; int fmax=0; + int nbpmax; for(map::iterator iter=cycle.begin();iter!=cycle.end();iter++){ if(strcmp((*iter).first.c_str(),"localhost")!=0){ - if(cycle[(*iter).first]cmax) cmax=cycle[(*iter).first]; - if(first[(*iter).first]fmax) fmax=first[(*iter).first]; + Engines::MachineParameters *p = _ContManager->GetMachineParameters((*iter).first.c_str()); + int nbproc = p->nb_node * p->nb_proc_per_node; + if(cycle[(*iter).first]/nbproccmax) cmax=cycle[(*iter).first]/nbproc; + if(first[(*iter).first]/nbprocfmax){ + fmax=first[(*iter).first]/nbproc; + nbpmax = nbproc; + } } } - if( ((cmax-cmin) <= 1) && (fmax == 10) && !error ){ + if( ((cmax-cmin) <= 1) && (fmax == 10/nbpmax) && !error ){ string msg; if(bestImplemented) msg = "TEST OK"; diff --git a/src/ResourcesManager/SALOME_LoadRateManager.cxx b/src/ResourcesManager/SALOME_LoadRateManager.cxx index 527cade0a..516892506 100644 --- a/src/ResourcesManager/SALOME_LoadRateManager.cxx +++ b/src/ResourcesManager/SALOME_LoadRateManager.cxx @@ -34,7 +34,7 @@ string SALOME_LoadRateManager::FindFirst(const Engines::MachineList& hosts) return string(hosts[0]); } -string SALOME_LoadRateManager::FindNext(const Engines::MachineList& hosts,SALOME_NamingService *ns) +string SALOME_LoadRateManager::FindNext(const Engines::MachineList& hosts,MapOfParserResourcesType& resList,SALOME_NamingService *ns) { MESSAGE("SALOME_LoadRateManager::FindNext " << hosts.length()); map machines; @@ -65,11 +65,15 @@ string SALOME_LoadRateManager::FindNext(const Engines::MachineList& hosts,SALOME } int imin = 0; - int min = machines[string(hosts[0])]; + ParserResourcesType resource = resList[string(hosts[0])]; + int nbproc = resource.DataForSort._nbOfProcPerNode * resource.DataForSort._nbOfNodes; + int min = machines[string(hosts[0])]/nbproc; for(int i=1;i #include CORBA_CLIENT_HEADER(SALOME_ContainerManager) #include +#include "SALOME_ResourcesCatalog_Parser.hxx" #include "SALOME_NamingService.hxx" #if defined RESOURCESMANAGER_EXPORTS @@ -44,7 +45,7 @@ class RESOURCESMANAGER_EXPORT SALOME_LoadRateManager public: std::string FindFirst(const Engines::MachineList& hosts); - std::string FindNext(const Engines::MachineList& hosts,SALOME_NamingService *ns); + std::string FindNext(const Engines::MachineList& hosts,MapOfParserResourcesType& resList,SALOME_NamingService *ns); std::string FindBest(const Engines::MachineList& hosts) throw (SALOME_Exception); }; diff --git a/src/ResourcesManager/SALOME_ResourcesManager.cxx b/src/ResourcesManager/SALOME_ResourcesManager.cxx index c5e1a4a68..2637bd5e2 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.cxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.cxx @@ -356,7 +356,7 @@ SALOME_ResourcesManager::FindFirst(const Engines::MachineList& listOfMachines) string SALOME_ResourcesManager::FindNext(const Engines::MachineList& listOfMachines) { - return _dynamicResourcesSelecter.FindNext(listOfMachines,_NS); + return _dynamicResourcesSelecter.FindNext(listOfMachines,_resourcesList,_NS); } //============================================================================= /*! @@ -927,6 +927,16 @@ SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer } - - - +Engines::MachineParameters* SALOME_ResourcesManager::GetMachineParameters(const char *hostname) +{ + ParserResourcesType resource = _resourcesList[string(hostname)]; + Engines::MachineParameters *p_ptr = new Engines::MachineParameters; + p_ptr->container_name = CORBA::string_dup(""); + p_ptr->hostname = CORBA::string_dup("hostname"); + p_ptr->OS = CORBA::string_dup(resource.OS.c_str()); + p_ptr->mem_mb = resource.DataForSort._memInMB; + p_ptr->cpu_clock = resource.DataForSort._CPUFreqMHz; + p_ptr->nb_proc_per_node = resource.DataForSort._nbOfProcPerNode; + p_ptr->nb_node = resource.DataForSort._nbOfNodes; + return p_ptr; +} diff --git a/src/ResourcesManager/SALOME_ResourcesManager.hxx b/src/ResourcesManager/SALOME_ResourcesManager.hxx index 7e0391adf..0d9c65137 100644 --- a/src/ResourcesManager/SALOME_ResourcesManager.hxx +++ b/src/ResourcesManager/SALOME_ResourcesManager.hxx @@ -102,6 +102,8 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager const MapOfParserResourcesType& GetList() const; + Engines::MachineParameters* GetMachineParameters(const char *hostname); + protected: SALOME_NamingService *_NS;