From: secher Date: Fri, 19 Feb 2010 10:30:22 +0000 (+0000) Subject: allow launch MPI containers when MPI environment is not defined in default environmen... X-Git-Tag: V5_1_4a1~38 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=96c588620b7e92720416adc9f61bfe406e137608;p=modules%2Fkernel.git allow launch MPI containers when MPI environment is not defined in default environment but in Salome environment --- diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 7d923bcf1..9bc68c2cb 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -998,15 +998,58 @@ string SALOME_ContainerManager::GetMPIZeroNode(const string machine, const strin { int status; string zeronode; - string cmd; + string command; string tmpFile = BuildTemporaryFileName(); if( getenv("LIBBATCH_NODEFILE") == NULL ) - cmd = "ssh " + machine + " mpirun -np 1 hostname > " + tmpFile; + { + if (_isAppliSalomeDefined) + { + const ParserResourcesType& resInfo = _ResManager->GetImpl()->GetResourcesDescr(machine); + + if (resInfo.Protocol == rsh) + command = "rsh "; + else if (resInfo.Protocol == ssh) + command = "ssh "; + else + throw SALOME_Exception("Unknown protocol"); + + if (resInfo.UserName != "") + { + command += "-l "; + command += resInfo.UserName; + command += " "; + } + + command += resInfo.HostName; + command += " "; + + if (resInfo.AppliPath != "") + command += resInfo.AppliPath; // path relative to user@machine $HOME + else + { + ASSERT(getenv("APPLI")); + command += getenv("APPLI"); // path relative to user@machine $HOME + } + + command += "/runRemote.sh "; + + ASSERT(getenv("NSHOST")); + command += getenv("NSHOST"); // hostname of CORBA name server + + command += " "; + ASSERT(getenv("NSPORT")); + command += getenv("NSPORT"); // port of CORBA name server + + command += " mpirun -np 1 hostname > " + tmpFile; + } + else + command = "mpirun -np 1 hostname > " + tmpFile; + } else - cmd = "mpirun -np 1 -machinefile " + machinesFile + " hostname > " + tmpFile; + command = "mpirun -np 1 -machinefile " + machinesFile + " hostname > " + tmpFile; - status = system(cmd.c_str()); + status = system(command.c_str()); if( status == 0 ){ ifstream fp(tmpFile.c_str(),ios::in); fp >> zeronode;