Software Archive
Read-only legacy content
17061 Discussions

OpenMP loops run not parallel

vw61
Beginner
597 Views


Hi,

in our application we have some loops parallelized by OMP. Compiled with VC they run parallel, compiled with Intel compiler they don't.

Some informations to my system: Windows 7 Ultimate, Visual Studio 9.0, Microsoft .Net Framework V. 3.5 SP1. We use an evaluation version of Parallel Studio.

Thanks for any help,
Volker
0 Kudos
2 Replies
Kevin_Magee__Intel_
597 Views
Hi,

Please double check that the intel compiler is being invoked with the '/Qopenmp' flag. The setting for this is located in "Configuration Properties>C/C++>Language>OpenMP Support" in the project properties dialog.

If that flag is set, do you have a reproducing case that you can share?

Thanks,

-Kevin
0 Kudos
vw61
Beginner
597 Views
Hi,

Please double check that the intel compiler is being invoked with the '/Qopenmp' flag. The setting for this is located in "Configuration Properties>C/C++>Language>OpenMP Support" in the project properties dialog.

If that flag is set, do you have a reproducing case that you can share?

Thanks,

-Kevin

Hi,

the flag is set.

But I have solved the issue.

Here is a little simplified sample of my code:


signed int numTiles = 10;
bool reduceThreads = false, abort = false, badAlloc = false, unknown = false;
omp_set_num_threads(4);

do
{
if (reduceThreads)
{
omp_set_num_threads(1);
reduceThreads = abort = badAlloc = false;
}

#pragma omp parallel for schedule(dynamic, 1)
for (int i = 0; i < numTiles; i++)
{
if (abort)
continue;

unsigned int tileX = i % getNumTilesX();
unsigned int tileY = i / getNumTilesX();
unsigned int state = ACTIVATED;
if (((state & ACTIVATED) == ACTIVATED))
{
try
{
{
#pragma omp critical
removeSomething(tileX, tileY);
}
makeSomething(tileX, tileY);
}
catch (std::bad_alloc&)
{
if (omp_get_num_threads() > 1)
{
reduceThreads = abort = badAlloc = true;
}
else
{
abort = badAlloc = true;
}
//continue;
}
catch (ExGenerationError&)
{
abort = true;
//continue;
}
catch (...)
{
abort = unknown = true;
//continue;
}
}
}
}
while (reduceThreads);


At first the continue statements were not commended. In this case the compiler runs without error message.
But the message OpenMP DEFINED LOOP WAS PARALLELIZED came not.

In the second step I commended the last three continue statements. The message OpenMP DEFINED LOOP WAS PARALLELIZED came and all was nice.

Any explanations?

Thanks,
Volker
0 Kudos
Reply