I'm struggling to use the mpi4py gather method. I want to keep calling gather on the root node until the end of the program, which is controlled by fin(), which returns a boolean, while the other nodes send, via gather, their data to the root node. The thing is, the code doesn't even manage to display text on the screen, even though a print is in the first line of code.
Here is a minimal working code :
from mpi4py import MPI
from random import random
from math import log2
comm = MPI.COMM_WORLD
data = ""
rank = comm.Get_rank()
if rank != 0:
while True:
data = "s"
datas = comm.gather(data, root = 0)
if rank == 0:
while True:
datas = comm.gather(data, root = 0)
print(datas, rank)
This, of course, runs forever, but still prints out data on the screen. This, however, doesn't print anything :
from mpi4py import MPI
from random import random
from math import log2
comm = MPI.COMM_WORLD
data = ""
datas = []
rank = comm.Get_rank()
if rank != 0:
data = "s"
datas = comm.gather(data, root = 0)
if rank == 0:
while datas != []:
datas = comm.gather(data, root = 0)
print(datas, rank)
This is, I believe, the issue about the following code, which is supposed to compute a dominating set of a graph using mpi4py :
https://drive.google.com/open?id=0B6O6mNqn_4AVWVlOeHNHWUZ3TmM
Thanks for any potential help you might provide !