[petsc-users] Local and global size of IS

Mark Adams mfadams at lbl.gov
Tue Apr 2 07:01:41 CDT 2019


On Tue, Apr 2, 2019 at 6:55 AM Eda Oktay via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> Hi Barry,
>
> I did what you said but now I get the error in ISSetPermutation that index
> set is not a permutation. ı think it is because since I selected indices on
> each process as you said. I did the following, did I understand you wrong:
>
>   PetscMPIInt rank,size;
>   MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
>   MPI_Comm_size(PETSC_COMM_WORLD, &size);
>
>   PetscInt *idxx,ss;
>   ss = siz/size;
>   PetscMalloc1(ss,&idxx);
>   if (rank != size-1) {
>     j =0;
>     for (i=rank*ss; i<(rank+1)*ss; i++) {
>       idxx[j] = idx[i];
>       j++;
>     }
>
>   } else {
>
>     j =0;
>     for (i=rank*ss; i<siz; i++) {
>       idxx[j] = idx[i];
>

if siz%size != 0, you will run off the end of idxx, that is you have a
memory error.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190402/e7be1c64/attachment.html>


More information about the petsc-users mailing list