Learning is a mess
Learning is a mess

Reputation: 8277

MPI executable and sharing stdin

I am coding my first programs using MPI. I was used to openMP but this seems much harder..!

I am facing a problem now with data passed as stdin. I am running my program using the following:

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

and what I am seeing is that only the rank 0 thread has a non empty stdin. Is it possible to share it from the beginning? As it is made of sting objects, it would be cumbersome to pass it inside with MPI directives.

edit: found what I wanted in the documentation: http://www.open-mpi.org/~jsquyres/www.open-mpi.org/doc/v1.3/man1/mpirun.1.php

adding -stdin all does the job.

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

Sorry for the bother...

Upvotes: 2

Views: 652

Answers (1)

Learning is a mess
Learning is a mess

Reputation: 8277

In the end, the answer was in the documentation: 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

Upvotes: 3

Related Questions