- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi,
I am compiling and running a Fortran77 code on the i7 Intel Processor. In this code there is a subroutine (called second) and it computed the CPU time whenever called. But as I amdebuggingthe code, it returns a negative value which is obviously wrong. I know it works on the one core processor well. So I guess it is because of the new CPU that I used and the function "etime" which is not compatible with multiple processor. I am wondering if anyone has any experience that could be helpful. Following is the second subroutine which is used by the main code.
subroutine second (tnow)
double precision tnow
real*4 d(2)
rtnow=etime(d)
tnow=d(1)+d(2)
return
end
Thanks in advance.
Mohsen
コピーされたリンク
3 返答(返信)
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
ETIME does behave differently on a multicore or multiprocessor system, as documented. On single-core systems, the first element is CPU time in seconds and the second element is system time. On multicore or multiprocessor systems, the first element is wallclock time in seconds and the second element is zero. (Don't ask me why this is, but it seems to be a common definition.)
I recommend using the standard Fortran intrinsic CPU_TIME instead. You can call it just the way you are calling SECOND.
I recommend using the standard Fortran intrinsic CPU_TIME instead. You can call it just the way you are calling SECOND.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Quoting - mbehzad
Hi,
I am compiling and running a Fortran77 code on the i7 Intel Processor. In this code there is a subroutine (called second) and it computed the CPU time whenever called. But as I amdebuggingthe code, it returns a negative value which is obviously wrong. I know it works on the one core processor well. So I guess it is because of the new CPU that I used and the function "etime" which is not compatible with multiple processor. I am wondering if anyone has any experience that could be helpful. Following is the second subroutine which is used by the main code.
subroutine second (tnow)
double precision tnow
real*4 d(2)
rtnow=etime(d)
tnow=d(1)+d(2)
return
end
Thanks in advance.
Mohsen
Ihave just moved to Fortran 11.0 from Fortran 9.1, and I am working on multi-core systems with x64.
Under version 9.1, ETIME returned the cpu time in seconds. Under version 11.0 it returns a very small number, usually about a factor of 1000 smaller than the correct result. This is NOT a matter of the first array member being the wallclock time, at least not the wallclock time in seconds. If I had to guess without stepping into the code, I wouldsuspect that the code was returning a real(8) instead of the documented real(4).
For the time being, I have followed the recommendation and changed my code to use CPU_TIME.
Regards,
Chuck
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Yes, the units in this case are off by a factor of 1000. This should be fixed in 11.1. Even so, I recommend use of CPU_TIME instead.
