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