Presentation is loading. Please wait.

Presentation is loading. Please wait.

Parallel Graph Partioning Using Simulated Annealing Parallel and Distributed Computing I Sadik Gokhan Caglar.

Similar presentations


Presentation on theme: "Parallel Graph Partioning Using Simulated Annealing Parallel and Distributed Computing I Sadik Gokhan Caglar."— Presentation transcript:

1 Parallel Graph Partioning Using Simulated Annealing Parallel and Distributed Computing I Sadik Gokhan Caglar

2 Graph Partitioning Problem Given a Graph G = (N,E) and a integer p Find subsets N 1,N 2,…,N p such that  p i=1 N i = N and N i  N j = 0 for i  j 2.W(i)  W / p, i = 1,2,…,p, where W(i) and W are the sums of node weights in N i and N respectively 3.The cut size is minimized

3 A Partitioned Graph A partitioned graph with edge-cut of seven

4 Solutions To The Problem Geometric Algorithms: Use the geometric coordinates –Recursive coordinate (or orthogonal) bisection –Recursive circle bisection Structural Algorithms: –Graph-Walking Algorithms –Spectral Algorithms Refinement Algorithms: –Kernighan-Lin Algorithm –Simulated Annealing Algorithm

5 Solutions To The Problem Multilevel technique: Coarsen Partition Refinement

6 Simulated Annealing

7 Implementation of SA Cost: The number of edges that has vertices in different sets Acceptation: The new cost is less than the old Rejection: The new cost is more than the old, a probabilistic calculation can change a rejection into an acceptation (e  cost/Temp ) Equilibrium: Number of rejections < (10 * vertexsize of the graph * number of sets)

8 Implementation of SA Frozen state: The temperature starts from 1, the cooling constant is 0.95, it is considered frozen at temperature 0.2 currentcost = cost(graph); printf ("The cost of the graph1 is %f \n", currentcost); while (temp > 0.2) { while (reject < (10 * graph.vertexsize * graph.setsize)) { makenewgraph (graph, &newgraph); tempcost = cost(newgraph); if (tempcost < currentcost) { currentcost = tempcost; graphfree(&graph); graph = newgraph; }

9 Implementation of SA else { reject++; if (tempcost == currentcost) prob = e(1, temp); else prob = e((tempcost - currentcost), temp); prob2 = drand48(); if (prob > prob2) { currentcost = tempcost; graphfree(&graph); graph = newgraph; } else graphfree(&newgraph); }//1st else }//reject temp = temp * coolconst; reject = 0; printf("cooled!!! temp = %f \n", temp); printf ("currentcost %f\n", currentcost); } printf ("The cost of the graph2 is %f \n", currentcost);

10 Input File Format

11 Data Structures typedef struct Edge { int v1; int v2; } Edge; typedef struct Set { int size; int* vertex; } Set; typedef struct Graph { int vertexsize; int edgesize; int setsize; struct Edge* edgelist; struct Set* setlist; } Graph;

12 Parallelization Approach 1 Problem independent tried to implement a general parallel simulated annealing Every process will generate a new graph and calculate the new cost The results will be sent to the root process The root process will choose the best result and broadcast it.

13 Parallelization Approach 1 The array that root process gathers: 0 – Acceptation ( 0 no, 1 yes, 2 probability) 1 – Cost 2 – The set number of the first vertex 3 – The set number of the second vertex 4 – The first vertex 5 – The second vertex

14 Parallelization Approach 1 The array that root process broadcasts: 0 - Temperature update 1 – Change done 2 – The set number of the first vertex 3 – The set number of the second vertex 4 – The first vertex 5 – The second vertex 6 – The cost of the new graph

15 Parallelization Approach 1 The equilibrium function has changed. From Number of rejections < (10 * vertexsize of the graph * number of sets) to Number of rejections < (10 * vertexsize of the graph * number of sets / number of processes) The rest of the program is the same the data is not distributed

16 Parallelization Approach 2 Problem dependent, works for only graph partition problem. Most of the work in graph partitioning problem is to calculate the cost of the graph. This is dependent on the number of edges that the graph has, the edges array can be scattered to the processes The processes only needs the edges it has to calculate the partial sum. It is perfectly parallelizable.

17 Parallelization Approach 2 After each process calculates its partial sum and MPI_Reduce with add operation is done to calculate the total sum. All the simulated annealing operation is done on the root process the others only calculate their partial sums.

18 ParSA1 16 Nodes

19 ParSA1 100 Nodes

20 ParSA1 300 Nodes

21 ParSA1 500 Nodes

22 ParSA1 1000 Nodes

23 ParSA2 16 Nodes

24 ParSA2 100 Nodes

25 ParSA2 300 Nodes

26 ParSA2 500 Nodes

27 ParSA2 1000 Nodes

28 ParSA2 10000 Nodes 40000 Edges

29 ParSA2 10000 Nodes 80000 Edges


Download ppt "Parallel Graph Partioning Using Simulated Annealing Parallel and Distributed Computing I Sadik Gokhan Caglar."

Similar presentations


Ads by Google