Skip to Content.
Sympa Menu

charm - Re: [charm] Unrecognized PUP::able::PUP_ID

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

Re: [charm] Unrecognized PUP::able::PUP_ID


Chronological Thread 
  • From: Nels John Frazier <nfrazie1 AT uwyo.edu>
  • To: Bilge Acun <acun2 AT illinois.edu>
  • Cc: "charm AT cs.illinois.edu" <charm AT cs.illinois.edu>
  • Subject: Re: [charm] Unrecognized PUP::able::PUP_ID
  • Date: Mon, 7 Mar 2016 15:41:25 +0000
  • Accept-language: en-US
  • Authentication-results: cs.illinois.edu; dkim=none (message not signed) header.d=none;cs.illinois.edu; dmarc=none action=none header.from=uwyo.edu;
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:23

Bilge,


Thanks for the reply.  In simplifying my example, I may have misslead you.  I don't want these classes to be chares.  I need a chare object to hold a reference to B, and I need this to be migratable.  Here is the code I used to do this.  I have elements that processes B objects, so each object may have a reference to B.  The following code creates a simlpe array of 2 elements, where each element has a pointer to a B object.  Then I want these elements to migrate, and the B pointer to correctly migrate with it.  So in my previous message, I was only illustrating the fact that creating a PUP::able object seemed to fail, because the register function is never called.  If I manually register I can make this example work.  So classes A and B are only using the PUP mechanics, as outlined in section 17.2 http://charm.cs.illinois.edu/manuals/html/charm++/17.html.


Am I still doing something wrong?  Why do I have to manually call the _register<>() function?


main.ci:


mainmodule main
{
    readonly CProxy_Main mainProxy;
    extern module element;

    mainchare Main
    {
        entry Main(CkArgMsg* msg);
        entry void done(int);
    };
};

main.C
//#include "B.h"
#include "main.decl.h"
#include "main.h"
CProxy_Main mainProxy;

// Entry point of Charm++ application
Main::Main(CkArgMsg* msg) 
{
  // Print a message for the user
  CkPrintf("Main chare starting with %d\n",CkNumPes());
  doneCount = 0;
  doneCount1 = 0;
  mainProxy = thisProxy;
  elementArray = CProxy_Element::ckNew(2);
  elementArray[0].process();
  elementArray[1].process();
}

// Constructor needed for chare object migration
Main::Main(CkMigrateMessage* msg) { }

void Main::done(int id)
{
    if(id == 0 && doneCount != 2)
    {
        doneCount++;
        elementArray[0].process();
    }
    else if(id == 1 && doneCount1 != 2)
    {
        doneCount1++;
        elementArray[1].process();
    }
    if(doneCount == 2 && doneCount1 == 2)
    {
     elementArray[0].ckDestroy();
     CkExit();
    }    
}
#include "main.def.h"


element.ci

module element
{
    array[1D] Element
    {
        entry Element();
        entry void process();
    }
}

element.h :

#ifndef __ELEMENT_H__
#define __ELEMENT_H__
#include "Reservoir.h"
class Element : public CBase_Element
{
private:
    B* b;
public:
    Element();
    Element(CkArgMsg* msg);
    Element(CkMigrateMessage* msg);
    ~Element();
    void process();
    virtual void pup(PUP::er &p);
    //Entry Method
};

#endif //__Element_H__

element.cpp

Element::Element(CkMigrateMessage* msg)
{
        b = new B();
}

Element::~Element()
{
    delete b;
}

void Element::process()
{
     migrateMe((CkMyPe()+1)%CkNumPes());    
     mainProxy.done(thisIndex);
}

void Element::pup(PUP::er &p)
{
    if(p.isUnpacking()) CkPrintf("Unpacking ELEMENT %d\n", thisIndex);
    else CkPrintf("Packing ELEMENT %d\n",thisIndex);
    p|b;    
}

#include "element.def.h"



From: bilgeacun AT gmail.com <bilgeacun AT gmail.com> on behalf of Bilge Acun <acun2 AT illinois.edu>
Sent: Saturday, March 5, 2016 1:15 PM
To: Nels John Frazier
Cc: charm AT cs.illinois.edu
Subject: Re: [charm] Unrecognized PUP::able::PUP_ID
 
Hi,

I have realized our manual does not show an inheritance example for regular chare objects. We'll work on improving our manual. 
There are a few problems with your code:

You can declare a regular migratable chare object as shown in this chaper. It does not need to declared as PUPable to be able to inherit from another chare. It also does not need to inherit from PUP::able, it can inherit from CBase_ChareType as regular chares. Writing pup functions enables them to migrate.

The second problem is with your module declaration. If you have a module that depends on another module, you need to declare it as extern as shown here. You can also put multiple chare declarations in one module.

I hope this helps fixing your code.

~Bilge


On 4 March 2016 at 14:37, Nels John Frazier <nfrazie1 AT uwyo.edu> wrote:

Hi,


Following the charm documentation, I created a set of migratable sub classes.  However, when I run a small test program, I get 


------------- Processor 1 Exiting: Called CmiAbort ------------
Reason: Unrecognized PUP::able::PUP_ID. is there an unregistered module?


My classes looks something like this

//FILE 1

#include "B.h"

#include "A.decl.h"


class A : public B

{

    private:

    static double moreData[3];

    public:

    int a = 0;

    double data = "1;

   

    A():B(a)

    {


    }


    PUPable_decl(A);
    A(CkMigrateMessage* m) : B(m) {}
    virtual void pup(PUP::er &p)
    {
        B::pup(p);
        if(p.isUnpacking()) CkPrintf("Unpacking A\n");
        else CkPrintf("Packing A\n");
        p|data;
        p(moreData, 3);
        if(p.isUnpacking())
        {
            CkPrintf("Unpacked stuff %f\n", a);
            CkPrintf("Array value: %f\n", moreData[2]);
        }
    }

};

double A::moreData[3] = {0,1,2}

#include "A.def.h"


//FILE 2

#include "pup.h"

#include "B.decl.h"

class B: public PUP::able

{

    public:

        int a;

        B(int a_):a(a_){};

        B(){};

        virtual ~B(){};


        PUPable_decl(B);

        B(CkMigrateMessage* m) : PUP::able(m){};

        vitrual void pup(PUP::er& p)

        {

            if(p.isUnpacking()) CkPrintf("Unpacking B\n");
            else CkPrintf("Packing B\n");
            PUP::able::pup(p);
            p|a;
            if(p.isUnpacking()) CkPrintf("Unpacked %ld\n",a);
        }        

};

#include "B.def.h"



The generated decl and def files:


A.decl.h

#ifndef _DECL_A_H_
#define _DECL_A_H_
#include "charm++.h"
#include "envelope.h"
#include <memory>
#include "sdag.h"

extern void _registerrA(void);
#endif 

A.def.h
#ifndef CK_TEMPLATES_ONLY
  PUPable_def(A)
#endif /* CK_TEMPLATES_ONLY */

#ifndef CK_TEMPLATES_ONLY
void _registerA(void)
{
  static int _done = 0; if(_done) return; _done = 1;
      PUPable_reg(A);

}
#endif /* CK_TEMPLATES_ONLY */



B.decl.h
#ifndef _DECL_B_H_
#define _DECL_B_H_
#include "charm++.h"
#include "envelope.h"
#include <memory>
#include "sdag.h"

extern void _registerB(void);
#endif 

B.def.h
#ifndef CK_TEMPLATES_ONLY
  PUPable_def(B)
#endif /* CK_TEMPLATES_ONLY */

#ifndef CK_TEMPLATES_ONLY
void _registerB(void)
{
  static int _done = 0; if(_done) return; _done = 1;
      PUPable_reg(B);

}
#endif /* CK_TEMPLATES_ONLY */

My A.ci file looks like this

module A
{
    PUPable A;
}

B.ci
module B
{
    PUPable B;
}

Simple compile:

charmc A.ci
charmc B.ci


Long story short, I have a small sample file to test migrating my A objects, and I get the indicated error.  I found a workaround, which is manually registering the module in A's constructor:

A():B(a)

{

        _registerA(); 

}



Is this a bug in charm or am I not doing this properly?

Thanks,

Nels Frazier




--
Bilge Acun
PhD Candidate, Computer Science Department
University of Illinois at Urbana-Champaign



Archive powered by MHonArc 2.6.16.

Top of Page