简体   繁体   English

MPI调用需要多少堆栈空间?

[英]How much stack space do MPI calls require?

I am writing a code that combines the use of the Message Passing Interface (MPI) and qthreads. 我正在编写将消息传递接口(MPI)和qthreads结合使用的代码。 I am having to use a larger than default stack size (8KB as opposed to 4KB) even though my actual code uses well under 1 KB per qthread. 即使我的实际代码在每个qthread的使用量不到1 KB,我也必须使用大于默认堆栈大小(8KB而不是4KB)的堆栈。 I believe that the MPI calls are the cause of the stack overflow. 我相信MPI调用是堆栈溢出的原因。

The code uses OpenMPI and qthreads from Sandia National Laboratories. 该代码使用来自Sandia国家实验室的OpenMPI和qthreads。

The code runs with a single qthread "shepherd" on each MPI process, using qthread_init(1) - qthreads is used only for context switching within an MPI process. 该代码使用qthread_init(1)在每个MPI进程上使用单个qthread“牧羊人”运行-qthreads仅用于MPI进程内的上下文切换。

My questions are: 1) Is there a way to determine how much stack space an MPI call will use? 我的问题是:1)是否可以确定MPI调用将使用多少堆栈空间? 2) Is there a way to reduce how much stack space it uses? 2)有没有办法减少它使用多少堆栈空间? 3) Are there particular MPI calls that use a larger amount of stack space than average MPI calls? 3)是否有比平均MPI调用占用更多堆栈空间的特定MPI调用?

There are profiling tools for this, google mpi profiling I would recommend mpip since its easy to setup. 有用于此的分析工具,google mpi profiling我推荐mpip,因为它易于设置。 Also Valgrind has a section on debugging mpi and parallel programs. Valgrind还提供了有关调试mpi和并行程序的部分。 If these don't identity the problem you will have to dig deeper into performance tuning and play around with message sizes and such. 如果这些都不能解决问题,则您将不得不更深入地研究性能调优,并尝试处理消息大小等。

MPI can be called from Pthreads, which have something like an 8 MB default stack size. 可以从Pthreads调用MPI,Pthreads的默认堆栈大小约为8 MB。 In practice, I think it's under 1 KB, with large temps allocated on the heap. 实际上,我认为它不到1 KB,并且在堆上分配了很大的临时文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM