<div dir="ltr">> Is ./ex5 -help -no_signal_handler | head good enough?<br><br>Umm. It eliminates the nondeterminism. Should discovery of options for petsc user applications go via error messages? (Or asking users to remember "-no_signal_handler" to avoid?) I don't understand signal handling well-enough to recommend a better way ... maybe there is no better way for |head.<br><br>The best alternative I can think of is if my codes supply the program name for the "const char man[]" argument of PetscOptionsXXX(). Then I can suggest this to users:<br><br>./program -help |grep program<div><br></div><div>Is this a mis-use of the "man" argument?<br><br>Ed<br><br>PS Amused to find "This routine should not be used from within a signal handler." in the man page for MPI_Abort(), which I reached by clicking on the call to MPI_Abort() in the view of PetscSignalHandlerDefault(). ;-)<div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 26, 2017 at 12:55 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Is<br>
<br>
./ex5 -help -no_signal_handler | head<br>
<br>
good enough?<br>
<br>
Normally we won't want to turn off catching of PIPE errors since it might hide other errors.<br>
<span class="HOEnZb"><font color="#888888"><br>
Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
> On Apr 26, 2017, at 3:31 PM, Ed Bueler <<a href="mailto:elbueler@alaska.edu">elbueler@alaska.edu</a>> wrote:<br>
><br>
> Dear Petsc --<br>
><br>
> Copied at the bottom is the behavior I get for ex5.c in snes examples/tutorials. When I do<br>
><br>
> $./ex5 -help |head<br>
><br>
> I get a "Caught signal number 13 Broken Pipe" or just a version string. Randomly, one or the other.<br>
><br>
> I know this has come up on petsc-users before:<br>
> <a href="http://lists.mcs.anl.gov/pipermail/petsc-users/2014-May/021848.html" rel="noreferrer" target="_blank">http://lists.mcs.anl.gov/<wbr>pipermail/petsc-users/2014-<wbr>May/021848.html</a><br>
> The claim was that the SIGPIPE error is standard behavior.<br>
><br>
> My real issue (feature request?) is that when writing a petsc application I want a rational help system. Suppose "program.c" has options with prefix "prg_". The user doesn't know the prefix yet (I could have used "prog_" as the prefix ...) The petsc-canonical help system is (I believe)<br>
><br>
> ./program -help |grep prg_<br>
><br>
> for program.c-specific options. Works great if you know to look for "prg_". My plan for my applications is to put the prefix in the first line or two of my help string, the user can discover the prefix by<br>
><br>
> ./program -help |head<br>
><br>
> and then use "-help |grep -prg_" and etc.<br>
><br>
> So my question is: Can petsc be set up to not generate an error message when the help system is used in a correct way? (I.e. catching return codes when writing, or handling SIGPIPE differently?) Or, on the other hand, can someone suggest a better help system that irritates less?<br>
><br>
> Thanks!<br>
><br>
> Ed<br>
><br>
> ~/petsc/src/snes/examples/<wbr>tutorials[master*]$ ./ex5 -help |head<br>
> Bratu nonlinear PDE in 2d.<br>
> We solve the Bratu (SFI - solid fuel ignition) problem in a 2D rectangular<br>
> domain, using distributed arrays (DMDAs) to partition the parallel grid.<br>
> The command line options include:<br>
> -par <parameter>, where <parameter> indicates the problem's nonlinearity<br>
> problem SFI: <parameter> = Bratu parameter (0 <= par <= 6.81)<br>
><br>
> -m_par/n_par <parameter>, where <parameter> indicates an integer<br>
> that MMS3 will be evaluated with 2^m_par, 2^n_par-----------------------<wbr>------------------------------<wbr>---------------------<br>
> Petsc Development GIT revision: v3.7.6-3453-ge45481d470 GIT Date: 2017-04-26 13:00:15 -0500<br>
> [0]PETSC ERROR: ------------------------------<wbr>------------------------------<wbr>------------<br>
> [0]PETSC ERROR: Caught signal number 13 Broken Pipe: Likely while reading or writing to a socket<br>
> [0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger<br>
> [0]PETSC ERROR: or see <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>documentation/faq.html#<wbr>valgrind</a><br>
> [0]PETSC ERROR: or try <a href="http://valgrind.org" rel="noreferrer" target="_blank">http://valgrind.org</a> on GNU/linux and Apple Mac OS X to find memory corruption errors<br>
> [0]PETSC ERROR: likely location of problem given in stack below<br>
> [0]PETSC ERROR: --------------------- Stack Frames ------------------------------<wbr>------<br>
> [0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,<br>
> [0]PETSC ERROR: INSTEAD the line number of the start of the function<br>
> [0]PETSC ERROR: is given.<br>
> [0]PETSC ERROR: [0] PetscVFPrintfDefault line 240 /home/ed/petsc/src/sys/fileio/<wbr>mprint.c<br>
> [0]PETSC ERROR: [0] PetscHelpPrintfDefault line 622 /home/ed/petsc/src/sys/fileio/<wbr>mprint.c<br>
> [0]PETSC ERROR: [0] PetscOptionsBegin_Private line 29 /home/ed/petsc/src/sys/<wbr>objects/aoptions.c<br>
> [0]PETSC ERROR: [0] PetscObjectOptionsBegin_<wbr>Private line 61 /home/ed/petsc/src/sys/<wbr>objects/aoptions.c<br>
> [0]PETSC ERROR: [0] PetscDSSetFromOptions line 218 /home/ed/petsc/src/dm/dt/<wbr>interface/dtds.c<br>
> [0]PETSC ERROR: [0] DMSetFromOptions line 747 /home/ed/petsc/src/dm/<wbr>interface/dm.c<br>
> [0]PETSC ERROR: --------------------- Error Message ------------------------------<wbr>------------------------------<wbr>--<br>
> [0]PETSC ERROR: Signal received<br>
> [0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>documentation/faq.html</a> for trouble shooting.<br>
> [0]PETSC ERROR: Petsc Development GIT revision: v3.7.6-3453-ge45481d470 GIT Date: 2017-04-26 13:00:15 -0500<br>
> [0]PETSC ERROR: ./ex5 on a linux-c-dbg named bueler-leopard by ed Wed Apr 26 11:22:07 2017<br>
> [0]PETSC ERROR: Configure options --download-mpich --with-debugging=1<br>
> [0]PETSC ERROR: #1 User provided function() line 0 in unknown file<br>
> application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0<br>
> [unset]: aborting job:<br>
> application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0<br>
> ~/petsc/src/snes/examples/<wbr>tutorials[master*]$ ./ex5 -help |head<br>
> Bratu nonlinear PDE in 2d.<br>
> We solve the Bratu (SFI - solid fuel ignition) problem in a 2D rectangular<br>
> domain, using distributed arrays (DMDAs) to partition the parallel grid.<br>
> The command line options include:<br>
> -par <parameter>, where <parameter> indicates the problem's nonlinearity<br>
> problem SFI: <parameter> = Bratu parameter (0 <= par <= 6.81)<br>
><br>
> -m_par/n_par <parameter>, where <parameter> indicates an integer<br>
> that MMS3 will be evaluated with 2^m_par, 2^n_par-----------------------<wbr>------------------------------<wbr>---------------------<br>
> Petsc Development GIT revision: v3.7.6-3453-ge45481d470 GIT Date: 2017-04-26 13:00:15 -0500<br>
> ~/petsc/src/snes/examples/<wbr>tutorials[master*]$<br>
><br>
><br>
> --<br>
> Ed Bueler<br>
> Dept of Math and Stat and Geophysical Institute<br>
> University of Alaska Fairbanks<br>
> Fairbanks, AK 99775-6660<br>
> 301C Chapman<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Ed Bueler<br>Dept of Math and Stat and Geophysical Institute<br>University of Alaska Fairbanks<br>Fairbanks, AK 99775-6660<br>301C Chapman<br></div></div></div>
</div>