That sounds great Ralph! Do you have any more details about how the process rank would be added?

And thanks for the other suggestions from Ashley and Galen. Both methods look like they would work great, and are probably a little nicer than my current setup.

-Mark


On Jul 11, 2008, at 9:46 AM, Ralph H Castain wrote:

Adding the ability to tag stdout/err with the process rank is fairly simple. We are going to talk about this next week at a design meeting - we have several different tagging schemes that people have requested, so we want to define a way to meet them all that doesn't create too much ugliness in the
code.

Will get back to you on this one. Regardless, the earliest version it could show up in would be 1.3 (which is a tight question given current release
plans).


On 6/24/08 9:36 AM, "Ashley Pittman" <apittman@concurrent- thinking.com>
wrote:


If you are using the openmpi mpirun then you can put the following in a wrapper script which will prefix stdout in a manner similar to what you appear to want. Simply add the wrapper script before the name of your
application.

Is this the kind of thing you were aiming for?  I'm quite surprised
mpirun doesn't have an option for this actually, it's a fairly common
thing to want.

Ashley Pittman.

#!/bin/sh

$@ | sed "s/^/\[rk:$OMPI_MCA_ns_nds_vpid,sz: $OMPI_MCA_ns_nds_num_procs
\]/"

On Tue, 2008-06-24 at 11:06 -0400, Mark Dobossy wrote:
Lately I have been doing a great deal of MPI debugging. I have, on an
occasion or two, fallen into the trap of "Well, that error MUST be
coming from rank X. There is no way it could be coming from any other rank..." Then proceeding to debug what's happening at rank X, only to
find out a few frustrating hours later that rank Y is throwing the
output (I'm sure no one else out there has fallen into this trap). It
was at that point, I decided to write up some code to automatically
(sort of) output the rank and size of my domain with every output. I
write mostly in C++, and this is what I came up with:

#include <iostream>
#include <mpi.h>

std::ostream &mpi_info(std::ostream &s) {
int rank, size;
rank = MPI::COMM_WORLD.Get_rank();
size = MPI::COMM_WORLD.Get_size();
s << "[rk:" << rank << ",sz:" << size << "]: ";
return s;
}

Then in my code, I have changed:

std::cerr << "blah" << std::endl;

to:

std::cerr << mpi_info << "blah" << std::endl;

(or cout, or file stream, etc...)

where "blah" is some amazingly informative error message.

Are there other ways people do this?  Simpler ways perhaps?

-Mark
_______________________________________________
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users

_______________________________________________
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users


_______________________________________________
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users

Reply via email to