Resolve build failure due to inttypes.h inclusion in hrctimer.h
[charm.git] / tests / ampi / speed / msgspeed.h
blob0239953b46a020c89d8b8bd9cbcfe7ece162819a
1 /**
2 Framework for measuring message-passing speed.
3 Orion Sky Lawlor, olawlor@uiuc.edu, 2003/8/21
5 This is needed to accurately, uniformly compare
6 vertically, across all our API's:
7 - Converse's netlrts-linux
8 - Charm++ messaging
9 - AMPI messaging
11 And horizontally, across different interconnects:
12 - UDP packets
13 - TCP sockets
14 - Myrinet
15 - Infiniband
16 - Shared memory
17 - Various MPI's
18 - IBM's LAPI
20 The basic idea is that an interconnect writes
21 a small, simple set of routines-- basically send
22 and recv-- and this code will try out a bunch of
23 different message passing styles to measure speed,
24 bandwidth, and congestion.
26 This header should be usable outside of Charm++.
28 #ifndef __CHARM_MSG_SPEED_H
29 #define __CHARM_MSG_SPEED_H
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
35 typedef struct msg_comm msg_comm;
36 typedef struct msg_driver msg_driver;
38 /**
39 Send len bytes of data to dest.
40 Once the data is sent, you must call msg_send_complete.
42 typedef void (*msg_send_fn)(void *data,int len, int dest,msg_comm *comm);
44 /**
45 This message was actually sent. This call can
46 be made from a msg_send_fn (for a blocking send)
47 or from outside (for a non-blocking send).
49 void msg_send_complete(msg_comm *comm,void *data,int len);
52 /**
53 Hint: you're about to recv len bytes of data from src.
54 Once the data arrives, you must call msg_recv_complete.
55 You only own the data pointer from this call until
56 you make the call to msg_recv_complete.
58 typedef void (*msg_recv_fn)(void *data,int len, int src,msg_comm *comm);
60 /**
61 This message just arrived. This call can
62 be made from a msg_recv_fn (for a blocking API
63 like MPI), or can be made from outside (for an
64 asynchronous API like converse or Charm++).
66 The data pointer need not be the same one passed
67 to msg_recv, and this function does not transfer
68 ownership of the data pointer.
70 void msg_recv_complete(msg_comm *comm,void *data,int len);
73 /**
74 We're ready to stop the test now. (collective)
76 typedef void (*msg_finish_fn)(msg_comm *comm);
78 /**
79 Interconnect writers will fill this struct out with
80 their send and recv functions, possibly extending the struct
81 with their own data.
83 struct msg_comm {
84 msg_driver *driver; /* controller routine private data */
86 msg_send_fn send_fn;
87 msg_recv_fn recv_fn;
88 msg_finish_fn finish_fn;
91 /**
92 Begin a test using this msg_comm state.
93 The "driver" portion can be left uninitalized,
94 but all other fields must be filled out.
96 This call must be made from exactly two processors,
97 0 and 1, at the same time.
99 This call will result in calls to the comm
100 send and recv functions. After a number of calls,
101 the finish function will be executed, at which
102 point the test is over.
104 void msg_comm_test(msg_comm *comm,const char *desc,int myPe,int verbose);
107 /* Returns wall clock time in seconds */
108 double msg_timer(void);
110 #ifdef __cplusplus
112 #endif
114 #endif