Re: [petsc-users] Clarification on MatMPIBAIJSetPreallocation (d_nnz and o_nnz)
This looks like one block row per process? (BAIJ formats store explicit zeros that appear within nonzero blocks.) You'd use d_nnz[] = {1}, o_nnz[] = {1} on each process. If each of the dummy numbers there was replaced by a nonzero block (so the diagram would be sketching nonzero 3x3 blocks of an 18x18 matrix), then you'd have bs=3 with: rank 0: d_nnz[] = {2,2,1}, o_nnz[] = {1,1,2}; rank 1: d_nnz[] = {1,1,1}, o_nnz[] = {2,1,1}; Edoardo alinovi writes: > Thank you Jed for the hint. > > So just to understand it with an example. Say I have this matrix here, > which has 4 3x3 blocks > > 1 2 0 | 0 5 0 | > 0 2 3 | 0 0 1 | < Proc 1 > 0 0 1 | 0 2 2 | > || > 1 2 0 | 0 5 0 | > 0 2 0 | 0 0 1 | < Proc 2 > 0 0 1 | 0 0 2 | > ---|-| > > This can be represented as a collection of submatrices like: > A B > C D > > A and D are the diagonal blocks, while B and C are the off-diagonal ones. > How should I set d_nnz and o_nnz in this case?
Re: [petsc-users] Clarification on MatMPIBAIJSetPreallocation (d_nnz and o_nnz)
Thank you Jed for the hint. So just to understand it with an example. Say I have this matrix here, which has 4 3x3 blocks 1 2 0 | 0 5 0 | 0 2 3 | 0 0 1 | < Proc 1 0 0 1 | 0 2 2 | || 1 2 0 | 0 5 0 | 0 2 0 | 0 0 1 | < Proc 2 0 0 1 | 0 0 2 | ---|-| This can be represented as a collection of submatrices like: A B C D A and D are the diagonal blocks, while B and C are the off-diagonal ones. How should I set d_nnz and o_nnz in this case?
Re: [petsc-users] Clarification on MatMPIBAIJSetPreallocation (d_nnz and o_nnz)
I recommend calling this one preallocation function, which will preallocate scalar and block formats. It takes one value per block row, counting in blocks. https://petsc.org/release/docs/manualpages/Mat/MatXAIJSetPreallocation/ Edoardo alinovi writes: > Hello Barry, > > I am doing some preliminary work to add a coupled solver in my code. I am > reading some documentation on MPIBAIJ as the matrix will be composed of > blocks of size 3x3 in 2D and 4x4 in 3D for each cell in the domain. > > I can't quite understand how to set d_nnz and o_nnz. What is their size? > Should I provide a number of non-zero entries for each block or should I do > it line by line as in MATAIJ? > > Would you be able to provide me with a silly example? > > Thank you!
[petsc-users] Clarification on MatMPIBAIJSetPreallocation (d_nnz and o_nnz)
Hello Barry, I am doing some preliminary work to add a coupled solver in my code. I am reading some documentation on MPIBAIJ as the matrix will be composed of blocks of size 3x3 in 2D and 4x4 in 3D for each cell in the domain. I can't quite understand how to set d_nnz and o_nnz. What is their size? Should I provide a number of non-zero entries for each block or should I do it line by line as in MATAIJ? Would you be able to provide me with a silly example? Thank you!