Skip to Content.
Sympa Menu

charm - Re: [charm] Custom reduction type contributing a user-defined type

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

Re: [charm] Custom reduction type contributing a user-defined type


Chronological Thread 
  • From: Jozsef Bakosi <jbakosi AT gmail.com>
  • To: Nikhil Jain <nikhil.jain AT acm.org>
  • Cc: "charm AT cs.uiuc.edu" <charm AT cs.uiuc.edu>
  • Subject: Re: [charm] Custom reduction type contributing a user-defined type
  • Date: Mon, 20 Jul 2015 13:44:00 -0600
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/charm/>
  • List-id: CHARM parallel programming system <charm.cs.uiuc.edu>

Thanks, Nikhil,

I think I'm very close to implementing what I need using a serialization library https://github.com/USCiLab/cereal, which seems to work quite nice for this purpose. The only problem I have now is that I get slightly different answers with different number of processors. I understand that I should not expect bit-by-bit reproducable results, but the difference seems to be a little more than could be explained by the usual order-dependence of reductions.

Could you clarify how the user-defined reducer, sumTwoShorts(), explained in 16.2 in the manual, is being called? In particular, I'm a bit confused by why the array ret[] there is initialized by zero. Is that function called several times during reduction or just once? Also, how should I expect the contributions coming in via the argument CkReductionMsg** msgs? As the reduction proceeds, there are more and more messages in msgs?

Thanks,
J

On Mon, Jul 20, 2015 at 9:21 AM, Nikhil Jain <nikhil.jain AT acm.org> wrote:
Hi Jozsef,

Unfortunately, contributions to reductions have to be a contiguous
buffer of data. Advanced support for contributing and reducing non-POD
does not exist in Charm++ currently. The round about way you described
is the only method I know of.

--Nikhil

On Fri, Jul 17, 2015 at 12:50 PM, Jozsef Bakosi <jbakosi AT gmail.com> wrote:
> Hi folks,
>
> What is the recommended way to define a custom reduction in which chare
> array elements contribute user-defined-type (ptentially non-POD) objects?
>
> What I have in mind is to convert an existing contribution of chare array
> elements using the vanilla entry-method call, estimate() to a typed (or
> non-typed) reduction. Example:
>
> User-defined non-POD type:
>
> class Cat {
>   std::map< int, double > catmap;
>   void pup( PUP::er& p ) { ... }
> };
>
> === Inefficient contribution using existing vanilla entry method call to
> host from array elements ===
>
> In some member function of a chare array:
>
> std::vector< Cat > v;
> hostproxy.estimate( v );        // non-reduction contribute a vector of Cats
>
> In the host's .ci file:
>
> entry void estimate( std::vector< Cat >& v );
>
> === Pseudo-code yielding a more efficient reduction to host from array
> elements ===
>
> Now in some member function of a chare array:
>
> std::vector< Cat > v;
> // reduction contribute a vector of Cats
> contribute( ... some way to specify the contribution v, hostproxy, and a
> custom reduction type on how to merge a Cat across a reduction );
>
> Now in the host's .ci file:
>
> entry [reductiontarget] void estimate( some way to receive a std::vector<
> Cat > );
>
> I think I should define a new reduction type (as in 16.2), but that example
> defines a custom reduction on a POD data of two short ints. What I think I
> need is a custom reduction on a non-POD type (Cat, containing a std::map).
>
> One solution I know I can do is to convert the std::map in Cat to a POD for
> the purpose of contributing to a reduction, but I'm wondering if there is a
> better/cleaner way to do this.
>
> Thanks,
> Jozsef
>
> _______________________________________________
> charm mailing list
> charm AT cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/charm
>



--
Nikhil Jain, nikhil.jain AT acm.org, http://charm.cs.uiuc.edu/people/nikhil
Doctoral Candidate @ CS, UIUC




Archive powered by MHonArc 2.6.16.

Top of Page