OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

vt_unify_hooks_msgmatch.h
1 /**
2 * VampirTrace
3 * http://www.tu-dresden.de/zih/vampirtrace
4 *
5 * Copyright (c) 2005-2012, ZIH, TU Dresden, Federal Republic of Germany
6 *
7 * Copyright (c) 1998-2005, Forschungszentrum Juelich, Juelich Supercomputing
8 * Centre, Federal Republic of Germany
9 *
10 * See the file COPYING in the package base directory for details
11 **/
12
13 #ifndef _VT_UNIFY_HOOKS_MSGMATCH_H_
14 #define _VT_UNIFY_HOOKS_MSGMATCH_H_
15
16 #include "vt_unify.h"
17 #include "vt_unify_hooks_base.h"
18 #include "vt_unify_lvector.hh"
19
20 #include "otfaux.h"
21
22 //
23 // HooksMsgMatchC class
24 //
25 class HooksMsgMatchC : public HooksBaseC
26 {
27 public:
28
29 // constructor
30 HooksMsgMatchC();
31
32 // destructor
33 ~HooksMsgMatchC();
34
35 // is this hook enabled?
36 static bool isEnabled() { return Params.domsgmatch; }
37
38 private:
39
40 //
41 // MatchContextC sub-class
42 //
43 class MatchContextC
44 {
45 public:
46
47 // constructor
48 MatchContextC();
49
50 // destructor
51 ~MatchContextC();
52
53 // provide a receive message for matching
54 inline void enqueueRecv( const uint64_t & time, const uint32_t & sender,
55 const uint32_t & receiver, const uint32_t & comm,
56 const uint32_t & tag, const uint32_t & length, const uint32_t & scl );
57
58 // try to match a send with the corresponding receive message
59 inline bool matchSend( const uint32_t & sender, const uint32_t & receiver,
60 const uint32_t & comm, const uint32_t & tag, uint64_t & recv_time,
61 uint32_t & length, uint32_t & scl );
62
63 private:
64
65 // release unused memory every N matched messages
66 static const uint64_t RELEASE_MEM_INTERVAL = 1000000;
67
68 // OTFAUX message matching context
69 OTFAUX_MsgMatching_Context * m_context;
70
71 // number of matched messages
72 uint64_t m_matchCount;
73
74 };
75
76 //
77 // receive message structure
78 //
79 struct RecvMsgS
80 {
81 // constructors
82 //
83 RecvMsgS()
84 : time( 0 ), sender( 0 ), receiver( 0 ), comm( 0 ), tag( 0 )
85 /*, length( 0 ), scl( 0 )*/ {}
86 RecvMsgS( const uint64_t & _time, const uint32_t & _sender,
87 const uint32_t & _receiver, const uint32_t & _comm,
88 const uint32_t & _tag
89 /*, const uint32_t & _length, const uint32_t & _scl*/ )
90 : time( _time ), sender( _sender ), receiver( _receiver ),
91 comm( _comm ), tag( _tag ) /*, length( _length ), scl( _scl )*/ {}
92
93 uint64_t time; // timestamp on which the recv. message event occurred
94 uint32_t sender; // sender process id
95 uint32_t receiver; // receiver process id
96 uint32_t comm; // comm. process group token
97 uint32_t tag; // message tag
98 /*uint32_t length;*/ // received bytes
99 /*uint32_t scl;*/ // source code location of recv. message event
100
101 };
102
103 // event record handlers
104 //
105
106 static int HandleEventComment( void * userData,
107 uint64_t time, uint32_t proc, const char * comment );
108
109 static int HandleRecvMsg( LargeVectorC<RecvMsgS*> * recvMsgs,
110 uint64_t time, uint32_t receiver, uint32_t sender,
111 uint32_t comm, uint32_t tag, uint32_t length, uint32_t scl );
112
113 // vvvvvvvvvvvvvvvvvvvv HOOK METHODS vvvvvvvvvvvvvvvvvvvv
114
115 // initialization/finalization hooks
116 //
117
118 void initHook();
119 void finalizeHook( const bool & error );
120
121 // phase hooks
122 //
123
124 void phaseHook_UnifyDefinitions_pre();
125 void phaseHook_UnifyEvents_pre();
126 void phaseHook_UnifyEvents_post();
127
128 // record hooks
129 //
130
131 void writeRecHook_SendMsg( HooksC::VaArgsT & args );
132 void writeRecHook_RecvMsg( HooksC::VaArgsT & args );
133
134 // ^^^^^^^^^^^^^^^^^^^^ HOOK METHODS ^^^^^^^^^^^^^^^^^^^^
135
136 // read receive messages
137 bool getRecvMsgs( LargeVectorC<RecvMsgS*> & recvMsgs );
138
139 #ifdef VT_MPI
140
141 // distribute receive messages to ranks which processes the corresponding
142 // sender streams
143 bool distRecvMsgs( LargeVectorC<RecvMsgS*> & recvMsgs );
144
145 #endif // VT_MPI
146
147 // enqueue receive messages to message matching context(s)
148 bool enqueueRecvMsgs( LargeVectorC<RecvMsgS*> & recvMsgs );
149
150 // global key tokens for matching receive timestamp, length, and
151 // source code location
152 //
153 enum { KEY_TIME /*, KEY_LENGTH, KEY_SCL*/ , KEY_NUM };
154 uint32_t m_keyTokens[KEY_NUM];
155
156 // maximum number of threads to use for unifying events
157 int m_maxThreads;
158
159 // array of message matching contexts (one for each thread)
160 MatchContextC * m_matchContexts;
161
162 };
163
164 #endif // _VT_UNIFY_HOOKS_MSGMATCH_H_
otfaux.h
Params
Definition: datastructs.h:41
OTFAUX_MsgMatching_Context
Definition: OTFAUX_MsgMatching.c:40
HooksBaseC
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_hooks_base.h:23
HooksMsgMatchC
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_hooks_msgmatch.h:25
HooksMsgMatchC::HooksMsgMatchC
HooksMsgMatchC()
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_hooks_msgmatch.cc:32