The source file is attached, and compile instructions are on the first line. The program takes input from readline(), does mpi stuff (spawn and merge), and prints the line index and line length to the terminal.
To reproduce, compile with should_merge set to true, then paste the contents of main.cpp into the program (main.cpp just happens to be the right length). You'll see that the text appears on the terminal, only the first line is received by readline(), and the rest diappears. Now paste a few lines (e.g. 5) of main.cpp, and note that each line is returned from readline(). Compile with should_merge set to false, and you can paste the entire contents of main.cpp, and each line will be returned by readline(). There may be timing issues. The first std::cout seems to be necessary, and doing too much in the while loop prevents the reproduction. It seems a bit nondeterministic. Thank you for looking at it. I hope it reproduces for you. Will On Fri, Apr 4, 2008 at 10:32 AM, Jeff Squyres <jsquy...@cisco.com> wrote: > On Apr 3, 2008, at 5:52 PM, Will Portnoy wrote: > >> Do you mean that you are starting it via ./my_mpi_program? > > > > Yes. > > This is quite odd; OMPI shouldn't be interfering much in this scenario > -- our IO forwarding stuff mostly comes into play when mpirun is used. > > However, I'd like to understand what's going on here. Could you send > me a small sample app that shows the problem? > > > -- > Jeff Squyres > Cisco Systems > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users >
// compile with g++ -o sample -lreadline -ltermcap $(mpic++ -showme:compile) $(mpic++ -showme:link) main.cpp #include <stdio.h> #include <readline/readline.h> #include <readline/history.h> #include <stdlib.h> #include <iostream> #include <sstream> #include <unistd.h> #include <mpi.h> int main(int argument_count, char ** argument_vector) { const bool should_merge = true; std::cout << "exec(" << argument_vector[0] << ")" << std::endl; ::MPI_Init(&argument_count, &argument_vector); MPI_Comm parent; ::MPI_Comm_get_parent(&parent); if (parent == MPI_COMM_NULL) { const char * line = ""; int index = 0; std::ostringstream stream; while ((line = ::readline(stream.str().c_str())) != NULL) { if (should_merge) { MPI_Comm intercommunicator; ::MPI_Comm_spawn(argument_vector[0], MPI_ARGV_NULL, 1, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &intercommunicator, MPI_ERRCODES_IGNORE); MPI_Comm intracommunicator; ::MPI_Intercomm_merge(intercommunicator, 0, &intracommunicator); } stream.str(""); stream << ++index << ':' << ::strlen(line); } } else { if (should_merge) { MPI_Comm intracommunicator; ::MPI_Intercomm_merge(parent, 1, &intracommunicator); while (true) { ::sleep(100); } } } }