[petsc-users] MatSetValues() for MATMPICUSP

recrusader recrusader at gmail.com
Sat Feb 11 00:00:33 CST 2012


Dear Matt,

in
http://www.mcs.anl.gov/petsc/petsc-dev/src/ksp/ksp/examples/tutorials/ex43.c.html

Why are two matrices set to MATAIJ? if I set MATAIJCUSP, is them changed?

1468: DMCreateMatrix<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/DM/DMCreateMatrix.html#DMCreateMatrix>
(da_Stokes,MATAIJ<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Mat/MATAIJ.html#MATAIJ>
,&A);

1469:   DMCreateMatrix
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/DM/DMCreateMatrix.html#DMCreateMatrix>(da_Stokes,MATAIJ
<http://www.mcs.anl.gov/petsc/petsc-dev/docs/manualpages/Mat/MATAIJ.html#MATAIJ>,&B);


Thanks a lot.

Best,
Yujie


On Fri, Feb 10, 2012 at 11:30 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Fri, Feb 10, 2012 at 11:10 PM, recrusader <recrusader at gmail.com> wrote:
>
>> Dear Matt,
>>
>> I added the print codes in libmesh after creating the matrix as follows:
>>     "    ierr = MatCreateMPIAIJ (libMesh::COMM_WORLD,
>>                                 m_local, n_local,
>>                                 m_global, n_global,
>>                                 PETSC_NULL, (int*) &n_nz[0],
>>                                 PETSC_NULL, (int*) &n_oz[0], &_mat);
>>              CHKERRABORT(libMesh::COMM_WORLD,ierr);
>>
>>       MatSetOption(_mat,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE); //by
>> Yujie
>>       std::cout<<"MatSetOption"<<std::endl;"
>>
>> I run the same codes in CPU and GPU modes (the same parameters except
>> that GPU uses '-vec_type mpicusp -mat_type mpiaijcusp'). I can find
>> "MatSetOption" output from both the modes. Does that mean that the codes
>> set the options for both the modes?
>> Thank you very much.
>>
>
> Yes, so you should have no problem with allocation errors. Partial reports
> like this help no one. It would be
> somewhat helpful to include a stack trace, to verify that after this
> change you see an error. If might actually
> enable us to find your error if you sent a small test code which failed.
>
>   Thanks,
>
>      Matt
>
>
>> Best,
>> Yujie
>>
>>
>> On Fri, Feb 10, 2012 at 3:14 PM, Matthew Knepley <knepley at gmail.com>wrote:
>>
>>> On Fri, Feb 10, 2012 at 3:12 PM, recrusader <recrusader at gmail.com>wrote:
>>>
>>>> Dear Jed,
>>>>
>>>> The first example works. However, the example uses
>>>> MatSetValuesStencil() not MatSetValues(). Are they same?
>>>>
>>>
>>> MatSetValuesStencil() calls MatSetValues(). I suspect that your MPIAIJ
>>> matrix does not have the option set to
>>> throw an error when inserting a new nonzero, and your MPICUSP matrix
>>> does.
>>>
>>>    Matt
>>>
>>>
>>>> Thanks a lot,
>>>> Yujie
>>>>
>>>> On Fri, Feb 10, 2012 at 2:51 PM, Jed Brown <jedbrown at mcs.anl.gov>wrote:
>>>>
>>>>> On Fri, Feb 10, 2012 at 14:49, recrusader <recrusader at gmail.com>wrote:
>>>>>
>>>>>> Since MATMPIAIJ works (I didn't change anything. Just set the vec and
>>>>>> mat types to mpicusp and mpiaijcusp for GPU), I think the problem is likely
>>>>>> from MatSetValues_MPIAIJ().
>>>>>>
>>>>>> Which PETSc examples can test this function?
>>>>>
>>>>>
>>>>> Try src/ksp/ksp/examples/tutorials/ex43.c and
>>>>> src/snes/examples/tutorials/ex48.c
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> 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
>>>
>>
>>
>
>
> --
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120211/0bd2c214/attachment.htm>


More information about the petsc-users mailing list