OPNEMP分割故障使用大型阵列上的减少
我对OpenMP有问题。我正在尝试并行化计数排序算法的第一步:计数所有可能值的频率(在这种情况下,我正在计算图形所有顶点的邻居数)。 当我在小数组(例如num_vertices = 100k)上运行此代码时,它可以正常工作。相反,当ROW_PTR数组很大时(例如Num_vertices = 1M),我会得到分段故障(或有时ZSH:BUS错误)。
PS:它的工作正常也可以使用,并且具有大量迭代(例如num_edges = 50m)和size(e_list)= num_edges。
#pragma omp parallel for reduction(+: row_ptr[:num_vertices + 2])
for (uint64_t i = 0; i < num_edges; i++)
row_ptr[std::get<0>(e_list[i]) + 1]++;
问题可能是机器的可用公羊,或者可能是其他的? 谢谢
I've a problem with OpenMP. I'm trying to parallelize the first step of the Counting Sort algorithm: counting the frequencies of all the possibile values (in this case I'm counting the number of neighbors of all vertices of a graph).
When I run this code on a small array (e.g. num_vertices = 100k) it works fine. Instead, when the row_ptr array is big (e.g. num_vertices = 1M) i get segmentation fault (or sometimes zsh: bus error).
PS: it works fine also with high number of iteration (e.g. num_edges = 50M) and size(e_list) = num_edges.
#pragma omp parallel for reduction(+: row_ptr[:num_vertices + 2])
for (uint64_t i = 0; i < num_edges; i++)
row_ptr[std::get<0>(e_list[i]) + 1]++;
The problem could be the available RAM of the machine or could be something else?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
减少的阵列保留在堆栈上。因此,问题的最可能原因是您的堆栈太小,并且您的溢出溢出。尝试通过设置 opt_stacksize 环境可变。如果无法解决您的问题,请提供
Arrays used in reduction are reserved on the stack. So, the most probable cause of your problem is that your stack is too small and you have an overflow. Try increasing it by setting the OMP_STACKSIZE environmental variable. If it does not solve your problem, please provide a minimal reproducible example.