def gather_mpi_arguments(hostfile, params):
from mpi4py import MPI
vendor = MPI.get_vendor()
print_and_log(['MPI detected: %s' % str(vendor)], 'debug', logger)
if vendor[0] == 'Open MPI':
mpi_args = ['mpirun']
if os.getenv('LD_LIBRARY_PATH'):
mpi_args += ['-x', 'LD_LIBRARY_PATH']
if os.getenv('PATH'):
mpi_args += ['-x', 'PATH']
if os.getenv('PYTHONPATH'):
mpi_args += ['-x', 'PYTHONPATH']
if os.path.exists(hostfile):
mpi_args += ['-hostfile', hostfile]
elif vendor[0] == 'Microsoft MPI':
mpi_args = ['mpiexec']
if os.path.exists(hostfile):
mpi_args += ['-machinefile', hostfile]
elif vendor[0] == 'MPICH2':
mpi_args = ['mpiexec']
if os.path.exists(hostfile):
mpi_args += ['-f', hostfile]
elif vendor[0] == 'MPICH':
mpi_args = ['mpiexec']
if os.path.exists(hostfile):
mpi_args += ['-f', hostfile]
else:
print_and_log([
'%s may not be yet properly implemented: contact developpers' %
vendor[0]], 'error', logger)
mpi_args = ['mpirun']
if os.path.exists(hostfile):
mpi_args += ['-hostfile', hostfile]
return mpi_args
评论列表
文章目录