Skip to Content.
Sympa Menu

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

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

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


Chronological Thread 
  • From: Jozsef Bakosi <jbakosi AT gmail.com>
  • To: "charm AT cs.uiuc.edu" <charm AT cs.uiuc.edu>
  • Subject: [charm] Custom reduction type contributing a user-defined type
  • Date: Fri, 17 Jul 2015 11:50:52 -0600
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/charm/>
  • List-id: CHARM parallel programming system <charm.cs.uiuc.edu>

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



Archive powered by MHonArc 2.6.16.

Top of Page