Skip to Content.
Sympa Menu

charm - [charm] Fwd: Multiple uses of a trigger in SDAG

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

[charm] Fwd: Multiple uses of a trigger in SDAG


Chronological Thread 
  • From: Jozsef Bakosi <jbakosi AT gmail.com>
  • To: "charm AT cs.uiuc.edu" <charm AT cs.uiuc.edu>
  • Subject: [charm] Fwd: Multiple uses of a trigger in SDAG
  • Date: Sat, 3 Sep 2016 09:06:29 -0600

CC list.

---------- Forwarded message ----------
From: Jozsef Bakosi <jbakosi AT gmail.com>
Date: Sat, Sep 3, 2016 at 9:06 AM
Subject: Re: [charm] Multiple uses of a trigger in SDAG
To: Phil Miller <mille121 AT illinois.edu>


Ok I think that makes it clearer. But let me rephrase this to see if I understand: I should think of these triggers, A_ready() etc., as consumers of messages whenever they appear in when clauses. Wherever they appear in when clauses they consume a message targeted for them (from some queue). If the same A_ready() appears in N when clauses, it will take exactly N A_ready() calls to activate them all. Furthermore, if there is a single A_ready() activation, the first when clause where it appears will take that matching message off the queue, so it will trigger true for that part of the when clause, but since that message is consumed, the next when clause where A_ready() appears can only consume (and therefore trigger as true) whene there is a new (2nd) message targeted for A_ready(), so until the 2nd message it will evaluate as false.

Is this a reasonable way to think about? This seems to be consistent with what you describe and with the behavior I have inferred so far.

On Fri, Sep 2, 2016 at 2:50 PM, Phil Miller <mille121 AT illinois.edu> wrote:
In short: each call to an entry method defined by a when clause will match to exactly one dynamic instance. If you have two "when A_ready()" clauses actively waiting for calls to A_ready(), it will take two calls to A_ready() on that chare to satisfy both of them.

On Fri, Sep 2, 2016 at 3:47 PM, Jozsef Bakosi <jbakosi AT gmail.com> wrote:
Hi folks,

Is it possible to use a trigger multiple times in SDAG?

Down below is a simplified example of performing a iteration, e.g., time stepping.

Can I realistically assume that both use_AndB() and use_AandBandC() will be
executed? Worded in another way: Is it okay to reuse the same triggers,
A_ready() and B_ready(), in both when statements?

I suspect the short answer is no, because in the past in similar situations I
had to place A_ready() and B_ready() in use_AandB() and/or use_AandBandC()
to reactivate the trigger for the other when statement, but that does not
seem like the it always does what I want. If I don't reactivate, I get a deadlock. I'm pretty
sure I'm using this incorrectly, also because this approach does not scale well as triggers
are reused.

Is this the proper way to think about this? Most likely not. I suspect I should not attempt to
reuse the same trigger multiple times and messing with reactivtation and just
create new triggers that are used once.

Can someone please explain this?

Thanks,
Jozsef

----------

group worker {

  entry void prepareA();
  entry void prepareB();
  entry void prepareC();

  entry void wait4_AandB() {
    when A_ready(), B_ready() serial {
      use_AandB();
    }
  };

  entry void wait4_AandBandC() {
    when A_ready(), B_ready(), C_ready() serial {
      use_AandBandC();
    }
  };

  entry void A_ready();
  entry void B_ready();
  entry void C_ready();
}

worker.C:
---------

void worker::getready() {
  wait4_AandB();
  wait4_AandBandC();
}

void worker::prepareA() {
  prepare_A();
  A_ready();
}

void worker::prepareB() {
  prepare_B();
  B_ready();
}

void worker::prepareC() {
  prepare_C();
  C_ready();
}

void worker::use_AandB() {
  callback2host();
}

void worker::use_AandBandC() {
  callback2host_someotherway();
}

Host object spawning work:
--------------------------

void dowork() {
  workerproxy.getready();  // not an entry method (not async)
  workerproxy.prepareA();  // entry method calls (all async)
  workerproxy.prepareB();
  workerproxy.prepareC();
}

void domorework() {
  if (need to do more work based on
      callback2host() and callback2host_someotherway() )
    dowork();
  else
    quit();
}






Archive powered by MHonArc 2.6.19.

Top of Page