Skip to Content.
Sympa Menu

charm - Re: [charm] Migration of bound arrays

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

Re: [charm] Migration of bound arrays


Chronological Thread 
  • From: Ronak Buch <rabuch2 AT illinois.edu>
  • To: Jozsef Bakosi <jbakosi AT lanl.gov>
  • Cc: "charm AT lists.cs.illinois.edu" <charm AT lists.cs.illinois.edu>
  • Subject: Re: [charm] Migration of bound arrays
  • Date: Thu, 10 Jan 2019 13:42:36 -0600
  • Authentication-results: illinois.edu; spf=pass smtp.mailfrom=rabuch2 AT illinois.edu; dmarc=pass header.from=illinois.edu

Your code seems to be correct, this should migrate A and B together. The only potential issue that I can see is that the code you've provided doesn't use resumeFromSync, which should be used in order to guarantee that migrations have actually completed.

Traditionally, m_a isn't pupped, it's set as a readonly instead, and then just used globally, but pupping it as you are doing should work.

Waiting for resumeFromSync should make it safe. I believe resumeFromSync will only be called on A, so you can do some messaging to make B know that.


All of the above are what I think should be true based on how I understand your sample code and description. I'll try to recreate a simple proof on concept to replicate your issue to do some additional checking and testing. If you have compileable sample code that you can share that exhibits this problem, that would also be appreciated.

Thanks,
Ronak

On Tue, Jan 8, 2019 at 5:21 PM Jozsef Bakosi <jbakosi AT lanl.gov> wrote:
Hi folks,

Consider the following:

=========================================
class A : public CProxy_A {
  public:
    A() { usesAtSync = true; }
};

class B : public CProxy_B {

  public:
    B( CProxy_A& a ) : m_a( a ) {}

    void pup( PUP::er& p ) { p | m_a; }

    A* aptr() { return m_a[ thisIndex ].ckLocal(); }

    void step() { if (time to migrate) aptr()->AtSync(); }

  private:
    CProxy_A m_a;
};


CProxy_A a = CProxy_A::ckNew();

CkArrayOptions bound;
bound.bindTo( a );
CProxy_B b = CProxy_B::ckNew( bound );

a[0].insert();
b[0].insert( a );

a.doneInserting();
b.doneInserting();
=========================================

In words: I have two bound chare arrays, A and B. In B I hold a proxy to
A and dereference it via aptr() to get a raw pointer to the bound object.

B::step() is called in some iteration and which when it is time to
migrate, calls A::AtSync(). Calling aptr() has worked so far fine
without migration. When I migrate, however, I randomly get segfaults
from aptr().

Questions:

1. Is this a correct way of migrating A and B together?

2. Is this a correct way of using usesAtSync and AtSync?

3. Is it mandatory to pup m_a as written above?

4. How do I know that calling aptr() is safe after migration? In other
words, how do I know that when I call B::aptr() A has already arrived?

Thanks,
Jozsef



Archive powered by MHonArc 2.6.19.

Top of Page