NAMD
DataExchanger.h
Go to the documentation of this file.
1 
7 #ifndef _DATAEXCHANGER_H
8 #define _DATAEXCHANGER_H
9 
10 #include "charm++.h"
11 #include "main.h"
12 #include "DataExchanger.decl.h"
13 
14 #define CPROXY_DE(x) ((CProxy_DataExchanger)(x))
15 CpvExtern(int, breakScheduler);
16 CpvExtern(int, inEval);
17 
18 class DataMessage {
19  public:
20  char core[CmiMsgHeaderSizeBytes];
21  int src, srcPart;
22  int size, code;
23  char data[1];
24 
25  void setMessage(const char *_data, int _src, int _srcPart, int _size, int _handler, int _code) {
26  src = _src; srcPart = _srcPart;
27  size = _size;
28  code = _code;
29  memcpy(data,_data,size);
30  CmiSetHandler(core,_handler);
31  }
32 };
33 
35  public:
36  char core[CmiMsgHeaderSizeBytes];
37  int srcPart;
38  int dcdIndex;
39  char data[1];
40 };
41 
43  public:
44  char core[CmiMsgHeaderSizeBytes];
45  int srcPart;
46  int dcdIndex;
48  double DELTA;
49  double unitcell[6];
50  char data[1];
51 };
52 
54  public:
55  char core[CmiMsgHeaderSizeBytes];
56 };
57 
58 class DataExchanger : public CBase_DataExchanger
59 {
60  public:
62  DataExchanger();
63  ~DataExchanger(void);
64 
66  enum{ TREE_WIDTH=2};
68 
69  //message handlers
76 };
77 
78 extern "C" {
79 void packSend(int dest, int partition, const char *data, int size, int handler, int code=0);
80 void sendReplicaDcdInit(int dstPart, ReplicaDcdInitMsg *msg, int msgsize);
81 void sendReplicaDcdData(int dstPart, ReplicaDcdDataMsg *msg, int msgsize);
82 void sendReplicaDcdAck(int dstPart, ReplicaDcdAckMsg *msg);
86 void recvData(DataMessage *dmsg);
87 void recvAck(DataMessage *dmsg);
88 
89 void replica_send(const char *sndbuf, int sendcount, int destPart, int destPE);
90 void replica_sendRecv(const char *sndbuf, int sendcount, int destPart, int destPE, DataMessage **precvMsg, int srcPart, int srcPE);
91 void replica_recv(DataMessage **precvMsg, int srcPart, int srcPE);
92 void replica_barrier();
93 
94 void replica_bcast(char *buf, int count, int root=0);
95 void replica_min_double(double *dat, int count);
96 
97 void replica_eval(const char *cmdbuf, int targPart, int targPE, DataMessage **precvMsg);
98 }
99 #endif
void setMessage(const char *_data, int _src, int _srcPart, int _size, int _handler, int _code)
Definition: DataExchanger.h:25
void recvReplicaDcdData(ReplicaDcdDataMsg *msg)
Definition: DataExchanger.C:82
~DataExchanger(void)
void sendReplicaDcdInit(int dstPart, ReplicaDcdInitMsg *msg, int msgsize)
Definition: DataExchanger.C:45
void packSend(int dst, int dstPart, const char *data, int size, int handler, int code)
Definition: DataExchanger.C:34
static void partition(int *order, const FullAtom *atoms, int begin, int end)
Definition: SortAtoms.C:41
char core[CmiMsgHeaderSizeBytes]
Definition: DataExchanger.h:55
void replica_send(const char *sndbuf, int sendcount, int destPart, int destPE)
void replica_eval(const char *cmdbuf, int targPart, int targPE, DataMessage **precvMsg)
void recvData(DataMessage *dmsg)
Definition: DataExchanger.C:93
char core[CmiMsgHeaderSizeBytes]
Definition: DataExchanger.h:20
int recv_eval_command_idx
Definition: DataExchanger.h:74
void recvReplicaDcdAck(ReplicaDcdAckMsg *msg)
Definition: DataExchanger.C:87
void replica_recv(DataMessage **precvMsg, int srcPart, int srcPE)
void replica_bcast(char *buf, int count, int root)
void sendReplicaDcdData(int dstPart, ReplicaDcdDataMsg *msg, int msgsize)
Definition: DataExchanger.C:56
void recvReplicaDcdInit(ReplicaDcdInitMsg *msg)
Definition: DataExchanger.C:77
int recv_eval_result_idx
Definition: DataExchanger.h:75
char core[CmiMsgHeaderSizeBytes]
Definition: DataExchanger.h:36
void replica_barrier()
char data[1]
Definition: DataExchanger.h:23
void replica_min_double(double *dat, int count)
void sendReplicaDcdAck(int dstPart, ReplicaDcdAckMsg *msg)
Definition: DataExchanger.C:67
CpvExtern(int, breakScheduler)
double unitcell[6]
Definition: DataExchanger.h:49
char core[CmiMsgHeaderSizeBytes]
Definition: DataExchanger.h:44
void replica_sendRecv(const char *sndbuf, int sendcount, int destPart, int destPE, DataMessage **precvMsg, int srcPart, int srcPE)
void recvAck(DataMessage *dmsg)
Definition: DataExchanger.C:99