On Oct 16, 2008, at 6:29 AM, Jed Brown wrote:
but when SEEK_* is not present and iostream has been included, OMPI-
dev
gives these errors.
/home/ompi/include/openmpi/ompi/mpi/cxx/mpicxx.h:53: error:
‘SEEK_SET’ was not declared in this scope
/home/ompi/include/openmpi/ompi/mpi/cxx/mpicxx.h:54: error:
‘SEEK_CUR’ was not declared in this scope
/home/ompi/include/openmpi/ompi/mpi/cxx/mpicxx.h:55: error:
‘SEEK_END’ was not declared in this scope
There is a subtle difference between OMPI 1.2.7 and -dev at least with
GCC 4.3.2. If iostream was included before mpi.h and then SEEK_* are
#undef'd then 1.2.7 succeeds while -dev fails with the message above.
If stdio.h is included and SEEK_* are #undef'd then both OMPI versions
fail. MPICH2 requires in both cases that SEEK_* be #undef'd.
Open MPI doesn't require undef'ing of anything. It should also not
require any special ordering of include files. Specifically, the
following codes both compile fine for me with 1.2.8 and the OMPI SVN
trunk (which is what I assume you mean by "-dev"?):
#include <iostream>
#include <mpi.h>
int a = MPI::SEEK_SET;
and
#include <mpi.h>
#include <iostream>
int a = MPI::SEEK_SET;
So in short: don't #undef anything and OMPI should do the Right things.
What do you recommend to remain portable? Is this really an MPICH2
issue? The standard doesn't seem to address this issue. The MPICH2
FAQ
has this
http://www.mcs.anl.gov/research/projects/mpich2/support/index.php?s=faqs#cxxseek
This is actually a problem in the MPI-2 spec; the names
"MPI::SEEK_SET" (and friends) were unfortunately chosen poorly.
Hopefully that'll be fixed relatively soon, in MPI-2.2.
MPICH chose to handle this situation a different way than we did, and
apparently requires that you either #undef something or you #define an
MPICH-specific macro. I guess the portable way might be to just
always define that MPICH-specific macro. It should be harmless for
OMPI.
FWIW, I was chatting with the MPICH developers at the recent MPI Forum
meeting and showed them how we did our SEEK_* solution in Open MPI.
--
Jeff Squyres
Cisco Systems