[Trilinos-Users] [EXTERNAL] Re: NOX output

Pawlowski, Roger P rppawlo at sandia.gov
Fri Feb 24 09:19:40 EST 2017


Hi Andreas,

By default, nox prints summary/status information from a single print process whose MPI rank can be set by the user in the “Printing” parameter sublist (defaults to rank 0).  You can also set the output and error streams in the “Printing” parameter sublist. So you can overload the ostream to print anything you want. Vaild printing parameters can be found in the documentation for the NOX:Utils object:

https://trilinos.org/docs/dev/packages/nox/doc/html/classNOX_1_1Utils.html#aa5feedb3df4a2085cb04587b676fcd97

Now if you really want all mpi processes to print (not just the print process), you can do that using a trick. In the printing sublist, you can set the print process equal to the mpi rank on each MPI process.

Here’s some code from the epetra Brusselator example, but modified so that all MPI processes print (the actual test sets the “Output Processor” to rank “0” on all MPI processes):

Epetra_MpiComm Comm( MPI_COMM_WORLD );
int MyPID = Comm.MyPID();

// Set the printing parameters in the "Printing" sublist
Teuchos::ParameterList& printParams = nlParams.sublist("Printing");
printParams.set("MyPID", MyPID);
printParams.set("Output Processor", MyPID);

If you don’t want to write your own ostream overloaded class, and want MPI information, we already have an ostream object in the Teuchos package for that called Teuchos::FancyOStream.

https://trilinos.org/docs/dev/packages/teuchos/doc/html/classTeuchos_1_1basic__FancyOStream.html

This code will tell the ostream to add the MPI process rank to all lines of output:

Teuchos::GlobalMPISession mpiSession(&argc,&argv);
Teuchos::FancyOStream out(Teuchos::rcpFromRef(std::cout));
out.setShowProcRank(true);

You can set the ostreams wrapped in a RCPs in the printing sublist. The information is below. Just make sure when setting the RCP in the parameter list that its type is explicitly an RCP<std::ostream>.

Roger

The following parameters are valid for this class and should be defined in the "Printing" sublist of the solver parameter list.

  *   "Output Information" - Can be a sublist or an integer. If it is an integer, this value is a sum of MsgType's to specify how much information to show. Defaults to NOX::Utils::Warning<https://trilinos.org/docs/dev/packages/nox/doc/html/classNOX_1_1Utils.html#ab30f60438649426b2490e4646754c856a460d575464fc6e5c6fd43abd62bc7cf3> + NOX::Utils::OuterIteration<https://trilinos.org/docs/dev/packages/nox/doc/html/classNOX_1_1Utils.html#ab30f60438649426b2490e4646754c856a25b135dc9f7c5b6fc0b9ce8171643e8b> + NOX::Utils::InnerIteration<https://trilinos.org/docs/dev/packages/nox/doc/html/classNOX_1_1Utils.html#ab30f60438649426b2490e4646754c856a119da0cce22656f16f1aac7400bd3b2a> + NOX::Utils::Parameters<https://trilinos.org/docs/dev/packages/nox/doc/html/classNOX_1_1Utils.html#ab30f60438649426b2490e4646754c856a692c04bea8f81df684acfd207ff5feda> = 0xf = 15. If this is a sublist, the following booleans are valid (set to true to enable print option):
     *   "Error"
     *   "Warning"
     *   "Outer Iteration"
     *   "Inner Iteration"
     *   "Parameters"
     *   "Details"
     *   "Outer Iteration StatusTest"
     *   "Linear Solver Details"
     *   "Test Details"
     *   "Stepper Iteration"
     *   "Stepper Details"
     *   "Stepper Parameters"
     *   "Debug"
  *   "Output Processor" - Specifies the designated print process. Defaults to 0.
  *   "MyPID" - Specifies this process's ID. Defaults to rank from MPI_COMM_WORLD in parallel and 0 in serial.
  *   "Output Precision" - Specifis the default number of decimal places to be used when printing floating point numbers. The default is 4.
  *   "Output Stream" - A Teuchos::RCP<std::ostream> object that will be used for standard output.
  *   "Error Stream" - A Teuchos::RCP<std::ostream> object that will be used for output of error information.



From: "Prokopenko, Andrey V." <prokopenkoav at ornl.gov>
Date: Thursday, February 23, 2017 at 10:26 PM
To: Andreas Kreienbuehl <akreienbuehl at lbl.gov>
Cc: Roger Pawlowski <rppawlo at sandia.gov>, "trilinos-users at trilinos.org" <trilinos-users at trilinos.org>
Subject: [EXTERNAL] Re: NOX output

Hi Andreas,

I'm not too familiar with NOX, so I cc'd Roger as he has a lot more insight on such issues. I'm cc'ing trilinos-users mailing list as well.

I will have to look at the code to properly answer your question. In the meantime, one thing that could help you is this: if you are using openmpi, you could run with `mpirun -tag-output`, which for every line of output should tell which processor it is coming from.

-Andrey
On 2/22/17 3:24 PM, Andreas Kreienbuehl wrote:
Hi Andrey:
Unfortunately, I have another output issue with NOX. I very much hope, you can spare a minute to help me out.
I am using NOX parallel in time. The convergence stats, if printed, should indicate from which process in time it is coming from. Thus, is there a way to pass additional information to NOX's print function? For example, how could I overload `utils.out()' to be `utils.out() << "... additional information ..."'? Alternatively, how could I give each process in time its own output stream? Do you know of an example showing how such objects are defined?
Many thanks,
Andreas

--
Andreas Kreienbuehl, Ph.D.
Mail Stop 50A3111
Center for Computational Sciences and Engineering
Lawrence Berkeley National Laboratory
1 Cyclotron Road
Berkeley CA 94720-8142
Phone: +1-510-486-4321
https://ccse.lbl.gov/people/akreienbuehl







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20170224/88ac6632/attachment.html>


More information about the Trilinos-Users mailing list