[petsc-dev] Are we suppressing stderr when comparing outputs of tests?

Pierre Jolivet pierre.jolivet at enseeiht.fr
Fri May 15 02:51:13 CDT 2020


Stefano,
If we go back to your original question, then you are correct under the additional assumption that main returns 0.
Here is a MWE.

$ git diff --unified=1 src/ksp/ksp/tutorials/ex1.c
diff --git a/src/ksp/ksp/tutorials/ex1.c b/src/ksp/ksp/tutorials/ex1.c
index 3b3e776a6d..a5ed63ca18 100644
--- a/src/ksp/ksp/tutorials/ex1.c
+++ b/src/ksp/ksp/tutorials/ex1.c
@@ -33,2 +33,3 @@ int main(int argc,char **args)
   ierr = PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr;
+  ierr = MatView(A,PETSC_VIEWER_STDOUT_WORLD);CHKERRQ(0); // not ierr, 0
   ierr = MPI_Comm_size(PETSC_COMM_WORLD,&size);CHKERRQ(ierr);
$ make -f gmakefile.test test search='ksp_ksp_tutorials-ex1_1'
Using MAKEFLAGS: search=ksp_ksp_tutorials-ex1_1
        TEST arch-darwin-c-debug-real/tests/counts/ksp_ksp_tutorials-ex1_1.counts
 ok ksp_ksp_tutorials-ex1_1
 ok diff-ksp_ksp_tutorials-ex1_1
$ echo $?
0
$ mpirun -n 1 arch-darwin-c-debug-real/tests/ksp/ksp/tutorials/ex1 -ksp_monitor_short -ksp_gmres_cgs_refinement_type refine_always
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Invalid argument
[0]PETSC ERROR: Wrong type of object: Parameter # 1
[0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
[…]

I’m not sure I’m OK with this (shouldn’t both stderr and stdout be compared, and if there is no stderr to compare against, check that it’s null?), but I guess this is how testing works.
About KSPHPDDM, I’m currently implementing the necessary steps as Matt suggested to go from PetscInt (MatMatMult) -> int (my stuff) -> PetscInt (KSPSolve_HPDDM) to have proper error checking so that in fact main does not return 0. Anyway, as you know since our last iteration the error w.r.t. MatDensePlaceArray is fixed now in your branch.

Thanks,
Pierre

> On 13 May 2020, at 6:15 PM, Matthew Knepley <knepley at gmail.com> wrote:
> 
> On Wed, May 13, 2020 at 11:33 AM Pierre Jolivet <pierre.jolivet at enseeiht.fr <mailto:pierre.jolivet at enseeiht.fr>> wrote:
> I’m only CHKERRQ’ing inside the routine but I’m not propagating this down to the return code of KSPSolve.
> I will try to fix this, or maybe switch to CHKERRABORT instead, because it currently goes like KSPSolve (PETSc) -> my stuff (non PETSc) -> MatMatMult or PCApply (PETSc), and I’m not sure I want to put some more PETSc code inside “my stuff” as it can be a pain to maintain for people that uses “my stuff” without PETSc. Sadly, they do exist.
> Also, I’m using PetscFunction[Begin|End]User, don’t know if switching to PetscFunction[Begin|End] would change something here, though I’m guessing it wouldn't.
> 
> No, those work the same.
> 
> I think you can propagate just with an integer return code, nothing PETSc dependent.
> 
>   Thanks,
> 
>      Matt
>  
> I’ll keep you posted, thanks for reporting this,
> Pierre
> 
>> On 13 May 2020, at 3:03 PM, Stefano Zampini <stefano.zampini at gmail.com <mailto:stefano.zampini at gmail.com>> wrote:
>> 
>> The error is raised from HPDDM , that does not stop and I think does not return error codes. Pierre?
>> 
>> Il giorno mer 13 mag 2020 alle ore 16:01 Matthew Knepley <knepley at gmail.com <mailto:knepley at gmail.com>> ha scritto:
>> I see my stderr with tests. I am running it right now.
>> 
>>    Matt
>> 
>> On Wed, May 13, 2020 at 8:55 AM Stefano Zampini <stefano.zampini at gmail.com <mailto:stefano.zampini at gmail.com>> wrote:
>> I have a test that fails, but it only prints a small amount of information
>> 
>> [szampini at localhost petsc]$ make -f gmakefile.test test search='ksp%' searchin='ex75_2_icc' PETSC_ARCH=arch-opt
>> Using MAKEFLAGS: -- PETSC_ARCH=arch-opt searchin=ex75_2_icc search=ksp%
>>         TEST arch-opt/tests/counts/ksp_ksp_tutorials-ex75_2_icc.counts
>>  ok ksp_ksp_tutorials-ex75_2_icc+reset-false
>> not ok diff-ksp_ksp_tutorials-ex75_2_icc+reset-false # Error code: 1
>> # 3c3
>> # < Linear solve converged due to CONVERGED_RTOL iterations 34
>> # ---
>> # > Linear solve did not converge due to DIVERGED_ITS iterations 1000
>>  ok ksp_ksp_tutorials-ex75_2_icc+reset-true
>>  ok diff-ksp_ksp_tutorials-ex75_2_icc+reset-true
>> 
>> If I run the test that fails myself, I get PETSC_ERROR messages
>> 
>> [szampini at localhost tutorials]$ ./ex75 -nmat 3 -pc_type icc -ksp_converged_reason -ksp_type hpddm -ksp_max_it 1000 -ksp_gmres_restart 40 -ksp_rtol 1e-10 -ksp_hpddm_type gcrodr -ksp_hpddm_recycle 20 -reset false -load_dir ${DATAFILESPATH}/matrices/hpddm/GCRODR
>> Linear solve converged due to CONVERGED_RTOL iterations 94
>> Linear solve converged due to CONVERGED_RTOL iterations 37
>> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
>> [0]PETSC ERROR: Operation done in wrong order
>> [0]PETSC ERROR: Need to call MatDenseRestoreArray first
>> [0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html <https://www.mcs.anl.gov/petsc/documentation/faq.html> for trouble shooting.
>> [0]PETSC ERROR: Petsc Development GIT revision: v3.13.1-192-g23916988c6  GIT Date: 2020-05-09 02:16:44 +0300
>> [0]PETSC ERROR: ./ex75 on a arch-debug named localhost.localdomain by szampini Wed May 13 15:51:48 2020
>> [0]PETSC ERROR: Configure options --DATAFILESPATH=/home/szampini/Devel/petscdatafiles --download-elemental --download-chaco --download-ctetgen --download-exodusii --download-glvis --download-hara --download-hara-commit=HEAD --download-hdf5 --download-hpddm --download-hpddm-commit=HEAD --download-hypre --download-metis --download-mfem-commit=origin/master --download-mfem=1 --download-ml --download-mumps --download-netcdf --download-p4est --download-parmetis --download-pnetcdf --download-ptscotch --download-revolve --download-scalapack --download-slepc --download-suitesparse --download-superlu --download-superlu_dist --download-triangle --with-blaslapack-include=/usr/include/openblas --with-cxx-dialect=C++11 --with-fortran-bindings=0 --with-opengl --with-openmp --with-thrust-dir=/home/szampini/local --with-valgrind --with-zlib CFLAGS="-Wall -g -O0" CXXFLAGS="-Wall -g -O0" FFLAGS="-g -O0" PETSC_ARCH=arch-debug
>> [0]PETSC ERROR: #1 MatDensePlaceArray_SeqDense() line 1364 in /home/szampini/Devel/petsc/src/mat/impls/dense/seq/dense.c
>> [0]PETSC ERROR: #2 MatDensePlaceArray() line 1900 in /home/szampini/Devel/petsc/src/mat/impls/dense/mpi/mpidense.c
>> [0]PETSC ERROR: #3 GMV() line 128 in /home/szampini/Devel/petsc/arch-debug/include/HPDDM_PETSc.hpp
>> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
>> [0]PETSC ERROR: Operation done in wrong order
>> [0]PETSC ERROR: Need to call MatDenseRestoreArray first
>> [0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html <https://www.mcs.anl.gov/petsc/documentation/faq.html> for trouble shooting.
>> [0]PETSC ERROR: Petsc Development GIT revision: v3.13.1-192-g23916988c6  GIT Date: 2020-05-09 02:16:44 +0300
>> [0]PETSC ERROR: ./ex75 on a arch-debug named localhost.localdomain by szampini Wed May 13 15:51:48 2020
>> [0]PETSC ERROR: Configure options --DATAFILESPATH=/home/szampini/Devel/petscdatafiles --download-elemental --download-chaco --download-ctetgen --download-exodusii --download-glvis --download-hara --download-hara-commit=HEAD --download-hdf5 --download-hpddm --download-hpddm-commit=HEAD --download-hypre --download-metis --download-mfem-commit=origin/master --download-mfem=1 --download-ml --download-mumps --download-netcdf --download-p4est --download-parmetis --download-pnetcdf --download-ptscotch --download-revolve --download-scalapack --download-slepc --download-suitesparse --download-superlu --download-superlu_dist --download-triangle --with-blaslapack-include=/usr/include/openblas --with-cxx-dialect=C++11 --with-fortran-bindings=0 --with-opengl --with-openmp --with-thrust-dir=/home/szampini/local --with-valgrind --with-zlib CFLAGS="-Wall -g -O0" CXXFLAGS="-Wall -g -O0" FFLAGS="-g -O0" PETSC_ARCH=arch-debug
>> [0]PETSC ERROR: #4 MatDensePlaceArray_SeqDense() line 1364 in /home/szampini/Devel/petsc/src/mat/impls/dense/seq/dense.c
>> [0]PETSC ERROR: #5 MatDensePlaceArray() line 1900 in /home/szampini/Devel/petsc/src/mat/impls/dense/mpi/mpidense.c
>> [0]PETSC ERROR: #6 apply() line 216 in /home/szampini/Devel/petsc/arch-debug/include/HPDDM_PETSc.hpp
>> Linear solve did not converge due to DIVERGED_ITS iterations 1000
>> 
>> Why is that? are we suppressing stderr when comparing diffs?
>> 
>> -- 
>> Stefano
>> 
>> 
>> -- 
>> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
>> -- Norbert Wiener
>> 
>> https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
>> 
>> 
>> -- 
>> Stefano
> 
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200515/256fcb8d/attachment.html>


More information about the petsc-dev mailing list