- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- 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).