Odd omp_get_wtime()
- From: Gib Bogle <bogle@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 31 Oct 2007 21:07:15 +1300
I've run into a a peculiar behaviour in XL Fortran with the OpenMP function omp_get_wtime(). I've reduced it to a simple program that shows the behaviour:
module wtime_mod
contains
subroutine wtimer2(t)
real(8) :: t
t = omp_get_wtime()
end subroutine
end module
module main_mod
use omp_lib
use wtime_mod
implicit none
contains
subroutine wtimer1(t)
real(8) :: t
t = omp_get_wtime()
end subroutine
end module
program main
use main_mod
real(8) :: t1,t2
integer :: i,num_cpu = 4
call omp_set_num_threads(num_cpu)
do i = 1,10
call wtimer1(t1)
call wtimer2(t2)
write(*,*) 't1,t2: ',t1,t2
enddo
end
When this is run the time t1 changes with each call, but t2 remains fixed. The value returned by wtimer2(), which is USEd in module main_mod, only returns multiples of 128, i.e. it only changes every 128 sec.
I was just about to post this when I realized that module wtime_mod lacked 'use omp_lib'. Sure enough, adding that line makes it work properly. It's surprising, though, that the program as shown compiles and runs without an error.
.
- Follow-Ups:
- Re: Odd omp_get_wtime()
- From: Reinhold Bader
- Re: Odd omp_get_wtime()
- Prev by Date: Re: Stack corruption and memory leak problems in c++/Fortran application
- Next by Date: Re: Stack corruption and memory leak problems in c++/Fortran application
- Previous by thread: Memory/Stack corruption problems in c++/fortran application
- Next by thread: Re: Odd omp_get_wtime()
- Index(es):
Relevant Pages
|