Menu

Fortran

Iain Miller

Fortran Example

:::fortran

program example

    use PMTM
    use MPI 
    implicit none

    integer :: err_code 
    type(pmtm_timer) :: loop_timer 
    integer :: loop_idx
    real :: res
    integer , parameter :: N = 10000

    call MPI_Init(err_code)
    call PMTM_init("example_file_", "Example Application", err_code)

    call PMTM_create_timer(PMTM_DEFAULT_GROUP , loop_timer , &
                            "Loop Timer", PMTM_TIMER_ALL , err_code)

    call PMTM_parameter_output(PMTM_DEFAULT_INSTANCE , &
            "Loop Count", PMTM_OUTPUT_ALWAYS , .false., N, err_code)

    call PMTM_timer_start(loop_timer) 

    res = 0

    do loop_idx = 1, N
        res = res + (res / loop_idx) 
    end do

    call PMTM_timer_stop(loop_timer) 

    call PMTM_finalize(err_code) 
    call MPI_finalize(err_code)

end program

Related

Wiki: PMTM

MongoDB Logo MongoDB