本文整理匯總了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()