| 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 OCEANTRANSPORTCORE 11 /*Profiling OCEANTRANSPORT */
|
|---|
| 25 | #define SMBCORE 12 /*Profiling SMB */
|
|---|
| 26 | #define GROUNDINGLINECORE 13 /*Profiling GROUDINGLINE MIGRATION */
|
|---|
| 27 | #define ESACORE 14 /*Profiling ESA */
|
|---|
| 28 | #define SLRCORE 15 /*Profiling SLR */
|
|---|
| 29 | #define SAMPLINGCORE 16 /*Profiling SAMPLING */
|
|---|
| 30 | #define MPISERIAL 17 /*Profiling MPISerial */
|
|---|
| 31 | #define SEDLOOP 18 /*Profiling MPISerial */
|
|---|
| 32 | #define SEDMatrix 19 /*Profiling MPISerial */
|
|---|
| 33 | #define SEDUpdate 20 /*Profiling MPISerial */
|
|---|
| 34 | #define EPLLOOP 21 /*Profiling MPISerial */
|
|---|
| 35 | #define EPLMasking 22 /*Profiling MPISerial */
|
|---|
| 36 | #define EPLMatrices 23 /*Profiling MPISerial */
|
|---|
| 37 | #define EPLUpdate 24 /*Profiling MPISerial */
|
|---|
| 38 | #define MAXPROFSIZE 25 /*Used to initialize static arrays*/
|
|---|
| 39 |
|
|---|
| 40 | class Profiler: public Object{
|
|---|
| 41 |
|
|---|
| 42 | public:
|
|---|
| 43 | IssmPDouble flops[MAXPROFSIZE];
|
|---|
| 44 | IssmPDouble flops_start[MAXPROFSIZE];
|
|---|
| 45 | IssmPDouble memory[MAXPROFSIZE];
|
|---|
| 46 | IssmPDouble memory_start[MAXPROFSIZE];
|
|---|
| 47 | IssmPDouble time[MAXPROFSIZE];
|
|---|
| 48 | IssmPDouble time_start[MAXPROFSIZE];
|
|---|
| 49 | bool running[MAXPROFSIZE];
|
|---|
| 50 | bool used[MAXPROFSIZE];
|
|---|
| 51 |
|
|---|
| 52 | /*Profiler constructors, destructors */
|
|---|
| 53 | Profiler();
|
|---|
| 54 | ~Profiler();
|
|---|
| 55 |
|
|---|
| 56 | /*Object virtual functions definitions*/
|
|---|
| 57 | Object *copy();
|
|---|
| 58 | void DeepEcho();
|
|---|
| 59 | void Echo();
|
|---|
| 60 | int Id();
|
|---|
| 61 | void Marshall(MarshallHandle* marshallhandle);
|
|---|
| 62 | int ObjectEnum();
|
|---|
| 63 |
|
|---|
| 64 | /*Profiler routines*/
|
|---|
| 65 | IssmPDouble TotalFlops(int tag);
|
|---|
| 66 | IssmPDouble TotalTime(int tag);
|
|---|
| 67 | int TotalTimeModHour(int tag);
|
|---|
| 68 | int TotalTimeModMin(int tag);
|
|---|
| 69 | int TotalTimeModSec(int tag);
|
|---|
| 70 | IssmPDouble Memory(int tag);
|
|---|
| 71 | void Start(int tagenum,bool dontmpisync=true); /*Do not call MPI barrier by default to save some ms*/
|
|---|
| 72 | void Stop(int tagenum, bool dontmpisync=true); /*Do not call MPI barrier by default to save some ms*/
|
|---|
| 73 | bool Used(int tagenum);
|
|---|
| 74 | };
|
|---|
| 75 |
|
|---|
| 76 | #endif /* _PROFILER_H_ */
|
|---|