- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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).
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