1 #include "hello.decl.h"
3 /* readonly */ CProxy_Main mainProxy;
4 /* readonly */ CProxy_Hello helloProxy;
6 class Main : public CBase_Main {
12 int n = 2 * CkNumPes();
14 helloProxy = CProxy_Hello::ckNew(n);
23 class Hello : public CBase_Hello {
30 CkPrintf("Hello, I'm chare %d on PE %d\n", thisIndex, pe);
33 Hello(CkMigrateMessage* m) { }
35 void pup(PUP::er &p) {
40 // For chares on latter half of the PEs, introduce artificial load
41 // so that they can be migrated to the lower half
42 bool heavy = (CkMyPe() >= (CkNumPes() / 2));
43 double start_time = CkWallTimer();
45 // Busy wait for one second
46 while (CkWallTimer() - start_time < 1) { }
49 // Informs the runtime system that the chare is ready to migrate
53 void ResumeFromSync() {
55 CkPrintf("I'm chare %d, I moved to PE %d from PE %d\n", thisIndex, CkMyPe(), pe);
58 CkPrintf("I'm chare %d, I'm staying on PE %d\n", thisIndex, pe);
61 CkCallback cb(CkReductionTarget(Main, done), mainProxy);
66 #include "hello.def.h"