[MOAB-dev] moab/ParallelComm.hpp include order

Nico Schlömer nico.schloemer at gmail.com
Tue Nov 3 01:55:14 CST 2015


> MPI_INCLUDED is defined in mpi.h (easy to check)

Not in my installation. This
```
#include <iostream>
#include <mpi.h>

int main() {
#ifdef MPI_INCLUDED
  std::cout << "defined" << std::endl;
#else
  std::cout << "NOT defined" << std::endl;
#endif
  return 0;
}
```
Returns `NOT defined` on my machine (OpenMPI 1.6.3); check out [1].

I checked the history of `./src/parallel/moab_mpi.h` and found that it's
had it's first and last changes in 2010. Perhaps the issues it tried to
work around don't exist anymore nowadays.

I would suggest removing the file `./src/parallel/moab_mpi.h` and have some
people test it. Alright?

--Nico

[1] https://github.com/open-mpi/ompi/blob/master/ompi/include/mpi.h.in


On Tue, Nov 3, 2015 at 12:34 AM Vijay S. Mahadevan <vijay.m at gmail.com>
wrote:

> I cant seem to replicate the issue locally. Nevertheless, that file
> definitely looks quite strange since I don't think we hit many of the
> paths in moab_mpi.h as MB_SEEK*/MB_RESTORE* are not defined in
> configure (autotools) anymore. Certainly, not in CMake.
>
> MPI_INCLUDED is defined in mpi.h (easy to check) and this just checks
> if you have previously included the header already (note that it is
> ifndef and not ifdef). So I'm not worried about the undefs really
> unless your MPI version does not define MPI_INCLUDED
> (openmpi/intel-mpi ??).
>
> Now in your case, if all of the MPI variables are getting undefined,
> we need to track why that is the case. Looking at the history for that
> file didn't reveal much but let us know your configuration command for
> MOAB so that we can create a build that replicates the failure.
>
> Vijay
>
>
> On Mon, Nov 2, 2015 at 5:09 PM, Nico Schlömer <nico.schloemer at gmail.com>
> wrote:
> > @Iulian, oh yes, you're right. But the error remains the same:
> > ```
> > MPI_Comm my = MPI_COMM_WORLD;
> > ```
> > The reason lies `moab_mpi.h`. There we find
> > ```
> > /* Work around brain-dead netcdf.h */
> > #ifndef MPI_INCLUDED
> > #  undef MPI_Comm
> > #  undef MPI_Info
> > #  undef MPI_COMM_WORLD
> > #  undef MPI_INFO_NULL
> > #endif
> > ```
> > Whoops! All of MPI undefined. No idea what's going on here and why.
> >
> > Any insight?
> >
> > --Nico
> >
> > On Tue, Nov 3, 2015 at 12:02 AM Grindeanu, Iulian R. <iulian at mcs.anl.gov
> >
> > wrote:
> >>
> >> this error has nothing to do with moab/ParallelComm.hpp
> >>
> >> MPI_COMM_WORLD is just a constant, not a type
> >>
> >> this should give compile errors too.
> >>
> >> Or I don't get what are you trying to do
> >>
> >> #include <mpi.h>
> >>
> >> int main() {
> >>   MPI_COMM_WORLD my;
> >> }
> >>
> >>
> >> ________________________________
> >> From: moab-dev-bounces at mcs.anl.gov [moab-dev-bounces at mcs.anl.gov] on
> >> behalf of Nico Schlömer [nico.schloemer at gmail.com]
> >> Sent: Monday, November 02, 2015 4:49 PM
> >> To: Vijay S. Mahadevan
> >> Cc: moab-dev at mcs.anl.gov
> >> Subject: Re: [MOAB-dev] moab/ParallelComm.hpp include order
> >>
> >> Alright. This
> >> ```
> >> #include <mpi.h>
> >> #include <moab/ParallelComm.hpp>
> >>
> >> int main() {
> >>   MPI_COMM_WORLD my;
> >> }
> >> ```
> >> creates the same
> >> ```
> >>  error: ‘MPI_COMM_WORLD’ was not declared in this scope
> >> ```
> >> Can you reproduce?
> >>
> >> Cheers,
> >> Nico
> >>
> >> On Mon, Nov 2, 2015 at 11:38 PM Nico Schlömer <nico.schloemer at gmail.com
> >
> >> wrote:
> >>>
> >>> Including <moab/MOABConfig.h> doesn't help. I'll see about creating a
> >>> minimal example...
> >>>
> >>> --Nico
> >>>
> >>> On Mon, Nov 2, 2015 at 10:05 PM Vijay S. Mahadevan <vijay.m at gmail.com>
> >>> wrote:
> >>>>
> >>>> Can you try including moab/MOABConfig.h directly in your test before
> >>>> ParallelComm and see if that resolves issues ?
> >>>>
> >>>> ParallelComm includes Interface.hpp which in turn includes
> >>>> MOABConfig.h. If you are including some other MOAB header before
> >>>> these, MOAB_HAVE_MPI might not be defined.
> >>>>
> >>>> Vijay
> >>>>
> >>>> On Mon, Nov 2, 2015 at 3:00 PM, Nico Schlömer <
> nico.schloemer at gmail.com>
> >>>> wrote:
> >>>> > It's a little convoluted with Trilinos includes right now, I'm
> trying
> >>>> > to
> >>>> > generate a minimal example.
> >>>> >
> >>>> > --Nico
> >>>> >
> >>>> > On Mon, Nov 2, 2015 at 10:00 PM Vijay S. Mahadevan <
> vijay.m at gmail.com>
> >>>> > wrote:
> >>>> >>
> >>>> >> Nico, can you give an example ? What else did you include before
> >>>> >> ParallelComm to get such an error ? I am guessing this has to do
> with
> >>>> >> how moab/MOABConfig.h gets included since that's where
> MOAB_HAVE_MPI
> >>>> >> is defined.
> >>>> >>
> >>>> >> Vijay
> >>>> >>
> >>>> >> On Mon, Nov 2, 2015 at 2:47 PM, Nico Schlömer
> >>>> >> <nico.schloemer at gmail.com>
> >>>> >> wrote:
> >>>> >> > When playing with MOAB, I found that if I include the header
> >>>> >> > ```
> >>>> >> > #include <moab/ParallelComm.hpp>
> >>>> >> > ```
> >>>> >> > after something that's also using MPI, I'm getting strange
> >>>> >> > compilation
> >>>> >> > errors of the kind
> >>>> >> > ```
> >>>> >> > error: ‘MPI_COMM_WORLD’ was not declared in this scope
> >>>> >> > ```
> >>>> >> > Has anyone else experienced this?
> >>>> >> >
> >>>> >> > Cheers,
> >>>> >> > Nico
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/moab-dev/attachments/20151103/9151eb78/attachment.html>


More information about the moab-dev mailing list