我读过 OpenMP 中的变量默认是共享的。这是否意味着在下面的代码中,应该对从 0 到 N-1 的所有数字求和,存在竞争条件?
int sum = 0,i;
#pragma omp parallel for
for (i = 0; i < N; i++)
sum+=i;
Find centralized, trusted content and collaborate around the technologies you use most.
Learn moreTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more我读过 OpenMP 中的变量默认是共享的。这是否意味着在下面的代码中,应该对从 0 到 N-1 的所有数字求和,存在竞争条件?
int sum = 0,i;
#pragma omp parallel for
for (i = 0; i < N; i++)
sum+=i;