Can you retrieve MPI.Comm object from an h5py.File instance?

Skip to first unread message

Edis Jakupovic

Aug 10, 2020, 11:27:06 PM8/10/20
to h5py

I have a question about "pulling out" the MPI communicator used to open an h5py file from the instance of the file: 

If I do something like,

f = h5py.File(filename, 'r', driver='mpio', comm=MPI.COMM_WORLD) 

comm =[0]

f2 = h5py.File(filename, 'r', driver='mpio', comm=comm) 

Will the second file also be opened with MPI.COMM_WORLD? I don't think this works, as MPI.COMM_WORLD is in instance of MPI.Intracomm, but comm is an instance of MPI.Comm.

Is there a way one can get back the communicator that was originally passed when the file was opened?

Thanks for any help,

Thomas Kluyver

Aug 13, 2020, 3:58:39 PM8/13/20
I think what h5py gives back is essentially a copy of the comm (from MPI_Comm_dup) - see the code here:

It's not clear to me if the duplication step is necessary.


You received this message because you are subscribed to the Google Groups "h5py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages