Skip to Content.
Sympa Menu

charm - Re: [charm] sending an object using PUP

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

Re: [charm] sending an object using PUP


Chronological Thread 
  • From: Phil Miller <mille121 AT illinois.edu>
  • To: "Kale, Laxmikant V" <kale AT illinois.edu>
  • Cc: "charm AT cs.uiuc.edu" <charm AT cs.uiuc.edu>
  • Subject: Re: [charm] sending an object using PUP
  • Date: Fri, 8 Nov 2013 11:14:34 -0800
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/charm/>
  • List-id: CHARM parallel programming system <charm.cs.uiuc.edu>

Err, maybe I wasn't clear, but I actually intended that we would marshal the value on both ends. Why wouldn't we just use the usual PUP::{to,from}Mem and CkMarshallMessage?


On Fri, Nov 8, 2013 at 11:11 AM, Kale, Laxmikant V <kale AT illinois.edu> wrote:
I see. We'd need a new pupper which "PUPsToMessage".

--- 
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          FAX: (217) 265-6582


On 11/8/13 1:08 PM, "Phil Miller" <mille121 AT illinois.edu> wrote:

I don't see any reason we couldn't automate 'return value marshalling' from [sync] entry methods just like we do for parameters. That would mean a single 'copy' on each end: one to marshal the returned object into a runtime-generated message from the callee, and one to unmarshall it for the caller.


On Fri, Nov 8, 2013 at 8:00 AM, Nicolas Bock <nicolasbock AT gmail.com> wrote:
Thanks for the detailed answer. I had meant my example simply as a rough sketch of what I would like to do, not to be taken to literal. Let me try to rephrase my question: If I pass an instance of the class foo as a method parameter, it is marshalled, i.e. the pup() method is used by the RTS to pack up the foo instance and send it to the receiving method. No additional steps are required on my end. If I want to return an instance of foo then I have to copy the foo instance into a message and return that message. I am concerned that the second approach incurs the cost of two copy operations, one to copy the instance into the message, and one to pup() the instance in the message so that it can be sent to the caller.

To be more concrete, from a performance point of view, is this approach problematic?

in the ci file:
entry [sync] getFoo (void);

in the caller:
FooMsg *msg = A.getFoo();

in the A chare:
FooMsg * getFoo (void)
{
  FooMsg *msg = new FooMsg();
  msg->foo = this->foo; /* Assuming I overload the assignment operator for the foo class. */
  return msg;
}

Thanks already,

nick




On Fri, Nov 8, 2013 at 6:58 AM, Kale, Laxmikant V <kale AT illinois.edu> wrote:
I will let someone else will respond with more details. But here is my quick attempt:

Sure, you can send any instance of a foo class in a method invocation, just using parameter marshaling as usual. There is no problem with that (and it satisfies what you asked for in the text). But your example is using a return value of type foo. The only  entry methods that can return anything are "sync" methods, and they must be called from entry methods tagged as "threaded". More pertinently, the return value is required to be a message. So, your example as stated will not work. 

It may be possible to define a different return type that’s puppable, and implement it with additional copying, but the extra copying is not worth it, I think. (note: the foo class does not include the message envelope). 

--- 
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          FAX: (217) 265-6582


On 11/7/13 2: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






Archive powered by MHonArc 2.6.16.

Top of Page