1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "SALOME_ResourcesManager.hxx"
21 //#include "SALOME_Container_i.hxx"
22 #include "Utils_ExceptHandlers.hxx"
41 #include <sys/types.h>
43 #include "utilities.h"
45 #define MAX_SIZE_FOR_HOSTNAME 256;
49 //=============================================================================
53 //=============================================================================
55 SALOME_ResourcesManager::
56 SALOME_ResourcesManager(CORBA::ORB_ptr orb,
57 const char *xmlFilePath) :
58 _path_resources(xmlFilePath)
60 _NS = new SALOME_NamingService(orb);
64 //=============================================================================
66 * Standard constructor, parse resource file.
67 * - if ${APPLI} exists in environment,
68 * look for ${HOME}/*{APPLI}/CatalogResources.xml
69 * - else look for default:
70 * ${KERNEL_ROOT_DIR}/share/salome/resources/kernel/CatalogResources.xml
71 * - parse XML resource file.
73 //=============================================================================
75 SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb)
77 _NS = new SALOME_NamingService(orb);
78 _isAppliSalomeDefined = (getenv("APPLI") != 0);
81 if (_isAppliSalomeDefined)
83 _path_resources = getenv("HOME");
84 _path_resources += "/";
85 _path_resources += getenv("APPLI");
86 _path_resources += "/CatalogResources.xml";
91 _path_resources = getenv("KERNEL_ROOT_DIR");
92 _path_resources += "/share/salome/resources/kernel/CatalogResources.xml";
98 //=============================================================================
100 * Standard Destructor
102 //=============================================================================
104 SALOME_ResourcesManager::~SALOME_ResourcesManager()
109 //=============================================================================
111 * get the list of name of ressources fitting for the specified module.
112 * If hostname specified, check it is local or known in resources catalog.
115 * - select first machines with corresponding OS (all machines if
116 * parameter OS empty),
117 * - then select the sublist of machines on witch the module is known
118 * (if the result is empty, that probably means that the inventory of
119 * modules is probably not done, so give complete list from previous step)
121 //=============================================================================
124 SALOME_ResourcesManager::
125 GetFittingResources(const Engines::MachineParameters& params,
126 const char *moduleName)
127 throw(SALOME_Exception)
129 // MESSAGE("ResourcesManager::GetFittingResources");
130 vector <std::string> ret;
133 // --- To be sure that we search in a correct list.
136 const char *hostname = (const char *)params.hostname;
137 MESSAGE("GetFittingResources " << hostname << " " << GetHostname().c_str());
139 if (hostname[0] != '\0')
141 // MESSAGE("ResourcesManager::GetFittingResources : hostname specified" );
143 if ( strcmp(hostname, "localhost") == 0 ||
144 strcmp(hostname, GetHostname().c_str()) == 0 )
146 // MESSAGE("ResourcesManager::GetFittingResources : localhost" );
147 ret.push_back(GetHostname().c_str());
148 // MESSAGE("ResourcesManager::GetFittingResources : " << ret.size());
151 else if (_resourcesList.find(hostname) != _resourcesList.end())
153 // --- params.hostname is in the list of resources so return it.
154 ret.push_back(hostname);
159 // Cas d'un cluster: nombre de noeuds > 1
161 for (map<string, ParserResourcesType>::const_iterator iter = _resourcesList.begin(); iter != _resourcesList.end(); iter++){
162 if( (*iter).second.DataForSort._nbOfNodes > 1 ){
163 if( strncmp(hostname,(*iter).first.c_str(),strlen(hostname)) == 0 ){
164 ret.push_back((*iter).first.c_str());
165 //cout << "SALOME_ResourcesManager::GetFittingResources vector["
166 // << cpt << "] = " << (*iter).first.c_str() << endl ;
172 // --- user specified an unknown hostame so notify him.
173 MESSAGE("ResourcesManager::GetFittingResources : SALOME_Exception");
174 throw SALOME_Exception("unknown host");
180 // --- Search for available resources sorted by priority
182 SelectOnlyResourcesWithOS(ret, params.OS);
184 KeepOnlyResourcesWithModule(ret, moduleName);
187 SelectOnlyResourcesWithOS(ret, params.OS);
189 // --- set wanted parameters
190 ResourceDataToSort::_nbOfNodesWanted = params.nb_node;
192 ResourceDataToSort::_nbOfProcPerNodeWanted = params.nb_proc_per_node;
194 ResourceDataToSort::_CPUFreqMHzWanted = params.cpu_clock;
196 ResourceDataToSort::_memInMBWanted = params.mem_mb;
200 list<ResourceDataToSort> li;
202 for (vector<string>::iterator iter = ret.begin();
205 li.push_back(_resourcesList[(*iter)].DataForSort);
211 for (list<ResourceDataToSort>::iterator iter2 = li.begin();
214 ret[i++] = (*iter2)._hostName;
217 // MESSAGE("ResourcesManager::GetFittingResources : return" << ret.size());
221 //=============================================================================
223 * add an entry in the ressources catalog xml file.
224 * Return 0 if OK (KERNEL found in new resources modules) else throw exception
226 //=============================================================================
229 SALOME_ResourcesManager::
230 AddResourceInCatalog(const Engines::MachineParameters& paramsOfNewResources,
231 const map<string, string>& modulesOnNewResources,
232 const char *environPathOfPrerequired,
234 const char *userName,
236 AccessProtocolType prot)
237 throw(SALOME_Exception)
239 map<string, string>::const_iterator iter =
240 modulesOnNewResources.find("KERNEL");
242 if (iter != modulesOnNewResources.end())
244 ParserResourcesType newElt;
245 newElt.DataForSort._hostName = paramsOfNewResources.hostname;
246 newElt.Alias = alias;
247 newElt.Protocol = prot;
249 newElt.UserName = userName;
250 newElt.ModulesPath = modulesOnNewResources;
251 newElt.PreReqFilePath = environPathOfPrerequired;
252 newElt.OS = paramsOfNewResources.OS;
253 newElt.DataForSort._memInMB = paramsOfNewResources.mem_mb;
254 newElt.DataForSort._CPUFreqMHz = paramsOfNewResources.cpu_clock;
255 newElt.DataForSort._nbOfNodes = paramsOfNewResources.nb_node;
256 newElt.DataForSort._nbOfProcPerNode =
257 paramsOfNewResources.nb_proc_per_node;
258 _resourcesList[newElt.DataForSort._hostName] = newElt;
263 throw SALOME_Exception("KERNEL is not present in this resource");
266 //=============================================================================
268 * Deletes a resource from the catalog
270 //=============================================================================
272 void SALOME_ResourcesManager::DeleteResourceInCatalog(const char *hostname)
274 _resourcesList.erase(hostname);
277 //=============================================================================
279 * write the current data in memory in file.
281 //=============================================================================
283 void SALOME_ResourcesManager::WriteInXmlFile()
285 QDomDocument doc("ResourcesCatalog");
286 SALOME_ResourcesCatalog_Handler* handler =
287 new SALOME_ResourcesCatalog_Handler(_resourcesList);
288 handler->PrepareDocToXmlFile(doc);
291 QFile file( _path_resources );
293 if ( !file.open( IO_WriteOnly ) )
294 INFOS("WRITING ERROR !");
296 QTextStream ts( &file );
298 ts << doc.toString();
302 MESSAGE("WRITING DONE!");
305 //=============================================================================
307 * parse the data type catalog
309 //=============================================================================
311 const MapOfParserResourcesType& SALOME_ResourcesManager::ParseXmlFile()
313 SALOME_ResourcesCatalog_Handler* handler =
314 new SALOME_ResourcesCatalog_Handler(_resourcesList);
315 QFile xmlFile(_path_resources);
317 QXmlInputSource source(xmlFile);
319 QXmlSimpleReader reader;
320 reader.setContentHandler( handler );
321 reader.setErrorHandler( handler );
322 reader.parse( source );
325 return _resourcesList;
328 //=============================================================================
330 * consult the content of the list
332 //=============================================================================
334 const MapOfParserResourcesType& SALOME_ResourcesManager::GetList() const
336 return _resourcesList;
340 //=============================================================================
342 * dynamically obtains the first machines
344 //=============================================================================
347 SALOME_ResourcesManager::FindFirst(const Engines::MachineList& listOfMachines)
349 return _dynamicResourcesSelecter.FindFirst(listOfMachines);
352 //=============================================================================
354 * dynamically obtains the best machines
356 //=============================================================================
359 SALOME_ResourcesManager::FindNext(const Engines::MachineList& listOfMachines)
361 return _dynamicResourcesSelecter.FindNext(listOfMachines,_NS);
363 //=============================================================================
365 * dynamically obtains the best machines
367 //=============================================================================
370 SALOME_ResourcesManager::FindBest(const Engines::MachineList& listOfMachines)
372 return _dynamicResourcesSelecter.FindBest(listOfMachines);
377 //=============================================================================
379 * This is no longer valid (C++ container are also python containers)
381 //=============================================================================
383 bool isPythonContainer(const char* ContainerName)
386 int len = strlen(ContainerName);
389 if (strcmp(ContainerName + len - 2, "Py") == 0)
396 //=============================================================================
398 * Builds the script to be launched
400 * If SALOME Application not defined ($APPLI),
401 * see BuildTempFileToLaunchRemoteContainer()
403 * Else rely on distant configuration. Command is under the form (example):
404 * ssh user@machine distantPath/runRemote.sh hostNS portNS \
405 * SALOME_Container containerName &"
407 * - where user is ommited if not specified in CatalogResources,
408 * - where distant path is always relative to user@machine $HOME, and
409 * equal to $APPLI if not specified in CatalogResources,
410 * - where hostNS is the hostname of CORBA naming server (set by scripts to
411 * use to launch SALOME and servers in $APPLI: runAppli.sh, runRemote.sh)
412 * - where portNS is the port used by CORBA naming server (set by scripts to
413 * use to launch SALOME and servers in $APPLI: runAppli.sh, runRemote.sh)
415 //=============================================================================
418 SALOME_ResourcesManager::BuildCommandToLaunchRemoteContainer
419 (const string& machine,
420 const Engines::MachineParameters& params, const long id)
424 char idc[3*sizeof(long)];
426 if ( ! _isAppliSalomeDefined )
427 command = BuildTempFileToLaunchRemoteContainer(machine, params);
431 const ParserResourcesType& resInfo = _resourcesList[machine];
435 if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
437 else if ( params.nb_node == 0 )
438 nbproc = params.nb_proc_per_node;
439 else if ( params.nb_proc_per_node == 0 )
440 nbproc = params.nb_node;
442 nbproc = params.nb_node * params.nb_proc_per_node;
445 // "ssh user@machine distantPath/runRemote.sh hostNS portNS \
446 // SALOME_Container containerName &"
448 if (resInfo.Protocol == rsh)
450 else if (resInfo.Protocol == ssh)
453 throw SALOME_Exception("Unknown protocol");
455 if (resInfo.UserName != "")
457 command += resInfo.UserName;
464 if (resInfo.AppliPath != "")
465 command += resInfo.AppliPath; // path relative to user@machine $HOME
468 ASSERT(getenv("APPLI"));
469 command += getenv("APPLI"); // path relative to user@machine $HOME
472 command += "/runRemote.sh ";
474 ASSERT(getenv("NSHOST"));
475 command += getenv("NSHOST"); // hostname of CORBA name server
478 ASSERT(getenv("NSPORT"));
479 command += getenv("NSPORT"); // port of CORBA name server
483 command += " mpirun -np ";
484 std::ostringstream o;
488 command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
490 command += " SALOME_MPIContainer ";
493 command += " SALOME_Container ";
495 command += _NS->ContainerName(params);
497 sprintf(idc,"%ld",id);
500 AddOmninamesParams(command);
501 command += " > /tmp/";
502 command += _NS->ContainerName(params);
504 command += GetHostname();
506 command += getenv( "USER" ) ;
507 command += ".log 2>&1 &" ;
509 MESSAGE("command =" << command);
516 //=============================================================================
518 * builds the command to be launched.
520 //=============================================================================
523 SALOME_ResourcesManager::BuildCommandToLaunchLocalContainer
524 (const Engines::MachineParameters& params, const long id)
529 char idc[3*sizeof(long)];
533 command = "mpirun -np ";
535 if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
537 else if ( params.nb_node == 0 )
538 nbproc = params.nb_proc_per_node;
539 else if ( params.nb_proc_per_node == 0 )
540 nbproc = params.nb_node;
542 nbproc = params.nb_node * params.nb_proc_per_node;
544 std::ostringstream o;
550 command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
553 if (isPythonContainer(params.container_name))
554 command += "pyMPI SALOME_ContainerPy.py ";
556 command += "SALOME_MPIContainer ";
561 if (isPythonContainer(params.container_name))
562 command = "SALOME_ContainerPy.py ";
564 command = "SALOME_Container ";
567 command += _NS->ContainerName(params);
569 sprintf(idc,"%ld",id);
572 AddOmninamesParams(command);
573 command += " > /tmp/";
574 command += _NS->ContainerName(params);
576 command += GetHostname();
578 command += getenv( "USER" ) ;
579 command += ".log 2>&1 &" ;
580 MESSAGE("Command is ... " << command);
585 //=============================================================================
587 * removes the generated temporary file in case of a remote launch.
589 //=============================================================================
591 void SALOME_ResourcesManager::RmTmpFile()
593 if (_TmpFileName != "")
596 string command = "rm ";
598 string command = "del /F ";
600 command += _TmpFileName;
601 char *temp = strdup(command.c_str());
602 int lgthTemp = strlen(temp);
603 temp[lgthTemp - 3] = '*';
604 temp[lgthTemp - 2] = '\0';
611 //=============================================================================
613 * builds the script to be launched
615 //=============================================================================
618 SALOME_ResourcesManager::BuildCommand
619 (const string& machine,
620 const char *containerName)
622 // rsh -n ikkyo /export/home/rahuel/SALOME_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515 &
623 const ParserResourcesType& resInfo = _resourcesList[machine];
624 bool pyCont = isPythonContainer(containerName);
628 if (resInfo.Protocol == rsh)
629 command = "rsh -n " ;
630 else if (resInfo.Protocol == ssh)
631 command = "ssh -f -n ";
633 throw SALOME_Exception("Not implemented yet...");
637 string path = (*(resInfo.ModulesPath.find("KERNEL"))).second;
639 command += "/bin/salome/";
642 command += "SALOME_ContainerPy.py ";
644 command += "SALOME_Container ";
646 command += containerName;
648 AddOmninamesParams(command);
649 command += " > /tmp/";
650 command += containerName;
654 command += getenv( "USER" ) ;
655 command += ".log 2>&1 &" ;
661 //=============================================================================
663 * Gives a sublist of machines with matching OS.
664 * If parameter OS is empty, gives the complete list of machines
666 //=============================================================================
668 // Warning need an updated parsed list : _resourcesList
670 SALOME_ResourcesManager::SelectOnlyResourcesWithOS
671 ( vector<string>& hosts,
672 const char *OS) const
673 throw(SALOME_Exception)
677 for (map<string, ParserResourcesType>::const_iterator iter =
678 _resourcesList.begin();
679 iter != _resourcesList.end();
682 if ( (*iter).second.OS == base || base.size() == 0)
683 hosts.push_back((*iter).first);
688 //=============================================================================
690 * Gives a sublist of machines on which the module is known.
692 //=============================================================================
694 //Warning need an updated parsed list : _resourcesList
696 SALOME_ResourcesManager::KeepOnlyResourcesWithModule
697 ( vector<string>& hosts,
698 const char *moduleName) const
699 throw(SALOME_Exception)
701 for (vector<string>::iterator iter = hosts.begin(); iter != hosts.end();)
703 MapOfParserResourcesType::const_iterator it = _resourcesList.find(*iter);
704 const map<string, string>& mapOfModulesOfCurrentHost =
705 (((*it).second).ModulesPath);
707 if (mapOfModulesOfCurrentHost.find(moduleName) ==
708 mapOfModulesOfCurrentHost.end())
716 //=============================================================================
718 * add to command all options relative to naming service.
720 //=============================================================================
722 void SALOME_ResourcesManager::AddOmninamesParams(string& command) const
724 // If env variable OMNIORB_CONFIG is not defined or the file is more complex than one line
726 // Even if we use it we have to check if env variable exists
727 //string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ;
728 //ifstream omniORBfile( omniORBcfg.c_str() ) ;
729 //char ORBInitRef[11] ;
731 //char nameservice[132] ;
732 //omniORBfile >> ORBInitRef ;
733 //command += "ORBInitRef " ;
734 //omniORBfile >> egal ;
735 //omniORBfile >> nameservice ;
736 //omniORBfile.close() ;
737 //char * bsn = strchr( nameservice , '\n' ) ;
741 //command += nameservice ;
743 char *iorstr = _NS->getIORaddr();
744 command += "ORBInitRef NameService=";
749 //=============================================================================
751 * add to command all options relative to naming service.
753 //=============================================================================
755 void SALOME_ResourcesManager::AddOmninamesParams(ofstream& fileStream) const
757 fileStream << "ORBInitRef NameService=";
758 fileStream << _NS->getIORaddr();
762 //=============================================================================
764 * generate a file name in /tmp directory
766 //=============================================================================
768 string SALOME_ResourcesManager::BuildTemporaryFileName() const
770 //build more complex file name to support multiple salome session
771 char *temp = new char[19];
772 strcpy(temp, "/tmp/command");
773 strcat(temp, "XXXXXX");
780 itoa(getpid(), aPID, 10);
784 string command(temp);
791 //=============================================================================
793 * Builds in a temporary file the script to be launched.
795 * Used if SALOME Application ($APPLI) is not defined.
796 * The command is build with data from CatalogResources, in which every path
797 * used on remote computer must be defined.
799 //=============================================================================
802 SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer
803 (const string& machine,
804 const Engines::MachineParameters& params)
806 _TmpFileName = BuildTemporaryFileName();
807 ofstream tempOutputFile;
808 tempOutputFile.open(_TmpFileName.c_str(), ofstream::out );
809 const ParserResourcesType& resInfo = _resourcesList[machine];
810 tempOutputFile << "#! /bin/sh" << endl;
814 tempOutputFile << "source " << resInfo.PreReqFilePath << endl;
816 for (map<string, string>::const_iterator iter = resInfo.ModulesPath.begin();
817 iter != resInfo.ModulesPath.end();
820 string curModulePath((*iter).second);
821 tempOutputFile << (*iter).first << "_ROOT_DIR=" << curModulePath << endl;
822 tempOutputFile << "export " << (*iter).first << "_ROOT_DIR" << endl;
823 tempOutputFile << "LD_LIBRARY_PATH=" << curModulePath
824 << "/lib/salome" << ":${LD_LIBRARY_PATH}" << endl;
825 tempOutputFile << "PYTHONPATH=" << curModulePath << "/bin/salome:"
826 << curModulePath << "/lib/salome:" << curModulePath
827 << "/lib/python${PYTHON_VERSION}/site-packages/salome:";
828 tempOutputFile << curModulePath
829 << "/lib/python${PYTHON_VERSION}/site-packages/salome/shared_modules:${PYTHONPATH}"
833 tempOutputFile << "export LD_LIBRARY_PATH" << endl;
834 tempOutputFile << "export PYTHONPATH" << endl;
835 tempOutputFile << "export SALOME_trace=local" << endl; // mkr : 27.11.2006 : PAL13967 - Distributed supervision graphs - Problem with "SALOME_trace"
836 //tempOutputFile << "source " << resInfo.PreReqFilePath << endl;
842 tempOutputFile << "mpirun -np ";
845 if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
847 else if ( params.nb_node == 0 )
848 nbproc = params.nb_proc_per_node;
849 else if ( params.nb_proc_per_node == 0 )
850 nbproc = params.nb_node;
852 nbproc = params.nb_node * params.nb_proc_per_node;
854 std::ostringstream o;
856 tempOutputFile << nbproc << " ";
858 tempOutputFile << "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
862 tempOutputFile << (*(resInfo.ModulesPath.find("KERNEL"))).second
867 if (isPythonContainer(params.container_name))
868 tempOutputFile << "pyMPI SALOME_ContainerPy.py ";
870 tempOutputFile << "SALOME_MPIContainer ";
875 if (isPythonContainer(params.container_name))
876 tempOutputFile << "SALOME_ContainerPy.py ";
878 tempOutputFile << "SALOME_Container ";
881 tempOutputFile << _NS->ContainerName(params) << " -";
882 AddOmninamesParams(tempOutputFile);
883 tempOutputFile << " &" << endl;
884 tempOutputFile.flush();
885 tempOutputFile.close();
886 chmod(_TmpFileName.c_str(), 0x1ED);
892 if (resInfo.Protocol == rsh)
895 string commandRcp = "rcp ";
896 commandRcp += _TmpFileName;
898 commandRcp += machine;
900 commandRcp += _TmpFileName;
901 system(commandRcp.c_str());
904 else if (resInfo.Protocol == ssh)
907 string commandRcp = "scp ";
908 commandRcp += _TmpFileName;
910 commandRcp += machine;
912 commandRcp += _TmpFileName;
913 system(commandRcp.c_str());
916 throw SALOME_Exception("Unknown protocol");
919 _CommandForRemAccess = command;
921 command += _TmpFileName;
924 command += _NS->ContainerName(params);
928 command += getenv( "USER" ) ;
929 command += ".log 2>&1 &";
936 //=============================================================================
937 /*! Creates a command line that the container manager uses to launch
938 * a parallel container.
940 //=============================================================================
942 SALOME_ResourcesManager::BuildCommandToLaunchLocalParallelContainer(const std::string& exe_name,
943 const Engines::MachineParameters& params,
944 const std::string& log)
946 // This method knows the differences between the proxy and the nodes.
947 // nb_component_nodes is not used in the same way if it is a proxy or
951 string parallelLib(CORBA::string_dup(params.parallelLib));
952 string hostname(CORBA::string_dup(params.hostname));
953 int par = exe_name.find("Proxy");
954 int nbproc = params.nb_component_nodes;
956 sprintf(buffer,"%d",nbproc);
958 Engines::MachineParameters_var rtn = new Engines::MachineParameters();
959 rtn->container_name = params.container_name;
960 rtn->hostname = params.hostname;
962 rtn->mem_mb = params.mem_mb;
963 rtn->cpu_clock = params.cpu_clock;
964 rtn->nb_proc_per_node = params.nb_proc_per_node;
965 rtn->nb_node = params.nb_node;
966 rtn->isMPI = params.isMPI;
968 string real_exe_name = exe_name + parallelLib;
970 if (parallelLib == "Dummy")
972 //command = "gdb --args ";
973 //command = "valgrind --tool=memcheck --log-file=val_log ";
974 //command += real_exe_name;
976 command = real_exe_name;
978 command += " " + _NS->ContainerName(rtn);
979 command += " " + parallelLib;
980 command += " " + hostname;
982 AddOmninamesParams(command);
985 if (parallelLib == "Mpi")
987 // Step 1 : check if MPI is started
988 if (_MpiStarted == false)
996 command = "mpiexec -np " + string(buffer) + " ";
997 command += real_exe_name;
998 command += " " + _NS->ContainerName(rtn);
999 command += " " + parallelLib;
1000 command += " " + hostname;
1002 AddOmninamesParams(command);
1007 command = "mpiexec -np 1 ";
1008 command += real_exe_name;
1009 command += " " + _NS->ContainerName(rtn);
1010 command += " " + string(buffer);
1011 command += " " + parallelLib;
1012 command += " " + hostname;
1014 AddOmninamesParams(command);
1019 if (log == "default")
1021 command += " > /tmp/";
1022 command += _NS->ContainerName(rtn);
1024 command += GetHostname();
1026 command += getenv( "USER" ) ;
1027 command += ".log 2>&1 &" ;
1031 command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; "
1032 + command + " \" &";
1033 //command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; "
1034 // + command + "; cat \" &";
1038 /* if (log == "xterm")
1040 command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; echo $LD_LIBRARY_PATH; echo $PATH; " + command + "; cat \" &";
1043 /* command = "cd ; rm " + fichier_commande + "; touch " + \
1044 fichier_commande + "; echo \" export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; " + \
1045 command + " >& /tmp/ribes_" + fichier_commande + " & \" > " + fichier_commande + ";";
1046 command += "ssh cn01 sh " + fichier_commande + " &";
1047 cerr << "La commande : " << command << endl;
1051 void SALOME_ResourcesManager::startMPI()
1053 cerr << "----------------------------------------------" << endl;
1054 cerr << "----------------------------------------------" << endl;
1055 cerr << "----------------------------------------------" << endl;
1056 cerr << "-Only Lam on Localhost is currently supported-" << endl;
1057 cerr << "----------------------------------------------" << endl;
1058 cerr << "----------------------------------------------" << endl;
1059 cerr << "----------------------------------------------" << endl;
1061 int status = system("lamboot");
1064 INFOS("lamboot failed : system command status -1");
1066 else if (status == 217)
1068 INFOS("lamboot failed : system command status 217");