- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

hi ,I want to parallel do-while codes with the workqueuing modol. soI writen a simple program for testing, however,the following codes does not get the right result as the serial ones,can you tell me why? thank you!

float ParallelTest(float *Array)

{

int pjn,step;

float sum=0;

pjn=1000;

#pragma intel omp parallel taskq shared(pjn,Array) reduction(+:sum)

{

do

{

#pragma intel omp task captureprivate(pjn)

{

for(step=0;step

sum+=Array[step]/(10*SIZE*SIZE);

// I add these codes for increasing calculation time

sum=sum*10/10*20/20*30/30;

sum=sum*10/10*20/20*30/30;

sum=sum*10/10*20/20*30/30;

sum=sum*10/10*20/20*30/30;

sum=sum*10/10*20/20*30/30;

}

}

pjn=pjn/2;

}while(pjn!=1);

}

return sum;

}

the serial codes is :

float ParallelTest(float *Array)

{

int pjn,step;

float sum=0;

pjn=1000;

do

{

for(step=0;step

sum+=Array[step]/(10*SIZE*SIZE);

// I add these codes for increasing calculation time

sum=sum*10/10*20/20*30/30;

sum=sum*10/10*20/20*30/30;

sum=sum*10/10*20/20*30/30;

sum=sum*10/10*20/20*30/30;

sum=sum*10/10*20/20*30/30;

}

pjn=pjn/2;

}while(pjn!=1);

return sum;

}

Link Copied

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page