Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.
2159 Discussions

Bug report: Intel C++ Compiler 10.1: OpenMP running fails. (while MSCL is OK)

jiefeng_liang
Beginner
361 Views

I get right result at mscl, but wrong at icl.

It happens atp->vItems, where items pushed wrong.

......
#pragma omp parallel// this section fails in ICL!
{
#ifdef _OPENMP
#pragma omp for reduction(+: nPSize) nowait
for (int c = 0; c <= BlockMax; ++c)
#else
for (BlockT c = 0; c <= BlockMax; ++c)
#endif
{
const PieceT a = genPiece(c);
PieceStat* p = stat;
if (p != NULL)
{
#ifdef _OPENMP
++nPSize;
#endif
#pragma omp critical
{
p->vItems.push_back(c);
}
}
}
}
#ifdef _OPENMP
nPSize /= nCount;
#endif
......
0 Kudos
2 Replies
TimP
Honored Contributor III
361 Views
How could this example work with nowait?
0 Kudos
jiefeng_liang
Beginner
361 Views

According to the convention of OpenMP, nowait overrides the barrier implicit in a directive. Barrier synchronizes all threads in a team.

Since the outside parallel directive has an enforced barrier, the inside for directive has no necessary to use a barrier.

0 Kudos
Reply