MPI可执行和共享标准

MPI executable and sharing stdin

本文关键字:标准 共享 可执行 MPI      更新时间:2023-10-16

我正在使用MPI编写我的第一个程序。我习惯了openMP,但这个似乎更难…!

我现在面临着一个问题,数据传递为stdin。我正在使用以下命令运行我的程序:

cat DATAfile | mpirun -n 8 ./a.out

,我所看到的是,只有rank 0线程有一个非空的stdin。有可能从一开始就分享吗?因为它是由sting对象组成的,所以用MPI指令传递它会很麻烦。

edit:在文档中找到我想要的:http://www.open-mpi.org/~ jsquyres/www.open-mpi.org/doc/v1.3/man1/mpirun.1.php

添加-stdin all就可以了。

cat DATAfile | mpirun -n 8 -stdin all ./a.out

最后,答案在文档中:http://www.open-mpi.org/~ jsquyres/www.open-mpi.org/doc/v1.3/man1/mpirun.1.php

cat DATAfile | mpirun -n 8 -stdin all ./a.out