Skip to Content.
Sympa Menu

charm - Re: [charm] [ppl] Execution flow of charm++ code

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

Re: [charm] [ppl] Execution flow of charm++ code


Chronological Thread 
  • From: Pritish Jetley <pjetley2 AT illinois.edu>
  • To: Yogesh Sonawane <sonawane.yogesh19 AT gmail.com>
  • Cc: charm AT cs.uiuc.edu
  • Subject: Re: [charm] [ppl] Execution flow of charm++ code
  • Date: Fri, 12 Aug 2011 11:35:05 -0500
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/charm>
  • List-id: CHARM parallel programming system <charm.cs.uiuc.edu>

Yogesh,

I went through your code and noticed that in the communicate() method the code is attempting to send a dynamically allocated 'SendArray' structure from one chare to another. I see that there are several 'Atom's packed into each one of these SendArray structures. You must provide a pup() function for the SendArray and Atom classes.

Then, you must change the signature of the recvData() function to the following (pass by reference instead of passing a pointer):

entry void recvData(SendArray &arr); // .ci
void recvData(SendArray &arr); // .C/.h

I've attached a couple of files showing some example code that is very similar to what you will need.

I also noticed that in your Object() constructor, you call communicate(), followed by a call to mainProxy.done(); I suppose this is the part where you were unsure about the flow of control. Since entry method invocations are asynchronous in Charm++, the runtime system will *not* wait for the completion of recvData() on the target chare/rank before calling mainProxy.done(). Therefore, your program will likely exit before all the recvData()s have finished. Instead, you should shift mainProxy.done() to the recvData() method, thereby ensuring that messages sent in communicate are received before the recipient chare signals to the mainchare that it is done.

Pritish

On Thu, Jul 14, 2011 at 1:23 AM, Yogesh Sonawane <sonawane.yogesh19 AT gmail.com> wrote:
hello,
     I just started learning charm++ and have done some small sample codes. Now i am doing a code regarding MD just to calculate a energy of water system. whatever i have done up till now, i have attached it with the mail with the  "input files water.psf and water.pdb".  Actually i am not getting the flow in which the program is executing. 
    I have created a array of 4 chares. i want to distribute those 4 chares ont 4 processors one on each so that they will work parallel on their respective processors. i didnt use message object. I have just tried to transfer normal object during communication. so please help me for it. 
    I am not getting, whether my concept about execution is wrong or my logic is wrong.
    Please look at this, 
   Thank you very much  

_______________________________________________
charm mailing list
charm AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/charm

_______________________________________________
ppl mailing list
ppl AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/ppl




--
Pritish Jetley
Doctoral Candidate, Computer Science
University of Illinois at Urbana-Champaign

Attachment: test.ci
Description: Binary data

struct Structure;
struct A;
#include "test.decl.h"

struct A {
  int x,y,z;

  A() {}

  A(int i){
    x = y = z = i;
  }

  void pup(PUP::er &p){
    p | x;
    p | y;
    p | z;
  }
};

struct Structure {
  A *arr;
  int len;

  Structure(int len){
    this->len = len;
    arr = new A[len];
  }

  Structure(){
    arr = NULL;
  }

  void pup(PUP::er &p){
    p | len;
    if(p.isUnpacking()){
      arr = new A[len];
    }
    PUParray(p,arr,len);
  }

  ~Structure(){
    delete[] arr;
  }
};

class Main : public CBase_Main {
  public:
  Main(CkArgMsg *m){
    int len = 100;
    Structure s(len);
    for(int i = 0; i < len; i++){
      s.arr[i] = A(i);
    }

    thisProxy.recv(s);
  }

  void recv(Structure &s){
    for(int i = 0; i < s.len; i++){
      CkAssert(s.arr[i].x == s.arr[i].y);
      CkAssert(s.arr[i].y == s.arr[i].z);
      CkAssert(s.arr[i].z == i);
    }
    CkExit();
  }
};

#include "test.def.h"


  • Re: [charm] [ppl] Execution flow of charm++ code, Pritish Jetley, 08/12/2011

Archive powered by MHonArc 2.6.16.

Top of Page