def __init__(self, master_node_ranks=[0]):
self.comm = MPI.COMM_WORLD
self.size = self.comm.Get_size()
self.rank = self.comm.Get_rank()
if self.size < 2:
raise ValueError('A minimum of 2 ranks are required for the MPI backend')
#Set the global backend
globals()['backend'] = self
#Call the appropriate constructors and pass the required data
if self.rank == 0:
super().__init__(master_node_ranks)
else:
super().__init__()
raise Exception("Slaves exitted main loop.")
评论列表
文章目录