1 // Copyright (C) 2007-2012 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
26 #include "Batch_MpiImpl.hxx"
42 MpiImpl_LAM::MpiImpl_LAM() : MpiImpl()
47 MpiImpl_LAM::~MpiImpl_LAM()
51 string MpiImpl_LAM::size()
56 string MpiImpl_LAM::rank()
61 string MpiImpl_LAM::boot(const string machinefile, const unsigned int nbnodes)
64 oss << "lamboot " << machinefile << endl;
68 string MpiImpl_LAM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
71 oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
75 string MpiImpl_LAM::halt()
78 oss << "lamhalt" << endl;
82 string MpiImpl_LAM::name()
87 // mpich1 implementation
89 MpiImpl_MPICH1::MpiImpl_MPICH1() : MpiImpl()
94 MpiImpl_MPICH1::~MpiImpl_MPICH1()
98 string MpiImpl_MPICH1::size()
100 return "${MPIRUN_NPROCS}";
103 string MpiImpl_MPICH1::rank()
105 return "${MPIRUN_RANK}";
108 string MpiImpl_MPICH1::boot(const string machinefile, const unsigned int nbnodes)
113 string MpiImpl_MPICH1::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
116 oss << "mpirun -machinefile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
120 string MpiImpl_MPICH1::halt()
125 string MpiImpl_MPICH1::name()
130 // mpich2 implementation
132 MpiImpl_MPICH2::MpiImpl_MPICH2() : MpiImpl()
137 MpiImpl_MPICH2::~MpiImpl_MPICH2()
141 string MpiImpl_MPICH2::size()
143 return "${PMI_SIZE}";
146 string MpiImpl_MPICH2::rank()
148 return "${PMI_RANK}";
151 string MpiImpl_MPICH2::boot(const string machinefile, const unsigned int nbnodes)
154 oss << "mpdboot" << " -n " << nbnodes;
156 oss << " -f " << machinefile;
161 string MpiImpl_MPICH2::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
164 oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
168 string MpiImpl_MPICH2::halt()
171 oss << "mpdallexit" << endl;
175 string MpiImpl_MPICH2::name()
180 // openmpi implementation
182 MpiImpl_OPENMPI::MpiImpl_OPENMPI() : MpiImpl()
187 MpiImpl_OPENMPI::~MpiImpl_OPENMPI()
191 string MpiImpl_OPENMPI::size()
193 return "${OMPI_MCA_ns_nds_num_procs}";
196 string MpiImpl_OPENMPI::rank()
198 return "${OMPI_MCA_ns_nds_vpid}";
201 string MpiImpl_OPENMPI::boot(const string machinefile, const unsigned int nbnodes)
206 string MpiImpl_OPENMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
209 oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
213 string MpiImpl_OPENMPI::halt()
218 string MpiImpl_OPENMPI::name()
223 // ompi implementation
225 MpiImpl_OMPI::MpiImpl_OMPI() : MpiImpl()
230 MpiImpl_OMPI::~MpiImpl_OMPI()
234 string MpiImpl_OMPI::size()
236 return "${OMPI_MCA_ns_nds_num_procs}";
239 string MpiImpl_OMPI::rank()
241 return "${OMPI_MCA_ns_nds_vpid}";
244 string MpiImpl_OMPI::boot(const string machinefile, const unsigned int nbnodes)
249 string MpiImpl_OMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
252 oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
256 string MpiImpl_OMPI::halt()
261 string MpiImpl_OMPI::name()
266 // slurm implementation
268 MpiImpl_SLURM::MpiImpl_SLURM() : MpiImpl()
273 MpiImpl_SLURM::~MpiImpl_SLURM()
277 string MpiImpl_SLURM::size()
279 return "${SLURM_NPROCS}";
282 string MpiImpl_SLURM::rank()
284 return "${SLURM_PROCID}";
287 string MpiImpl_SLURM::boot(const string machinefile, const unsigned int nbnodes)
292 string MpiImpl_SLURM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
295 oss << "srun " << fileNameToExecute << endl;
299 string MpiImpl_SLURM::halt()
304 string MpiImpl_SLURM::name()
309 // prun implementation
311 MpiImpl_PRUN::MpiImpl_PRUN() : MpiImpl()
316 MpiImpl_PRUN::~MpiImpl_PRUN()
320 string MpiImpl_PRUN::size()
322 return "${RMS_NPROCS}";
325 string MpiImpl_PRUN::rank()
327 return "${RMS_RANK}";
330 string MpiImpl_PRUN::boot(const string machinefile, const unsigned int nbnodes)
335 string MpiImpl_PRUN::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
338 oss << "prun -n " << nbproc << " " << "-p mpi " << fileNameToExecute << endl;
342 string MpiImpl_PRUN::halt()
347 string MpiImpl_PRUN::name()