I’ve generated raw rust bindings to a C header for use as a
-sys crate, but one function is making me uncomfortable; it takes an MPI_Comm by value. Unfortunately for me, there’s no
mpi-sys crate; perhaps due in part to the same issue I’m about to discuss.
So, what is an
MPI_Comm? Glad you asked! It’s part of the MPI protocol and, to the best of my knowledge, it’s… not specified. What I mean is, it can vary between MPI implementations. Some common ones:
typedef struct comm_info* MPI_Comm; // used by OpenMPI typedef int MPI_Comm; // used by... things that aren't OpenMPI
What’s the common approach to handling this? To my understanding
-sys crates should ideally make no design decisions at all and simply present the C API as it is; but I don’t see how that can be done here.