
00001 /***************************************************************************** 00002 Persistent Communication API for ELAN 00003 00004 * PersistentHandle: 00005 persistent communication handler, created by CmiCreatePersistent() 00006 * void CmiPersistentInit(): 00007 initialize persistent communication module, used by converseInit. 00008 * PersistentHandle CmiCreatePersistent(int destPE, int maxBytes): 00009 Sender initiates the setting up of persistent communication. 00010 create a persistent communication handler, with dest PE and maximum 00011 bytes for this persistent communication. Machine layer will send 00012 message to destPE and setup a persistent communication. a buffer 00013 of size maxBytes is allocated in the destination PE. 00014 * PersistentReq CmiCreateReceiverPersistent(int maxBytes); 00015 PersistentHandle CmiRegisterReceivePersistent(PersistentReq req); 00016 Alternatively, a receiver can initiate the setting up of persistent 00017 communication. 00018 At receiver side, user calls CmiCreateReceiverPersistent() which 00019 returns a temporary handle type - PersistentRecvHandle. Send this 00020 handle to the sender side and the sender should call 00021 CmiRegisterReceivePersistent() to setup the persistent communication. 00022 The function returns a PersistentHandle which can then be used for 00023 the following persistent communication. 00024 * void CmiUsePersistentHandle(PersistentHandle *p, int n); 00025 ask Charm machine layer to use an array of PersistentHandle "p" 00026 (array size of n) for all the following communication. Calling with 00027 p = NULL will cancel the persistent communication. n = 1 is for 00028 sending message to one Chare, n > 1 is for message in multicast - 00029 one PersistentHandle for each PE. 00030 * void CmiDestoryPersistent(PersistentHandle h); 00031 Destory a persistent communication specified by PersistentHandle h. 00032 * void CmiDestoryAllPersistent(); 00033 Destory all persistent communication on the local processor. 00034 00035 *****************************************************************************/ 00036 00037 #include "conv-config.h" 00038 00039 #ifndef __PERSISTENT_H__ 00040 #define __PERSISTENT_H__ 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00046 typedef void * PersistentHandle; 00047 00048 #if CMK_PERSISTENT_COMM 00049 00050 typedef struct { 00051 int pe; 00052 int maxBytes; 00053 void **bufPtr; 00054 PersistentHandle myHand; 00055 } PersistentReq; 00056 00057 void CmiPersistentInit(); 00058 PersistentHandle CmiCreatePersistent(int destPE, int maxBytes); 00059 PersistentHandle CmiCreateNodePersistent(int destNode, int maxBytes); 00060 PersistentReq CmiCreateReceiverPersistent(int maxBytes); 00061 PersistentHandle CmiRegisterReceivePersistent(PersistentReq req); 00062 void CmiUsePersistentHandle(PersistentHandle *p, int n); 00063 void CmiDestoryPersistent(PersistentHandle h); 00064 void CmiDestoryAllPersistent(); 00065 00066 void CmiPersistentOneSend(); 00067 #else 00068 00069 typedef int PersistentRecvHandle; 00070 00071 #define CmiPersistentInit() 00072 #define CmiCreatePersistent(x,y) 0 00073 #define CmiCreateReceiverPersistent(maxBytes) 0 00074 #define CmiRegisterReceivePersistent(req) 0 00075 #define CmiUsePersistentHandle(x,y) 00076 #define CmiDestoryAllPersistent() 00077 00078 #endif 00079 00080 #ifdef __cplusplus 00081 } 00082 #endif 00083 00084 #endif
1.5.5