Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Running slowly

GHui
Novice
652 Views
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]
0 Kudos
3 Replies
Arjen_Markus
Honored Contributor I
652 Views
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
0 Kudos
GHui
Novice
652 Views
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.
0 Kudos
mecej4
Honored Contributor III
652 Views
He probably meant

ll(1:n) = 0.0
0 Kudos
Reply