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
23 * Auteur : Bernard SECHER - CEA/DEN
32 #include "utilities.h"
33 #include "MpiImpl.hxx"
40 MESSAGE("MpiImpl constructor");
46 MESSAGE("MpiImpl destructor");
51 MpiImpl_LAM::MpiImpl_LAM() : MpiImpl()
56 MpiImpl_LAM::~MpiImpl_LAM()
58 MESSAGE("MpiImpl_LAM destructor");
61 string MpiImpl_LAM::size()
66 string MpiImpl_LAM::rank()
71 string MpiImpl_LAM::boot(const string machinefile, const unsigned int nbnodes)
74 oss << "lamboot " << machinefile << endl;
78 string MpiImpl_LAM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
81 oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
85 string MpiImpl_LAM::halt()
88 oss << "lamhalt" << endl;
92 // mpich1 implementation
94 MpiImpl_MPICH1::MpiImpl_MPICH1() : MpiImpl()
99 MpiImpl_MPICH1::~MpiImpl_MPICH1()
101 MESSAGE("MpiImpl_MPICH1 destructor");
104 string MpiImpl_MPICH1::size()
106 throw SALOME_Exception("mpich1 doesn't work with this batch system to submit salome session");
109 string MpiImpl_MPICH1::rank()
111 throw SALOME_Exception("mpich1 doesn't work with this batch system to submit salome session");
114 string MpiImpl_MPICH1::boot(const string machinefile, const unsigned int nbnodes)
119 string MpiImpl_MPICH1::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
122 oss << "mpirun -machinefile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
126 string MpiImpl_MPICH1::halt()
131 // mpich2 implementation
133 MpiImpl_MPICH2::MpiImpl_MPICH2() : MpiImpl()
138 MpiImpl_MPICH2::~MpiImpl_MPICH2()
140 MESSAGE("MpiImpl_MPICH2 destructor");
143 string MpiImpl_MPICH2::size()
145 return "${PMI_SIZE}";
148 string MpiImpl_MPICH2::rank()
150 return "${PMI_RANK}";
153 string MpiImpl_MPICH2::boot(const string machinefile, const unsigned int nbnodes)
156 oss << "mpdboot -n " << nbnodes << " -f " << machinefile << endl;
160 string MpiImpl_MPICH2::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
163 oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
167 string MpiImpl_MPICH2::halt()
170 oss << "mpdallexit" << endl;
174 // openmpi implementation
176 MpiImpl_OPENMPI::MpiImpl_OPENMPI() : MpiImpl()
181 MpiImpl_OPENMPI::~MpiImpl_OPENMPI()
183 MESSAGE("MpiImpl_OPENMPI destructor");
186 string MpiImpl_OPENMPI::size()
188 return "${OMPI_MCA_ns_nds_num_procs}";
191 string MpiImpl_OPENMPI::rank()
193 return "${OMPI_MCA_ns_nds_vpid}";
196 string MpiImpl_OPENMPI::boot(const string machinefile, const unsigned int nbnodes)
201 string MpiImpl_OPENMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
204 oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
208 string MpiImpl_OPENMPI::halt()