Changeset 13534


Ignore:
Timestamp:
10/04/12 12:22:14 (12 years ago)
Author:
Eric.Larour
Message:

NEW and CHG:
added new enums in src/m/enum. Please run source Synchronize.sh when adding new enums in EnumDefinitions.h
new Profiler object that stores unlimited number of tags. easier to handle time profiling anywhere in the
code.
debugged EnvironmentInit, which was duplicating external symbols.
new EnvironmentFinalize, to simplify finalization of environment variables like Petsc and MPI.
simplified issm.cpp accordingly with new Profiler capabilitlie.s

Location:
issm/trunk-jpl/src
Files:
6 added
11 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/EnumDefinitions/EnumDefinitions.h

    r13521 r13534  
    323323        PentaEnum,
    324324        PentaP1InputEnum,
     325        ProfilerEnum,
    325326        MatrixParamEnum,
    326327        VectorParamEnum,
  • issm/trunk-jpl/src/c/Makefile.am

    r13530 r13534  
    159159                                        ./classes/objects/Params/DataSetParam.h\
    160160                                        ./classes/objects/Params/DataSetParam.cpp\
     161                                        ./classes/objects/Profiler.h\
     162                                        ./classes/objects/Profiler.cpp\
    161163                                        ./Container/Container.h\
    162164                                        ./Container/Constraints.h\
     
    351353                                        ./solutions/CorePointerFromSolutionEnum.cpp\
    352354                                        ./solutions/EnvironmentInit.cpp\
     355                                        ./solutions/EnvironmentFinalize.cpp\
    353356                                        ./solvers/solver_linear.cpp\
    354357                                        ./solvers/solver_nonlinear.cpp\
  • issm/trunk-jpl/src/c/classes/objects/objects.h

    r13426 r13534  
    1313#include "./Vertex.h"
    1414#include "./Node.h"
     15#include "./Profiler.h"
    1516#include "./DependentObject.h"
    1617#include "./IndependentObject.h"
  • issm/trunk-jpl/src/c/modules/EnumToStringx/EnumToStringx.cpp

    r13521 r13534  
    320320                case PentaEnum : return "Penta";
    321321                case PentaP1InputEnum : return "PentaP1Input";
     322                case ProfilerEnum : return "Profiler";
    322323                case MatrixParamEnum : return "MatrixParam";
    323324                case VectorParamEnum : return "VectorParam";
  • issm/trunk-jpl/src/c/modules/StringToEnumx/StringToEnumx.cpp

    r13521 r13534  
    327327              else if (strcmp(name,"Penta")==0) return PentaEnum;
    328328              else if (strcmp(name,"PentaP1Input")==0) return PentaP1InputEnum;
     329              else if (strcmp(name,"Profiler")==0) return ProfilerEnum;
    329330              else if (strcmp(name,"MatrixParam")==0) return MatrixParamEnum;
    330331              else if (strcmp(name,"VectorParam")==0) return VectorParamEnum;
     
    383384              else if (strcmp(name,"SurfaceAbsVelMisfit")==0) return SurfaceAbsVelMisfitEnum;
    384385              else if (strcmp(name,"SurfaceArea")==0) return SurfaceAreaEnum;
    385               else if (strcmp(name,"SurfaceAverageVelMisfit")==0) return SurfaceAverageVelMisfitEnum;
    386386         else stage=4;
    387387   }
    388388   if(stage==4){
    389               if (strcmp(name,"SurfaceLogVelMisfit")==0) return SurfaceLogVelMisfitEnum;
     389              if (strcmp(name,"SurfaceAverageVelMisfit")==0) return SurfaceAverageVelMisfitEnum;
     390              else if (strcmp(name,"SurfaceLogVelMisfit")==0) return SurfaceLogVelMisfitEnum;
    390391              else if (strcmp(name,"SurfaceLogVxVyMisfit")==0) return SurfaceLogVxVyMisfitEnum;
    391392              else if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
     
    506507              else if (strcmp(name,"Scaled")==0) return ScaledEnum;
    507508              else if (strcmp(name,"Separate")==0) return SeparateEnum;
    508               else if (strcmp(name,"Sset")==0) return SsetEnum;
    509509         else stage=5;
    510510   }
    511511   if(stage==5){
    512               if (strcmp(name,"Verbose")==0) return VerboseEnum;
     512              if (strcmp(name,"Sset")==0) return SsetEnum;
     513              else if (strcmp(name,"Verbose")==0) return VerboseEnum;
    513514              else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
    514515              else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
  • issm/trunk-jpl/src/c/solutions/EnvironmentInit.cpp

    r13533 r13534  
    99#include "../include/include.h"
    1010#include "../toolkits/toolkits.h"
    11 #include "../include/globals.h"
    1211
    1312void EnvironmentInit(int argc,char** argv){
     13       
     14        extern int my_rank;
     15        extern int num_procs;
    1416
    1517        /*Initialize environments: Petsc, MPI, etc...: */
  • issm/trunk-jpl/src/c/solutions/issm.cpp

    r13533 r13534  
    66#include "../include/globals.h"
    77       
     8void ProfilerEcho(Profiler* profiler);
     9
    810int main(int argc,char **argv){
    911
     
    3436        char *rootpath       = NULL;
    3537
    36         /*time*/
    37         IssmPDouble   finish;
    38         IssmPDouble   start_core, finish_core;
    39 
    4038        /*profiling*/   
     39        Profiler* profiler=NULL;
    4140        bool profiling = false;
    4241        IssmPDouble Time_start, Flops_start;
     
    185184
    186185        /*Get finish time and close*/
    187         #ifdef _HAVE_MPI_
    188         MPI_Barrier(MPI_COMM_WORLD); finish = MPI_Wtime( );
    189         _pprintLine_("");
    190         _pprintLine_("   "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<finish_init-start_init);
    191         _pprintLine_("   "<<setw(40)<<left<<"Core solution elapsed time:"<<finish_core-start_core);
    192         _pprintLine_("");
    193         _pprintLine_("   Total elapsed time:"<<int((finish-start)/3600)<<" hrs "<<int(int(finish-start)%3600/60)<<" min "<<int(finish-start)%60<<" sec");
    194         _pprintLine_("");
    195         #else
    196         finish=(IssmPDouble)clock();
    197         _pprintLine_("");
    198         _pprintLine_("   "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<(finish_init-start_init)/CLOCKS_PER_SEC);
    199         _pprintLine_("   "<<setw(40)<<left<<"Core solution elapsed time:"<<(finish_core-start_core)/CLOCKS_PER_SEC);
    200         _pprintLine_("");
    201         _pprintLine_("   Total elapsed time:"
    202                                 <<int((finish-start)/CLOCKS_PER_SEC/3600)<<" hrs "
    203                                 <<int(int(finish-start)/CLOCKS_PER_SEC%3600/60)<<" min "
    204                                 <<int(finish-start)/CLOCKS_PER_SEC%60<<" sec");
    205         _pprintLine_("");
    206         #endif
    207        
    208         #ifdef _HAVE_PETSC_
    209         _pprintLine_("closing MPI and Petsc");
    210         PetscFinalize();
    211         #else
    212         #ifdef _HAVE_MPI_
    213         _pprintLine_("closing MPI and Petsc");
    214         MPI_Finalize();
    215         #endif
    216         #endif
     186        profiler->Tag(Finish); ProfilerEcho(profiler);
     187
     188        /*Finalize environment:*/
     189        EnvironmentFinalize();
    217190
    218191        /*Finalize exception trapping: */
    219192        ExceptionTrapEnd();
    220193
    221         return 0; //unix success return;
     194        /*Return unix success: */
     195        return 0;
    222196}
     197       
     198
     199
     200void ProfilerEcho(Profiler* profiler){
     201
     202        _pprintLine_("");
     203        _pprintLine_("   "<<setw(40)<<left<<"FemModel initialization elapsed time:"<<profiler->Delta(StartInit,FinishInit));
     204        _pprintLine_("   "<<setw(40)<<left<<"Core solution elapsed time:"<<profiler->Delta(StartCore,FinishCore));
     205        _pprintLine_("");
     206        _pprintLine_("   Total elapsed time:"
     207                <<profiler->DeltaModHour(Start,Finish)<<" hrs "
     208                <<profiler->DeltaModMin(Start,Finish)<<" min "
     209                <<profiler->DeltaModSec(Start,Finish)<<" sec"
     210                );
     211        _pprintLine_("");
     212
     213}
     214
  • issm/trunk-jpl/src/c/solutions/kriging.cpp

    r13531 r13534  
    8989        delete results;
    9090
    91 #ifdef _HAVE_PETSC_
    92         _pprintLine_("closing MPI and Petsc");
    93         PetscFinalize();
    94 #else
    95 #ifdef _HAVE_MPI_
    96         _pprintLine_("closing MPI and Petsc");
    97         MPI_Finalize();
    98 #endif
    99 #endif
     91        /*Finalize environment:*/
     92        EnvironmentFinalize();
    10093
    10194        /*Finalize exception trapping: */
  • issm/trunk-jpl/src/c/solutions/solutions.h

    r13530 r13534  
    4646void ResetBoundaryConditions(FemModel* femmodel, int analysis_type);
    4747void EnvironmentInit(int argc,char** argv);
     48void EnvironmentFinalize(void);
    4849
    4950//solution configuration
  • issm/trunk-jpl/src/m/enum/EnumDefinitions.py

    r13523 r13534  
    30393039        return StringToEnum('PentaP1Input')[0]
    30403040
     3041def ProfilerEnum():
     3042        """
     3043        PROFILERENUM - Enum of Profiler
     3044
     3045           Usage:
     3046              macro=ProfilerEnum()
     3047        """
     3048
     3049        return StringToEnum('Profiler')[0]
     3050
    30413051def MatrixParamEnum():
    30423052        """
     
    49674977        """
    49684978
    4969         return 495
    4970 
     4979        return 496
     4980
  • issm/trunk-jpl/src/m/enum/MaximumNumberOfEnums.m

    r13523 r13534  
    99%      macro=MaximumNumberOfEnums()
    1010
    11 macro=495;
     11macro=496;
Note: See TracChangeset for help on using the changeset viewer.