[petsc-users] Local and global size of IS

Eda Oktay eda.oktay at metu.edu.tr
Tue Apr 2 08:00:13 CDT 2019


Hi Mark,

siz%size = 0 in my case because siz=362 and I use at most 2 processors.

Mark Adams <mfadams at lbl.gov>, 2 Nis 2019 Sal, 15:12 tarihinde şunu yazdı:

>
>
> 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/d961da36/attachment.html>


More information about the petsc-users mailing list