charm AT lists.siebelschool.illinois.edu
Subject: Charm++ parallel programming system
List archive
- From: Phil Miller <mille121 AT illinois.edu>
- To: Charm Mailing List <charm AT cs.illinois.edu>
- Subject: [charm] Fwd: sending an object using PUP
- Date: Fri, 8 Nov 2013 07:57:18 -0800
- List-archive: <http://lists.cs.uiuc.edu/pipermail/charm/>
- List-id: CHARM parallel programming system <charm.cs.uiuc.edu>
I accidentally sent this follow-up to Nicholas privately, rather than copying the list
---------- Forwarded message ----------
From: Phil Miller <mille121 AT illinois.edu>
Date: Thu, Nov 7, 2013 at 1:23 PM
Subject: Re: [charm] sending an object using PUP
To: Nicolas Bock <nicolasbock AT gmail.com>
void work(Foo foo_arg) {
// do stuff with foo_arg
void work(Foo foo_arg) {
// do stuff with foo_arg
From: Phil Miller <mille121 AT illinois.edu>
Date: Thu, Nov 7, 2013 at 1:23 PM
Subject: Re: [charm] sending an object using PUP
To: Nicolas Bock <nicolasbock AT gmail.com>
It's apparently not shown in the manual (we apparently only show primitive types and arrays thereof, which is a dire issue that we should fix), but you can actually pass any type that has a pup() routine defined directly as an argument to an entry method, through 'parameter marshalling'. For instance, one way to express a transfer of a foo object from Bar to Flo is
struct Flo : public CBase_Flo { }
};
};
struct Bar : public CBase_Bar {
CProxy_Flo flo;
Foo myFoo;
void give() {
flo.work(myFoo);
}
};
The automates the process you describe of defining a message with its associated allocation, packing, and unpacking routines.
I'll note that as written, this is in a sense the 'inverse' flow control of what you wrote - it's pushing the Foo object, rather than pulling it. If you explicitly want to get it 'on demand' (e.g. because the owner doesn't know a priori who will want it, or because you need to limit resource consumption), the most straightforward way to go about it is to have an entry method through which to make the request, with parameters as necessary to indicate who wants the data. The owner of the data then explicitly sends it to a specific response entry method of the requester.
E.g.
struct Flo : public CBase_Flo {
struct Flo : public CBase_Flo {
CProxy_Bar bar;
void start() {
bar.give(thisProxy);
}
void work(Foo foo_arg) {
// do stuff with foo_arg
}
};
};
struct Bar : public CBase_Bar {
Foo myFoo;
void give(CProxy_Flo requesting_flo) {
requesting_flo.work(myFoo);
}
};If the split control flow between Flo::start() and Flo::work(Foo) bothers you, then you can smooth over it with SDAG (manual chapter 5) to put the various steps in explicit sequence.
On Thu, Nov 7, 2013 at 12:31 PM, Nicolas Bock <nicolasbock AT gmail.com> wrote:
_______________________________________________Hi,suppose I use the foo class as in the example code in chapter 6 and I include an instance of it as a field in a chare. Since foo defines pup(), the chare can be migrated.
Now suppose I would like to send the foo instance to some other chare. I could write a CMessage and define pack(), unpack(), and alloc(), but it seems that since foo already defines pup(), there should be a much simpler way.To make this more concrete, I would like to do something like the following:class Bar : public CBase_Bar {private:foo myFoo;public:foo getFoo (void);};class Flo : public CBase_Flo {private:CProxy_Bar bar;public:void work (void) {foo theFoo = bar.getFoo();}};Thanks already,nick
charm mailing list
charm AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/charm
- [charm] sending an object using PUP, Nicolas Bock, 11/07/2013
- Re: [charm] sending an object using PUP, Kale, Laxmikant V, 11/08/2013
- Re: [charm] sending an object using PUP, Nicolas Bock, 11/08/2013
- Re: [charm] sending an object using PUP, Phil Miller, 11/08/2013
- Re: [charm] sending an object using PUP, Kale, Laxmikant V, 11/08/2013
- Message not available
- Re: [charm] sending an object using PUP, Phil Miller, 11/08/2013
- Re: [charm] sending an object using PUP, Phil Miller, 11/08/2013
- Re: [charm] sending an object using PUP, Nicolas Bock, 11/08/2013
- Message not available
- [charm] Fwd: sending an object using PUP, Phil Miller, 11/08/2013
- Re: [charm] sending an object using PUP, Kale, Laxmikant V, 11/08/2013
Archive powered by MHonArc 2.6.16.