]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
improvement to take account the number of processors available for each machine for...
authorsecher <secher>
Wed, 9 May 2007 12:48:03 +0000 (12:48 +0000)
committersecher <secher>
Wed, 9 May 2007 12:48:03 +0000 (12:48 +0000)
idl/SALOME_ContainerManager.idl
src/Container/SALOME_ContainerManager.cxx
src/Container/SALOME_ContainerManager.hxx
src/Container/TestContainerManager.cxx
src/ResourcesManager/SALOME_LoadRateManager.cxx
src/ResourcesManager/SALOME_LoadRateManager.hxx
src/ResourcesManager/SALOME_ResourcesManager.cxx
src/ResourcesManager/SALOME_ResourcesManager.hxx

index 20867310fda2e4e19307a9d8782c4813c8448262..04980beab65b519c09cbf7572419c8c6a7ae6a9d 100644 (file)
@@ -72,6 +72,8 @@ struct MachineParameters
                                     in string componentName )
       raises (SALOME::SALOME_Exception);
 
+    MachineParameters GetMachineParameters( in string hostname );
+
     void Shutdown();
 
     void ShutdownContainers();
index 413934de5b20b87c713b5dd3afdeefcd1926be05..33cc6c5799f7a86dc6ef858c97c848d98584e5d8 100644 (file)
@@ -400,3 +400,7 @@ long SALOME_ContainerManager::GetIdForContainer(void)
   return _id;
 }
 
+Engines::MachineParameters* SALOME_ContainerManager::GetMachineParameters(const char *hostname)
+{
+  return _ResManager->GetMachineParameters(hostname);
+}
index a4f7dba701800524b5325cae2f5594bd614d5995..25c4c1f6ee12e2cc45b04b1e6cad6b4d79f9e24b 100644 (file)
@@ -72,6 +72,8 @@ public:
 
   char* FindFirst(const Engines::MachineList& possibleComputers);
 
+  Engines::MachineParameters* GetMachineParameters(const char *hostname);
+
   void Shutdown();
   void ShutdownContainers();
 
index 3d991bbdd3770df4500881908ca47a3af6323b4d..ca20a105780e721e45734446544564f659940fce 100644 (file)
@@ -125,15 +125,21 @@ int main (int argc, char * argv[])
   int cmax=0;
   int fmin=10;
   int fmax=0;
+  int nbpmax;
   for(map<string,int>::iterator iter=cycle.begin();iter!=cycle.end();iter++){
     if(strcmp((*iter).first.c_str(),"localhost")!=0){
-      if(cycle[(*iter).first]<cmin) cmin=cycle[(*iter).first];
-      if(cycle[(*iter).first]>cmax) cmax=cycle[(*iter).first];
-      if(first[(*iter).first]<fmin) fmin=first[(*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]/nbproc<cmin) cmin=cycle[(*iter).first]/nbproc;
+      if(cycle[(*iter).first]/nbproc>cmax) cmax=cycle[(*iter).first]/nbproc;
+      if(first[(*iter).first]/nbproc<fmin) fmin=first[(*iter).first]/nbproc;
+      if(first[(*iter).first]/nbproc>fmax){
+       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";
index 527cade0a0f4568a04dea147a56127f6377d5638..5168925062ce01e1d0516683a56e95355686865c 100644 (file)
@@ -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<string, int> 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<hosts.length();i++){
-    if( machines[string(hosts[i])] < min ){
+    resource = resList[string(hosts[i])];
+    nbproc = resource.DataForSort._nbOfProcPerNode * resource.DataForSort._nbOfNodes;
+    if( machines[string(hosts[i])]/nbproc < min ){
       imin = i;
-      min = machines[string(hosts[i])];
+      min = machines[string(hosts[i])]/nbproc;
     }
   }
 
index b03b96a1888230df414f744d8a6fb52b9280f7f9..061b925ae5f6f0384169242b222da60f2066d9e5 100644 (file)
@@ -23,6 +23,7 @@
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
 #include <string>
+#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);
   };
 
index c5e1a4a68bc64bd4f9228233db73718c4f0a62c6..2637bd5e280cbb58d17d16b21b7db1b7bd6b2fda 100644 (file)
@@ -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;
+}
index 7e0391adf90662cdf341b997608582dd315c7ff4..0d9c651374ee1f98e90aa5c5a12f3c4263c08351 100644 (file)
@@ -102,6 +102,8 @@ class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager
 
     const MapOfParserResourcesType& GetList() const;
 
+    Engines::MachineParameters* GetMachineParameters(const char *hostname);
+
   protected:
     SALOME_NamingService *_NS;