DataExchanger.h

Go to the documentation of this file.
00001 
00007 #ifndef _DATAEXCHANGER_H
00008 #define _DATAEXCHANGER_H
00009 
00010 #include "charm++.h"
00011 #include "main.h"
00012 #include "DataExchanger.decl.h"
00013 
00014 #define CPROXY_DE(x) ((CProxy_DataExchanger)(x))
00015 CpvExtern(int, breakScheduler);
00016 CpvExtern(int, inEval);
00017 
00018 class DataMessage {
00019   public:
00020   char core[CmiMsgHeaderSizeBytes];
00021   int src, srcPart;
00022   int size, code;
00023   char data[1];
00024 
00025   void setMessage(const char *_data, int _src, int _srcPart, int _size, int _handler, int _code) {
00026     src = _src; srcPart = _srcPart;
00027     size = _size;
00028     code = _code;
00029     memcpy(data,_data,size);
00030     CmiSetHandler(core,_handler);
00031   }
00032 };
00033 
00034 class ReplicaDcdInitMsg {
00035   public:
00036   char core[CmiMsgHeaderSizeBytes];
00037   int srcPart;
00038   int dcdIndex;
00039   char data[1];
00040 };
00041 
00042 class ReplicaDcdDataMsg {
00043   public:
00044   char core[CmiMsgHeaderSizeBytes];
00045   int srcPart;
00046   int dcdIndex;
00047   int NSAVC, NPRIV, NSTEP, NFILE, with_unitcell, numAtoms;
00048   double DELTA;
00049   double unitcell[6];
00050   char data[1];
00051 };
00052 
00053 class ReplicaDcdAckMsg {
00054   public:
00055   char core[CmiMsgHeaderSizeBytes];
00056 };
00057 
00058 class DataExchanger : public CBase_DataExchanger
00059 {
00060   public:
00061     DataExchanger_SDAG_CODE;
00062     DataExchanger();
00063     ~DataExchanger(void);
00064   
00065     int loop, recvred, sendbcast;
00066     enum{ TREE_WIDTH=2};
00067     int numChildren, firstChild, parent;
00068 
00069     //message handlers
00070     int recv_data_idx;
00071     int recv_ack_idx;
00072     int recv_bcast_idx;
00073     int recv_red_idx;
00074     int recv_eval_command_idx;
00075     int recv_eval_result_idx;
00076 };
00077 
00078 extern "C" {
00079 void packSend(int dest, int partition, const char *data, int size, int handler, int code=0);
00080 void sendReplicaDcdInit(int dstPart, ReplicaDcdInitMsg *msg, int msgsize);
00081 void sendReplicaDcdData(int dstPart, ReplicaDcdDataMsg *msg, int msgsize);
00082 void sendReplicaDcdAck(int dstPart, ReplicaDcdAckMsg *msg);
00083 void recvReplicaDcdInit(ReplicaDcdInitMsg *msg);
00084 void recvReplicaDcdData(ReplicaDcdDataMsg *msg);
00085 void recvReplicaDcdAck(ReplicaDcdAckMsg *msg);
00086 void recvData(DataMessage *dmsg); 
00087 void recvAck(DataMessage *dmsg); 
00088 
00089 void replica_send(char *sndbuf, int sendcount, int destPart, int destPE);
00090 void replica_sendRecv(char *sndbuf, int sendcount, int destPart, int destPE, DataMessage **precvMsg, int srcPart, int srcPE);
00091 void replica_recv(DataMessage **precvMsg, int srcPart, int srcPE);
00092 void replica_barrier();
00093 
00094 void replica_bcast(char *buf, int count, int root=0);
00095 void replica_min_double(double *dat, int count);
00096 
00097 void replica_eval(char *cmdbuf, int targPart, int targPE, DataMessage **precvMsg);
00098 }
00099 #endif

Generated on Fri Sep 22 01:17:12 2017 for NAMD by  doxygen 1.4.7