openMP 中无限大小堆栈的行为

发布于 2024-10-20 08:57:33 字数 1037 浏览 1 评论 0原文

我很好奇 openmp 如何处理(或不按照实际情况)无限的堆栈大小:

[alm475@compute-0-139 ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
max nice                        (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 278528
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 4096
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
max rt priority                 (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 278528
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
[alm475@compute-0-139 ~]$ big_stack_openmp
Segmentation Fault
[alm475@compute-0-139 ~]$ ulimit -s 30960
[alm475@compute-0-139 ~]$ big_stack_openmp

最终的命令运行干净并产生正确的结果。它需要约 12MB 的堆栈才能运行。

当没有声明堆栈大小时,并行环境中堆栈分配的行为是什么?

I'm curious how openmp deals with (or doesn't as the case looks to be) with an unlimited stacksize:

[alm475@compute-0-139 ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
max nice                        (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 278528
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 4096
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
max rt priority                 (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 278528
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
[alm475@compute-0-139 ~]$ big_stack_openmp
Segmentation Fault
[alm475@compute-0-139 ~]$ ulimit -s 30960
[alm475@compute-0-139 ~]$ big_stack_openmp

The final command runs clean and produces the correct result. It requires a ~12MB stack to run.

What is the behavior of the stack allocations in a parallel environment when there is not a declared stack size?

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

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

发布评论

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

评论(1

云柯 2024-10-27 08:57:33

使用 OpenMP 时必须考虑两种堆栈大小。有初始(或主)线程的堆栈,它由 ulimit 控制。然后是每个“从”线程的堆栈,该堆栈由 OpenMP 环境变量 OMP_STACKSIZE 控制。第二个堆栈有一个由每个实现确定的默认值。大多数都有不同的默认大小,具体取决于您是在 32 位模式还是 64 位模式下运行。

There are two stack sizes you have to consider when working with OpenMP. There is the stack of the initial (or master) thread, which is controlled by ulimit. Then there is the stack of each of the "slave" threads which is controlled by the OpenMP environment variable OMP_STACKSIZE. This second stack has a default determined by each implementation. Most have a different size default depending on whether you are running in 32-bit or 64-bit mode.

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