Skip to content
Snippets Groups Projects
Commit d4b76b0f authored by 13518104 Kevin Austin Stefano's avatar 13518104 Kevin Austin Stefano
Browse files

openmp done

parent d67df575
Branches
No related merge requests found
......@@ -85,8 +85,10 @@ void QuickSortSrc(Edge T[], int i, int j)
if (i < j)
{
PartisiSrc(T, i, j, &k);
QuickSortSrc(T, k + 1, j);
QuickSortSrc(T, i, k);
#pragma omp task
{QuickSortSrc(T, k + 1, j);}
#pragma omp task
{QuickSortSrc(T, i, k);}
}
}
......@@ -132,9 +134,6 @@ void QuickSortWeight(Edge T[], int i, int j)
{QuickSortWeight(T, k + 1, j);}
#pragma omp task
{QuickSortWeight(T, i, k);}
}
}
......@@ -301,17 +300,11 @@ void KruskalMST(Graph *graph, Edge result[], int *e)
while (((*e) < V - 1) && (i < graph->E))
{
// Pick the smallest edge of the graph
// #pragma omp parallel
// #pragma omp single
// #pragma omp critical
{
int x, y;
Edge next_edge = graph->edge[i++];
// #pragma omp task
{x = find(subsets, next_edge.src);}
// #pragma omp task
{y = find(subsets, next_edge.dest);}
// #pragma omp taskwait
if (x != y)
{
......@@ -326,8 +319,14 @@ void KruskalMST(Graph *graph, Edge result[], int *e)
}
QuickSortSrc(result, 1, (*e));
#pragma omp parallel num_threads(thread_count)
{
#pragma omp single
{
QuickSortSrc(result, 1, (*e));
}
}
// bubbleSort(result, (*e), 2);
return;
// qsort(result, e, sizeof(result[0]), compare_src);
......
No preview for this file type
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment