- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to apply parallelism for an algoritm which sorts an array of 1,5 M records. I have divided the array into 4 parts and assigned each part to a core:
#pragma
omp parallel private(i,tid){
#pragma omp sections{
#pragma omp section{
BucketSort(A1); } #pragma omp section{
BucketSort(A2); }#pragma omp section
{
BucketSort(A3); } #pragma omp section{
BucketSort(A4); }} }
I am running the program on Intel Quad Q6600. I found that for the sequential program the execution time is 7 milisec. For the parallel program, the execution time varies significantly from 4ms to 22ms. I wonder what is the reason for this variation because it prevents me from measuring the real speedup. I tried to set the affinity for each thread to a different core, and there was no result. Can you please help me find the reason why performance is so unstable?
Thank you,
Svetlana
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Svetlana,
Consider setting block time to something other than 0ms and adding a dummy parallel section to get all threads running. Then fall into parallel section you wish to time
Jim Dempsey
long count = 0;
// dummy parallel section to get all threads running
#pragma omp parallel private(i,tid)
{
_InterlockedIncrement(&count);
}
// get start time for compute section
double startTime = omp_get_wtime( );
#pragma omp parallel private(i,tid)
{
#pragma omp sections
{ #pragma omp section
{ BucketSort(A1); }
#pragma omp section
{ BucketSort(A2); }
#pragma omp section
{ BucketSort(A3); }
#pragma omp section
{ BucketSort(A4); }
} }
// get end time for compute section
double endTime = omp_get_wtime( );
// compute elapse time
double elapsTime = endTime - startTime;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Jim,
That solved the problem. The execution time is stable now.
Regards,
Svetlana

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