Hi Guys,
I have an error using anaconda to run a task farm code I am playing about with.
Any suggestions as to what is causing the problem would be appreciated.
The
code has a wrapper super_master.py, that should spawn a single instance
of master.py, which then spawns instances of slave.py to work through a
set of tasks. The reason I am using this wrapper is that the code is a
test case to be included in another piece of code, which is run from the
terminal without invoking mpi, so I want the wrapper to invoke it.
The error I get is:
[mpiexec@itd-ngpu-01] match_arg (./utils/args/args.c:122): unrecognized argument pmi_args
[mpiexec@itd-ngpu-01] HYDU_parse_array (./utils/args/args.c:140): argument matching returned error
[mpiexec@itd-ngpu-01] parse_args (./ui/mpich/utils.c:1387): error parsing input array
[mpiexec@itd-ngpu-01] HYD_uii_mpx_get_parameters (./ui/mpich/utils.c:1438): unable to parse user arguments
Usage: ./mpiexec [global opts] [exec1 local opts] : [exec2 local opts] : ...
If i use an os call:
os.system('{}'.format('mpirun -np 1 python master.py'))
in
super_master.py it runs fine, but I was curious as to why the issue
arises using spawn. At a guess my spawn call in super_master.py is
formatted incorrectly, but I can't see the problem.....
Thanks!
code follows:
super_master.py:
#!/usr/bin/env python
import os
from mpi4py import MPI
import sys
comm = MPI.COMM_WORLD
print(sys.executable)
new_comm=comm.Spawn(sys.executable,args=["/path/to/master.py"],maxprocs=1)
master.py:
#!/usr/bin/env python
from mpi4py import MPI
import numpy as np
import sys
import os
import time
comm = MPI.COMM_WORLD
rank = MPI.COMM_WORLD.Get_rank()
processes=4
tasks=([StopIteration] * (processes))+[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
new_comm=comm.Spawn("/path/to/slave.py",
args=[],maxprocs=processes)
status=MPI.Status()
#if rank == 0:
while tasks:
new_comm.recv(source=MPI.ANY_SOURCE, status=status)
data=tasks.pop()
print("on master received source: ",status.Get_source())
print("On master sending: ",data," to:",status.Get_source())
new_comm.send(obj=data,dest=status.Get_source())
print("On master sent: ",data," to:",status.Get_source())
new_comm.Barrier()
new_comm.Disconnect()
print("Finished All",rank)
slave.py:
#!/usr/bin/env python
from mpi4py import MPI
import numpy as np
import sys
import os
import time
comm = MPI.Comm.Get_parent()
rank = comm.Get_rank()
cwd=os.getcwd()
print("slave", rank," entering loop")
for task in iter(lambda: comm.sendrecv(dest=0), StopIteration):
print("slave ", rank," recvd data", task)
directory=os.path.join(cwd,str(task))
os.chdir(directory)
info = MPI.Info.Create()
info.update({"wdir": directory})
new_comm=MPI.COMM_SELF.Spawn("/path/to/some/mpi/executable/to/run/on/task",
args=[],maxprocs=4,info=info)
new_comm.Barrier()
new_comm.Disconnect()
info.Free()
os.chdir(cwd)
comm.Barrier()
comm.Disconnect()