Skip to Content.
Sympa Menu

charm - Re: [charm] [ppl] Packed messages and CkMulticast

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

Re: [charm] [ppl] Packed messages and CkMulticast


Chronological Thread 
  • From: Gengbin Zheng <gzheng AT illinois.edu>
  • To: "Venkataraman, Ramprasad" <ramv AT illinois.edu>
  • Cc: "charm AT cs.uiuc.edu" <charm AT cs.uiuc.edu>, "Jetley, Pritish" <pjetley2 AT illinois.edu>
  • Subject: Re: [charm] [ppl] Packed messages and CkMulticast
  • Date: Thu, 29 Mar 2012 18:31:09 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/charm>
  • List-id: CHARM parallel programming system <charm.cs.uiuc.edu>

I am not sure about this. There is a field in envelope for the packing
and unpacking states. The message should be pack/unpacked when needed
by checking the flag.
I don't see the following explains.
Do you have a small test program that can show the bug?

Gengbin


On Thu, Mar 29, 2012 at 1:24 PM, Venkataraman, Ramprasad
<ramv AT illinois.edu>
wrote:
> I just spoke to Pritish about this, but am also replying just to
> archive the findings.
>
> CkMulticast cannot support packed messages the way you describe the
> usage below. This is because the multicast manager actually needs the
> information present in the CkMcastBaseMsg at each intermediate point
> along the tree while transmitting a multicast. Since it has no way of
> distinguishing packed messages, it cannot unpack (pup) it to retrieve
> this metadata.
>
> Hence instead of packing (pupping) a CkMcastBaseMsg* directly, a
> solution that works currently will be to size the PUP::able data,
> allocate a varsize msg that inherits from CkMcastBaseMsg and has
> enough space for the above data and then PUP the data into the msg.
> This will allow CkMulticast to transmit a PUP::able type without
> issues. All this machinery could be encapsulated behind a factory
> method that created the message given a PUP::able.
>
> Of course, this issue can be avoided if we supported efficient
> parameter-marshalled multicasts. This is a feature currently under
> development.
>
> Ram
>
> On Wed, Mar 28, 2012 at 15:07, Pritish Jetley
> <pjetley2 AT illinois.edu>
> wrote:
>> Hi all,
>>
>> I have a question about using packed messages with CkMulticast. I have a
>> user-defined, packed message type, MapMsg, which has integer members, as
>> well as a pointer to a PUPable class:
>>
>> struct MapMsg : public CkMcastBaseMsg, public CMessage_MapMsg {
>>   int x,y;
>>   MyPupableClass *ptr;
>>
>>   static void *pack(MapMsg *in);
>>   static MapMsg *unpack(void *buf);
>>   void pup(PUP::er &p);
>> }
>>
>> When I send out a MapMsg, I would like the PUPable object to which 'ptr'
>> points, to be packed into it. Therefore, I have defined the pack() and
>> unpack() methods for the MapMsg class:
>>
>> void *MapMsg::pack(MapMsg *inm){
>>   PUP::sizer psz;
>>   inm->pup(psz);
>>
>>   void *buf = (void *)CkAllocBuffer(inm,psz.size());
>>   PUP::toMem pmem(buf);
>>   inm->pup(pmem);
>>
>>   delete inm;
>>   return buf;
>> }
>>
>> MapMsg *MapMsg::unpack(void *inbuf){
>>   MapMsg *m = (MapMsg *)CkAllocBuffer(inbuf,sizeof(MapMsg));
>>   m->a = NULL;
>>   PUP::fromMem pmem(inbuf);
>>   m->pup(pmem);
>>
>>   CkFreeMsg(inbuf);
>>   return m;
>> }
>>
>> That is, I call pup() on the message to size and pack/unpack its contents.
>> The pup() method for MapMsg is as follows:
>>
>>   void MapMsg::pup(PUP::er &p){
>>     CkMcastBaseMsg::pup(p);
>>     CMessage_MapMsg::pup(p);
>>     p|x;
>>     p|y;
>>     p|ptr;
>>   }
>>
>> I defined CkMcastBaseMsg::pup() myself, to pup the values of the
>> CkMulticast
>> cookie, magic number and ep index:
>>
>> void CkMcastBaseMsg::pup(PUP::er &p){
>>   p|_cookie;
>>   p|magic;
>>   p|ep;
>> }
>>
>> However, the code segfaults when the message is being sent, which leads me
>> to believe that I'm forgetting to pack something. Can anyone see something
>> that is wrong with the code above?
>>
>> Thanks,
>> Pritish
>>
>> --
>> Pritish Jetley
>> Doctoral Candidate, Computer Science
>> University of Illinois at Urbana-Champaign
>>
>> _______________________________________________
>> charm mailing list
>> charm AT cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/charm
>>
>> _______________________________________________
>> ppl mailing list
>> ppl AT cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/ppl
>>
>
>
>
> --
> Ramprasad Venkataraman
> Parallel Programming Lab
> Univ. of Illinois
>
> _______________________________________________
> charm mailing list
> charm AT cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/charm
>
> _______________________________________________
> ppl mailing list
> ppl AT cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/ppl





Archive powered by MHonArc 2.6.16.

Top of Page