[petsc-users] Local and global size of IS
Eda Oktay
eda.oktay at metu.edu.tr
Wed Mar 27 07:33:34 CDT 2019
Hello,
I am trying to permute a matrix A(of size 2n*2n) according to a sorted
eigenvector vr (of size 2n) in parallel using 2 processors (processor
number can change). However, I get an error in MatPermute line stating that
arguments are out of range and a new nonzero caused a malloc even if I used
MatSetOption.
I discovered that this may be because of the unequality of local sizes of
is (and newIS) and local size of A.
Since I allocate index set idx according to size of the vector vr, global
size of is becomes 2n and the local size is also 2n (I think it should be n
since both A and vr has local sizes n because of the number of processors).
If I change the size of idx, then because of VecGetArrayRead, I think is is
created wrongly.
So, how can I make both global and local sizes of is,newIS and A?
Below, you can see the part of my program.
Thanks,
Eda
ierr = VecGetSize(vr,&siz);CHKERRQ(ierr);
ierr = PetscMalloc1(siz,&idx);CHKERRQ(ierr);
for (i=0; i<siz;i++) idx[i] = i;
ierr = VecGetArrayRead(vr,&avr);CHKERRQ(ierr);
ierr = PetscSortRealWithPermutation(siz,avr,idx);CHKERRQ(ierr);
ierr =
ISCreateGeneral(PETSC_COMM_SELF,siz,idx,PETSC_COPY_VALUES,&is);CHKERRQ(ierr);
ierr = ISSetPermutation(is);CHKERRQ(ierr);
ierr = ISDuplicate(is,&newIS);CHKERRQ(ierr);
MatSetOption(A,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr);
ierr = MatPermute(A,is,newIS,&PL);CHKERRQ(ierr);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190327/6f8f9d16/attachment.html>
More information about the petsc-users
mailing list