I have a question about the standards compliance of OpenMPI. Is the following program valid according to the MPI standard?
#include <stdio.h> #include <mpi.h> int main(int argc, char **argv) { int rank; double in[2], out[2]; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); in[1] = in[0] = (double) rank; MPI_Reduce(in, out, 1, MPI_2DOUBLE_PRECISION, MPI_MAXLOC, 0, MPI_COMM_WORLD); if (rank == 0) printf("out = %f %f\n", out[0], out[1]); MPI_Finalize(); return 0; } Specifically, I am wondering if MPI_2DOUBLE_PRECISION can be used with MPI_MAXLOC (or MPI_MINLOC) in a C program. MPI_2DOUBLE_PRECISION is not included in the list of datatypes for reduction functions in C in Appendix A.1 of the MPI 3.1 standard, although it is included in the list of reduction functions for Fortran. What exactly does that mean? The program above runs with OpenMPI 1.10.2 and gives the output one would expect for an equivalent program written in Fortran. Can I rely on this being portable to other MPI implementations? Thanks, Brian