1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // SALOME ResourcesCatalog : implementation of catalog resources parsing (SALOME_ModuleCatalog.idl)
23 // File : SALOME_ResourcesCatalog_Handler.cxx
24 // Author : Estelle Deville
28 #include "SALOME_ResourcesCatalog_Handler.hxx"
29 #include "Basics_Utils.hxx"
35 //=============================================================================
38 * \param listOfResources: map of ParserResourcesType to fill when parsing
40 //=============================================================================
42 SALOME_ResourcesCatalog_Handler::
43 SALOME_ResourcesCatalog_Handler(MapOfParserResourcesType& resources_list): _resources_list(resources_list)
45 //XML tags initialisation
46 test_machine = "machine";
47 test_cluster = "cluster";
49 test_hostname = "hostname";
50 test_protocol = "protocol";
51 test_cluster_internal_protocol = "iprotocol";
55 test_user_name = "userName";
56 test_appli_path = "appliPath";
57 test_modules = "modules";
58 test_module_name = "moduleName";
59 test_components = "component";
60 test_component_name = "name";
62 test_mem_in_mb = "memInMB";
63 test_cpu_freq_mhz = "CPUFreqMHz";
64 test_nb_of_nodes = "nbOfNodes";
65 test_nb_of_proc = "nbOfProc";
66 test_nb_of_proc_per_node = "nbOfProcPerNode";
67 test_batch_queue = "batchQueue";
68 test_user_commands = "userCommands";
70 test_members = "members";
73 //=============================================================================
77 //=============================================================================
79 SALOME_ResourcesCatalog_Handler::~SALOME_ResourcesCatalog_Handler()
81 // cout << "SALOME_ResourcesCatalog_Handler destruction") << endl;
84 //=============================================================================
86 * Retrieves DS after the file parse.
88 //=============================================================================
90 const MapOfParserResourcesType&
91 SALOME_ResourcesCatalog_Handler::GetResourcesAfterParsing() const
93 return _resources_list;
96 //=============================================================================
98 * Processes XML document and fills the list of resources
100 //=============================================================================
102 void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
104 // Empty private elements
105 _resources_list.clear();
107 // Get the document root node
108 xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc);
110 aCurNode = aCurNode->xmlChildrenNode;
112 // Processing the document nodes
113 while(aCurNode != NULL)
115 // Cas d'une machine ou d'une machine batch
116 if (!xmlStrcmp(aCurNode->name,(const xmlChar*)test_machine))
119 bool Ok = ProcessMachine(aCurNode, _resource);
123 if(_resource.HostName == "localhost")
125 _resource.HostName = Kernel_Utils::GetHostname();
126 if (_resource.Name == "localhost")
128 _resource.Name = Kernel_Utils::GetHostname();
129 _resource.DataForSort._Name = Kernel_Utils::GetHostname();
132 _resources_list[_resource.Name] = _resource;
135 // Cas de la déclaration d'un cluster
136 if (!xmlStrcmp(aCurNode->name,(const xmlChar*)test_cluster))
139 if(ProcessCluster(aCurNode, _resource))
141 _resources_list[_resource.Name] = _resource;
144 aCurNode = aCurNode->next;
148 for (map<string, ParserResourcesType>::const_iterator iter = _resources_list.begin();
149 iter != _resources_list.end();
152 std::cerr << "************************************************" << std::endl;
153 std::cerr << "Resource " << (*iter).first << " found:" << std::endl;
154 std::cerr << " Name: " << (*iter).second.Name << std::endl;
155 std::cerr << " Hostname: " << (*iter).second.HostName << std::endl;
156 std::cerr << " Username: " << (*iter).second.UserName << std::endl;
157 std::cerr << " Appli path: " <<(*iter).second.AppliPath << std::endl;
158 std::cerr << " OS: " << (*iter).second.OS << std::endl;
159 std::cerr << " Protocol: " << (*iter).second.PrintAccessProtocolType() << std::endl;
160 std::cerr << " Internal Protocol: " <<(*iter).second.PrintClusterInternalProtocol() << std::endl;
161 std::cerr << " Mode: " << (*iter).second.PrintAccessModeType() << std::endl;
162 std::cerr << " Batch Type: " << (*iter).second.PrintBatchType() << std::endl;
163 std::cerr << " MPI Impl: " << (*iter).second.PrintMpiImplType() << std::endl;
164 std::cerr << "************************************************" << std::endl;
170 SALOME_ResourcesCatalog_Handler::ProcessCluster(xmlNodePtr cluster_descr, ParserResourcesType & resource)
172 // Ajout d'un cluster
173 // hostname, use et nbOfProc sont obligatoires
174 if (xmlHasProp(cluster_descr, (const xmlChar*)test_hostname))
176 xmlChar* hostname = xmlGetProp(cluster_descr, (const xmlChar*)test_hostname);
177 resource.HostName = (const char*)hostname;
182 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a hostname" << std::endl;
183 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
187 if (xmlHasProp(cluster_descr, (const xmlChar*)test_name))
189 xmlChar* name = xmlGetProp(cluster_descr, (const xmlChar*)test_name);
190 resource.Name = (const char*)name;
191 resource.DataForSort._Name = (const char*)name;
196 resource.Name = resource.HostName;
197 resource.DataForSort._Name = resource.HostName;
198 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! No Name found use Hostname for resource: " << _resource.Name << std::endl;
201 if (xmlHasProp(cluster_descr, (const xmlChar*)test_use))
203 xmlChar* use = xmlGetProp(cluster_descr, (const xmlChar*)test_use);
204 resource.use = (const char*)use;
209 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a use" << std::endl;
210 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
214 if (xmlHasProp(cluster_descr, (const xmlChar*)test_nb_of_proc))
216 xmlChar* nb_of_proc = xmlGetProp(cluster_descr, (const xmlChar*)test_nb_of_proc);
217 resource.nbOfProc = atoi((const char*)nb_of_proc);
222 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a nbOfProc" << std::endl;
223 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
227 if (xmlHasProp(cluster_descr, (const xmlChar*)test_mpi))
229 xmlChar* mpi = xmlGetProp(cluster_descr, (const xmlChar*)test_mpi);
230 std::string anMpi = (const char*)mpi;
234 else if (anMpi == "mpich1")
235 resource.mpi = mpich1;
236 else if (anMpi == "mpich2")
237 resource.mpi = mpich2;
238 else if (anMpi == "openmpi")
239 resource.mpi = openmpi;
240 else if (anMpi == "slurm")
241 resource.mpi = slurm;
242 else if (anMpi == "prun")
245 resource.mpi = nompi;
248 // Parsing des membres du cluster
249 xmlNodePtr aCurSubNode = cluster_descr->xmlChildrenNode;
250 while(aCurSubNode != NULL)
252 if (!xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_members))
254 xmlNodePtr members = aCurSubNode->xmlChildrenNode;
255 while (members != NULL)
258 if (!xmlStrcmp(members->name, (const xmlChar*)test_machine))
260 ParserResourcesClusterMembersType new_member;
261 if (ProcessMember(members, new_member))
262 resource.ClusterMembersList.push_back(new_member);
264 members = members->next;
267 aCurSubNode = aCurSubNode->next;
270 // Test: Il faut au moins un membre pour que le cluster soit correct !
271 if (resource.ClusterMembersList.empty())
273 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! found a cluster without a member" << std::endl;
274 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessCluster : !!! Warning !!! this cluster will not be added" << std::endl;
281 SALOME_ResourcesCatalog_Handler::ProcessMember(xmlNodePtr member_descr, ParserResourcesClusterMembersType & resource)
283 if (xmlHasProp(member_descr, (const xmlChar*)test_hostname))
285 xmlChar* hostname = xmlGetProp(member_descr, (const xmlChar*)test_hostname);
286 resource.HostName = (const char*)hostname;
291 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a hostname" << std::endl;
292 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
296 if (xmlHasProp(member_descr, (const xmlChar*)test_protocol))
298 xmlChar* protocol= xmlGetProp(member_descr, (const xmlChar*)test_protocol);
302 resource.Protocol = rsh;
305 resource.Protocol = ssh;
308 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
309 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
316 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl;
317 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
321 if (xmlHasProp(member_descr, (const xmlChar*)test_cluster_internal_protocol))
323 xmlChar* iprotocol= xmlGetProp(member_descr, (const xmlChar*)test_cluster_internal_protocol);
324 switch (iprotocol[0])
327 resource.ClusterInternalProtocol = rsh;
330 resource.ClusterInternalProtocol = ssh;
333 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine with a bad protocol" << std::endl;
334 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
341 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a protocol" << std::endl;
342 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
346 if (xmlHasProp(member_descr, (const xmlChar*)test_user_name))
348 xmlChar* user_name= xmlGetProp(member_descr, (const xmlChar*)test_user_name);
349 resource.UserName = (const char*)user_name;
354 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a user name" << std::endl;
355 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
359 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_nodes))
361 xmlChar* nb_of_nodes = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_nodes);
362 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
363 xmlFree(nb_of_nodes);
367 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfNodes" << std::endl;
368 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
372 if (xmlHasProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node))
374 xmlChar* nb_of_proc_per_node = xmlGetProp(member_descr, (const xmlChar*)test_nb_of_proc_per_node);
375 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
376 xmlFree(nb_of_proc_per_node);
380 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a nbOfProcPerNode" << std::endl;
381 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
385 if (xmlHasProp(member_descr, (const xmlChar*)test_appli_path))
387 xmlChar* appli_path = xmlGetProp(member_descr, (const xmlChar*)test_appli_path);
388 resource.AppliPath = (const char*)appli_path;
393 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning found a machine without a AppliPath" << std::endl;
394 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMember : Warning this machine will not be added" << std::endl;
401 SALOME_ResourcesCatalog_Handler::ProcessMachine(xmlNodePtr machine_descr, ParserResourcesType & resource)
403 if (xmlHasProp(machine_descr, (const xmlChar*)test_hostname))
405 xmlChar* hostname = xmlGetProp(machine_descr, (const xmlChar*)test_hostname);
406 resource.HostName = (const char*)hostname;
411 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning found a machine without a hostname" << std::endl;
412 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : Warning this machine will not be added" << std::endl;
416 if (xmlHasProp(machine_descr, (const xmlChar*)test_name))
418 xmlChar* name = xmlGetProp(machine_descr, (const xmlChar*)test_name);
419 resource.Name = (const char*)name;
420 resource.DataForSort._Name = (const char*)name;
425 resource.Name = resource.HostName;
426 resource.DataForSort._Name = resource.HostName;
427 std::cerr << "SALOME_ResourcesCatalog_Handler::ProcessMachine : !!! Warning !!! No Name found use Hostname for resource: " << _resource.Name << std::endl;
430 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch_queue))
432 xmlChar* batch_queue = xmlGetProp(machine_descr, (const xmlChar*)test_batch_queue);
433 resource.batchQueue = (const char*)batch_queue;
434 xmlFree(batch_queue);
437 resource.batchQueue = "";
439 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_commands))
441 xmlChar* user_commands= xmlGetProp(machine_descr, (const xmlChar*)test_user_commands);
442 resource.userCommands = (const char*)user_commands;
443 xmlFree(user_commands);
446 resource.userCommands = "";
448 if (xmlHasProp(machine_descr, (const xmlChar*)test_protocol))
450 xmlChar* protocol= xmlGetProp(machine_descr, (const xmlChar*)test_protocol);
451 switch ( protocol[0])
454 resource.Protocol = rsh;
457 resource.Protocol = ssh;
460 // If it'not in all theses cases, the protocol is affected to rsh
461 resource.Protocol = rsh;
467 resource.Protocol = rsh;
469 if (xmlHasProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol))
471 xmlChar* iprotocol= xmlGetProp(machine_descr, (const xmlChar*)test_cluster_internal_protocol);
472 switch ( iprotocol[0])
475 resource.ClusterInternalProtocol = rsh;
478 resource.ClusterInternalProtocol = ssh;
481 // If it'not in all theses cases, the protocol is affected to rsh
482 resource.ClusterInternalProtocol = rsh;
488 resource.ClusterInternalProtocol = resource.Protocol;
490 if (xmlHasProp(machine_descr, (const xmlChar*)test_mode))
492 xmlChar* mode=xmlGetProp(machine_descr, (const xmlChar*)test_mode);
496 resource.Mode = interactive;
499 resource.Mode = batch;
502 // If it'not in all theses cases, the mode is affected to interactive
503 resource.Mode = interactive;
509 resource.Mode = interactive;
511 if (xmlHasProp(machine_descr, (const xmlChar*)test_batch))
513 xmlChar* batch = xmlGetProp(machine_descr, (const xmlChar*)test_batch);
514 std::string aBatch = (const char*)batch;
517 resource.Batch = pbs;
518 else if (aBatch == "lsf")
519 resource.Batch = lsf;
520 else if (aBatch == "sge")
521 resource.Batch = sge;
522 else if (aBatch == "ssh_batch")
523 resource.Batch = ssh_batch;
525 resource.Batch = none;
528 if (xmlHasProp(machine_descr, (const xmlChar*)test_mpi))
530 xmlChar* mpi = xmlGetProp(machine_descr, (const xmlChar*)test_mpi);
531 std::string anMpi = (const char*)mpi;
535 else if (anMpi == "mpich1")
536 resource.mpi = mpich1;
537 else if (anMpi == "mpich2")
538 resource.mpi = mpich2;
539 else if (anMpi == "openmpi")
540 resource.mpi = openmpi;
541 else if (anMpi == "slurm")
542 resource.mpi = slurm;
543 else if (anMpi == "prun")
546 resource.mpi = nompi;
549 if (xmlHasProp(machine_descr, (const xmlChar*)test_user_name))
551 xmlChar* user_name= xmlGetProp(machine_descr, (const xmlChar*)test_user_name);
552 resource.UserName = (const char*)user_name;
556 if (xmlHasProp(machine_descr, (const xmlChar*)test_appli_path))
558 xmlChar* appli_path = xmlGetProp(machine_descr, (const xmlChar*)test_appli_path);
559 resource.AppliPath = (const char*)appli_path;
563 if (xmlHasProp(machine_descr, (const xmlChar*)test_os))
565 xmlChar* os = xmlGetProp(machine_descr, (const xmlChar*)test_os);
566 resource.OS = (const char*)os;
570 if (xmlHasProp(machine_descr, (const xmlChar*)test_mem_in_mb))
572 xmlChar* mem_in_mb = xmlGetProp(machine_descr, (const xmlChar*)test_mem_in_mb);
573 resource.DataForSort._memInMB = atoi((const char*)mem_in_mb);
577 if (xmlHasProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz))
579 xmlChar* cpu_freq_mhz = xmlGetProp(machine_descr, (const xmlChar*)test_cpu_freq_mhz);
580 resource.DataForSort._CPUFreqMHz = atoi((const char*)cpu_freq_mhz);
581 xmlFree(cpu_freq_mhz);
584 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_nodes))
586 xmlChar* nb_of_nodes = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_nodes);
587 resource.DataForSort._nbOfNodes = atoi((const char*)nb_of_nodes);
588 xmlFree(nb_of_nodes);
591 if (xmlHasProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node))
593 xmlChar* nb_of_proc_per_node = xmlGetProp(machine_descr, (const xmlChar*)test_nb_of_proc_per_node);
594 resource.DataForSort._nbOfProcPerNode = atoi((const char*)nb_of_proc_per_node);
595 xmlFree(nb_of_proc_per_node);
598 // Process children nodes
599 xmlNodePtr aCurSubNode = machine_descr->xmlChildrenNode;
600 while(aCurSubNode != NULL)
602 // Process components
603 if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_components) )
605 //If a component is given, it is in a module with the same name
606 //except if the module name is given
607 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_component_name))
609 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_component_name);
610 std::string aComponentName = (const char*)component_name;
611 _resource.ComponentsList.push_back(aComponentName);
612 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
614 xmlChar* module_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
615 std::string aModuleName = (const char*)module_name;
616 _resource.ModulesList.push_back(aModuleName);
617 xmlFree(module_name);
620 _resource.ModulesList.push_back(aComponentName);
621 xmlFree(component_name);
625 else if ( !xmlStrcmp(aCurSubNode->name, (const xmlChar*)test_modules) )
627 // If a module is given, we create an entry in componentsList and modulesList
628 // with the same name (module == component)
629 if (xmlHasProp(aCurSubNode, (const xmlChar*)test_module_name))
631 xmlChar* component_name = xmlGetProp(aCurSubNode, (const xmlChar*)test_module_name);
632 std::string aComponentName = (const char*)component_name;
633 _resource.ComponentsList.push_back(aComponentName);
634 _resource.ModulesList.push_back(aComponentName);
635 xmlFree(component_name);
638 aCurSubNode = aCurSubNode->next;
643 //=============================================================================
645 * Fill the document tree in xml file, used to write in an xml file.
646 * \param theDoc document to fill.
648 //=============================================================================
650 void SALOME_ResourcesCatalog_Handler::PrepareDocToXmlFile(xmlDocPtr theDoc)
653 xmlNodePtr root_node = NULL, node = NULL, node1 = NULL;
656 root_node = xmlNewNode(NULL, BAD_CAST "resources");
657 xmlDocSetRootElement(theDoc, root_node);
659 std::map<std::string, ParserResourcesType>::iterator iter = _resources_list.begin();
660 for (; iter != _resources_list.end(); iter++)
662 node = xmlNewChild(root_node, NULL, BAD_CAST test_machine, NULL);
663 xmlNewProp(node, BAD_CAST test_name, BAD_CAST (*iter).second.Name.c_str());
664 xmlNewProp(node, BAD_CAST test_hostname, BAD_CAST (*iter).second.HostName.c_str());
665 xmlNewProp(node, BAD_CAST test_batch_queue, BAD_CAST (*iter).second.batchQueue.c_str());
666 xmlNewProp(node, BAD_CAST test_user_commands, BAD_CAST (*iter).second.userCommands.c_str());
668 switch ((*iter).second.Protocol)
671 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
674 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "ssh");
677 xmlNewProp(node, BAD_CAST test_protocol, BAD_CAST "rsh");
680 switch ((*iter).second.ClusterInternalProtocol)
683 xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh");
686 xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "ssh");
689 xmlNewProp(node, BAD_CAST test_cluster_internal_protocol, BAD_CAST "rsh");
692 switch ((*iter).second.Mode)
695 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
698 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "batch");
701 xmlNewProp(node, BAD_CAST test_mode, BAD_CAST "interactive");
704 switch ((*iter).second.Batch)
707 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "pbs");
710 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "lsf");
713 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "sge");
716 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "ssh_batch");
719 xmlNewProp(node, BAD_CAST test_batch, BAD_CAST "");
722 switch ((*iter).second.mpi)
725 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "lam");
728 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich1");
731 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "mpich2");
734 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "openmpi");
737 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "slurm");
740 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "prun");
743 xmlNewProp(node, BAD_CAST test_mpi, BAD_CAST "");
746 xmlNewProp(node, BAD_CAST test_user_name, BAD_CAST (*iter).second.UserName.c_str());
748 std::vector<std::string>::const_iterator iter2 = (*iter).second.ComponentsList.begin();
749 for(;iter2 != (*iter).second.ComponentsList.end(); iter2++)
751 node1 = xmlNewChild(node, NULL, BAD_CAST test_components, NULL);
752 xmlNewProp(node1, BAD_CAST test_component_name, BAD_CAST (*iter2).c_str());
755 xmlNewProp(node, BAD_CAST test_os, BAD_CAST (*iter).second.OS.c_str());
756 xmlNewProp(node, BAD_CAST test_mem_in_mb, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._memInMB));
757 xmlNewProp(node, BAD_CAST test_cpu_freq_mhz, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._CPUFreqMHz));
758 xmlNewProp(node, BAD_CAST test_nb_of_nodes, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfNodes));
759 xmlNewProp(node, BAD_CAST test_nb_of_proc_per_node, BAD_CAST sprintf(string_buf, "%u", (*iter).second.DataForSort._nbOfProcPerNode));