OpenMPI 0.1.1

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

- File List
- Globals

vt_unify_esync.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_ESYNC_H_
14 #define _VT_UNIFY_ESYNC_H_
15
16 #include "config.h"
17
18 #include "vt_inttypes.h"
19
20 #include <list>
21 #include <map>
22 #include <string>
23 #include <vector>
24
25 //
26 // ETimeSyncC class
27 //
28 class ETimeSyncC
29 {
30 public:
31
32 //
33 // synchronization phase structure
34 //
35 struct SyncPhaseS
36 {
37 SyncPhaseS()
38 : mapid( 0 ), time( 0 ), duration( 0 ) {}
39
40 SyncPhaseS( const uint32_t & _mapid, const uint64_t & _time,
41 const uint64_t & _duration )
42 : mapid( _mapid ), time( _time ), duration( _duration ) {}
43
44 uint32_t mapid;
45 uint64_t time;
46 uint64_t duration;
47 };
48
49 //
50 // synchronization timestamp structure
51 //
52 struct SyncTimeS
53 {
54 SyncTimeS()
55 : phase_idx ( 0 )
56 {
57 t[0] = t[1] = t[2] = t[3] = 0;
58 }
59
60 ~SyncTimeS() {}
61
62 uint64_t t[4];
63 uint32_t phase_idx;
64 };
65
66 // constructor
67 ETimeSyncC();
68
69 // destructor
70 ~ETimeSyncC();
71
72 // calculate timer parameters
73 bool initialize();
74
75 // update timer parameters of certain process
76 void updateSyncParam( const uint32_t & proc );
77
78 // reset timer parameters of certain process
79 void resetSyncParam( const uint32_t & proc );
80
81 // set start time of certain stream
82 void setStartTime( const uint32_t & streamId, const uint64_t & startTime )
83 {
84 m_streamId2StartTime.insert(
85 std::make_pair( streamId, startTime ) );
86 }
87
88 // get start time of certain stream
89 uint64_t getStartTime( const uint32_t & streamId ) const
90 {
91 std::map<uint32_t, uint64_t>::const_iterator it =
92 m_streamId2StartTime.find( streamId );
93 assert( it != m_streamId2StartTime.end() );
94
95 return it->second;
96 }
97
98 private:
99
100 //
101 // sychronization parameter structure
102 //
103 struct SyncParamS
104 {
105 SyncParamS()
106 : offset( 0 ), drift( 1.0 ) {}
107
108 SyncParamS( const int64_t & _offset, const double & _drift )
109 : offset( _offset ), drift( _drift ) {}
110
111 ~SyncParamS() {}
112
113 int64_t offset;
114 double drift;
115 };
116
117 bool calcSync( uint32_t round,
118 std::map<std::pair<uint32_t, uint32_t>, SyncTimeS*> & firstTimeStamps,
119 std::map<std::pair<uint32_t, uint32_t>, SyncTimeS*> & lastTimeStamps );
120
121 void print(double *a, int m, int n, char* info);
122
123 #ifdef VT_MPI
124
125 bool distStartTimes();
126
127 #endif // VT_MPI
128
129 std::map<uint32_t, std::map<std::pair<uint32_t, uint32_t>, SyncTimeS*>*>
130 m_syncPhasemapProcessIds2Timestamps;
131 std::map<uint32_t, std::vector<struct SyncParamS*>*> m_idxvecSyncParam;
132 std::map<uint32_t, uint64_t> m_streamId2StartTime;
133 std::vector<double> m_syncPreCorrection;
134 std::map<uint32_t, uint32_t> m_streamId2RoundNum;
135 uint32_t m_procNum;
136 uint32_t m_roundMax;
137
138 };
139
140 #endif // _VT_UNIFY_ESYNC_H_
ETimeSyncC
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_esync.h:28
ETimeSyncC::SyncTimeS
Definition: vt_unify_esync.h:52
ETimeSyncC::SyncPhaseS
Definition: vt_unify_esync.h:35