persistent threshold use smsg_max, dynamic_smsgs works now with persistent
[charm.git] / src / arch / gemini_gni / machine-persistent.h
1 /** @file
2  * General implementation of persistent communication support
3  * @ingroup Machine
4  */
5
6 /**
7  * \addtogroup Machine
8 */
9 /*@{*/
10
11 #include "gni_pub.h"
12
13 #define PERSIST_MIN_SIZE                SMSG_MAX_MSG
14
15 #define PERSIST_BUFFERS_NUM             1
16
17 #define PERSIST_SEQ                     0xFFFFFFF
18
19 typedef struct  _PersistentBuf {
20   void *destAddress;
21   void *destSizeAddress;
22   gni_mem_handle_t    mem_hndl;
23 } PersistentBuf;
24
25 typedef struct _PersistentSendsTable {
26   int destPE;
27   int sizeMax;
28   PersistentHandle   destHandle;  
29   PersistentBuf     destBuf[PERSIST_BUFFERS_NUM];
30   void *messageBuf;
31   int messageSize;
32   struct _PersistentSendsTable *prev, *next;
33 } PersistentSendsTable;
34
35 typedef struct _PersistentReceivesTable {
36 #if 0
37   void *messagePtr[PERSIST_BUFFERS_NUM];      /* preallocated message buffer of size "sizeMax" */
38   unsigned int *recvSizePtr[PERSIST_BUFFERS_NUM];   /* pointer to the size */
39 #endif
40   PersistentBuf     destBuf[PERSIST_BUFFERS_NUM];
41   int sizeMax;
42   size_t               index;
43   struct _PersistentReceivesTable *prev, *next;
44 } PersistentReceivesTable;
45
46 CpvExtern(PersistentReceivesTable *, persistentReceivesTableHead);
47 CpvExtern(PersistentReceivesTable *, persistentReceivesTableTail);
48
49 CpvExtern(PersistentHandle *, phs);
50 CpvExtern(int, phsSize);
51 CpvExtern(int, curphs);
52
53 PersistentHandle getPersistentHandle(PersistentHandle h, int toindex);
54 void *PerAlloc(int size);
55 void PerFree(char *msg);
56 int PumpPersistent();
57 void swapSendSlotBuffers(PersistentSendsTable *slot);
58 void swapRecvSlotBuffers(PersistentReceivesTable *slot);
59 void setupRecvSlot(PersistentReceivesTable *slot, int maxBytes);
60 void clearRecvSlot(PersistentReceivesTable *slot);
61
62 /*@}*/
63