[petsc-users] MATELEMENTAL MatSetValue( )
Jed Brown
jed at jedbrown.org
Wed May 25 22:32:02 CDT 2016
Use MatGetOwnershipIS() and set only the entries in your owned rows and
columns. What you're doing is nonscalable anyway because every process
is filling the global matrix. If you want a cheap hack for small
problems on small numbers of cores, you can run your insertion loop on
only rank 0.
"Eric D. Robertson" <eric.robertson at cfdrc.com> writes:
> I am trying to multiply two dense matrices using the Elemental interface. I fill the matrix using MatSetValue( ) like below:
>
> for ( i = 0; i < Matrix.M; i++){
> for ( j = 0; j < Matrix.N; j++) {
> PetscScalar temp = i + one + (j*three);
> MatSetValue(Matrix.A, i, j, temp, INSERT_VALUES);
>
> }
> }
>
>
> However, I seem to get the following error:
>
> [0]PETSC ERROR: No support for this operation for this object type
> [0]PETSC ERROR: Only ADD_VALUES to off-processor entry is supported
>
> But if I use ADD_VALUES, I get a different matrix depending on the number of processors used. The entries become multiplied by the number of processors. How do I reconcile this?
>
>
> <redir.aspx?REF=hVEx-ekIltbV6NDJuYjzplTZG3ymEirNPcO9eR2dIGrvJzCyE4XTCAFtYWlsdG86ZXJpYy5yb2JlcnRzb25AY2ZkcmMuY29t>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160525/e817feaf/attachment.pgp>
More information about the petsc-users
mailing list