本文介绍了我的程序如何检测是否通过mpirun启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的MPI程序是作为独立应用程序还是通过mpirun启动的,该如何检测?

How can my MPI program detect, if it was launched as a standalone application or via mpirun?

推荐答案

考虑到Semiuseless和Hristo Iliev的回答和评论,没有通用且可移植的方式来做到这一点.解决方法是,您可以检查由mpirun设置的环境变量.参见例如:
http://www.open-mpi.org/faq/?category =正在运行#mpi-环境变量

Considering the answer and comments by semiuseless and Hristo Iliev, there is no general and portable way to do this. As a workaround, you can check for environment variables that are set by mpirun. See e.g.:
http://www.open-mpi.org/faq/?category=running#mpi-environmental-variables

这篇关于我的程序如何检测是否通过mpirun启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 19:03