<div dir="auto">What about raising an error from the interface if mat_reuse_matrix is requested with the same input and output matrix?</div><div class="gmail_extra"><br><div class="gmail_quote">Il 16 dic 2016 8:37 PM, "Barry Smith" <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> ha scritto:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
I have added more words to the manual page for MatConvert() to make the MatReuse easier to understand.<br>
<br>
> On Dec 16, 2016, at 7:50 AM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
><br>
><br>
> Eric,<br>
><br>
> Perhaps you should be using MAT_INPLACE_MATRIX?<br>
><br>
> The documentation is not as clear as it should be on MAT_INPLACE_MATRIX vs MAT_REUSE_MATRIX and it is possible that some implementations of MatConvert_xxx() are broken and do not use this flag properly.<br>
><br>
> MAT_INPLACE_MATRIX means replace the input matrix with the matrix of the new type<br>
><br>
> MAT_REUSE_MATRIX means reuse the matrix that has been passed in as the final value (that matrix must have come from a previous call to MatConvert() with the flag MAT_INITIAL_MATRIX)<br>
><br>
> Barry<br>
><br>
><br>
>> On Dec 16, 2016, at 7:43 AM, Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com">stefano.zampini@gmail.com</a>> wrote:<br>
>><br>
>> Actually, the matrix type has not yet been set (since you have "null" in your output)<br>
>><br>
>> 2016-12-16 16:43 GMT+03:00 Stefano Zampini <<a href="mailto:stefano.zampini@gmail.com">stefano.zampini@gmail.com</a>>:<br>
>> Looking at lines 113-115 of master<br>
>><br>
>> if (reuse == MAT_REUSE_MATRIX) {<br>
>> ierr = PetscObjectTypeCompare((<wbr>PetscObject)*newmat,<wbr>MATSEQDENSE,&isseqdense);<wbr>CHKERRQ(ierr);<br>
>> if (!isseqdense) SETERRQ1(PetscObjectComm((<wbr>PetscObject)*newmat),PETSC_<wbr>ERR_USER,"Cannot reuse matrix of type %s",((PetscObject)(*newmat))-><wbr>type);<br>
>> }<br>
>><br>
>> you are trying to call MatConvert with the reuse flag on a matrix which is not of type SeqDense. Can you provide a MWE to reproduce the problem?<br>
>><br>
>> Thanks,<br>
>> Stefano<br>
>><br>
>> 2016-12-16 16:39 GMT+03:00 Eric Chamberland <<a href="mailto:Eric.Chamberland@giref.ulaval.ca">Eric.Chamberland@giref.<wbr>ulaval.ca</a>>:<br>
>> Another precision: the problem may still be there since dec 15, not tonight...<br>
>><br>
>> Eric<br>
>><br>
>><br>
>><br>
>> On 16/12/16 08:30 AM, Eric Chamberland wrote:<br>
>> Hi,<br>
>><br>
>> something seems broken with master branch since last night.<br>
>><br>
>> With our nighlty tests, we now have many times this PETSC ERROR:<br>
>><br>
>> [0]PETSC ERROR: Cannot reuse matrix of type (null)<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><br>
>> for trouble shooting.<br>
>> [0]PETSC ERROR: Petsc Development GIT revision: v3.7.4-2508-ga46e98f GIT<br>
>> Date: 2016-12-14 17:44:47 -0600<br>
>> [0]PETSC ERROR:<br>
>> /pmi/cmpbib/compilation_BIB_<wbr>gcc_redhat_petsc-master_debug/<wbr>COMPILE_AUTO/BIB/bin/Test.<wbr>BIBProblemeGD.dev<br>
>> on a arch-linux2-c-debug named compile by Unknown Fri Dec 16 03:06:00 2016<br>
>> [0]PETSC ERROR: Configure options --prefix=/opt/petsc-master_<wbr>debug<br>
>> --with-mpi-compilers=1 --with-make-np=12 --with-shared-libraries=1<br>
>> --with-mpi-dir=/opt/openmpi-1.<wbr>10.2 --with-debugging=yes<br>
>> --with-mkl_pardiso=1 --with-mkl_pardiso-dir=/opt/<wbr>intel/composerxe/mkl<br>
>> --download-ml=yes --download-mumps=yes --download-superlu=yes<br>
>> --download-superlu_dist=yes --download-parmetis=yes<br>
>> --download-ptscotch=yes --download-metis=yes --download-suitesparse=yes<br>
>> --download-hypre=yes --with-scalapack=1<br>
>> --with-scalapack-include=/opt/<wbr>intel/composerxe/mkl/include<br>
>> --with-scalapack-lib="-L/opt/<wbr>intel/composerxe/mkl/lib/<wbr>intel64<br>
>> -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64"<br>
>> --with-blas-lapack-dir=/opt/<wbr>intel/composerxe/mkl/lib/<wbr>intel64<br>
>> [0]PETSC ERROR: #1 MatConvert_SeqAIJ_SeqDense() line 115 in<br>
>> /pmi/cmpbib/compilation_BIB_<wbr>gcc_redhat_petsc-master_debug/<wbr>COMPILE_AUTO/petsc-master-<wbr>debug/src/mat/impls/dense/seq/<wbr>dense.c<br>
>><br>
>> [0]PETSC ERROR: #2 MatConvert() line 4136 in<br>
>> /pmi/cmpbib/compilation_BIB_<wbr>gcc_redhat_petsc-master_debug/<wbr>COMPILE_AUTO/petsc-master-<wbr>debug/src/mat/interface/<wbr>matrix.c<br>
>><br>
>><br>
>><br>
>> With all other PETSc versions we use, with the same tests, we do not<br>
>> have this problem.<br>
>><br>
>> Here are the configure/build logs:<br>
>><br>
>> <a href="http://www.giref.ulaval.ca/~cmpgiref/petsc-master-debug/2016.12.16.02h00m01s_configure.log" rel="noreferrer" target="_blank">http://www.giref.ulaval.ca/~<wbr>cmpgiref/petsc-master-debug/<wbr>2016.12.16.02h00m01s_<wbr>configure.log</a><br>
>><br>
>> <a href="http://www.giref.ulaval.ca/~cmpgiref/petsc-master-debug/2016.12.16.02h00m01s_make.log" rel="noreferrer" target="_blank">http://www.giref.ulaval.ca/~<wbr>cmpgiref/petsc-master-debug/<wbr>2016.12.16.02h00m01s_make.log</a><br>
>><br>
>> <a href="http://www.giref.ulaval.ca/~cmpgiref/petsc-master-debug/2016.12.16.02h00m01s_RDict.log" rel="noreferrer" target="_blank">http://www.giref.ulaval.ca/~<wbr>cmpgiref/petsc-master-debug/<wbr>2016.12.16.02h00m01s_RDict.log</a><br>
>><br>
>> <a href="http://www.giref.ulaval.ca/~cmpgiref/petsc-master-debug/2016.12.16.02h00m01s_CMakeLists.txt" rel="noreferrer" target="_blank">http://www.giref.ulaval.ca/~<wbr>cmpgiref/petsc-master-debug/<wbr>2016.12.16.02h00m01s_<wbr>CMakeLists.txt</a><br>
>><br>
>><br>
>> Is it a normal change or is it a bug?<br>
>><br>
>> I can provide more context to help dig into this.<br>
>><br>
>> Thanks,<br>
>><br>
>> Eric<br>
>><br>
>><br>
>><br>
>> --<br>
>> Stefano<br>
>><br>
>><br>
>><br>
>> --<br>
>> Stefano<br>
><br>
<br>
</blockquote></div></div>