-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmpid.hh
102 lines (81 loc) · 3 KB
/
mpid.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2018, Lawrence Livermore National Security, LLC.
// Produced at the Lawrence Livermore National Laboratory.
//
// Written by Emilio Castillo <ecastill@bsc.es>.
// LLNL-CODE-745958. All rights reserved.
//
// This file is part of Loupe. For details, see:
// https://github.com/LLNL/loupe
// Please also read the LICENSE file for the MIT License notice.
//////////////////////////////////////////////////////////////////////////////
#ifndef __MPID_HH
#define __MPID_HH
#include <map>
#include <string>
#include <vector>
#include <sys/time.h>
class mpid_data_stats {
public:
mpid_data_stats(std::string p_section_name, std::string* p_call_names);
void mpid_init();
void mpid_finalize();
void mpid_call_start(int p_name);
uint64_t mpid_call_end(int p_name);
void mpid_call_stats(int p_count, int p_datatype, uint64_t p_time, int p_name);
void mpid_traffic_pattern(int dest, int p_count, int p_datatype, int comm, int p_name);
void mpid_add_communicator(MPI_Comm* newcomm);
bool is_me(int rank, MPI_Comm newcomm);
/**
* Functions to get the profile data as matrices for hdf5 output
*/
uint64_t app_time(){return m_app_time;}
uint64_t mpi_time(){return m_mpi_acc_time;}
uint64_t n_mpi_calls(){ return m_global_call_data.size();}
uint64_t n_mpi_callsites(){ return m_mpi_call_data.size();}
uint64_t size_pattern(){ return m_pattern.size();}
uint64_t size_call_pattern();
void calls_data(uint64_t *p_data_out);
void callsites_data(uint64_t *p_data_out);
void pattern_data(uint64_t *p_data_out);
void call_pattern_data(uint64_t *p_data_out);
private:
mpid_data_stats(const mpid_data_stats&);
mpid_data_stats& operator=(const mpid_data_stats&);
// Rank for this process in the comm world
int m_rank;
int m_num_ranks;
// Map that had the rank in every comunicator
// its mostly a translation table
std::map<uint64_t,std::vector<int>> m_comm_rank;
// Stores my rank in every communicator I'm in
std::map<uint64_t, int> m_my_comm_ranks;
struct mpi_call_t{
uint64_t m_kbytes_sent;
uint64_t m_total_calls;
uint64_t m_time_spent;
int m_name;
};
std::map<uint64_t, mpi_call_t> m_mpi_call_data;
//Int are the calls identifier
std::map<int, mpi_call_t> m_global_call_data;
struct mpi_pattern_t{
uint64_t m_kbytes;
//Get the name for the per call patterns
uint64_t m_comm;
uint64_t m_count;
int m_name;
};
std::map<int,mpi_pattern_t> m_pattern;
//PC, <DEST NODE, KBYTES SENT>
std::map<uint64_t, std::map<int,mpi_pattern_t>> m_call_pattern;
struct timeval m_timer_start, m_timer_end;
//This is for MPI functions
struct timeval m_func_timer_start, m_func_timer_end;
uint64_t m_app_time;
uint64_t m_mpi_acc_time;
std::string m_section_name;
std::string* m_call_names;
bool m_enabled;
};
#endif