[Dune] strange MPI with CMAKE

Dominic Kempf dominic.r.kempf at gmail.com
Wed Jan 21 17:42:16 CET 2015


Dear Alekseij,

you are not adding the MPI flags to your second target, that is why any MPI
related names are not found.

You have to call

add_dune_mpi_flags(target)

on a target in order to add mpi flags. add_dune_parmetis_flags internally
calls that macro. That is why you dont experience problems with parmetis
applications.

Dominic

On Wed, Jan 21, 2015 at 5:31 PM, Aleksejs Fomins <aleksejs.fomins at lspr.ch>
wrote:

> Dear Dune,
>
> I have 1 test program, which compiles and runs. It uses MPI and ParMetis
> I have now written a 2nd test program. It uses MPI but does not use
> ParMetis. I compile the 2nd test and I get the error
>
> error: ‘MPI_Comm’ was not declared in this scope
>    MPI_Comm comm = Dune::MPIHelper::getCommunicator();
>
> although statements like that work no problem in the 1st test. From my
> point of view, the ONLY difference between the tests in terms of CMAKE
> is that one of them uses ParMetis and the other does not.
>
>
> Now here is the trick. I decided to make the tests completely symmetric by
>
> if(HAVE_MPI)
>     add_dune_parmetis_flags(test1)
>     add_dune_parmetis_flags(test2)   # I inserted this line
> endif(HAVE_MPI)
>
> Now both tests compile.
>
>
> I mean, this solution works, but I am sure I am doing something wrong.
>
> Opts file and cmake file attached
>
> Cheers,
> Aleksejs
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20150121/563e6248/attachment.htm>


More information about the Dune mailing list