On Wed, May 12, 2010 at 2:51 PM, Jeff Squyres <jsquy...@cisco.com> wrote: > On May 12, 2010, at 1:48 PM, Hanjun Kim wrote: > >> I am working on parallelizing my sequential program using OpenMPI. >> Although I got performance speedup using many threads, there was >> slowdown on a small number of threads like 4 threads. >> I found that it is because getc worked much slower than sequential >> version. Does OpenMPI override or wrap getc function? > > No.
Please correct me if I'm wrong, but I believe OpenMPI sends stdin/stdout from the other ranks back to rank 0 so that the output is displayed as the stdin of mpirun and the other way around with stdout/stderr. Otherwise it wouldn't be possible to even see the output from the other ranks. I guess that could make things slower. MPICH-2 had a command line option that told mpiexec who would receive stdin (all processes or only some of them) so that you could do things like mpiexec <bigfile and not worry (too much) about the overhead of distributing the contents of bigfile across the network. Regards,