pio_rpc.h 1.8 KB
Newer Older
Deike Kleberg's avatar
Deike Kleberg committed
1
2
3
#ifndef PIO_RPC_H
#define PIO_RPC_H

4
5
6
7
#ifdef HAVE_CONFIG_H
#  include "config.h"
#endif

8
9
#include <stdbool.h>

Deike Kleberg's avatar
Deike Kleberg committed
10
#include <mpi.h>
11
#include <yaxt.h>
Deike Kleberg's avatar
Deike Kleberg committed
12

13
14
15
enum collectorCommandTags {
  FINALIZE,
  RESOURCES,
16
17
18
  STREAMOPEN,
  STREAMCLOSE,
  STREAMDEFVLIST,
19
  WRITETS,
20
  BLOCK_XFER,
21
};
22

23
#define MAXWINBUFFERSIZE ((size_t)2048 * 1024 * 1024)
24

25
26
enum
{
27
28
  numRPCFuncs = 1,
  STREAMDEFTIMESTEP = -1,
Thomas Jahns's avatar
Thomas Jahns committed
29
30
  HEADERSIZEMARKER = -numRPCFuncs - 1,
  PARTDESCMARKER = -numRPCFuncs - 2,
31
};
32
33
34
35
36
enum {
  MINFUNCID = -numRPCFuncs,
  MAXFUNCID = -1,
  defVlistNInts = 2,
};
37
extern const char * const funcMap[numRPCFuncs];
Deike Kleberg's avatar
Deike Kleberg committed
38

39
40
struct headerSize
{
41
  int numDataEntries, numRPCEntries;
42
43
44
45
};

struct dataRecord
{
46
  int varID, nmiss;
47
48
};

49
union funcArgs
50
{
51
52
53
54
  struct
  {
    int streamID, tsID;
  } streamNewTimestep;
55
56
};

57
58
59
60
61
62
63
/* Describes offset and ID of serialized partition descriptor.
 * partDescMarker == PARTDESCMARKER, always. */
struct partDescRecord
{
  Xt_uid uid;
};

64
struct winHeaderEntry
65
{
66
  int id;
67
68
69
70
  union
  {
    struct headerSize headerSize;
    struct dataRecord dataRecord;
71
    union funcArgs funcArgs;
72
73
74
    struct partDescRecord partDesc;
  }  specific;
  int offset;
75
76
77
78
79
80
81
82
83
84
85
86
87
};

/* round size to next multiple of factor */
static inline size_t
roundUpToMultiple(size_t size, size_t factor)
{
  return (size + factor - 1)/factor * factor;
}

enum
{
  /* align window base addresses and sizes to this value */
  PIO_WIN_ALIGN = sizeof (double),
88
89
};

90
91
92
93
94
95
96
97
98
99
100
101
102
103
struct clientBufSize
{
  size_t bufSize;
  int numDataRecords, numRPCRecords;
};

struct collSpec
{
  int numClients;
  int numServers;
  bool sendRPCData;
};

struct clientBufSize
Thomas Jahns's avatar
Thomas Jahns committed
104
computeClientStreamBufSize(int streamID, const struct collSpec *collector);
105

Deike Kleberg's avatar
Deike Kleberg committed
106
#endif
107

108
109
110
111
112
113
114
115
116
/*
 * Local Variables:
 * c-file-style: "Java"
 * c-basic-offset: 2
 * indent-tabs-mode: nil
 * show-trailing-whitespace: t
 * require-trailing-newline: t
 * End:
 */