Changeset 23221
- Timestamp:
- 09/05/18 09:58:54 (7 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/c/classes/FemModel.cpp ¶
r23173 r23221 254 254 /*Before we delete the profiler, report statistics for this run: */ 255 255 profiler->Stop(TOTAL); //final tagging 256 256 257 _printf0_("\n"); 257 _printf0_(" "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<profiler->TotalTime(MPROCESSOR) << "\n"); 258 _printf0_(" "<<setw(40)<<left<<"Core solution elapsed time:"<<profiler->TotalTime(CORE) << "\n"); 259 _printf0_(" "<<setw(40)<<left<<"Solver elapsed time:"<<profiler->TotalTime(SOLVER) << "\n"); 258 _printf0_(" "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<setw(7)<<profiler->TotalTime(MPROCESSOR) << "\n"); 259 /*Total times*/ 260 _printf0_(" "<<setw(40)<<left<<"Total Core solution elapsed time:"<<setw(7)<<profiler->TotalTime(CORE) << "\n"); 261 /*Individual cores*/ 262 if(profiler->Used(STRESSBALANCECORE)) _printf0_(" "<<setw(40)<<left<<"Stress balance core elapsed time:"<<setw(7)<<profiler->TotalTime(STRESSBALANCECORE) << "\n"); 263 if(profiler->Used(MASSTRANSPORTCORE)) _printf0_(" "<<setw(40)<<left<<"Mass transport core elapsed time:"<<setw(7)<<profiler->TotalTime(MASSTRANSPORTCORE) << "\n"); 264 /*Linear solver only*/ 265 _printf0_(" "<<setw(40)<<left<<"Linear solver elapsed time:"<<setw(7)<<profiler->TotalTime(SOLVER) << " ("<<setprecision(2)<<profiler->TotalTime(SOLVER)/profiler->TotalTime(CORE)*100.<<"%)\n"); 260 266 _printf0_("\n"); 261 267 _printf0_(" Total elapsed time: " -
TabularUnified issm/trunk-jpl/src/c/classes/Profiler.cpp ¶
r23066 r23221 15 15 /*Profiler constructors and destructors:*/ 16 16 Profiler::Profiler(){/*{{{*/ 17 for(int i=0;i<MAX IMUMSIZE;i++){17 for(int i=0;i<MAXPROFSIZE;i++){ 18 18 this->time[i] = 0.; 19 19 this->time_start[i] = 0.; … … 23 23 this->memory_start[i] = 0.; 24 24 this->running[i] = false; 25 this->used[i] = false; 25 26 } 26 27 } /*}}}*/ … … 32 33 Profiler* output=new Profiler(); 33 34 34 for(int i=0;i<MAX IMUMSIZE;i++){35 for(int i=0;i<MAXPROFSIZE;i++){ 35 36 output->time[i] =this->time[i]; 36 37 output->flops[i] =this->flops[i]; … … 49 50 50 51 _printf_("Profiler:\n"); 51 for(int i=0;i<MAX IMUMSIZE;i++){52 for(int i=0;i<MAXPROFSIZE;i++){ 52 53 _printf_(" Tag "<<i<<":\n"); 53 54 _printf_(" flops: "<<this->flops[i]<<"\n"); … … 70 71 MARSHALLING_ENUM(ProfilerEnum); 71 72 pointer = &this->time[0]; 72 MARSHALLING_DYNAMIC(pointer,IssmPDouble,MAX IMUMSIZE);73 MARSHALLING_DYNAMIC(pointer,IssmPDouble,MAXPROFSIZE); 73 74 pointer = &this->flops[0]; 74 MARSHALLING_DYNAMIC(pointer,IssmPDouble,MAX IMUMSIZE);75 MARSHALLING_DYNAMIC(pointer,IssmPDouble,MAXPROFSIZE); 75 76 pointer = &this->memory[0]; 76 MARSHALLING_DYNAMIC(pointer,IssmPDouble,MAX IMUMSIZE);77 MARSHALLING_DYNAMIC(pointer,IssmPDouble,MAXPROFSIZE); 77 78 bpointer = &this->running[0]; 78 MARSHALLING_DYNAMIC(bpointer,bool,MAX IMUMSIZE);79 MARSHALLING_DYNAMIC(bpointer,bool,MAXPROFSIZE); 79 80 80 81 } /*}}}*/ … … 88 89 /*Get tag*/ 89 90 _assert_(tag>=0); 90 _assert_(tag<MAX IMUMSIZE);91 _assert_(tag<MAXPROFSIZE); 91 92 if(this->running[tag]) _error_("Tag "<<tag<<" has not been stopped"); 92 93 … … 97 98 /*Get tag*/ 98 99 _assert_(tag>=0); 99 _assert_(tag<MAX IMUMSIZE);100 _assert_(tag<MAXPROFSIZE); 100 101 if(this->running[tag]) _error_("Tag "<<tag<<" has not been stopped"); 101 102 … … 130 131 /*Get initial flops*/ 131 132 _assert_(tag>=0); 132 _assert_(tag<MAX IMUMSIZE);133 _assert_(tag<MAXPROFSIZE); 133 134 if(this->running[tag]) _error_("Tag "<<tag<<" has not been stopped"); 134 135 … … 140 141 /*Check tag*/ 141 142 _assert_(tag>=0); 142 _assert_(tag<MAX IMUMSIZE);143 _assert_(tag<MAXPROFSIZE); 143 144 if(this->running[tag]) _error_("Tag "<<tag<<" is already running"); 144 145 … … 167 168 /*Plug into this->time: */ 168 169 _assert_(tag>=0); 169 _assert_(tag<MAX IMUMSIZE);170 _assert_(tag<MAXPROFSIZE); 170 171 this->time_start[tag] = t; 171 172 this->flops_start[tag] = f; … … 174 175 /*turn on running*/ 175 176 this->running[tag] = true; 177 this->used[tag] = true; 176 178 }/*}}}*/ 177 179 void Profiler::Stop(int tag,bool dontmpisync){/*{{{*/ … … 179 181 /*Check tag*/ 180 182 _assert_(tag>=0); 181 _assert_(tag<MAX IMUMSIZE);183 _assert_(tag<MAXPROFSIZE); 182 184 if(!this->running[tag]) _error_("Tag "<<tag<<" is not running"); 183 185 … … 206 208 /*Plug into this->time: */ 207 209 _assert_(tag>=0); 208 _assert_(tag<MAX IMUMSIZE);210 _assert_(tag<MAXPROFSIZE); 209 211 this->time[tag] += t - this->time_start[tag]; 210 212 this->flops[tag] += f - this->flops_start[tag]; … … 214 216 this->running[tag] = false; 215 217 }/*}}}*/ 218 bool Profiler::Used(int tag){/*{{{*/ 219 220 /*Check tag*/ 221 _assert_(tag>=0); 222 _assert_(tag<MAXPROFSIZE); 223 return this->used[tag]; 224 }/*}}}*/ -
TabularUnified issm/trunk-jpl/src/c/classes/Profiler.h ¶
r22551 r23221 11 11 12 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 MAXIMUMSIZE 5 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 STRESSBALANCECORE 5 /*Profiling AD */ 19 #define MASSTRANSPORTCORE 6 /*Profiling AD */ 20 #define MAXPROFSIZE 7 /*Used to initialize static arrays*/ 19 21 20 22 class Profiler: public Object{ 21 23 22 24 public: 23 IssmPDouble flops[MAXIMUMSIZE]; 24 IssmPDouble flops_start[MAXIMUMSIZE]; 25 IssmPDouble memory[MAXIMUMSIZE]; 26 IssmPDouble memory_start[MAXIMUMSIZE]; 27 IssmPDouble time[MAXIMUMSIZE]; 28 IssmPDouble time_start[MAXIMUMSIZE]; 29 bool running[MAXIMUMSIZE]; 25 IssmPDouble flops[MAXPROFSIZE]; 26 IssmPDouble flops_start[MAXPROFSIZE]; 27 IssmPDouble memory[MAXPROFSIZE]; 28 IssmPDouble memory_start[MAXPROFSIZE]; 29 IssmPDouble time[MAXPROFSIZE]; 30 IssmPDouble time_start[MAXPROFSIZE]; 31 bool running[MAXPROFSIZE]; 32 bool used[MAXPROFSIZE]; 30 33 31 34 /*Profiler constructors, destructors */ … … 50 53 void Start(int tagenum,bool dontmpisync=false); 51 54 void Stop(int tagenum,bool dontmpisync=false); 55 bool Used(int tagenum); 52 56 }; 53 57 -
TabularUnified issm/trunk-jpl/src/c/cores/masstransport_core.cpp ¶
r23066 r23221 11 11 12 12 void masstransport_core(FemModel* femmodel){ 13 14 /*Start profiler*/ 15 femmodel->profiler->Start(MASSTRANSPORTCORE); 13 16 14 17 /*parameters: */ … … 81 84 /*Free ressources:*/ 82 85 if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);} 86 87 /*profiler*/ 88 femmodel->profiler->Stop(MASSTRANSPORTCORE); 83 89 } -
TabularUnified issm/trunk-jpl/src/c/cores/stressbalance_core.cpp ¶
r23215 r23221 12 12 13 13 void stressbalance_core(FemModel* femmodel){ 14 15 /*Start profiler*/ 16 femmodel->profiler->Start(STRESSBALANCECORE); 14 17 15 18 /*parameters: */ … … 86 89 /*Free ressources:*/ 87 90 if(numoutputs){for(int i=0;i<numoutputs;i++){xDelete<char>(requested_outputs[i]);} xDelete<char*>(requested_outputs);} 91 92 /*End profiler*/ 93 femmodel->profiler->Stop(STRESSBALANCECORE); 88 94 }
Note:
See TracChangeset
for help on using the changeset viewer.