mpi.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:abcpy 作者: eth-cscs 项目源码 文件源码
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.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号