Open kurpicz opened 2 years ago
.data()
for the first case?I like that proposal. It would be even cooler if we could do that in
In ...? :-)
Can't we just compare .data() for the first case?
I thought about that, but wasn't sure if every object has a .data()
member. But it probably has, as we're using .data(...)
to get the pointer we pass to the MPI function. So :+1:
In ...? :-)
Hm.. I forgot what I wanted to say there :/
I thought about that, but wasn't sure if every object has a .data() member. But it probably has, as we're using .data(...) to get the pointer we pass to the MPI function. So +1
The important part is that the parameter object always has .data()
, which it does because we wrote it ;)
I like that proposal. It would be even cooler if we could do that in
Actually, let me fix that: I like the idea (which is very close to how the normal MPI interface does it), but I don't like passing a tag without the named parameter syntax ;)
One of the reasons we decided against the (imho) way prettier send_buf = value
interface was exactly such that we can use tags instead of the (imho) ugly kamping::in_place()
syntax. Also, tags are “more C++” than our named parameters.
Well yes, but named parameters are always used in kamping.
I don't recall that being a reason against the =
syntax (in fact, I don't see a difference between a tag in the ()
-Syntax and in the =
-Syntax.
Operations supporting inplace:
Asymmmetric: moved to #666
Thank you, Niklas! :-)
A few small comments:
kamping::inplace
and not recv_buf(kamping::inplace)
.send_buf
and recv_buf
(either to automatically do the operation inplace or to emit an error message); not zero-overhead
- Does the MPI standard enforce, that MPI_INPLACE may only be passed on one or on all ranks (e.g., for allreduce)?
This depends on the operation, see the list above
- I'd prefer if the user simply passed
kamping::inplace
and notrecv_buf(kamping::inplace)
.- Do we explicitly check if the same two buffers are passed to
send_buf
andrecv_buf
(either to automatically do the operation inplace or to emit an error message); not zero-overhead
I ditched the idea of providing inplace
explicitely (see #626). The same semantics can be achieved with a lot less confusion by passing send_recv_buf
and no send_buf
and recv_buf
. When a send_recv_buf
is passed, we detect that inplace
should be used, no implicit comparison of send and recv buffers. If users pass them explicitely instead of using a send_recv_buf
, they might have a reason to do so ...
- Does the MPI standard enforce, that MPI_INPLACE may only be passed on one or on all ranks (e.g., for allreduce)?
This depends on the operation, see the list above
I see, the list is what the MPI standard enforces; I read it as what we want to support. :+1:
- I'd prefer if the user simply passed
kamping::inplace
and notrecv_buf(kamping::inplace)
.- Do we explicitly check if the same two buffers are passed to
send_buf
andrecv_buf
(either to automatically do the operation inplace or to emit an error message); not zero-overheadI ditched the idea of providing
inplace
explicitely (see #626). The same semantics can be achieved with a lot less confusion by passingsend_recv_buf
and nosend_buf
andrecv_buf
. When asend_recv_buf
is passed, we detect thatinplace
should be used, no implicit comparison of send and recv buffers. If users pass them explicitely instead of using asend_recv_buf
, they might have a reason to do so ...
Sounds good. It's harder to use the API wrong this way. :-)
We have to think about three cases:
send_buf(...)
andreceive_buf(...)
. Possibly via aSpan<>
object or otherwise encapsulated. We could decide to either not support this or to require the passed objects to have anunderlying_buffer_equals_that_of(...)
if the user wants the possibility for us to detect this. Note, that MPI forbids passing pointers to overlapping memory regions as send and recv buffer; if you want this, you have to use MPI_INPLACE. I would prefer not to useoperator==
for the comparison, as two object might be unequal even if they have the same underlying buffer (e.g. astd::vector
and aSpan<>
pointing to the same memory region).kamping::in_place
orMPI_INPLACE
as the receive buffer. Imho, it would be nice to support specifyingkamping::in_place
as a tag, e.g.,comm.scan(send_buf(value), kamping::in_place);
send_buf
, i.e.,value = comm.reduce(send_buf(value));
. This should always yield the expected result, and we can do nothing to optimize this anyway; so we do not need to consider this further.