QMCPACK / QMCPACK/qmcpack

Please make MPI Communicate::Barrier() non-const

Open
#3,777 0 comments 0 reactions 0 assignees View on GitHub
mpi
Dominant language
C++
Stars
403
Forks
154
Avg merge
1d 12h
Merged PRs (30d)
82

Description

**Describe the bug**

This is an incompatibility created by a defect in B-MPI3 (that I am trying to solve).
`bmpi3::communicator::barrier()` was `const` so far but it shouldn't be.
(The reason for that is complicated, for a summary look here: https://github.com/LLNL/b-mpi3#communicator-and-threads)

`Communicate::Barrier()` is `const`.
Some time in the past, I think (@markdewing ?) , `Communicate` contained a `*mutable* mpi3::communicator` which was an acceptable use, and would allow to remove the `const` from `Communicate::Barrier()`.

In summary, with the current design, either `Communicate::Barrier()` should be non-const or the internal `mpi3::communicator` needs to be `mutable`.
I don't expect this to generate a lot of problems but if it doesn't it would be a good improvement to the (both) code(s).

To be concrete, the idea is to solve this compilation error:

```
/builds/correaa/boost-mpi3/qmcpack/src/Message/Communicate.cpp:130:49: error: passing 'const boost::mpi3::communicator' as 'this' argument discards qualifiers [-fpermissive]
130 | void Communicate::barrier() const { comm.barrier(); }
|
```

The deeper point is that right now `Communicate` is inconsistent and have some communication operations `const` and not others, but that is beyond this use.
Please let me know if one of the two options is possible.
If you want to have a discussion of what is better (and they are different in IMO) please let me know, we can discuss that too.

**To Reproduce**

1. compile QMCPACK with newer versions of B-MPI3

**Expected behavior**

B-MPI3 should be compatible with QMCPACK

**System:**
- N/A

**Additional context**

Interaction between threading and MPI.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.