Highly Efficient FFT for Exascale: HeFFTe v2.4
Toggle main menu visibility
Loading...
Searching...
No Matches
heffte_trace.h
1
/*
2
-- heFFTe --
3
Univ. of Tennessee, Knoxville
4
@date
5
*/
6
7
#ifndef HEFFTE_TRACE_H
8
#define HEFFTE_TRACE_H
9
10
#include "heffte_utils.h"
11
45
46
namespace
heffte
{
47
48
#ifdef Heffte_ENABLE_TRACING
56
struct
event
{
58
std::string
name
;
60
double
start_time
;
62
double
duration
;
63
};
64
69
extern
std::deque<event>
event_log
;
74
extern
std::string
log_filename
;
75
84
struct
add_trace
{
86
add_trace
(std::string s) :
name
(s),
start_time
(MPI_Wtime()){}
88
~add_trace
(){
89
double
duration = MPI_Wtime() -
start_time
;
90
event_log
.push_back({std::move(
name
),
start_time
, duration});
91
}
92
93
std::string
name
;
95
double
start_time
;
96
};
97
102
inline
void
init_tracing
(std::string root_filename){
103
event_log
= std::deque<event>();
104
log_filename
= root_filename +
"_"
+ std::to_string(
mpi::world_rank
()) +
".log"
;
105
}
106
111
inline
void
finalize_tracing
(){
112
std::ofstream ofs(
log_filename
);
113
ofs.precision(12);
114
115
for
(
auto
const
&e :
event_log
)
116
ofs << std::setw(40) << e.name << std::setw(20) << e.start_time << std::setw(20) << e.duration <<
"\n"
;
117
}
118
119
#else
120
121
struct
add_trace{
122
add_trace
(std::string){}
123
};
124
inline
void
init_tracing
(std::string){}
125
inline
void
finalize_tracing
(){}
126
127
#endif
128
129
}
130
131
#endif
// #ifndef HEFFTE_TRACE_H
heffte::mpi::world_rank
bool world_rank(int rank)
Returns true if this process has the me rank within the MPI_COMM_WORLD (useful for debugging).
Definition
heffte_utils.h:98
heffte::finalize_tracing
void finalize_tracing()
Finalize tracing and write the result to a file, see the Detailed Description.
Definition
heffte_trace.h:111
heffte::event_log
std::deque< event > event_log
Logs the list of events (declared in heffte_reshape3d.cpp).
heffte::log_filename
std::string log_filename
Root filename to write out the traces (decaled in heffte_reshape3d.cpp).
heffte::init_tracing
void init_tracing(std::string root_filename)
Initialize tracing and remember the root filename for output, see the Detailed Description.
Definition
heffte_trace.h:102
heffte
Namespace containing all HeFFTe methods and classes.
Definition
heffte_backend_cuda.h:38
heffte::add_trace::add_trace
add_trace(std::string s)
Defines a trace.
Definition
heffte_trace.h:86
heffte::add_trace::name
std::string name
Defines the name of a trace.
Definition
heffte_trace.h:93
heffte::add_trace::~add_trace
~add_trace()
Saves a trace.
Definition
heffte_trace.h:88
heffte::add_trace::start_time
double start_time
Saves the starting wall-clock-time of the trace.
Definition
heffte_trace.h:95
heffte::event
A tracing event.
Definition
heffte_trace.h:56
heffte::event::duration
double duration
Duration according to the MPI high-precision clock.
Definition
heffte_trace.h:62
heffte::event::start_time
double start_time
Start time according to MPI high-precision clock.
Definition
heffte_trace.h:60
heffte::event::name
std::string name
Name of the event.
Definition
heffte_trace.h:58
include
heffte_trace.h
Generated by
1.17.0