- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have two piece code. The "code one" run more slow than "code two". The different is only "ll(1,n)=0.0".
ifort version is 12.1.
[bash]== code one == subroutine run(...) ... ll(1,n)=0.0 do i=1,n do j=1,m ll(i)=ll(i)+b(j) enddo enddo ... end subroutine[/bash]
[cpp] == code two == subroutine run(...) ... do i=1,n do j=1,m ll(i)=ll(i)+b(j) enddo enddo ... end subroutine[/cpp]
ifort version is 12.1.
[bash]== code one == subroutine run(...) ... ll(1,n)=0.0 do i=1,n do j=1,m ll(i)=ll(i)+b(j) enddo enddo ... end subroutine[/bash]
[cpp] == code two == subroutine run(...) ... do i=1,n do j=1,m ll(i)=ll(i)+b(j) enddo enddo ... end subroutine[/cpp]
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This looks very strange - ll is one-dimensional in the loop and two-dimensional in the assignment
just before it.
Are you sure this is the actual code? If so, I can hardly believe it compiles.
Regards,
Arjen
just before it.
Are you sure this is the actual code? If so, I can hardly believe it compiles.
Regards,
Arjen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found the cause. If i didn't add "ll(1,n)=0.0", most time the ll value is NaN. May be this reason reduce calculation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
He probably meant
ll(1:n) = 0.0
ll(1:n) = 0.0
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