On Feb 4, 2016, at 9:46 PM, Brian Taylor <spam.brian.tay...@gmail.com> wrote: > > Thanks for the explanation, Jeff. I'm not surprised to hear that using a > Fortran type from C in this manner is potentially buggy and not portable. > However, assuming that the C and Fortran types are interoperable, is there > any guarantee that the call to MPI_Reduce in the program above will execute > successfully?
If the representations of the C and Fortran datatypes are the same, then yes, it should work. > If OpenMPI 1.10.2 is built with Fortran support, the program above runs and > gives the expected output. If OpenMPI 1.10.2 is built without Fortran > support, the program exits with the following error: > > taylor@host $ mpirun -np 1 ./bug > [host:49234] *** An error occurred in MPI_Reduce: the reduction operation > MPI_MAXLOC is not defined on the MPI_2DBLPREC datatype > [host:49234] *** reported by process [3133079553,0] > [host:49234] *** on communicator MPI_COMM_WORLD > [host:49234] *** MPI_ERR_OP: invalid reduce operation > [host:49234] *** MPI_ERRORS_ARE_FATAL (processes in this communicator will > now abort, > [host:49234] *** and potentially your MPI job) I suppose that error message is a bit misleading -- it's not available because we disabled *all* Fortran support, including support for Fortran data types. So yes, MPI_MAXLOC is not defined for MPI2DBLPREC, but *because* there's no Fortran support *at all*. > It seems that the MPI_MAXLOC operator for MPI_2DOUBLE_PRECISION is not > available if OpenMPI is built without Fortran support; thus, the call to > MPI_Reduce fails. Is this the expected behavior? Is the MPI_MAXLOC operator > for MPI_2DOUBLE_PRECISION required to be available from C for compliance with > the MPI standard, or is its availability from C in OpenMPI (when built with > Fortran support) an implementation-dependent "extension"? If there's no Fortran compiler, Open MPI can't possibly know what the Fortran representation of the Fortran datatypes. BTW: is there a reason you don't want to just use the C datatypes? The fundamental output of the index is an integer value -- casting it to a float of some flavor doesn't fundamentally change its value. -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/