OpenMPI  0.1.1
vt_filter_common.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_FILTER_COMMON_H_
14 #define _VT_FILTER_COMMON_H_
15 
16 #include "vt_inttypes.h"
17 
18 #ifdef VT_MPI
19 # include "vt_defs.h" // to get VT_MPI_INT
20 # include "mpi.h"
21 #endif // VT_MPI
22 
23 //
24 // FilterCommonC class
25 //
27 {
28 public:
29 
30  // contructor
31  FilterCommonC();
32 
33  // destructor
34  virtual ~FilterCommonC();
35 
36 protected:
37 
38  // prepare progress
39  void prepareProgress( const uint64_t& maxBytes );
40 
41  // update progress
42  void updateProgress( const uint64_t& deltaBytes, bool wait = false );
43 
44  // finish progress
45  void finishProgress( void );
46 
47 #ifdef VT_MPI
48  // get number and communicator of worker ranks
49  void getWorkerComm( const uint32_t& maxWorkers );
50 
51  // communicator of worker ranks
52  MPI_Comm m_workerComm;
53 
54  // number of worker ranks
55  VT_MPI_INT m_numWorkerRanks;
56 #endif // VT_MPI
57 
58 private:
59 
60  //
61  // data structure for progress
62  //
63  struct ProgressS
64  {
65  // contructor
66  ProgressS()
67  : curBytes( 0 ), maxBytes( 0 )
68 #ifdef VT_MPI
69  , sendRequest( MPI_REQUEST_NULL ), recvBuffers( 0 ), recvRequests( 0 ),
70  recvStatuses( 0 ), recvIndices( 0 ), rankCurBytes( 0 ), ranksLeft( 0 )
71 #endif // VT_MPI
72  {}
73 
74  uint64_t curBytes; // current bytes read
75  uint64_t maxBytes; // max. bytes readable
76 
77 #ifdef VT_MPI
78  // The following variables are significant for the MPI-parallel version of
79  // vtfilter to get the progresses of all worker ranks.
80 
81  static const VT_MPI_INT msgTag = 500; // message tag
82 
83  MPI_Request sendRequest; // sender request handle
84 
85  uint64_t* recvBuffers; // receive buffers
86  MPI_Request* recvRequests; // persistent receive request handles
87  MPI_Status* recvStatuses; // receive statuses
88  VT_MPI_INT* recvIndices; // indices of completed receive operations
89 
90  uint64_t* rankCurBytes; // current bytes read per rank (except rank 0)
91  uint32_t ranksLeft; // root keeps track of ranks left to quary
92 #endif // VT_MPI
93 
94  };
95 
96  // storage of progress information
97  ProgressS m_progress;
98 
99 };
100 
101 #endif // _VT_FILTER_COMMON_H_
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_filter_common.h:26
Definition: mpi.h:337
FilterCommonC()
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_filter_common.cc:26
Definition: communicator.h:118
Main top-level request struct definition.
Definition: request.h:100