0

I want to implement Disjoint set Data Structures and Kruskal's algorithm in OpenCL. I have implemented some codes in OpenCL, but don't know how to get started with Data Structures in OpenCL. Djkstra's algorithm given in the book by Aftab Munshi is hard to understand. Can anyone suggest another source...?

shunya
  • 533
  • 1
  • 5
  • 16

1 Answers1

0

I suggest you start with simple C version of the algorithm like:

http://prabhakargouda.hubpages.com/hub/Kruskal-algorithm-implementation-in-C

Assess what can be done in parallel. In the above code, there are are several nested for loops that are candidates to be done in parallel. The adjacency matrix, is good parallel structure compared with pointers in a tree. So try and leverage that.

Remember that not all the phases of algorithm can be done in parallel. So start with the inner most for loops and take the implementation in stages.

Also, note there is no copyright or license associated with the above code. So careful how you use it. Remember to give copyright where its due.

Tim Child
  • 2,994
  • 1
  • 26
  • 25
  • I have imlemented kruskal's Algorithm in C using Disjoint Sets(Quick Union)... But i don't know how data structures are represented in OpenCl, To be more specific I don't know how dynamic memory allocation is done in the host code of OpenCL and then how these variables are passed in the kernel. I know that dynamic memory allocation can't be done in OpenCL kernel, so then how are data structures programmed in OpenCL. – shunya Feb 05 '13 at 08:41