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 "MpiImpl.hxx"
48 MpiImpl_LAM::MpiImpl_LAM() : MpiImpl()
53 MpiImpl_LAM::~MpiImpl_LAM()
57 string MpiImpl_LAM::size()
62 string MpiImpl_LAM::rank()
67 string MpiImpl_LAM::boot(const string machinefile, const unsigned int nbnodes)
70 oss << "lamboot " << machinefile << endl;
74 string MpiImpl_LAM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
77 oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
81 string MpiImpl_LAM::halt()
84 oss << "lamhalt" << endl;
88 // mpich1 implementation
90 MpiImpl_MPICH1::MpiImpl_MPICH1() : MpiImpl()
95 MpiImpl_MPICH1::~MpiImpl_MPICH1()
99 string MpiImpl_MPICH1::size()
101 throw MpiImplException("mpich1 doesn't work with this batch system to submit salome session");
104 string MpiImpl_MPICH1::rank()
106 throw MpiImplException("mpich1 doesn't work with this batch system to submit salome session");
109 string MpiImpl_MPICH1::boot(const string machinefile, const unsigned int nbnodes)
114 string MpiImpl_MPICH1::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
117 oss << "mpirun -machinefile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
121 string MpiImpl_MPICH1::halt()
126 // mpich2 implementation
128 MpiImpl_MPICH2::MpiImpl_MPICH2() : MpiImpl()
133 MpiImpl_MPICH2::~MpiImpl_MPICH2()
137 string MpiImpl_MPICH2::size()
139 return "${PMI_SIZE}";
142 string MpiImpl_MPICH2::rank()
144 return "${PMI_RANK}";
147 string MpiImpl_MPICH2::boot(const string machinefile, const unsigned int nbnodes)
150 oss << "mpdboot -n " << nbnodes << " -f " << machinefile << endl;
154 string MpiImpl_MPICH2::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
157 oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
161 string MpiImpl_MPICH2::halt()
164 oss << "mpdallexit" << endl;
168 // openmpi implementation
170 MpiImpl_OPENMPI::MpiImpl_OPENMPI() : MpiImpl()
175 MpiImpl_OPENMPI::~MpiImpl_OPENMPI()
179 string MpiImpl_OPENMPI::size()
181 return "${OMPI_MCA_ns_nds_num_procs}";
184 string MpiImpl_OPENMPI::rank()
186 return "${OMPI_MCA_ns_nds_vpid}";
189 string MpiImpl_OPENMPI::boot(const string machinefile, const unsigned int nbnodes)
194 string MpiImpl_OPENMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
197 oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
201 string MpiImpl_OPENMPI::halt()
206 // slurm implementation
208 MpiImpl_SLURM::MpiImpl_SLURM() : MpiImpl()
213 MpiImpl_SLURM::~MpiImpl_SLURM()
217 string MpiImpl_SLURM::size()
219 return "${SLURM_NPROCS}";
222 string MpiImpl_SLURM::rank()
224 return "${SLURM_PROCID}";
227 string MpiImpl_SLURM::boot(const string machinefile, const unsigned int nbnodes)
232 string MpiImpl_SLURM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
235 oss << "srun " << fileNameToExecute << endl;
239 string MpiImpl_SLURM::halt()