- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi: I was a bit surprised that the code
max=0
do i=1,100000
if (a(i) > maxi) then
maxi = a(i)
end if
end do
is faster than
maxi = maxval(a)
where maxval is an intrinsic function (is 10% slower).
Is it possible and there is a meaningful reason for such unexpected behavior?
max=0
do i=1,100000
if (a(i) > maxi) then
maxi = a(i)
end if
end do
is faster than
maxi = maxval(a)
where maxval is an intrinsic function (is 10% slower).
Is it possible and there is a meaningful reason for such unexpected behavior?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Running Visual Fortran v6.1 on windows I find that the example you gave ran slower than the intrinsic maxval. (Running in Release Configuration with speed optimisation throughout.) Typical results for an array of dimension 10,000,000 were:
0.453 sec for your example,
0.375 sec for the intrinsic maxval,
--or, a speed-up of 17% by use of the intrinsic maxval.
HOWEVER, for smaller length arrays, there is no significant difference in execution times.
0.453 sec for your example,
0.375 sec for the intrinsic maxval,
--or, a speed-up of 17% by use of the intrinsic maxval.
HOWEVER, for smaller length arrays, there is no significant difference in execution times.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my experience, g77 SSE/SSE2 code performs these operations faster than Intel supported compilers, although prof_gen/prof_use do help IFL/ifc. If you actually tested with that typo included, your compiler may have been able to eliminate basic operations as dead code.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page