0

I have a program that I am writing in python that utilizes multiple different PI boards. The main one is a raspberry pi running on raspios-buster-lite-armhf. However, the nodes are all Nano Pi's running on sd-friendlycore-xenial-4.4-arm64. I would like to utilize all if possible, that way making my program as efficient as I can at the moment. I have MPI installed on all of them, and it works to an extent. This is the output from the demo helloworld.py program that prints the ranks and sizes:

Hello, World! I am process 4 of 5 on Node04.
Hello, World! I am process 1 of 5 on Node02.
Hello, World! I am process 2 of 5 on Node01.
Hello, World! I am process 3 of 5 on Node03.
Hello, World! I am process 0 of 5 on HeadPi.

Which as you can see does work. However, if I try to have a signal sent it doesn't work. This is the general code:

from mpi4py import MPI
import sys
comm = MPI.COMM_WORLD 
size = comm.Get_size()
rank = comm.Get_rank()
name = MPI.Get_processor_name()

if rank == 0:
    shared = 'hi'
    print('sending')
    req = comm.isend(shared, dest=4, tag=1)
    print('sent')
    req.wait()
    print('done waiting')
if rank == 4:
    receive = comm.irecv(source=0, tag=1)
    data = receive.wait()
    print(data)

If I run that, it prints send and then just stops indefinitely. However, if I have the message sent from one of the nodes to another one, it sends just fine. Obviously meaning that it is unable to communicate across the different platforms, or I set something up on the raspberry pi very wrongly. Is there a quick fix to this like to add an argument after mpiexec to make it able to work cross platform? If I switched the raspberry pi to an ARM 64 instead of the current ARMhf would that make it work? Is the only solution that may work trying to install the xenial firmware onto the raspberry pi and it will then work?

Sam Moldenha
  • 463
  • 2
  • 11
  • first you could use `print()` in `if rank == 4:` to see if this part of code is executed – furas Dec 19 '20 at 23:30
  • It is, if I have it print the receive it returns a pointer value, it it prints the data which is receive.wait() it prints the data if the message comes from not rank 0, also I had a previous version where it printed before the receive and it did print. So the code is executed – Sam Moldenha Dec 19 '20 at 23:45
  • I don't know if it is important but you probably send 4 messages but you run `irecv` only once so it receives only from one node and rest may have to wait. – furas Dec 20 '20 at 00:31
  • Yeah, I’ve tried with normal recv and send but I switched to isend and irecv purely because of the blocking and I can check to see if it was actually sent through a print message. They have the same result. It works when it’s on the same platform but not different platforms communicating with each other and that’s my problem :/ – Sam Moldenha Dec 20 '20 at 00:35
  • doesn't this need special configuration with list of hosts which you can connect? In some articles/tutorial I see file `hostfile.txt` - ie. `mpirun --hostfile hostfile.txt python script.py` – furas Dec 20 '20 at 00:49
  • right, so the way that I run mine instead of "hostfile" I say machine file this is my execution command: `mpiexec -f machinefile -n 5 python3 /root/sendTest.py` and machine file is the same as hostfile. so -f is the same as --hostfile, that is where you specify the IP addresses of all the other nodes. That is included in any regular tutorial thats worth anything when it comes to MPI. – Sam Moldenha Dec 20 '20 at 01:16
  • You need such support in the MPI library (that is being used by `mpi4py` under the hood. For example, Open MPI can be configured with `--enable-heterogeneous` (this is lightly tested though). – Gilles Gouaillardet Dec 20 '20 at 02:37
  • I am currently reinstalling the entire MPI in the root directory like it is with the other nodes. Currently waiting for that to finish and will see if that fixes my issue. I will try with the —enable-heterogeneous option – Sam Moldenha Dec 20 '20 at 02:56

0 Answers0