Changeset 13554


Ignore:
Timestamp:
10/05/12 11:22:30 (12 years ago)
Author:
Eric.Larour
Message:

CHG:

  • profiling is now done entirely inside the FemModel methods
  • moved globals into issm.h
  • PrintBanner a new routine to dump ISSM specific information.
Location:
issm/trunk-jpl/src/c
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/Makefile.am

    r13549 r13554  
    343343                                        ./modules/InputConvergencex/InputConvergencex.cpp\
    344344                                        ./modules/InputConvergencex/InputConvergencex.h\
     345                                        ./solutions/PrintBanner.cpp\
    345346                                        ./solutions/convergence.cpp\
    346347                                        ./solutions/ProcessArguments.cpp\
  • issm/trunk-jpl/src/c/classes/FemModel.cpp

    r13553 r13554  
    171171        delete parameters;
    172172        delete results;
     173
     174        /*Before we delete the profiler, report statistics for this run: */
     175        profiler->Tag(Finish);  //final tagging
     176        _pprintLine_("");
     177        _pprintLine_("   "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<profiler->DeltaTime(StartInit,FinishInit));
     178        _pprintLine_("   "<<setw(40)<<left<<"Core solution elapsed time:"<<profiler->DeltaTime(StartCore,FinishCore));
     179        _pprintLine_("");
     180        _pprintLine_("   Total elapsed time:"
     181                        <<profiler->DeltaTimeModHour(Start,Finish)<<" hrs "
     182                        <<profiler->DeltaTimeModMin(Start,Finish)<<" min "
     183                        <<profiler->DeltaTimeModSec(Start,Finish)<<" sec"
     184                        );
     185        _pprintLine_("");
     186
     187        /*Now delete: */
    173188        delete profiler;
    174189
     
    177192
    178193/*Object management*/
     194/*FUNCTION FemModel::OutputResults {{{*/
     195void FemModel::OutputResults(void){
     196       
     197        _pprintLine_("write results to disk:");
     198
     199        /*Just call the OutputResultsx module: */
     200        OutputResultsx(this->elements, this->nodes, this->vertices, this->loads, this->materials, this->parameters,this->results);
     201
     202}
     203/*}}}*/
    179204/*FUNCTION FemModel::Solve {{{*/
    180205void FemModel::Solve(void){
    181206
     207        /*profiling: */
     208        bool profiling = false;
     209        IssmDouble solution_time;
     210        IssmDouble solution_flops;
     211        IssmDouble solution_memory;
     212
     213        /*solution: */
    182214        int solution_type;
    183215        void (*solutioncore)(FemModel*)=NULL; //core solution function pointer
     
    186218
    187219        /*Retrieve solution_type from parameters: */
    188         this->parameters->FindParam(&solution_type,SolutionTypeEnum);
     220        parameters->FindParam(&solution_type,SolutionTypeEnum);
    189221
    190222        /*Figure out which solution core we are going to run with the current solution type: */
     
    201233        profiler->Tag(FinishAdCore);
    202234
     235        /*some profiling results for the core: */
     236        parameters->FindParam(&profiling,DebugProfilingEnum);
     237        if(profiling){
     238
     239                solution_time=profiler->DeltaTime(StartCore,FinishCore);
     240                solution_flops=profiler->DeltaFlops(StartCore,FinishCore);
     241                solution_memory=profiler->Memory(FinishCore);
     242
     243                _pprintLine_("Solution elapsed time  : " << solution_time << "  Seconds");
     244                _pprintLine_("Solution elapsed flops : " << solution_flops << "  Flops");
     245                _pprintLine_("Solution memory used   : " << solution_memory << "  Bytes");
     246
     247                /*Add to results: */
     248                results->AddObject(new GenericExternalResult<IssmDouble>(results->Size()+1, ProfilingSolutionTimeEnum, solution_time, 1, 0));
     249                results->AddObject(new GenericExternalResult<IssmDouble>(results->Size()+1, ProfilingCurrentMemEnum, solution_memory, 1, 0));
     250                results->AddObject(new GenericExternalResult<IssmDouble>(results->Size()+1, ProfilingCurrentFlopsEnum, solution_flops, 1, 0));
     251        }
    203252
    204253}
  • issm/trunk-jpl/src/c/classes/FemModel.h

    r13553 r13554  
    5454                void Echo();
    5555                void Solve(void);
     56                void OutputResults(void);
    5657
    5758                /*Fem: */
  • issm/trunk-jpl/src/c/issm.h

    r12835 r13554  
    1212#endif
    1313
     14#include "./include/globals.h" //only include this header file once!
    1415#include "./include/include.h"
    1516#include "./shared/shared.h"
  • issm/trunk-jpl/src/c/solutions/issm.cpp

    r13553 r13554  
    11/*!\file:  issm.cpp
    2  * \brief: ISSM main parallel program
     2 * \brief: ISSM main program
    33 */
    44
    55#include "../issm.h"
    6 #include "../include/globals.h"
    76       
    8 void ProfilerEcho(Profiler* profiler);
    9 void ProfilerEnd(Profiler* profiler, Results* results, Parameters* parameters);
    10 
    117int main(int argc,char **argv){
    128
    13         /*FemModel: */
    14         FemModel *femmodel = NULL;
    15 
    16         /*Print starting banner: {{{*/
    17         _pprintLine_("");
    18         _pprintLine_("Ice Sheet System Model (" << PACKAGE_NAME << ") version " << PACKAGE_VERSION);
    19         _pprintLine_("(website: " << PACKAGE_URL << " contact: " << PACKAGE_BUGREPORT << ")");
    20         _pprintLine_("");
    21         /*}}}*/
     9        /*Print starting banner:*/
     10        PrintBanner();
    2211
    2312        /*Initialize exception trapping: */
     
    2817               
    2918        /*Initialize femmodel from arguments provided command line: */
    30         femmodel=new FemModel(argc,argv);
     19        FemModel *femmodel = new FemModel(argc,argv);
    3120
    3221        /*Solve: */
    3322        femmodel->Solve();
    3423
    35         /*Some profiling: */
    36         ProfilerEnd(femmodel->profiler,femmodel->results,femmodel->parameters);
    37 
    38         _pprintLine_("write results to disk:");
    39         OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
    40        
    41         /*Profiling at the end: */
    42         femmodel->profiler->Tag(Finish);
    43         ProfilerEcho(femmodel->profiler);
     24        /*Output results: */
     25        femmodel->OutputResults();
    4426       
    4527        /*Wrap up: */
     
    5537        return 0;
    5638}
    57        
    58 void ProfilerEcho(Profiler* profiler){ /*{{{*/
    59 
    60         _pprintLine_("");
    61         _pprintLine_("   "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<profiler->DeltaTime(StartInit,FinishInit));
    62         _pprintLine_("   "<<setw(40)<<left<<"Core solution elapsed time:"<<profiler->DeltaTime(StartCore,FinishCore));
    63         _pprintLine_("");
    64         _pprintLine_("   Total elapsed time:"
    65                 <<profiler->DeltaTimeModHour(Start,Finish)<<" hrs "
    66                 <<profiler->DeltaTimeModMin(Start,Finish)<<" min "
    67                 <<profiler->DeltaTimeModSec(Start,Finish)<<" sec"
    68                 );
    69         _pprintLine_("");
    70 
    71 } /*}}}*/
    72 void ProfilerEnd(Profiler* profiler, Results* results, Parameters* parameters){ /*{{{*/
    73 
    74         bool profiling = false;
    75        
    76         IssmDouble solution_time;
    77         IssmDouble solution_flops;
    78         IssmDouble solution_memory;
    79 
    80         parameters->FindParam(&profiling,DebugProfilingEnum);
    81 
    82         if(profiling){
    83 
    84                 solution_time=profiler->DeltaTime(StartCore,FinishCore);
    85                 solution_flops=profiler->DeltaFlops(StartCore,FinishCore);
    86                 solution_memory=profiler->Memory(FinishCore);
    87 
    88                 _pprintLine_("Solution elapsed time  : " << solution_time << "  Seconds");
    89                 _pprintLine_("Solution elapsed flops : " << solution_flops << "  Flops");
    90                 _pprintLine_("Solution memory used   : " << solution_memory << "  Bytes");
    91 
    92                 /*Add to results: */
    93                 results->AddObject(new GenericExternalResult<IssmDouble>(results->Size()+1, ProfilingSolutionTimeEnum, solution_time, 1, 0));
    94                 results->AddObject(new GenericExternalResult<IssmDouble>(results->Size()+1, ProfilingCurrentMemEnum, solution_memory, 1, 0));
    95                 results->AddObject(new GenericExternalResult<IssmDouble>(results->Size()+1, ProfilingCurrentFlopsEnum, solution_flops, 1, 0));
    96         }
    97 
    98 } /*}}}*/
  • issm/trunk-jpl/src/c/solutions/kriging.cpp

    r13534 r13554  
    44
    55#include "../issm.h"
    6 #include "../include/globals.h"
    76
    87/*Local prototypes*/
  • issm/trunk-jpl/src/c/solutions/solutions.h

    r13545 r13554  
    5050void EnvironmentFinalize(void);
    5151int  DakotaSpawnCore(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, void* femmodel,int counter);
     52void PrintBanner(void);
    5253
    5354//solution configuration
Note: See TracChangeset for help on using the changeset viewer.