Menu
  • HOME
  • TAGS

Is prefix scan CUDA sample code in gpugems3 correct?

cuda,gpu,nvidia,prefix-sum

It seems that you've made at least 1 error in transcribing the code from the GPU Gems 3 chapter into your kernel. This line is incorrect: temp[bi] += g_idata[ai]; it should be: temp[bi] += temp[ai]; When I make that one change to the code you have now posted, it seems...

Python convert list to tree representation format

python,list,binary-tree,prefix-sum

You can take advantage of the fact that for the element in row r, col c of your tree, the left and right child elements are at position c*2 and c*2+1 of the next row, respectively, if those elements exist (otherwise that node is a leaf). Just put that into...

Dynamic prefix sum

algorithm,data-structures,binary-search-tree,prefix-sum

A treap with implicit keys can perform all this operations in O(log n) time per query. The idea of implicit keys is pretty simple: we do not store any keys in nodes. Instead, we maintain subtrees' sizes for all nodes and find an appropriate position when we add or remove...