Specifically, how does one go about writing code that works with, say, both MPICH and OpenMPI?
I am currently in the process of cleaning up the build scripts and code for a distributed-memory stochastic mixed-integer linear programming package we aim to release this Spring. One of idiosyncrasies of the code (or rather, one of the libraries we rely on from our collaborators) is that it will only work with MPICH, and it will not build or run with OpenMPI. What sort of things should I look to be implementing in an MPI implementation-independent fashion? (e.g., a coworker has pointed out that OpenMPI and MPICH represent communicators differently.) My goal is to try and patch the software so it will work with both OpenMPI and MPICH, and any high-level guidance about how to do that (hopefully with some references) would be extremely helpful.
Edit: Here's an example error message from the compiler (OS X, Clang from Xcode 7.2):
PIPS/PIPS-IPM/Core/QpStoch/sTree.C:147:9: error: no matching function for call to 'MPI_Comm_create' ierr = MPI_Comm_create(mpiWorldGroup, childGroup, &childComm); assert(ierr==MPI_SUCCESS); ^~~~~~~~~~~~~~~ /usr/local/Cellar/open-mpi/1.10.1_1/include/mpi.h:1271:20: note: candidate function not viable: cannot convert argument of incomplete type 'MPI_Group' (aka 'ompi_group_t *') to 'MPI_Comm' (aka 'ompi_communicator_t *') OMPI_DECLSPEC int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm); ^ 1 error generated.
I should make more clear: the errors are in a library I am helping some collaborators get ready for a new release. I was not the original author, but I have patched up the code to add functionality I needed, plus I helped improve the build system. So this question is really geared more towards the situation where a developer is somewhat familiar with MPI, can write MPI-standard-compliant code, but is now trying to debug someone else's code and replace it with MPI-standard-compliant code. I'm looking for common pitfalls, basically.