[Dune] example for mpicollectivecommunication

Aleksejs Fomins aleksejs.fomins at lspr.ch
Wed Oct 1 12:20:34 CEST 2014


Thank you Tobias :)

On 10/01/2014 12:10 PM, Tobias Malkmus wrote:
> Hi Aleksejs
> 
> The template argument for the CollectiveCommunicator is MPI_Comm:
> This is type is defined if MPI is found.
> 
> Best Tobias
> 
> On 10/01/2014 12:02 PM, Aleksejs Fomins wrote:
>> Thank you for your replies.
> 
>> So I write it like this
> 
>> ------------------------------------ Dune::CollectiveCommunication
>> comm = mpihelper_.getCollectiveCommunication();
> 
>> int parallel_sum_elem  = comm.sum(internal_elements.size()); 
>> ------------------------------------
> 
>> and get error
> 
>> error: missing template arguments before ‘comm’ 
>> Dune::CollectiveCommunication comm = 
>> mpihelper_.getCollectiveCommunication();
> 
>> How do how do I get the correct template argument.
> 
>> I am sorry if this question is trivial, I am just not very familiar
>> with the structure yet.
> 
>> Regards, Aleksejs
> 
> 
> 
>> On 10/01/2014 11:27 AM, Tobias Malkmus wrote:
>>> Hi Aleksejs
>>>
>>> You can use the Dune::CollectiveCommunication from 
>>> dune-common/dune/common/parallel/mpicollectivecommunication.hh. 
>>> It contains a method called sum, which does what you need.
>>>
>>> Of cousre you will have to initialize the MPI communicator
>>> using:
>>>
>>> MPIHelper::instance( argc, argv )
>>>
>>> from dune-common/dune/common/parallel/mpihelper.hh at the
>>> beginning of your main routine.
>>>
>>> Don't forget to configure dune with parallel support( 
>>> --enable-parallel, MPICC=/.../mpicc )
>>>
>>>
>>> Best Tobias
>>>
>>> On 10/01/2014 11:00 AM, Aleksejs Fomins wrote:
>>>> Dear Dune,
>>>
>>>> I would like to sum up a variable over all processes.
>>>
>>>> Could you suggest an example program I can take inspiration
>>>> from?
>>>
>>>> Thank you, Aleksejs
>>>
>>>
>>>
>>>> _______________________________________________ Dune mailing
>>>> list Dune at dune-project.org 
>>>> http://lists.dune-project.org/mailman/listinfo/dune
>>>
>>>
>>>
>>>
> 
> 
> 
>> _______________________________________________ Dune mailing list 
>> Dune at dune-project.org 
>> http://lists.dune-project.org/mailman/listinfo/dune
> 
> 
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20141001/4686e4e5/attachment.sig>


More information about the Dune mailing list