[petsc-users] ISCreateStride and MatGetSubmatrices

shu guo greatgs2008 at gmail.com
Tue Aug 28 10:48:09 CDT 2012


I am using totalview instead of  Valgrind. Where can I find the
information of the stack trace?... Sorry about this easy question, I
am really a beginner in programming...

Shu

On Tue, Aug 28, 2012 at 11:44 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> On Tue, Aug 28, 2012 at 10:42 AM, shu guo <greatgs2008 at gmail.com> wrote:
>>
>> Hi Jed,
>>
>> I was thinking about this issue either. But when I create the matrix,
>> I hardcoded as
>>
>>           call MatCreateMPIBAIJ  (PETSC_COMM_WORLD,4,32,32,
>>      &                          PETSC_DETERMINE, PETSC_DETERMINE,
>>      &                          PETSC_NULL_INTEGER, mr(np(246)),
>>      &                          PETSC_NULL_INTEGER, mr(np(247)),
>>      &                          Kmatem, ierr)
>>
>> And it works good. Does that mean this should not be a concern as you
>> mentioned?
>
>
> Probably, but it's still bad practice when using Fortran, and it will cause
> problems if you change the integer size later (e.g. to solve problems with
> more than 2B degrees of freedom). What does Valgrind say?
>
>>
>>
>> Thanks.
>>
>> Shu
>>
>>
>>
>> On Tue, Aug 28, 2012 at 11:37 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>> > On Tue, Aug 28, 2012 at 10:33 AM, shu guo <greatgs2008 at gmail.com> wrote:
>> >>
>> >> Dear All,
>> >>
>> >> I want to extract a sequential matrix from a MPIBAIJ matrix A with a
>> >> dimension of 4n*4n. After assembly A, I use ISCreateStride to define
>> >> the index by
>> >>
>> >>           call ISCreateStride(PETSC_COMM_WORLD,n,0,1,isrow,ierr)
>> >
>> >
>> > Fortran does not do type conversion without interfaces (which are about
>> > as
>> > much hassle as benefit). If you configured PETSc with non-default
>> > integer
>> > sizes, be sure to declare PetscInt zero,one instead of using numeric
>> > literals.
>> >
>> > Otherwise, run in valgrind to check that there isn't earlier corruption
>> > and
>> > run in a debugger to get a stack trace.
>> >
>> >>
>> >>
>> >> And extract the matrix as
>> >>           call MatGetSubMatrices(Kmatem,1,isrow,isrow,
>> >>      &                           MAT_INITIAL_MATRIX,Kmatemseq)
>> >>
>> >> But it gives me a segmentation fault when I call ISCreateStride. Is
>> >> there anything I did wrong? Thanks for any advice.
>> >>
>> >> Shu
>> >
>> >
>
>


More information about the petsc-users mailing list