2 #include "hello.decl.h"
3 //header from Charm to enable Interoperation
4 #include "mpi-interoperate.h"
7 class MainHello : public CBase_MainHello
12 //Process command-line arguments
14 //Start the computation
15 CkPrintf("Running Hello on %d processors for %d elements\n",
16 CkNumPes(),nElements);
17 CProxy_MainHello mainHelloProxy = thisProxy;
19 CProxy_Hello arr = CProxy_Hello::ckNew(mainHelloProxy, nElements, nElements);
24 MainHello(CkMigrateMessage *m) {}
33 class Hello : public CBase_Hello
36 CProxy_MainHello mainProxy;
39 Hello(CProxy_MainHello mp, int nElems)
45 Hello(CkMigrateMessage *m) {}
49 CkPrintf("Hello[%d] from element %d\n",hiNo,thisIndex);
50 if (thisIndex < nElements-1)
52 thisProxy[thisIndex+1].SayHi(hiNo+1);
54 //We've been around once-- we're done.
59 //C++ function invoked from MPI, marks the begining of Charm++
60 void HelloStart(int elems)
63 CkPrintf("HelloStart - Starting lib by calling constructor of MainHello\n");
64 CProxy_MainHello mainhello = CProxy_MainHello::ckNew(elems, 0);
66 StartCharmScheduler();
69 #include "hello.def.h"