charm AT lists.siebelschool.illinois.edu
Subject: Charm++ parallel programming system
List archive
- From: "Kale, Laxmikant V" <kale AT illinois.edu>
- To: Jozsef Bakosi <jbakosi AT gmail.com>
- Cc: "Miller, Philip B" <mille121 AT illinois.edu>, Tom Quinn <trq AT astro.washington.edu>, "charm AT cs.uiuc.edu" <charm AT cs.uiuc.edu>
- Subject: Re: [charm] Run multiple custom reducers at (potentially) the same time
- Date: Wed, 20 Jul 2016 16:47:59 +0000
- Accept-language: en-US
[sorry this overlaps with Phil’s answer somewhat, but it may be useful to some of you].
The types (whether same or not) don’t matter for this issue. Even overlapping reductions are ok : i.e. you can contribute into the second reduction before the first reduction results are delivered. You don’t need the “bound arrays” escape for these. The only scenario when you need bound arrays is if different members of a chare array are contributing into 2 (or more) reduction operations in different orders. E.g. Chare array with index I contributes into a sum reduction with callback X, then contributes into a max reduction with callback Y, whereas another array element J contributes the max reduction going to callback Y first, before the contribution to sum going to X.
(This happens in case of ChaNGa with a liveViz visualization because the requests for visualization frame arrives from an outside user asynchronously with the applications own flow: so some array elements may have contributed to the application’s K’th reduction while others have only contributed to K-1’th, when they receive a request to contribute their visualization input into another reduction)
I used different callbacks (X and Y) and different reductions (sum and max) to make the example clear. But even if the reductions are of the same type, but logically different, application logic has to make sure they are contributed in the same order or else use bound arrays. E.g. If I want to contribute kinetic energy into a reduction, and potential energy into another reduction, from the same chare array, in every iteration: I have to make sure every chare contributes them in the same order (say, kinetic first then potential) to avoid having to use bound arrays.
So, in your example, you have to ensure that the “some member function” and “some OTHER member function” execute in the same order on all chares (if you cannot or don’t want to ensure ordering between them, use a bound array for the second reduction).
To answer your later question: that sequencing reductions may be hard in general : in most applications, unless there is external asynchrony, you can ensure sequencing without too much trouble. A way of fixing this issue is to allow some sort of unique handle in “contribute” that must be matched, but that may add overhead and/or make the common case more cumbersome to write. But we will explore this in future.
Laxmikant (Sanjay) Kale http://charm.cs.uiuc.edu Professor, Computer Science kale AT illinois.edu 201 N. Goodwin Avenue Ph: (217) 244-0094 Urbana, IL 61801-2302
From:
Jozsef Bakosi <jbakosi AT gmail.com>
I'm not sure if I understand correctly, let me be more specific starting from the example in the user manual 16.2 but modified a bit to be closer to how I'm using it.
/*initnode*/ void registerSumTwoShorts(void) { sumTwoShortsType=CkReduction::addReducer(sumTwoShorts); }
/* reductiontarget */ void fn1( CkReductionMsg* msg ) { /* 1st final aggregated result here */ } /* reductiontarget */ void fn2( CkReductionMsg* msg ) { /* 2nd final aggregated result here */ }
// In some member function, contribute data to a customized reduction: short data[2]=...; std::pair< int, std::unique_ptr<char[]> > stream = serialize( data ); // returns serialized data as length and char stream CkCallback cb( fn1(nullptr), thisProxy ); contribute( stream.first, stream.second.get(), sumTwoShortsType, cb );
// In some OTHER member function, contribute data to the ANOTHER customized reduction but of the same type: short otherdata[2]=...; std::pair< int, std::unique_ptr<char[]> > stream = serialize( otherdata ); // returns serialized otherdata as length and char stream CkCallback cb( fn2(nullptr), thisProxy ); contribute( stream.first, stream.second.get(), sumTwoShortsType, cb ); // 'sumTwoShortsType' okay or need 'sumTwoShortsType2'?
So my question is: Is it okay to use a single sumTwoShortsType for both reductions which may overlap, i.e., happening at the same time?
I'm thinking that since I have two separate reduction targets, fn1() and fn2(), for the two reductions, I should be fine. However, the two reductions do happen on the same chare array/group and collect different data (of the same custom type). I have a feeling that this should be okay, but even if not, I could just register a second custom reducer, e.g., sumTwoShortsType2, and use it in the second contribute() call, which would make the two reductions have nothing to do with each other. Correct?
On Tue, Jul 19, 2016 at 3:30 PM, Kale, Laxmikant V <kale AT illinois.edu> wrote:
|
- [charm] Run multiple custom reducers at (potentially) the same time, Jozsef Bakosi, 07/19/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Phil Miller, 07/19/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Tom Quinn, 07/19/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Phil Miller, 07/19/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Kale, Laxmikant V, 07/19/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Jozsef Bakosi, 07/20/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Phil Miller, 07/20/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Jozsef Bakosi, 07/20/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Kale, Laxmikant V, 07/20/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Jozsef Bakosi, 07/20/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Phil Miller, 07/20/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Jozsef Bakosi, 07/20/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Kale, Laxmikant V, 07/19/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Phil Miller, 07/19/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Tom Quinn, 07/19/2016
- Re: [charm] Run multiple custom reducers at (potentially) the same time, Phil Miller, 07/19/2016
Archive powered by MHonArc 2.6.16.