本文整理汇总了Python中mpi4py.MPI.Finalize方法的典型用法代码示例。如果您正苦于以下问题:Python MPI.Finalize方法的具体用法?Python MPI.Finalize怎么用?Python MPI.Finalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpi4py.MPI
的用法示例。
在下文中一共展示了MPI.Finalize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __exit__
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import Finalize [as 别名]
def __exit__(self, type, value, traceback):
try:
# Import MPI4Py without initializing it
import mpi4py.rc
mpi4py.rc.initialize = False
from mpi4py import MPI
mpi_init = MPI.Is_initialized()
except:
mpi_init = False
if mpi_init or os.getenv('D500_IN_MPI') is not None:
MPI.Finalize()
示例2: mpi_end_barrier
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import Finalize [as 别名]
def mpi_end_barrier():
""" Invokes a barrier and finalization if MPI is running, or nothing
otherwise. """
# Import MPI4Py without initializing it
import mpi4py.rc
mpi4py.rc.initialize = False
from mpi4py import MPI
if MPI.Is_initialized():
MPI.COMM_WORLD.Barrier()
MPI.Finalize()
示例3: __del__
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import Finalize [as 别名]
def __del__(self):
"""
Overriding the delete function to explicitly call MPI.finalize().
This is also required so we can tell the teams to get out of the
while loop they are in and exit gracefully and they themselves call
finalize when they die.
"""
#Tell the teams they can exit gracefully.
self.__command_teams(self.OP_FINISH, None)
#Finalize the connection because the teams should have finished.
MPI.Finalize()
self.finalized = True
示例4: finalize
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import Finalize [as 别名]
def finalize():
return MPI.Finalize()