custom_print_fn=rprint, theta=theta) labels = runner.DO_PHASE_I(index) labels_ph1[index] = labels rprint("Finished period=%d (index %d). Freeing memory" % (period, index)) runner = None # free up the memory # Now, combine all those results on the root node for index, period in enumerate(periods): owner = index % nproc if rank == 0: # ROOT process receives if owner != 0: comm.Recv(labels_ph1[index], source=owner) elif owner == rank: # Other processes send only their computations comm.Send(labels_ph1[index], dest=0) labels_ph1[index] = None # now, we do phase 2 # Want to find the best period from all possible periods (`periods` array) # The cost of selecting a given period is the cost of using that period and # the associated start time with that period at that pixel if rank == 0: runner = Runner(vid_color, periods, args, True, rprint, theta=theta) runner.provide_all_p1_labels(labels_ph1) runner.DO_PHASE_II() rprint("process exiting at", datetime.now())
from prelude import * from runner import Runner r = Runner(vid_color, periods, args, theta=theta) for index, period in enumerate(periods): print("-" * 15, "Starting period", period, "-" * 15) r.DO_PHASE_I(index) if len(periods) > 1: r.DO_PHASE_II() else: print("Skipping Phase II since there was only 1 period")