8 Replies Latest reply on Feb 5, 2013 11:14 PM by himanshu.gautam

    Implementation of Disjoint Sets and Kruskal's Algorithm(and other data structures) in OpenCL

    shreedhar_pawar

      I want to implement Disjoint set Data Structures and Kruskal's algorithm in OpenCL. I have implemented some codes in OpenCL and aslo implemented Kruskal's Algorithm in C, but don't know how to get started with programming the Data Structures 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 kernels.  Djkstra's algorithm given in the book by Aftab Munshi is hard to understand. Can anyone suggest another source...?

        • Re: Implementation of Disjoint Sets and Kruskal's Algorithm(and other data structures) in OpenCL
          himanshu.gautam

          OpenCL does not understand complex data-structures. Basic primitive and vector-types are supported though (like int, float, unsigned int, int2, uint2, int4, float2, float4 etc...)

           

          As far as memory, cl_mem object is what a kernel understands. It is seen as a pointer by the OpenCL kernel to an area in memory,

          cl_image too is more or less the same except that you can do some sampling on the object and other image related stuff.

           

          OpenCL does not enforce what is stored in the memory area (or) how it is stored. You can store structures (or) whatever you want inside it. Your kernels can interpret it accordingly.

           

          If you could post one specific use-case, I can help you out. Thanks,

          1 of 1 people found this helpful