The OpenMP 3.1 standard prescribes a very strict form for the for-loop construct (see pag.39):
for (init-expr; test-expr; incr-expr) structured-block
In particular, test-expr
must look like one of the following:
var relational-op b
b relational-op var
where relational-op is one of <,<=,>,>=
and b
is a loop invariant expressions of a type compatible with the type of var.
Other than that you must ensure that:
The values of the loop control expressions of the loops associated
with the loop construct must be the same for all the threads in the
team.
So, coming back to your case, I would check sqrtt
to be a loop invariant and to have the same value for all threads.
A little side note
long long
isn't standard in C++ prior to C++11, see for instance this question on SO.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…