- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hi all,
I want to fully understand the do loop process behind the following code:
[fxfortran] do kdim = 1, ndim
do jdim = 1, ndim
ULOCAL(kdim) = ULOCAL(kdim)-ALOCAL(jdim,kdim)*UTEMP(jdim)
enddo
enddo[/fxfortran] Does this start from the first do loop (kdim) at 1, then start the second do loop (jdim) at 1, then conduct the calculation ULOCAL(kdim) at 1. Take the value at ULOCAL(1) and minus ALOCAL(1,1)*UTEMP(1). Where 1 is the array reference?
I have been going through books in fortran but, I thought it might help to talk the problem through too to improve my understanding.
Thanks
링크가 복사됨
1 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Conceptually, your understanding is correct. The compiler can choose another order of evaluation only if analysis indicates the result will be the same, except for changes in roundoff error. Ideally, the compiler could optimize this the same as a MATMUL, possibly involving unroll-and-jam (grouping outer loop iterations) as well as scalar replacement (inner loop treated as dot_product).