Python mpi4py.MPI.Finalize() Examples

The following are 4 code examples of mpi4py.MPI.Finalize(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module mpi4py.MPI , or try the search function .
Example #1
Source File: mpi_helper.py    From deep500 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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() 
Example #2
Source File: mpi_helper.py    From deep500 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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() 
Example #3
Source File: mpi.py    From abcpy with BSD 3-Clause Clear License 5 votes vote down vote up
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 
Example #4
Source File: mpi.py    From utilities with MIT License 5 votes vote down vote up
def finalize():
    return MPI.Finalize()