mpi process ids

允我心安 提交于 2019-12-11 06:25:35

问题


I would like to get the process ids of an mpi application which I start with mpirun/mpiexec tools.

For example I run my code with lets say 8 processes and want to get the process ids of all these 8 processes right at the beginning of the execution to give to another tool as an input.

What would be the right way to do this?


回答1:


I don't believe that there is any MPI library routine which will return the pid of the o/s process which is running an MPI process. To be absolutely precise I don't think that the MPI standard requires there to be a one:one mapping between MPI processes and o/s processes, nor any other cardinality of mapping, though I don't think I've ever used an MPI implementation where there wasn't a one:one mapping between the different views of processes.

All that aside, why not simply use getpid if you are on Linux machine ? Each MPI process should get its own pid. I guess there is a Windows system call which does the same thing but I don't know much about Windows.



来源:https://stackoverflow.com/questions/14569577/mpi-process-ids

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!