given the next iteration:
double calculateClusterDistance(Cluster* cluster, const int NUM_OF_DIMENSIONS)
{
double tempRadius = 0;
int i, j;
#pragma omp parallel for private (i, j) shared(cluster)
for(i = 0 ; i < cluster->numOfPoints ; i++)
{
for(j = 0 ; j < cluster->numOfPoints ; j++)
{
if(i != j)
{
double calculatedRadius = getDistanceBetweenTwoPoints(cluster->points[i], cluster->points[j], NUM_OF_DIMENSIONS);
if(calculatedRadius > tempRadius)
{
tempRadius = calculatedRadius;
}
}
}
}
return tempRadius;
}
When I put in comment the pragma, the program run faster. In average, cluster->numOfPoints is between 60-70. Any help?
edit:
I measure time using
clock_t start, finish;
start = clock();
finish = clock();
In before and after this function.
Without omp it will be about 1.8~ sec With omp it will be about 3.2~ sec