LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Hugh Merz (merz_at_[hidden])
Date: 2005-05-22 17:16:27


>> How can I print synchronized messages to std::cout, i.e. I want processes to
>> print smth in increasing order of their ranks.
>>
> I dont know the solution in lam-mpi. But in mpich, you can use -l
> option to mpiexec which prints the number of processor in front of
> each line. Then you can use standard unix utility like sort to sort
> the output.

I'm not aware of such an option in lam, but you could prepend each print
statement with the rank of the process to achieve the same result.

The following would satisfy the initial query, but would block all
further computation until every process reached it:

do i=0,num_procs-1
   if (i==my_rank) print *,my_rank,'statement_to_print'
   call mpi_barrier(mpi_comm_world,ierr)
enddo

Hugh