<div dir="ltr"><div dir="ltr">On Tue, Feb 23, 2021 at 3:55 PM Francesco Brarda <<a href="mailto:brardafrancesco@gmail.com">brardafrancesco@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">Thank you for the quick response. <div>Sorry, you are right. Here is the complete output:<br><br><font face="Menlo" size="1">fbrarda@srvulx13:~/cmdstan-petsc$ $PETSC_DIR/$PETSC_ARCH/bin/mpirun -n 2 examples/rosenbrock/rosenbrock optimize -start_in_debugger<br>PETSC: Attaching gdb to examples/rosenbrock/rosenbrock of pid 47803 on display :0.0 on machine srvulx13<br>PETSC: Attaching gdb to examples/rosenbrock/rosenbrock of pid 47804 on display :0.0 on machine srvulx13<br>xterm: Xt error: Can't open display: :0.0<br>xterm: DISPLAY is not set<br>xterm: Xt error: Can't open display: :0.0<br>xterm: DISPLAY is not set<br></font></div></div></blockquote><div><br></div><div>Do you have an Xserver running? If not, you can use</div><div><br></div><div>  -start_in_debugger noxterm -debugger_nodes 3</div><div><br></div><div>and try to get a stack trace from one node.</div><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><font face="Menlo" size="1">method = optimize<br>  optimize<br>    algorithm = lbfgs (Default)<br>      lbfgs<br>method = optimize<br>  optimize<br>    algorithm = lbfgs (Default)<br>      lbfgs<br>        init_alpha = 0.001 (Default)<br>        tol_obj = 9.9999999999999998e-13 (Default)<br>        tol_rel_obj = 10000 (Default)<br>        tol_grad = 1e-08 (Default)<br>        init_alpha = 0.001 (Default)<br>        tol_obj = 9.9999999999999998e-13 (Default)<br>        tol_rel_obj = 10000 (Default)<br>        tol_grad = 1e-08 (Default)<br>        tol_rel_grad = 10000000 (Default)<br>        tol_param = 1e-08 (Default)<br>        history_size = 5 (Default)<br>        tol_rel_grad = 10000000 (Default)<br>        tol_param = 1e-08 (Default)<br>        history_size = 5 (Default)<br>    iter = 2000 (Default)<br>    iter = 2000 (Default)<br>    save_iterations = 0 (Default)<br>id = 0 (Default)<br>data    save_iterations = 0 (Default)<br>id = 0 (Default)<br>data<br>  file =  (Default)<br><br>  file =  (Default)<br>init = 2 (Default)<br>random<br>  seed = 3585768430 (Default)<br>init = 2 (Default)<br>random<br>  seed = 3585768430 (Default)<br>output<br>  file = output.csv (Default)<br>output<br>  file = output.csv (Default)<br>  diagnostic_file =  (Default)<br>  refresh = 100 (Default)<br>  diagnostic_file =  (Default)<br>  refresh = 100 (Default)<br><br><br>Initial log joint probability = -731.444<br>    Iter      log prob        ||dx||      ||grad||       alpha      alpha0  # evals  Notes <br>[1]PETSC ERROR: PetscAbortErrorHandler: main() line 12 in src/cmdstan/main.cpp  <br>  To prevent termination, change the error handler using PetscPushErrorHandler()<br><br>===================================================================================<br>=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES<br>=   PID 47804 RUNNING AT srvulx13<br>=   EXIT CODE: 134<br>=   CLEANING UP REMAINING PROCESSES<br>=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES<br>===================================================================================<br>YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Aborted (signal 6)<br>This typically refers to a problem with your application.<br>Please see the FAQ page for debugging suggestions</font><div><font face="Menlo" size="1"><br></font></div><div><font face="Menlo" size="1"><br></font></div><div><font face="Menlo" size="1"><br></font></div><div><font face="Menlo" size="1"><br></font></div><div><font face="Menlo" size="1"><br></font></div><div>The code inside main.cpp is the following:</div><div><br></div><font face="Menlo" size="1">#include <cmdstan/command.hpp><br>#include <stan/services/error_codes.hpp><br><br>#include <petsc.h><br><br>int main(int argc, char* argv[]) {<br><br>  PetscErrorCode ierr;<br>  ierr = PetscInitialize(&argc, &argv, 0, 0);CHKERRQ(ierr);<br><br>  try {<br>   <span style="background-color:rgb(0,249,0)"> ierr = cmdstan::command(argc, argv);CHKERRQ(ierr);</span><br>  } catch (const std::exception& e) {<br>    std::cout << e.what() << std::endl;<br>    ierr = stan::services::error_codes::SOFTWARE;CHKERRQ(ierr);<br>  }<br><br>  ierr = PetscFinalize();CHKERRQ(ierr);<br>  return ierr;<br>}<br></font><br>I highlighted the line 12. Although I read the page where the command PetscPushErrorHandler is explained and the example provided (src/ksp/ksp/tutorials/ex27.c), I do not understand how I should effectively use the command.<div>Should I change the entire try/catch with <span style="font-family:Menlo">PetscPushErrorHandler</span><span style="font-family:Menlo">(</span><span style="font-family:Menlo">PetscIgnoreErrorHandler</span><span style="font-family:Menlo">,NULL); ?</span></div><div><span style="font-family:Menlo"><br></span></div><div>Best,</div><div>Francesco</div><div><span><br></span></div><div><span><br><blockquote type="cite">Il giorno 23 feb 2021, alle ore 11:54, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> ha scritto:<br><br>On Tue, Feb 23, 2021 at 3:54 AM Francesco Brarda <<a href="mailto:brardafrancesco@gmail.com" target="_blank">brardafrancesco@gmail.com</a>> wrote:<br>Hi!<br><br>I am very new to the PETSc world. I am working with a GitHub repo that uses PETSc together with Stan (a statistics open source software), here you can find the discussion. <br>It has been defined a functor to convert EigenVector to PetscVec and viceversa, both sequentially and in parallel. <br>The file using these functions does the conversions with the sequential setting. I changed to those using MPI, that is from EigenVectorToPetscVecSeq to EigenVectorToPetscVecMPI and so on because I want to evaluate the scaling.<br>Running the example with mpirun -n 5 examples/rosenbrock/rosenbrock optimize in the debug mode I get the error Caught signal number 11 SEGV. I therefore used the option -start_in_debugger and I get the following:<br><br>For some reason, the -start_in_debuggger option is not being seen. Are you showing all the output? Once the debugger is attached,<br>you run the program (conr) and then when you hit the SEGV you get a stack trace (where).<br><br>  THanks,<br><br>    Matt<br> <br>[2]PETSC ERROR: ------------------------------------------------------------------------<br>[2]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range<br>[2]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger<br>[2]PETSC ERROR: or see <a href="https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind" target="_blank">https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind</a><br>[2]PETSC ERROR: or try <a href="http://valgrind.org" target="_blank">http://valgrind.org</a> on GNU/linux and Apple Mac OS X to find memory corruption errors<br>[2]PETSC ERROR: likely location of problem given in stack below<br>[2]PETSC ERROR: ---------------------  Stack Frames ------------------------------------<br>[2]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,<br>[2]PETSC ERROR:       INSTEAD the line number of the start of the function<br>[2]PETSC ERROR:       is given.<br>[3]PETSC ERROR: ------------------------------------------------------------------------<br>[3]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range<br>[3]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger<br>[3]PETSC ERROR: or see <a href="https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind" target="_blank">https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind</a><br>[3]PETSC ERROR: or try <a href="http://valgrind.org" target="_blank">http://valgrind.org</a> on GNU/linux and Apple Mac OS X to find memory corruption errors<br>[3]PETSC ERROR: likely location of problem given in stack below<br>[3]PETSC ERROR: ---------------------  Stack Frames ------------------------------------<br>[3]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,<br>[3]PETSC ERROR:       INSTEAD the line number of the start of the function<br>[3]PETSC ERROR:       is given.<br>[3]PETSC ERROR: PetscAbortErrorHandler: User provided function() line 0 in  unknown file (null)<br>  To prevent termination, change the error handler using PetscPushErrorHandler()<br>[2]PETSC ERROR: PetscAbortErrorHandler: User provided function() line 0 in  unknown file (null)<br>  To prevent termination, change the error handler using PetscPushErrorHandler()<br><br>===================================================================================<br>=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES<br>=   PID 22939 RUNNING AT srvulx13<br>=   EXIT CODE: 134<br>=   CLEANING UP REMAINING PROCESSES<br>=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES<br>===================================================================================<br>YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Aborted (signal 6)<br>This typically refers to a problem with your application.<br>Please see the FAQ page for debugging suggestions<br><br>I read the documentation regarding the PetscAbortErrorHandler, but I do not know where should I use it. How can I solve the problem? <br>I hope I have been clear enough.<br>Attached you can find also my configure.log and make.log files.<br><br>Best,<br>Francesco<br><br><br><br><br><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br><br><a href="https://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></blockquote><br></span></div></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>