1 | /*!\file Profiler.h
|
---|
2 | * \brief: header file for node object
|
---|
3 | */
|
---|
4 |
|
---|
5 | #ifndef _PROFILER_H_
|
---|
6 | #define _PROFILER_H_
|
---|
7 |
|
---|
8 | /*Headers:*/
|
---|
9 | #include "../shared/shared.h"
|
---|
10 | #include "../datastructures/datastructures.h"
|
---|
11 |
|
---|
12 | /*Macros*/
|
---|
13 | #define TOTAL 0 /*Profiling Total time */
|
---|
14 | #define MPROCESSOR 1 /*Profiling Model processor*/
|
---|
15 | #define CORE 2 /*Profiling solution */
|
---|
16 | #define SOLVER 3 /*Profiling solution */
|
---|
17 | #define ADCORE 4 /*Profiling AD */
|
---|
18 | #define THERMALCORE 5 /*Profiling THERMAL */
|
---|
19 | #define HYDROLOGYCORE 6 /*Profiling HYDROLOGY */
|
---|
20 | #define STRESSBALANCECORE 7 /*Profiling STRESSBALANCE */
|
---|
21 | #define DAMAGECORE 8 /*Profiling DAMAGE */
|
---|
22 | #define MOVINGFRONTCORE 9 /*Profiling MOVINGFRONT */
|
---|
23 | #define MASSTRANSPORTCORE 10 /*Profiling MASSTRANSPORT */
|
---|
24 | #define MMEMASSTRANSPORTCORE 11 /*Profiling MMEMASSTRANSPORT */
|
---|
25 | #define OCEANTRANSPORTCORE 12 /*Profiling OCEANTRANSPORT */
|
---|
26 | #define SMBCORE 13 /*Profiling SMB */
|
---|
27 | #define GROUNDINGLINECORE 14 /*Profiling GROUDINGLINE MIGRATION */
|
---|
28 | #define ESACORE 15/*Profiling ESA */
|
---|
29 | #define SLRCORE 16 /*Profiling SLR */
|
---|
30 | #define SAMPLINGCORE 17 /*Profiling SAMPLING */
|
---|
31 | #define MPISERIAL 18 /*Profiling MPISerial */
|
---|
32 | #define SEDLOOP 19 /*Profiling MPISerial */
|
---|
33 | #define SEDMatrix 20 /*Profiling MPISerial */
|
---|
34 | #define SEDUpdate 21 /*Profiling MPISerial */
|
---|
35 | #define EPLLOOP 22 /*Profiling MPISerial */
|
---|
36 | #define EPLMasking 23 /*Profiling MPISerial */
|
---|
37 | #define EPLMatrices 24 /*Profiling MPISerial */
|
---|
38 | #define EPLUpdate 25 /*Profiling MPISerial */
|
---|
39 | #define MAXPROFSIZE 26 /*Used to initialize static arrays*/
|
---|
40 |
|
---|
41 | class Profiler: public Object{
|
---|
42 |
|
---|
43 | public:
|
---|
44 | IssmPDouble flops[MAXPROFSIZE];
|
---|
45 | IssmPDouble flops_start[MAXPROFSIZE];
|
---|
46 | IssmPDouble memory[MAXPROFSIZE];
|
---|
47 | IssmPDouble memory_start[MAXPROFSIZE];
|
---|
48 | IssmPDouble time[MAXPROFSIZE];
|
---|
49 | IssmPDouble time_start[MAXPROFSIZE];
|
---|
50 | bool running[MAXPROFSIZE];
|
---|
51 | bool used[MAXPROFSIZE];
|
---|
52 |
|
---|
53 | /*Profiler constructors, destructors */
|
---|
54 | Profiler();
|
---|
55 | ~Profiler();
|
---|
56 |
|
---|
57 | /*Object virtual functions definitions*/
|
---|
58 | Object *copy();
|
---|
59 | void DeepEcho();
|
---|
60 | void Echo();
|
---|
61 | int Id();
|
---|
62 | void Marshall(MarshallHandle* marshallhandle);
|
---|
63 | int ObjectEnum();
|
---|
64 |
|
---|
65 | /*Profiler routines*/
|
---|
66 | IssmPDouble TotalFlops(int tag);
|
---|
67 | IssmPDouble TotalTime(int tag);
|
---|
68 | int TotalTimeModHour(int tag);
|
---|
69 | int TotalTimeModMin(int tag);
|
---|
70 | int TotalTimeModSec(int tag);
|
---|
71 | IssmPDouble Memory(int tag);
|
---|
72 | void Start(int tagenum,bool dontmpisync=true); /*Do not call MPI barrier by default to save some ms*/
|
---|
73 | void Stop(int tagenum, bool dontmpisync=true); /*Do not call MPI barrier by default to save some ms*/
|
---|
74 | bool Used(int tagenum);
|
---|
75 | };
|
---|
76 |
|
---|
77 | #endif /* _PROFILER_H_ */
|
---|