Using of MatGetSubMatrices

Barry Smith bsmith at mcs.anl.gov
Mon Aug 28 11:41:39 CDT 2006


   All processes that share the matrix must call MatGetSubMatrices()
the same number of times. If a process doesn't need a matrix it should
pass in zero length IS's. If you are always calling it with all processes
then you can run with -start_in_debugger and when it is hanging hit
control C in the debugger and type where to see where/why it is hanging.

  Barry

On Mon, 28 Aug 2006, Christian Henke wrote:

> Hi all,
>
> I am trying with petsc2.2.0 to get access to my sparse blockdiagonalmatrix
> matrix which contains for example 4 blocks m1 ... m4. If I use 2 Processors
> then m1 and m2 are owned by p1 and m3, m4 owned by p2. Now I want to read m1,
> m2 from p2 and m3, m4 from p1. First I have used MatGetValues, but then I
> took the message: Only local values currently supported.
> My next try was the function MatGetSubMatrices:
>
>     IS             isrow, iscol;
>     Mat            *M;
>
>     ISCreateStride(PETSC_COMM_SELF,m,(int)i*m,1,&isrow);
>     ISCreateStride(PETSC_COMM_SELF,m,(int)j*m,1,&iscol);
>
>     const int ierr
>       = MatGetSubMatrices(matrix,1,&isrow,&iscol,MAT_INITIAL_MATRIX,&M);
>
>     ...
>
>     ISDestroy(isrow);
>     ISDestroy(iscol);
>
> where i,j the blockindices and m is the blocksize. It works well for a few
> functioncalls, but then it stops with the log_trace-message:
>
> [0] 0.055568 Event begin: MatGetSubMatrice.
>
> What is my error? Is MatGetSubMatrices the wrong function for my problem or
> are the above lines wrong?
>
> Regards Christian
>
>




More information about the petsc-users mailing list