Changeset 12655


Ignore:
Timestamp:
07/18/12 15:17:32 (13 years ago)
Author:
habbalf
Message:

Added PETSc profiling. Timing is redundant with MPI timing...may remove at some point if 'extra' features from PETSc with this are not used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/solutions/issm.cpp

    r12519 r12655  
    3535        int      ierr;
    3636
     37        /*PETSc profiling*/   
     38        bool petsc_profiling = false;
     39        PetscLogDouble petscTime_start, petscTime_finish;
     40        PetscLogDouble petsc_memUse, petscFlops_start, petscFlops_finish;
     41
    3742        ISSMBOOT();
    3843
     
    9499        femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
    95100        femmodel->parameters->FindParam(&tao_analysis,InversionTaoEnum);
     101   femmodel->parameters->FindParam(&petsc_profiling,DebugPetscProfilingEnum);
     102
    96103        #ifdef _HAVE_MPI_
    97104        MPI_Barrier(MPI_COMM_WORLD); finish_init=MPI_Wtime();
     
    107114        #endif
    108115       
     116        if(petsc_profiling){
     117                PetscGetTime(&petscTime_start);
     118                PetscGetFlops(&petscFlops_start);
     119        }
     120
    109121        if(dakota_analysis){
    110122                #ifdef _HAVE_DAKOTA_
     
    127139                solutioncore(femmodel);
    128140        }
     141
     142        if(petsc_profiling){
     143                PetscGetTime(&petscTime_finish);
     144                PetscGetFlops(&petscFlops_finish);
     145                PetscMemoryGetCurrentUsage(&petsc_memUse);
     146
     147                _pprintLine_("PETSc elapsed time  : " << (petscTime_finish-petscTime_start) << "  Seconds");
     148                _pprintLine_("PETSc elapsed flops : " << (petscFlops_finish-petscFlops_start) << "  Flops");
     149                _pprintLine_("PETSc memory used   : " << petsc_memUse << "  Bytes");
     150               
     151                femmodel->results->AddObject(new DoubleExternalResult(femmodel->results->Size()+1, PetscProfilingSolutionTimeEnum, (petscTime_finish-petscTime_start), 1, 0));
     152                femmodel->results->AddObject(new DoubleExternalResult(femmodel->results->Size()+1, PetscProfilingCurrentMemEnum, petsc_memUse, 1, 0));
     153                femmodel->results->AddObject(new DoubleExternalResult(femmodel->results->Size()+1, PetscProfilingCurrentFlopsEnum, (petscFlops_finish-petscFlops_start), 1, 0));
     154        }
     155
    129156        #ifdef _HAVE_MPI_
    130157        MPI_Barrier(MPI_COMM_WORLD); finish_core=MPI_Wtime( );
     
    132159        finish_core=(IssmPDouble)clock();
    133160        #endif
    134        
     161
    135162        _pprintLine_("write results to disk:");
    136163        OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
     
    143170        }
    144171
    145         /*Free ressources */
     172        /*Free resources */
    146173        xDelete<int>(analyses);
    147174        xDelete<char>(lockfilename);
Note: See TracChangeset for help on using the changeset viewer.