Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.

omp taskq problem

chbq
Beginner
156 Views

Hi ,I want to parallel my program with workqueuing model,can you help me ?

it's a do-while model, this model is a algorithm of Navier-Stokes Equations
for simulating incompressible fluid flows based on the finite difference methord.
the following codes determine whether the torrence of each grid is acceptable,if
not ,revise the data .if all the torrence is acceptable, the do-while is finished.

do
{
flag=0;
//triple-nested loop,it must be parallelled with pipeline-parallel technology,I had finished
// this?
#pragma omp prallel ...// I add parallel clause and get the right result,however,the do-whilemay executemany times,the fork-join of threadsmay lead to waste much time. Iwant to move the #pragma omp parallel to the outside of do-while,but failed.
for(i=0;i

for(j=0;j for(k=0;k {
ijk=i*MN+j*N+k;//
if(delta=F(A[ijk])>torrence)// function F() get the tolerence of grid ijk.
{
flag++;
//revise some data of the grid ijk?
...
}
}
}while(flag!=0)

maybe I can use the workqueuing model to solve this problem ,I write a simple program to test whether the workqueuing model is working correctly,but the code does not get the right result. the test program codes is here:

float ParallelTest(float *Array)
{
int pjn,step;
float sum=0;
pjn=1000;
#pragma intel omp parallel taskq firstprivate(pjn) default(shared) reduction(+:sum)
{
for(;pjn!=1;pjn=pjn/2)
{
#pragma intel omp task captureprivate(Array)
{
for(step=0;stepsum+=Array[step]/(10*SIZE*SIZE);
}
}
}
return sum;
}
can you tell me what's wrong? thank you.

0 Kudos
0 Replies
Reply