Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.

mpirun error

GoodLuck
Beginner
911 Views

Code:

import mpi4py
import time
import numpy as np
from mpi4py import MPI

comm = MPI.COMM_WORLD
rank = comm.Get_rank()
print("rank",rank)


if __name__ == '__main__':
    if rank == 0:
        mem = np.array([0], dtype='i')
        win = MPI.Win.Create(mem, comm=comm)
    else:
        win = MPI.Win.Create(None, comm=comm)
    print(rank, "end")

 

(py3.6.8) ➜ ~ mpirun -n 2 python -u test.py
rank 0
rank 1
0 end
1 end
Abort(806449679): Fatal error in internal_Finalize: Other MPI error, error stack:
internal_Finalize(50)...........: MPI_Finalize failed
MPII_Finalize(345)..............:
MPID_Finalize(511)..............:
MPIDI_OFI_mpi_finalize_hook(895):
destroy_vni_context(1137).......: OFI domain close failed (ofi_init.c:1137:destroy_vni_context:Device or resource busy)

 

Why is this happening? How to debug? This error is not reported on the other machine.

0 Kudos
1 Solution
SantoshY_Intel
Moderator
879 Views

Hi,

 

Thanks for posting in the Intel forums.

 

New window objects can be created by calling the "MPI.Win.Create()" method within a communicator and by specifying a memory buffer.

When a window instance is no longer needed, the "MPI.Win.Free()" method should be called.

 

So we should use MPI.Win.Free() method to free the new window objects that have been created. Please refer to the below code:

import mpi4py
import time
import numpy as np
from mpi4py import MPI

#comm = MPI.COMM_WORLD
#rank = comm.Get_rank()
#print("rank",rank)


if __name__ == '__main__':
    comm = MPI.COMM_WORLD
    rank = comm.Get_rank()
    print("rank",rank)

    if rank == 0:
        mem = np.array([0], dtype='i')
        win = MPI.Win.Create(mem, comm=comm)
        MPI.Win.Free(win)
    else:
        win = MPI.Win.Create(None, comm=comm)
        MPI.Win.Free(win)
    print(rank, "end")

Command to run the code:

mpirun -n 2 python -u test.py

 

Observed output:

SantoshY_Intel_0-1667534872452.png

 

Thanks & Regards,

Santosh

 

View solution in original post

0 Kudos
3 Replies
SantoshY_Intel
Moderator
880 Views

Hi,

 

Thanks for posting in the Intel forums.

 

New window objects can be created by calling the "MPI.Win.Create()" method within a communicator and by specifying a memory buffer.

When a window instance is no longer needed, the "MPI.Win.Free()" method should be called.

 

So we should use MPI.Win.Free() method to free the new window objects that have been created. Please refer to the below code:

import mpi4py
import time
import numpy as np
from mpi4py import MPI

#comm = MPI.COMM_WORLD
#rank = comm.Get_rank()
#print("rank",rank)


if __name__ == '__main__':
    comm = MPI.COMM_WORLD
    rank = comm.Get_rank()
    print("rank",rank)

    if rank == 0:
        mem = np.array([0], dtype='i')
        win = MPI.Win.Create(mem, comm=comm)
        MPI.Win.Free(win)
    else:
        win = MPI.Win.Create(None, comm=comm)
        MPI.Win.Free(win)
    print(rank, "end")

Command to run the code:

mpirun -n 2 python -u test.py

 

Observed output:

SantoshY_Intel_0-1667534872452.png

 

Thanks & Regards,

Santosh

 

0 Kudos
GoodLuck
Beginner
876 Views
0 Kudos
SantoshY_Intel
Moderator
871 Views

Hi,

 

Glad to know that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.

 

Since your issue is resolved, make sure to accept my previous post as a solution. This would help others with similar issues. Thank you! 

 

Best Regards,

Santosh

 

0 Kudos
Reply