Skip to content

A concurrent heap/priority_queue data structure for CUDA programming

Notifications You must be signed in to change notification settings

srivatsan-ramesh/Concurrent-Heap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Concurrent Heap

Usage

On the Host side

Heap<int> *heap = createHeap<int>();
initHeap(heap, size);

On the Device side

__global__ void ParallelInsert(Heap<int> *heap, int *a, int n) {
    int id = getThreadID();
    if(id % 32 == 0)
            heap->insert(a[id/32]);
}

__global__ void ParallelRemove(Heap<int> *heap) {
    int id = getThreadID();
    if(id % 32 == 0)
            heap->remove(); // Returns the topmost element of the heap
}

Limitation

More than one thread of a warp can not insert or remove elements parallely from the heap, it will get into a deadlock situation.

TODO

Support for custom comparators.

Reference

About

A concurrent heap/priority_queue data structure for CUDA programming

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published