radiasoft / zgoubi

Git repo for zgoubi source code
https://sourceforge.net/projects/zgoubi/
GNU General Public License v2.0
9 stars 3 forks source link

Convert "do" loops to appropriate modern constructs #13

Open robnagler opened 6 years ago

robnagler commented 6 years ago

Convert do loops to:

zbeekman commented 6 years ago

I would highly recommend do concurrent or vanilla do loops in performance critical regions, over other constructs. Often (not always) array syntax and especially forall statements can cause really painful cache misses in performance critical code. Array statements where array sections are memory aligned, contiguous blocks of O(cache-line length) elements tend to be fine; array statements where array sections (including the rest of the cache line if strided) of the working variables don't fit in L1 and/or L2 end up evicting from cache and re-reading the variables from more distant memory repeatedly. (This is due to the semantics of array statements and forall statements.) do concurrent helps to avoid this in most cases.