Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-23 Thread Barry Smith
BAIJ and SBAIJ will only pad matrices on a MatLoad() if you have not already set the sizes. See the source code for MatLoad_MPIBAIJ(). Barry > On Mar 23, 2016, at 7:11 PM, Steena Monteiro wrote: > > Thanks, Barry. The block size compatibility was a probe to investigate an > error arising

Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-23 Thread Matthew Knepley
On Wed, Mar 23, 2016 at 7:11 PM, Steena Monteiro wrote: > Thanks, Barry. The block size compatibility was a probe to investigate an > error arising when trying to assign unequal numbers of rows across two MPI > ranks. > > To re-visit the initial question, what is going wrong when I try to divide

Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-23 Thread Steena Monteiro
Thanks, Barry. The block size compatibility was a probe to investigate an error arising when trying to assign unequal numbers of rows across two MPI ranks. To re-visit the initial question, what is going wrong when I try to divide rows unequally across MPI ranks using MatSetSize? For matrix A wit

Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-23 Thread Barry Smith
The baij and sbaij MatLoad() do automatically pad the matrix with rows/columns of the identity to make it divisible by the block size. This is why you are seeing what you are seeing. Barry Is this a good idea? Maybe not > On Mar 22, 2016, at 8:59 PM, Steena Monteiro wrote: > > > >

Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-22 Thread Steena Monteiro
> So, are you saying that > > 1) You have a matrix with odd total dimension > > 2) You set the block size of the initial matrix to 2 > > 3) You load the matrix > > and there is no error? Can you make a simple example with a matrix of size > 5? > I can put in the relevant error checking. > > >

Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-15 Thread Steena Monteiro
Hi Matt, Yes, the rest of the code is: ierr = MatSetBlockSize(A,2);CHKERRQ(ierr); * ierr = MatLoad(A,fd);CHKERRQ(ierr);* ierr = MatCreateVecs(A, &x, &y);CHKERRQ(ierr); ierr = VecSetRandom(x,NULL); CHKERRQ(ierr); ierr = VecSet(y,zero); CHKERRQ(ierr); ierr = MatMult(A,x,y); CHKERRQ(ie

Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-15 Thread Matthew Knepley
On Tue, Mar 15, 2016 at 12:14 PM, Steena Monteiro wrote: > Hi Matt, > > Yes, the rest of the code is: > > ierr = MatSetBlockSize(A,2);CHKERRQ(ierr); > * ierr = MatLoad(A,fd);CHKERRQ(ierr);* > So, are you saying that 1) You have a matrix with odd total dimension 2) You set the block size

Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-15 Thread Matthew Knepley
On Tue, Mar 15, 2016 at 11:04 AM, Steena Monteiro wrote: > I pass a binary, matrix data file at the command line and load it into the > matrix: > > PetscInitialize(&argc,&args,(char*)0,help); > ierr = MPI_Comm_rank(PETSC_COMM_WORLD,&rank);CHKERRQ(ierr); > > /* converted mtx to dat file*/ > ierr =

Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-15 Thread Steena Monteiro
I pass a binary, matrix data file at the command line and load it into the matrix: PetscInitialize(&argc,&args,(char*)0,help); ierr = MPI_Comm_rank(PETSC_COMM_WORLD,&rank);CHKERRQ(ierr); /* converted mtx to dat file*/ ierr = PetscOptionsGetString(NULL,"-f",file,PETSC_MAX_PATH_LEN,&flg); CHKERRQ(i

Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-15 Thread Matthew Knepley
On Tue, Mar 15, 2016 at 10:54 AM, Steena Monteiro wrote: > Thank you, Dave. > > Matt: I understand the inconsistency but MatMult with non divisible block > sizes (here, 2) does not throw any errors and fail, when MatSetSize is > commented out. Implying that 1139905 global size does work with bloc

Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-15 Thread Steena Monteiro
Thank you, Dave. Matt: I understand the inconsistency but MatMult with non divisible block sizes (here, 2) does not throw any errors and fail, when MatSetSize is commented out. Implying that 1139905 global size does work with block size 2. On 15 March 2016 at 00:12, Dave May wrote: > > On 15 Ma

Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-15 Thread Dave May
On 15 March 2016 at 04:46, Matthew Knepley wrote: > On Mon, Mar 14, 2016 at 10:05 PM, Steena Monteiro > wrote: > >> Hello, >> >> I am having difficulty getting MatSetSize to work prior to using MatMult. >> >> For matrix A with rows=cols=1,139,905 and block size = 2, >> > > It is inconsistent to

Re: [petsc-users] MatSetSizes with blocked matrix

2016-03-14 Thread Matthew Knepley
On Mon, Mar 14, 2016 at 10:05 PM, Steena Monteiro wrote: > Hello, > > I am having difficulty getting MatSetSize to work prior to using MatMult. > > For matrix A with rows=cols=1,139,905 and block size = 2, > It is inconsistent to have a row/col size that is not divisible by the block size. Ma

[petsc-users] MatSetSizes with blocked matrix

2016-03-14 Thread Steena Monteiro
Hello, I am having difficulty getting MatSetSize to work prior to using MatMult. For matrix A with rows=cols=1,139,905 and block size = 2, rank 0 gets 40 rows and rank 1 739905 rows, like so: /*Matrix setup*/ ierr=PetscViewerBinaryOpen(PETSC_COMM_WORLD,file,FILE_MODE_READ,&fd); ierr = Mat