question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document difference between Comm.Barrier() and Comm.barrier()

See original GitHub issue

There are two methods Comm.Barrier() and Comm.barrier(), which seem to be implemented differently:

https://github.com/mpi4py/mpi4py/blob/ddefbb790d14777cb322ea9007d61345f81f2099/src/mpi4py/MPI/Comm.pyx#L668-L675

https://github.com/mpi4py/mpi4py/blob/ddefbb790d14777cb322ea9007d61345f81f2099/src/mpi4py/MPI/Comm.pyx#L1557-L1560

I guess one releases the GIL and the other doesn’t?

The upper vs. lower case convention seems to imply an analogy with the generic Python object interface vs. buffer-like object interface (e. g. Comm.Bcast() vs Comm.bcast()), but since MPI_Barrier() doesn’t communicate any data, it’s not obvious what the difference is here (if any). The docstrings unfortunately don’t have any more information either (“Barrier synchronization” vs. “Barrier”).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Socobcommented, Oct 27, 2021

Ah, right, I didn’t consider that subclassing Comm by the user could be a relevant/supported use case. I was just trying to say that the different method bodies surprised me, since they’re functionally equivalent (a better example would have been to say that I would’ve expected both methods to have the same body, e.g.

    cdef MPI_Comm comm = self.ob_mpi 
    return PyMPI_barrier(comm)

).

0reactions
leofangcommented, Oct 27, 2021

to say that I would’ve expected both methods to have the same body

During the review of #126 I actually have the same question in mind 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python MPI: Collective Operations
Comm.Barrier(). Synchronization operation. Creates a barrier synchronization in a group. Each task, when reaching the Barrier() call, blocks until all tasks ...
Read more >
I/O and Barriers - Google Groups
comm.Barrier(). print "2nd wave". and expect that all the first prints should clear ... files. This is not a Python or mpi4py related...
Read more >
mpi4py.MPI.Comm — MPI for Python 3.1.4 documentation
Barrier (). Barrier synchronization ; Bcast (buf[, root]). Broadcast a message from one process to all other processes in a group ; Bsend...
Read more >
MPI4Py comm.Barrier() not blocking on MSMPI?
It is in that communication where the order of the messages is getting mixed up. Generally, standard output is not treated with priority...
Read more >
How can I use collective communication to move data from ...
For example, the often used MPI barrier ( comm.barrier() ) makes every task hold until all tasks in the communicator comm have called...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found