Fix parallel build of examples/charm++/user-driven-interop
[charm.git] / src / conv-core / persistent.h
blobc351335f3b9b004d48b56f165ff6dad62f16a1ab
1 /*****************************************************************************
2 Persistent Communication API
4 * PersistentHandle:
5 persistent communication handler, created by CmiCreatePersistent()
6 * void CmiPersistentInit():
7 initialize persistent communication module, used by converseInit.
8 * PersistentHandle CmiCreatePersistent(int destPE, int maxBytes):
9 Sender initiates the setting up of persistent communication.
10 create a persistent communication handler, with dest PE and maximum
11 bytes for this persistent communication. Machine layer will send
12 message to destPE and setup a persistent communication. a buffer
13 of size maxBytes is allocated in the destination PE.
14 * PersistentReq CmiCreateReceiverPersistent(int maxBytes);
15 PersistentHandle CmiRegisterReceivePersistent(PersistentReq req);
16 Alternatively, a receiver can initiate the setting up of persistent
17 communication.
18 At receiver side, user calls CmiCreateReceiverPersistent() which
19 returns a temporary handle type - PersistentRecvHandle. Send this
20 handle to the sender side and the sender should call
21 CmiRegisterReceivePersistent() to setup the persistent communication.
22 The function returns a PersistentHandle which can then be used for
23 the following persistent communication.
24 * void CmiUsePersistentHandle(PersistentHandle *p, int n);
25 ask Charm machine layer to use an array of PersistentHandle "p"
26 (array size of n) for all the following communication. Calling with
27 p = NULL will cancel the persistent communication. n = 1 is for
28 sending message to one Chare, n > 1 is for message in multicast -
29 one PersistentHandle for each PE.
30 * void CmiDestroyPersistent(PersistentHandle h);
31 Destroy a persistent communication specified by PersistentHandle h.
32 * void CmiDestroyAllPersistent();
33 Destroy all persistent communication on the local processor.
35 *****************************************************************************/
37 #include "conv-config.h"
39 #ifndef __PERSISTENT_H__
40 #define __PERSISTENT_H__
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
46 typedef void * PersistentHandle;
48 #if CMK_PERSISTENT_COMM
50 typedef struct {
51 int pe;
52 int maxBytes;
53 void **bufPtr;
54 PersistentHandle myHand;
55 } PersistentReq;
57 void CmiPersistentInit(void);
59 PersistentHandle CmiCreatePersistent(int destPE, int maxBytes);
60 PersistentHandle CmiCreateNodePersistent(int destNode, int maxBytes);
61 PersistentHandle CmiCreateCompressPersistent(int destPE, int maxBytes, int start, int type);
62 PersistentHandle CmiCreateCompressNodePersistent(int destNode, int maxBytes, int start, int type);
63 PersistentHandle CmiCreateCompressPersistentSize(int destPE, int maxBytes, int start, int size, int type);
64 PersistentHandle CmiCreateCompressNodePersistentSize(int destNode, int maxBytes, int start, int size, int type);
65 PersistentReq CmiCreateReceiverPersistent(int maxBytes);
66 PersistentHandle CmiRegisterReceivePersistent(PersistentReq req);
67 void CmiUsePersistentHandle(PersistentHandle *p, int n);
68 void CmiDestroyPersistent(PersistentHandle h);
69 void CmiDestroyAllPersistent(void);
71 void CmiPersistentOneSend(void);
72 #else
74 typedef int PersistentRecvHandle;
76 #define CmiPersistentInit()
77 #define CmiCreatePersistent(x,y)
78 #define CmiCreateNodePersistent(x,y)
79 #define CmiCreateCompressPersistent(x,y,z,m)
80 #define CmiCreateCompressPersistentSize(x,y,z,t,m)
81 #define CmiCreateCompressNodePersistent(x,y,z,m)
82 #define CmiCreateCompressNodePersistentSize(x,y,z,t,m)
83 #define CmiCreateReceiverPersistent(maxBytes)
84 #define CmiRegisterReceivePersistent(req)
85 #define CmiUsePersistentHandle(x,y)
86 #define CmiDestroyAllPersistent()
88 #endif
90 #ifdef __cplusplus
92 #endif
94 #endif