Changeset 2489


Ignore:
Timestamp:
10/22/09 11:53:24 (15 years ago)
Author:
Mathieu Morlighem
Message:

Added ellapsed time in diagnostic parallel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/parallel/diagnostic.cpp

    r2409 r2489  
    4545        DataSet* parameters=NULL;
    4646
     47        /*time*/
     48        double   start, finish;
     49        double   start_core, finish_core;
     50        double   start_init, finish_init;
     51
    4752        MODULEBOOT();
    4853
     
    5156        #endif
    5257
     58        /*Initialize Petsc and get start time*/
    5359        PetscInitialize(&argc,&argv,(char *)0,""); 
     60        MPI_Barrier(MPI_COMM_WORLD); start=MPI_Wtime();
    5461
    5562        /*Size and rank: */
     
    6370
    6471        /*Initialize model structure: */
     72        MPI_Barrier(MPI_COMM_WORLD); start_init=MPI_Wtime();
    6573        model=new Model();
    6674
     
    106114        results=new DataSet(ResultsEnum());
    107115
     116        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
     117
    108118        /*are we running the solution sequence, or a qmu wrapper around it? : */
    109119        if(!qmu_analysis){
     
    111121                        /*run diagnostic analysis: */
    112122                        _printf_("call computational core:\n");
     123                        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    113124                        diagnostic_core(results,model,inputs);
     125                        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    114126
    115127                        /*Add analysis_type to results: */
     
    123135                        /*run control analysis: */
    124136                        _printf_("call computational core:\n");
     137                        MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    125138                        control_core(results,model,inputs);
     139                        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    126140
    127141                        /*Add analysis_type and control_type to results: */
     
    145159
    146160                #ifdef _HAVE_DAKOTA_
     161                MPI_Barrier(MPI_COMM_WORLD); start_core=MPI_Wtime( );
    147162                Qmux(model,inputs,DiagnosticAnalysisEnum(),NoneAnalysisEnum());
     163                MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
    148164                #else
    149165                throw ErrorException(__FUNCT__," Dakota not present, cannot do qmu!");
     
    164180        delete processed_results;
    165181
     182        /*Get finish time and close*/
     183        MPI_Barrier(MPI_COMM_WORLD); finish = MPI_Wtime( );
     184        _printf_("\n   %-34s %f seconds  \n","Model initialization elapsed time:",finish_init-start_init);
     185        _printf_("   %-34s %f seconds  \n","Core solution elapsed time:",finish_core-start_core);
     186        _printf_("   %-34s %f seconds\n\n","Total elapsed time:",finish-start);
    166187        _printf_("closing MPI and Petsc\n");
    167188        PetscFinalize();
Note: See TracChangeset for help on using the changeset viewer.