我的代码如下所示:
#pragma omp parallel for num_threads(5)
for(int i = 0; i < N; i++)
{
//some code
//#pragma omp parallel for reduction(+ : S_x,S_y,S_theta)
for(int j = 0; j < N; j++)
{
if (j==i) continue;
// some code
for(int ky = -1; ky<= 1; ky++)
{
for(int kx = -1; kx<= 1; kx++)
{
//some code
if (r_ij_square > l0_two)
{
//some code
}
}
}
}
//some code
}
我不确定上面代码中的continue
是否会导致任何问题。为避免出现任何问题,我在#pragma
中忽略了上述代码中的第二个//
。但我还不确定上面的代码是否会因使用continue
而导致任何问题?我的问题是,如果上面的代码可能会导致问题,如果是,我该如何解决问题?
搜索时,我发现了loops with "restricted" continue statements can be parallelized.
或Only an iteration of the innermost associated loop may be curtailed by a continue statement.
这两句话。但我不知道他们究竟是什么意思