[Users] bug in Dissipation thorn?
kentaro.takami at aei.mpg.de
Tue Mar 5 02:33:22 CST 2013
> I notice that you made several changes to the code when converting:
> (1) You introduce a local array var, which is a copy of the input variable
> (2) You rewrote the do loops with array expressions
> Both are not good for performance. The former is certainly slowing things
> down, the second complicates an OpenMP parallelisation and makes the code
> more difficult to read. I am therefore hesitant to apply these. Did you try
> making only one of these changes, to see whether this would suffice?
Maybe we need the changing point (1) to avoid random results,
although the copy of array require additional cost (but this array copy is not
so expensive compared with the do loop copy.
For changing point (2), we can choose both array expression and do loop style.
Unless using OpenMP, array expression style is faster than do loop style,
because there is no cost of do loop over head, and compiler can
However when we use OpenMP, I'm not clear which style is more efficient.
The operations in dissipation equation are cheap and simple
(so maybe the calculation efficiency is limited by data transfer from
while OpenMP require large overhead costs of OMP parallelization.
Therefore I choose array expression style.
> The document to which you pointed contains also the suggestion to use the
> option -fp-model-precise. Did you try this?
Yes, I tried to use this option.
Then we can avoid random results even if we use original f77 code.
> As a side remark, in Fortran 90 you can also use a select case statement
> instead of if statements to choose the dissipation order.
We should use "select case", because "select case" is more efficient than "if"
in recent compiler.
More information about the Users