Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

immediate_receive and count? #134

Open
sbromberger opened this issue Oct 4, 2022 · 1 comment
Open

immediate_receive and count? #134

sbromberger opened this issue Oct 4, 2022 · 1 comment

Comments

@sbromberger
Copy link

Hi all,

First off, thanks for maintaining this package!

I'm trying to understand why immediate_receive() is hardcoded with a count of 1 - I think this makes it impossible to receive a vector of, say, u8.

a) is there a reason for the restriction?
b) is there another way to do an MPI_IRecv with a count?

If the answer to a) is "There's no particular reason", then I might just try my hand at a PR (I'll probably need some help).

Cheers!

@jtronge
Copy link
Collaborator

jtronge commented Oct 5, 2022

That seems like it could be a good idea. Something like immediate_receive(count)?

There's also the immediate_receive_into_*() set of functions, which would allow you to do an MPI_IRecv with a count. These take a mutable reference to some buffer of a fixed size and then return a request. To ensure that this buffer isn't dropped while MPI is still using it, you have to wrap your code in a closure that takes a Scope object and ensure that you allocate any buffers outside the closure. Before exiting the closure, all requests must be waited on, or else it will panic.

examples/immediate.rs is a good example that demonstrates this.

For the current version of immediate_receive(), I think you might be able to work around this if you derived Equivalence on a struct containing a buffer. Something like this:

#[derive(Equivalence)]
struct Wrapper {
    buf: [u8; 128],
}

Then you should be able to do an immediate_receive::<Wrapper>() to pass around a buffer. The count will then be fixed at compile time, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants