Community
cancel
Showing results for 
Search instead for 
Did you mean: 
djbenton
Beginner
50 Views

How long does it take?

Typical VTune output from typical FORTRAN code:







Line Source _____________________________ Cloc



132 ELSE



133 WTERM=WTERM-0.5*DELTA*W2(L,K)* ________ 65



134 & (UUU(L+1,K+1)+UUU(L,K+1)+VVV(LN,K+1)+VVV(L,K+1)___ 6



135 & +WWW(L,K)+WWW(L,K+1)) ___________ 11



136 ENDIF



137 IF(ISFCT(MVAR).GE.2)THEN ______________ 11



138 FWU(L,K)=0.5*WTERM



139 IF(ISFCT(MVAR).EQ.3)THEN



140 FWU(L,K)=WTERM



141 ENDIF



142 ELSE



143 WW=WTERM/(CON(L,K+1)+CON(L,K)+BSMALL) ___ 9



144 FWU(L,K)=MAX(WW,0.)*CON(L,K) _________ 316



145 & +MIN(WW,0.)*CON(L,K+1) ___________ 4



146 ENDIF



147 ELSE



148 FWU(L,K)=0.



149 ENDIF



150 ENDDO __________________________________ 4



My question is, "how can you (or the compiler) possibly optimize code when you have no clue how long instructions will take to execute?" I realize some of these are continuation lines; so I combine the times and treat them as one; but I look over the code and can see no consistent relationship between the complexity of the statement and the number of clock cycles! This is maddening.



I know why line 144 takes so long. It has a MAX and a MIN in it which are two branches. I'm not that stupid.



Am I interpreting this correctly? That the numbers in the right column (Cloc) means the average number of clock cycles required to perform this instruction? or is it not this specific? I mentioned in another message I've seen a C statement if(z>Z)then take 1784 clocks!

Message Edited by djbenton@dsllc.com on 06-15-200607:50 AM

Message Edited by djbenton@dsllc.com on 06-15-200607:52 AM

0 Kudos
0 Replies
Reply