矢量化 (SIMD) 树运算

发布于 2024-12-01 13:09:57 字数 187 浏览 2 评论 0原文

关于向量化树操作的一般提示/指针有哪些?内存布局明智、算法明智等。

一些特定于领域的内容:

  • 每个父节点将有相当多(20 - 200)个子节点。
  • 每个节点拥有子节点的概率都很低。
  • 对树的操作主要是条件行走。
  • 遍历树的性能比插入/删除/搜索速度更重要。

What are some general tips/pointers on vectorizing tree operations? Memory layout wise, algorithm wise, etc.

Some domain specific stuff:

  • Each parent node will have quite a few (20 - 200) child nodes.
  • Each node has a low probability of having child nodes.
  • Operations on the tree is mostly conditional walks.
  • The performance of walking over the tree is more important than insertion/deletion/search speeds.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

摇划花蜜的午后 2024-12-08 13:09:57

请注意,这很难实现。去年,由英特尔、甲骨文和 UCSC 组成的团队提出了一个令人惊叹的解决方案“快速:快速架构敏感树搜索
on Modern CPUs and GPUs”
。他们获得了“2010年最佳论文奖” ”,作者:ACM SIGMOD

Beware, this is very hard to implement. Last year a team of Intel, Oracle and UCSC presented an amazing solution "FAST: Fast Architecture Sensitive Tree Search
on Modern CPUs and GPUs"
. They won the "Best Paper Award 2010" by ACM SIGMOD.

层林尽染 2024-12-08 13:09:57

由于树木的随机性,矢量化行走对您来说有何好处并不是立即显而易见的。

我会将树布置为(parentid,节点数据)“节点”项的平面数组,按parentid排序,这样您至少可以一起访问节点的子节点。当然,如果您的树不是“胖”(即节点的平均子节点数量较少),那么这不会给您带来太多好处。

不过,您最好的选择实际上只是强调 SIMD 的强力,因为您确实无法使用此 API 在列表中进行奇特的随机跳转。

编辑:我不会扔掉你最有可能拥有的普通树类,实现 SIMD 方式并看看你是否真的获得任何东西,我不相信你会......

Because of the random nature of trees it's not immediately obvious how vectorizing walks would be a big plus to you.

I would lay the tree out as a flat array of (parentid, node data) "node" items, sorted by parentid, so you can at least visit the children of a node together. Of course this doesn't give you much if your tree isn't "fat" (ie low number of children on average for a node).

Your best bet though is really just to emphasize on the brute force of SIMD, because you really can't do fancy random jumps through your list with this API.

Edit: I wouldn't throw out the normal tree class you most likely have though, implement the SIMD way and see if you really gain anything, I'm not convinced you will...

溺渁∝ 2024-12-08 13:09:57

使用谱图论算法怎么样?它们应该很容易矢量化,因为它们处理矩阵。

What about using spectral graph theory algorithms? They should be much easy to vectorize, as they deal with matrices.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文