<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body dir="auto">
Hi Stefano,
<div><br>
</div>
<div>It’s odd that the matmult works for several iterations before crashing. I will dig into the code and see if we do something to the matrix that disrupts it’s state along the way. Only thing I can think of is that BNLS does attempt to do diagonal shifts
 when it detects ill conditioning and maybe that’s causing a bug with MFFD. The other Newton methods don’t do this because they don’t have a rigid descent direction requirement like the line search version does. </div>
<div><br>
</div>
<div>Anyway thanks for pointing this out. And yes we should definitely add this to the tests. <br>
<div><br>
<div dir="ltr"><span style="background-color: rgba(255, 255, 255, 0);">Alp Dener</span>
<div><span style="background-color: rgba(255, 255, 255, 0);">Argonne National Laboratory</span></div>
<div><span style="background-color: rgba(255, 255, 255, 0);">Mathematics and Computer Science</span></div>
<div>https://alp.dener.me</div>
</div>
<div dir="ltr"><br>
<blockquote type="cite">On Oct 14, 2021, at 10:19 AM, Stefano Zampini <stefano.zampini@gmail.com> wrote:<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<div>Alp</div>
<div><br>
</div>
<div>I have found this problem, reproducible with release (see below using src/tao/unconstrained/tutorials/minsurf1)</div>
<div>I was trying MFFD hessian with bntr.<br>
</div>
<div><br>
</div>
<div>Using assembled hessian is fine<br>
</div>
<div><br>
</div>
<div>(tf-oneapi) [szampini@localhost tutorials]$ ./minsurf1 -tao_smonitor -tao_type bntr -mx 10 -my 8 -tao_bnk_max_cg_its 3 -tao_gatol 1.e-4</div>
<br>
---- Minimum Surface Area Problem -----<br>
mx: 10     my: 8   <br>
<br>
iter =   0, Function value 1.45591, Residual: 0.21372 <br>
iter =   0, Function value 1.43469, Residual: 0.205909 <br>
  iter =   0,   Function value 1.43469,   Residual: 0.205909 <br>
  iter =   1,   Function value 1.42058,   Residual: 0.0881207 <br>
  iter =   2,   Function value 1.41987,   Residual: 0.10019 <br>
  iter =   3,   Function value 1.41797,   Residual: 0.0209656 <br>
iter =   1, Function value 1.41775, Residual: 0.000288154 <br>
  iter =   0,   Function value 1.41775,   Residual: 0.000288154 <br>
  iter =   1,   Function value 1.41775,   Residual: 0.000207788 <br>
  iter =   2,   Function value 1.41775,   Residual: 0.000123638 <br>
  iter =   3,   Function value 1.41775,   Residual: 0.000117563 <br>
<div>iter =   2, Function value 1.41775, Residual: < 1.0e-6 <br>
</div>
<div><br>
</div>
<div>Using MFFD hessian error (using bnls segefaults, we should try to check all possible Tao solvers affected by this bug?)</div>
(tf-oneapi) [szampini@localhost tutorials]$ ./minsurf1 -tao_smonitor -tao_type bntr -mx 10 -my 8 -tao_bnk_max_cg_its 3 -tao_gatol 1.e-4 -tao_mf_hessian<br>
<br>
---- Minimum Surface Area Problem -----<br>
mx: 10     my: 8   <br>
<br>
iter =   0, Function value 1.45591, Residual: 0.21372 <br>
iter =   0, Function value 1.43469, Residual: 0.205909 <br>
  iter =   0,   Function value 1.43469,   Residual: 0.205909 <br>
  iter =   1,   Function value 1.42058,   Residual: 0.0881207 <br>
  iter =   2,   Function value 1.41987,   Residual: 0.10019 <br>
  iter =   3,   Function value 1.41797,   Residual: 0.0209656 <br>
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------<br>
[0]PETSC ERROR: Object is in wrong state<br>
[0]PETSC ERROR: MatMFFDSetBase() has not been called, this is often caused by forgetting to call
<br>
MatAssemblyBegin/End on the first Mat in the SNES compute function<br>
[0]PETSC ERROR: See <a href="https://petsc.org/release/faq/">https://petsc.org/release/faq/</a> for trouble shooting.<br>
[0]PETSC ERROR: Petsc Release Version 3.16.0, unknown <br>
[0]PETSC ERROR: ./minsurf1 on a arch-conda-tf-oneapi-single-real named localhost.localdomain by szampini Thu Oct 14 18:11:23 2021<br>
[0]PETSC ERROR: Configure options --with-blaslapack-dir=/home/szampini/Devel/miniforge/envs/tf-oneapi --download-thrust --LDFLAGS=-liomp5 --with-debugging=0 --with-openmp --with-precision=single --with-fc=0 --download-h2opus --download-slepc --download-slepc-commit=origin/release
 PETSC_ARCH=arch-conda-tf-oneapi-single-real PETSC_DIR=/home/szampini/Devel/miniforge/Devel/petsc<br>
[0]PETSC ERROR: #1 MatMult_MFFD() at /home/szampini/Devel/miniforge/Devel/petsc/src/mat/impls/mffd/mffd.c:333<br>
[0]PETSC ERROR: #2 MatMult_Shell() at /home/szampini/Devel/miniforge/Devel/petsc/src/mat/impls/shell/shell.c:1066<br>
[0]PETSC ERROR: #3 MatMult() at /home/szampini/Devel/miniforge/Devel/petsc/src/mat/interface/matrix.c:2439<br>
[0]PETSC ERROR: #4 KSP_MatMult() at /home/szampini/Devel/miniforge/Devel/petsc/include/petsc/private/kspimpl.h:346<br>
[0]PETSC ERROR: #5 KSPCGSolve_STCG() at /home/szampini/Devel/miniforge/Devel/petsc/src/ksp/ksp/impls/cg/stcg/stcg.c:183<br>
[0]PETSC ERROR: #6 KSPSolve_Private() at /home/szampini/Devel/miniforge/Devel/petsc/src/ksp/ksp/interface/itfunc.c:914<br>
[0]PETSC ERROR: #7 KSPSolve() at /home/szampini/Devel/miniforge/Devel/petsc/src/ksp/ksp/interface/itfunc.c:1086<br>
[0]PETSC ERROR: #8 TaoBNKComputeStep() at /home/szampini/Devel/miniforge/Devel/petsc/src/tao/bound/impls/bnk/bnk.c:477<br>
[0]PETSC ERROR: #9 TaoSolve_BNTR() at /home/szampini/Devel/miniforge/Devel/petsc/src/tao/bound/impls/bnk/bntr.c:139<br>
[0]PETSC ERROR: #10 TaoSolve() at /home/szampini/Devel/miniforge/Devel/petsc/src/tao/interface/taosolver.c:227<br>
[0]PETSC ERROR: #11 main() at minsurf1.c:110<br>
[0]PETSC ERROR: PETSc Option Table entries:<br>
[0]PETSC ERROR: -check_pointer_intensity 0<br>
[0]PETSC ERROR: -mx 10<br>
[0]PETSC ERROR: -my 8<br>
[0]PETSC ERROR: -tao_bnk_max_cg_its 3<br>
[0]PETSC ERROR: -tao_gatol 1.e-4<br>
[0]PETSC ERROR: -tao_mf_hessian<br>
[0]PETSC ERROR: -tao_smonitor<br>
[0]PETSC ERROR: -tao_type bntr<br>
[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------<br>
<div>Abort(73) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0</div>
<div><br>
</div>
<div>Using fd is fine</div>
<div><br>
</div>
(tf-oneapi) [szampini@localhost tutorials]$ ./minsurf1 -tao_smonitor -tao_type bntr -mx 10 -my 8 -tao_bnk_max_cg_its 3 -tao_gatol 1.e-4 -tao_fd_hessian<br>
<br>
---- Minimum Surface Area Problem -----<br>
mx: 10     my: 8   <br>
<br>
iter =   0, Function value 1.45591, Residual: 0.21372 <br>
iter =   0, Function value 1.43469, Residual: 0.205909 <br>
  iter =   0,   Function value 1.43469,   Residual: 0.205909 <br>
  iter =   1,   Function value 1.42058,   Residual: 0.0881207 <br>
  iter =   2,   Function value 1.41987,   Residual: 0.10019 <br>
  iter =   3,   Function value 1.41797,   Residual: 0.0209656 <br>
iter =   1, Function value 1.41775, Residual: 0.000342734 <br>
  iter =   0,   Function value 1.41775,   Residual: 0.000342734 <br>
  iter =   1,   Function value 1.41775,   Residual: 0.000275372 <br>
  iter =   2,   Function value 1.41775,   Residual: 0.000148513 <br>
  iter =   3,   Function value 1.41775,   Residual: 0.000150663 <br>
iter =   2, Function value 1.41775, Residual: < 1.0e-6 <br>
<div><br>
</div>
<div><br>
</div>
<br>
-- <br>
<div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Stefano</div>
</div>
</div>
</blockquote>
</div>
</div>
</body>
</html>