From dave.mayhem23 at gmail.com Tue Dec 1 01:38:06 2009 From: dave.mayhem23 at gmail.com (Dave May) Date: Tue, 1 Dec 2009 08:38:06 +0100 Subject: How to copy global data to local ? In-Reply-To: <650026.6302.qm@web15802.mail.cnb.yahoo.com> References: <650026.6302.qm@web15802.mail.cnb.yahoo.com> Message-ID: <956373f0911302338v69d2086fj80afa6169f4104cc@mail.gmail.com> If the rows you want on each processor are local to this processor, why not try using MatGetRow(). http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatGetRow.html On Tue, Dec 1, 2009 at 6:21 AM, ming zhu wrote: > Hi > I have a huge matrix U for all processors (PETSC_COMM_WORLD). I only want > to copy only two rows (i,j) for each local processor. i,j is different for > each processor and not related to rank. I was trying to use a vector filter > (like, 00000010000). However, if the vector is PETSC_COMM_WORLD, it will be > changed by different processor. So, how to make it ? > Thank you > > My original code is > > Vec filter > VecCreate(PETSC_COMM_WORLD,&filter); > VecSetsizes(filter,PETSC_DECIDE,m); > VecSetFromOptions(filter); > > Vecset(filter,0); > VecSetValue(filter,i,1,INSERT_VALUES); > > ... > MatMult(U, filter,ui); > > If I create filter with PETSC_COMM_SELF, it is impossible for U and filter > to multiply. > > > > > > ------------------------------ > ????????????????? -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Tue Dec 1 08:23:17 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Tue, 1 Dec 2009 08:23:17 -0600 Subject: How to copy global data to local ? In-Reply-To: <650026.6302.qm@web15802.mail.cnb.yahoo.com> References: <650026.6302.qm@web15802.mail.cnb.yahoo.com> Message-ID: On Nov 30, 2009, at 11:21 PM, ming zhu wrote: > Hi > I have a huge matrix U for all processors (PETSC_COMM_WORLD). I only > want to copy only two rows (i,j) for each local processor. i,j is > different for each processor and not related to rank. I was trying > to use a vector filter (like, 00000010000). However, if the vector > is PETSC_COMM_WORLD, it will be changed by different processor. So, > how to make it ? ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I do not understand what this means. To do the multiply you can and should use a vector of PETSC_COMM_WORLD. Also multiplying by a vector will not give you back "rows" of a matrix. Do you truly want the entire row of nonzeros of the matrix or something else. If you want the entire row or part of a row then you can use MatGetSubMatrix(). Barry > Thank you > > My original code is > > Vec filter > VecCreate(PETSC_COMM_WORLD,&filter); > VecSetsizes(filter,PETSC_DECIDE,m); > VecSetFromOptions(filter); > > Vecset(filter,0); > VecSetValue(filter,i,1,INSERT_VALUES); > > ... > MatMult(U, filter,ui); > > If I create filter with PETSC_COMM_SELF, it is impossible for U and > filter to multiply. > > > > > > ????????????????? From foolishzhu at yahoo.com.cn Tue Dec 1 08:29:16 2009 From: foolishzhu at yahoo.com.cn (ming zhu) Date: Tue, 1 Dec 2009 22:29:16 +0800 (CST) Subject: How to copy global data to local ? In-Reply-To: Message-ID: <265424.8392.qm@web15802.mail.cnb.yahoo.com> It seems that MatGetSubMatrix() only get the local matrix for the processor? If U is global(PETSC_COMM_WORLD), the local matrix may not store the column or row I wanted. For example, if U is 4*4, and there are 4 processors, processors one has local matrix 2*2, but i need the third row, Then,MatGetSubmatrix() may not work --- 09?12?1????, Barry Smith ??? ???: Barry Smith ??: Re: How to copy global data to local ? ???: "PETSc users list" ??: 2009?12?1?,??,??10:23 On Nov 30, 2009, at 11:21 PM, ming zhu wrote: > Hi > I have a huge matrix U for all processors (PETSC_COMM_WORLD). I only want to copy only two rows (i,j) for each local processor. i,j is different for each processor and not related to rank.? I was trying to use a vector filter (like, 00000010000). However, if the vector is PETSC_COMM_WORLD, it will be changed by different processor. So, how to make it ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ???^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ???I do not understand what this means. To do the multiply you can and should use a vector of PETSC_COMM_WORLD. ???Also multiplying by a vector will not give you back "rows" of a matrix. Do you truly want the entire row of nonzeros of the matrix or something else. If you want the entire row or part of a row then you can use MatGetSubMatrix(). ???Barry > Thank you > > My original code is > > Vec filter > VecCreate(PETSC_COMM_WORLD,&filter); > VecSetsizes(filter,PETSC_DECIDE,m); > VecSetFromOptions(filter); > > Vecset(filter,0); > VecSetValue(filter,i,1,INSERT_VALUES); > > ... > MatMult(U, filter,ui); > > If I create filter with PETSC_COMM_SELF, it is impossible for U and filter to multiply. > > > > > > ????????????????? ___________________________________________________________ ????????????????? http://card.mail.cn.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Tue Dec 1 08:35:40 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Tue, 1 Dec 2009 08:35:40 -0600 Subject: How to copy global data to local ? In-Reply-To: <265424.8392.qm@web15802.mail.cnb.yahoo.com> References: <265424.8392.qm@web15802.mail.cnb.yahoo.com> Message-ID: You misunderstand the usage of MatGetSubMatrix(). Any process can request ANY row, including rows that are not originally owned by that process. Barry On Dec 1, 2009, at 8:29 AM, ming zhu wrote: > It seems that MatGetSubMatrix() only get the local matrix for the > processor If U is global(PETSC_COMM_WORLD), the local matrix may > not store the column or row I wanted. For example, if U is 4*4, and > there are 4 processors, processors one has local matrix 2*2, but i > need the third row, Then,MatGetSubmatrix() may not work > > --- 09?12?1????, Barry Smith ? > ?? > > ???: Barry Smith > ??: Re: How to copy global data to local ? > ???: "PETSc users list" > ??: 2009?12?1?,??,??10:23 > > > On Nov 30, 2009, at 11:21 PM, ming zhu wrote: > > > Hi > > I have a huge matrix U for all processors (PETSC_COMM_WORLD). I > only want to copy only two rows (i,j) for each local processor. i,j > is different for each processor and not related to rank. I was > trying to use a vector filter (like, 00000010000). However, if the > vector is PETSC_COMM_WORLD, it will be changed by different > processor. So, how to make it ? > ^ > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > I do not understand what this means. To do the multiply you can > and should use a vector of PETSC_COMM_WORLD. > > Also multiplying by a vector will not give you back "rows" of a > matrix. Do you truly want the entire row of nonzeros of the matrix > or something else. If you want the entire row or part of a row then > you can use MatGetSubMatrix(). > > Barry > > > Thank you > > > > My original code is > > > > Vec filter > > VecCreate(PETSC_COMM_WORLD,&filter); > > VecSetsizes(filter,PETSC_DECIDE,m); > > VecSetFromOptions(filter); > > > > Vecset(filter,0); > > VecSetValue(filter,i,1,INSERT_VALUES); > > > > ... > > MatMult(U, filter,ui); > > > > If I create filter with PETSC_COMM_SELF, it is impossible for U > and filter to multiply. > > > > > > > > > > > > ????????????????? > > > ????????????????? From foolishzhu at yahoo.com.cn Tue Dec 1 14:04:07 2009 From: foolishzhu at yahoo.com.cn (ming zhu) Date: Wed, 2 Dec 2009 04:04:07 +0800 (CST) Subject: How to copy global data to local ? In-Reply-To: <265424.8392.qm@web15802.mail.cnb.yahoo.com> Message-ID: <464599.27756.qm@web15806.mail.cnb.yahoo.com> OK. It worksThank you --- 09?12?1????, ming zhu ??? ???: ming zhu ??: Re: How to copy global data to local ? ???: "PETSc users list" ??: 2009?12?1?,??,??10:29 It seems that MatGetSubMatrix() only get the local matrix for the processor? If U is global(PETSC_COMM_WORLD), the local matrix may not store the column or row I wanted. For example, if U is 4*4, and there are 4 processors, processors one has local matrix 2*2, but i need the third row, Then,MatGetSubmatrix() may not work --- 09?12?1????, Barry Smith ??? ???: Barry Smith ??: Re: How to copy global data to local ? ???: "PETSc users list" ??: 2009?12?1?,??,??10:23 On Nov 30, 2009, at 11:21 PM, ming zhu wrote: > Hi > I have a huge matrix U for all processors (PETSC_COMM_WORLD). I only want to copy only two rows (i,j) for each local processor. i,j is different for each processor and not related to rank.? I was trying to use a vector filter (like, 00000010000). However, if the vector is PETSC_COMM_WORLD, it will be changed by different processor. So, how to make it ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ???^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ???I do not understand what this means. To do the multiply you can and should use a vector of PETSC_COMM_WORLD. ???Also multiplying by a vector will not give you back "rows" of a matrix. Do you truly want the entire row of nonzeros of the matrix or something else. If you want the entire row or part of a row then you can use MatGetSubMatrix(). ???Barry > Thank you > > My original code is > > Vec filter > VecCreate(PETSC_COMM_WORLD,&filter); > VecSetsizes(filter,PETSC_DECIDE,m); > VecSetFromOptions(filter); > > Vecset(filter,0); > VecSetValue(filter,i,1,INSERT_VALUES); > > ... > MatMult(U, filter,ui); > > If I create filter with PETSC_COMM_SELF, it is impossible for U and filter to multiply. > > > > > > ????????????????? ????????????????? ___________________________________________________________ ????????????????? http://card.mail.cn.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From foolishzhu at yahoo.com.cn Tue Dec 1 14:10:28 2009 From: foolishzhu at yahoo.com.cn (ming zhu) Date: Wed, 2 Dec 2009 04:10:28 +0800 (CST) Subject: how to run petsc on different machine Message-ID: <127879.15805.qm@web15804.mail.cnb.yahoo.com> ?With?--download-mpich=1,Petsc install mpi. However, since I want to run my Petsc program on different machines and mpiexec -machinefile does not work.?It complains:invalid mpiexec argument -machinefile. Do I have to install mpi for this?? Or do other way? Thank you ___________________________________________________________ ????????????????? http://card.mail.cn.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From balay at mcs.anl.gov Tue Dec 1 14:15:30 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Tue, 1 Dec 2009 14:15:30 -0600 (CST) Subject: how to run petsc on different machine In-Reply-To: <127879.15805.qm@web15804.mail.cnb.yahoo.com> References: <127879.15805.qm@web15804.mail.cnb.yahoo.com> Message-ID: --download-mpich=1 defaults to gforker i.e a single machine. If you wish to run on multiple machines - then you'll have to figureout what mechanism you'd like to use - and then direct the MPI install for that method. For eg: - the common method is to use MPD. So you can install petsc with --download-mpich=1 --download-mpich-pm=mpd [Or install any MPI as you desire - separately - and then install PETSc with it]. Satish On Wed, 2 Dec 2009, ming zhu wrote: > ?With?--download-mpich=1,Petsc install mpi. However, since I want to run my Petsc program on different machines and mpiexec -machinefile does not work.?It complains:invalid mpiexec argument -machinefile. > Do I have to install mpi for this?? Or do other way? > Thank you > > > > > ___________________________________________________________ > ????????????????? > http://card.mail.cn.yahoo.com/ From foolishzhu at yahoo.com.cn Tue Dec 1 21:59:36 2009 From: foolishzhu at yahoo.com.cn (ming zhu) Date: Wed, 2 Dec 2009 11:59:36 +0800 (CST) Subject: How to copy global data to local ? In-Reply-To: Message-ID: <380794.50807.qm@web15802.mail.cnb.yahoo.com> HiI tried?MatGetSubMatrix() but I am a little confused by the column parameter. For exampleMy matrix is U (m * n). I want to get i,j rows to local.my code is? PetscInt* rowindex,colindex;PetscMalloc...for (k= 0; k < n; k++)?? colindex[k] = k; rowindex[0] = i;rowindex[1] = j; MatGetSubMatrixRaw(U,1,&i,n,indices,n,MAT_INITIAL_MATRIX,&newmat); What I hope is newmat is 2 * n matrix. But I failed. Thank you --- 09?12?1????, Barry Smith ??? ???: Barry Smith ??: Re: How to copy global data to local ? ???: "PETSc users list" ??: 2009?12?1?,??,??10:35 ???You misunderstand the usage of MatGetSubMatrix(). Any process can request ANY row, including rows that are not originally owned by that process. ???Barry On Dec 1, 2009, at 8:29 AM, ming zhu wrote: > It seems that MatGetSubMatrix() only get the local matrix for the processor? If U is global(PETSC_COMM_WORLD), the local matrix may not store the column or row I wanted. For example, if U is 4*4, and there are 4 processors, processors one has local matrix 2*2, but i need the third row, Then,MatGetSubmatrix() may not work > > --- 09?12?1????, Barry Smith ??? > > ???: Barry Smith > ??: Re: How to copy global data to local ? > ???: "PETSc users list" > ??: 2009?12?1?,??,??10:23 > > > On Nov 30, 2009, at 11:21 PM, ming zhu wrote: > > > Hi > > I have a huge matrix U for all processors (PETSC_COMM_WORLD). I only want to copy only two rows (i,j) for each local processor. i,j is different for each processor and not related to rank.? I was trying to use a vector filter (like, 00000010000). However, if the vector is PETSC_COMM_WORLD, it will be changed by different processor. So, how to make it ? >? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > >? ? I do not understand what this means. To do the multiply you can and should use a vector of PETSC_COMM_WORLD. > >? ? Also multiplying by a vector will not give you back "rows" of a matrix. Do you truly want the entire row of nonzeros of the matrix or something else. If you want the entire row or part of a row then you can use MatGetSubMatrix(). > >? ? Barry > > > Thank you > > > > My original code is > > > > Vec filter > > VecCreate(PETSC_COMM_WORLD,&filter); > > VecSetsizes(filter,PETSC_DECIDE,m); > > VecSetFromOptions(filter); > > > > Vecset(filter,0); > > VecSetValue(filter,i,1,INSERT_VALUES); > > > > ... > > MatMult(U, filter,ui); > > > > If I create filter with PETSC_COMM_SELF, it is impossible for U and filter to multiply. > > > > > > > > > > > > ????????????????? > > > ????????????????? ___________________________________________________________ ????????????????? http://card.mail.cn.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From foolishzhu at yahoo.com.cn Tue Dec 1 21:59:36 2009 From: foolishzhu at yahoo.com.cn (ming zhu) Date: Wed, 2 Dec 2009 11:59:36 +0800 (CST) Subject: How to copy global data to local ? In-Reply-To: Message-ID: <380794.50807.qm@web15802.mail.cnb.yahoo.com> HiI tried?MatGetSubMatrix() but I am a little confused by the column parameter. For exampleMy matrix is U (m * n). I want to get i,j rows to local.my code is? PetscInt* rowindex,colindex;PetscMalloc...for (k= 0; k < n; k++)?? colindex[k] = k; rowindex[0] = i;rowindex[1] = j; MatGetSubMatrixRaw(U,1,&i,n,indices,n,MAT_INITIAL_MATRIX,&newmat); What I hope is newmat is 2 * n matrix. But I failed. Thank you --- 09?12?1????, Barry Smith ??? ???: Barry Smith ??: Re: How to copy global data to local ? ???: "PETSc users list" ??: 2009?12?1?,??,??10:35 ???You misunderstand the usage of MatGetSubMatrix(). Any process can request ANY row, including rows that are not originally owned by that process. ???Barry On Dec 1, 2009, at 8:29 AM, ming zhu wrote: > It seems that MatGetSubMatrix() only get the local matrix for the processor? If U is global(PETSC_COMM_WORLD), the local matrix may not store the column or row I wanted. For example, if U is 4*4, and there are 4 processors, processors one has local matrix 2*2, but i need the third row, Then,MatGetSubmatrix() may not work > > --- 09?12?1????, Barry Smith ??? > > ???: Barry Smith > ??: Re: How to copy global data to local ? > ???: "PETSc users list" > ??: 2009?12?1?,??,??10:23 > > > On Nov 30, 2009, at 11:21 PM, ming zhu wrote: > > > Hi > > I have a huge matrix U for all processors (PETSC_COMM_WORLD). I only want to copy only two rows (i,j) for each local processor. i,j is different for each processor and not related to rank.? I was trying to use a vector filter (like, 00000010000). However, if the vector is PETSC_COMM_WORLD, it will be changed by different processor. So, how to make it ? >? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > >? ? I do not understand what this means. To do the multiply you can and should use a vector of PETSC_COMM_WORLD. > >? ? Also multiplying by a vector will not give you back "rows" of a matrix. Do you truly want the entire row of nonzeros of the matrix or something else. If you want the entire row or part of a row then you can use MatGetSubMatrix(). > >? ? Barry > > > Thank you > > > > My original code is > > > > Vec filter > > VecCreate(PETSC_COMM_WORLD,&filter); > > VecSetsizes(filter,PETSC_DECIDE,m); > > VecSetFromOptions(filter); > > > > Vecset(filter,0); > > VecSetValue(filter,i,1,INSERT_VALUES); > > > > ... > > MatMult(U, filter,ui); > > > > If I create filter with PETSC_COMM_SELF, it is impossible for U and filter to multiply. > > > > > > > > > > > > ????????????????? > > > ????????????????? ___________________________________________________________ ????????????????? http://card.mail.cn.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Tue Dec 1 23:46:03 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Tue, 1 Dec 2009 23:46:03 -0600 Subject: How to copy global data to local ? In-Reply-To: <380794.50807.qm@web15802.mail.cnb.yahoo.com> References: <380794.50807.qm@web15802.mail.cnb.yahoo.com> Message-ID: <4C2AEE29-5A1F-4722-9B0A-6507174689FD@mcs.anl.gov> Don't know what MatGetSubMatrixRaw() is, but based on the calling sequence you are asking for the ith row whatever that is, and n columns in the array indices For MatGetSubMatrix() each process can ask for any rows it wants, but all the processors have to ask for the same columns that are wanted. Barry On Dec 1, 2009, at 9:59 PM, ming zhu wrote: > Hi > I tried MatGetSubMatrix() but I am a little confused by the column > parameter. For example > My matrix is U (m * n). I want to get i,j rows to local. > my code is > > PetscInt* rowindex,colindex; > PetscMalloc... > for (k= 0; k < n; k++) > colindex[k] = k; > > rowindex[0] = i; > rowindex[1] = j; > > MatGetSubMatrixRaw(U,1,&i,n,indices,n,MAT_INITIAL_MATRIX,&newmat); > > What I hope is newmat is 2 * n matrix. But I failed. > > Thank you > > > --- 09?12?1????, Barry Smith ? > ?? > > ???: Barry Smith > ??: Re: How to copy global data to local ? > ???: "PETSc users list" > ??: 2009?12?1?,??,??10:35 > > > You misunderstand the usage of MatGetSubMatrix(). Any process can > request ANY row, including rows that are not originally owned by > that process. > > Barry > > On Dec 1, 2009, at 8:29 AM, ming zhu wrote: > > > It seems that MatGetSubMatrix() only get the local matrix for the > processor If U is global(PETSC_COMM_WORLD), the local matrix may > not store the column or row I wanted. For example, if U is 4*4, and > there are 4 processors, processors one has local matrix 2*2, but i > need the third row, Then,MatGetSubmatrix() may not work > > > > --- 09?12?1????, Barry Smith ? > ?? > > > > ???: Barry Smith > > ??: Re: How to copy global data to local ? > > ???: "PETSc users list" > > ??: 2009?12?1?,??,??10:23 > > > > > > On Nov 30, 2009, at 11:21 PM, ming zhu wrote: > > > > > Hi > > > I have a huge matrix U for all processors (PETSC_COMM_WORLD). I > only want to copy only two rows (i,j) for each local processor. i,j > is different for each processor and not related to rank. I was > trying to use a vector filter (like, 00000010000). However, if the > vector is PETSC_COMM_WORLD, it will be changed by different > processor. So, how to make it ? > > > ^ > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > I do not understand what this means. To do the multiply you can > and should use a vector of PETSC_COMM_WORLD. > > > > Also multiplying by a vector will not give you back "rows" of a > matrix. Do you truly want the entire row of nonzeros of the matrix > or something else. If you want the entire row or part of a row then > you can use MatGetSubMatrix(). > > > > Barry > > > > > Thank you > > > > > > My original code is > > > > > > Vec filter > > > VecCreate(PETSC_COMM_WORLD,&filter); > > > VecSetsizes(filter,PETSC_DECIDE,m); > > > VecSetFromOptions(filter); > > > > > > Vecset(filter,0); > > > VecSetValue(filter,i,1,INSERT_VALUES); > > > > > > ... > > > MatMult(U, filter,ui); > > > > > > If I create filter with PETSC_COMM_SELF, it is impossible for U > and filter to multiply. > > > > > > > > > > > > > > > > > > ????????????????? > > > > > > ????????????????? > > > ????????????????? From foolishzhu at yahoo.com.cn Wed Dec 2 00:33:32 2009 From: foolishzhu at yahoo.com.cn (ming zhu) Date: Wed, 2 Dec 2009 14:33:32 +0800 (CST) Subject: How to copy global data to local ? In-Reply-To: <4C2AEE29-5A1F-4722-9B0A-6507174689FD@mcs.anl.gov> Message-ID: <805175.90302.qm@web15806.mail.cnb.yahoo.com> OK. I am now use MatGetSubMatrix.My code is as follows ? PetscMalloc(n*sizeof(PetscInt),&indices);? ? for (j = 0; j < n; j++) ? {?? ????? indices[j] = j; ? } ? ISCreateGeneral(PETSC_COMM_SELF,n,indices,&iy); // get all columns ?.... ?? PetscMalloc(2*sizeof(PetscInt),&indices);? ??? indices[0] = i; ??? indices[1] = j; ??? ISCreateGeneral(PETSC_COMM_SELF,2,indices,&ix);???? // only get i,j rows ??? Mat ui,uj; // I am not sure how to set the third parameter : how many "local " columns.. Since I want all columns, I set it to n ???? ierr = MatGetSubMatrix(U,ix,iy,n, MAT_INITIAL_MATRIX,&ui);CHKERRQ(ierr); What I really hope is to ???? ??? for (i = 0; i < n; i++) { ????? ????????? PetscInt row = 0; ????????? MatGetValues(ui,1,&row,1,&i,&u_ik); } It does not work. I tried to change the n to PETSC_DECIDE, it still does not work So, I really doubt that whether I can get the entire row of the matrix. BTW, the matrix is created as follows: ?MatCreateMPIDense(PETSC_COMM_WORLD,PETSC_DECIDE,PETSC_DECIDE,m,n,PETSC_NULL,&U) THank you --- 09?12?2????, Barry Smith ??? ???: Barry Smith ??: Re: How to copy global data to local ? ???: "PETSc users list" ??: 2009?12?2?,??,??1:46 ???Don't know what MatGetSubMatrixRaw() is, but based on the calling sequence you are asking for the ith row whatever that is, and n columns in the array indices ???For MatGetSubMatrix() each process can ask for any rows it wants, but all the processors have to ask for the same columns that are wanted. ???Barry On Dec 1, 2009, at 9:59 PM, ming zhu wrote: > Hi > I tried MatGetSubMatrix() but I am a little confused by the column parameter. For example > My matrix is U (m * n). I want to get i,j rows to local. > my code is > > PetscInt* rowindex,colindex; > PetscMalloc... > for (k= 0; k < n; k++) >? ? colindex[k] = k; > > rowindex[0] = i; > rowindex[1] = j; > > MatGetSubMatrixRaw(U,1,&i,n,indices,n,MAT_INITIAL_MATRIX,&newmat); > > What I hope is newmat is 2 * n matrix. But I failed. > > Thank you > > > --- 09?12?1????, Barry Smith ??? > > ???: Barry Smith > ??: Re: How to copy global data to local ? > ???: "PETSc users list" > ??: 2009?12?1?,??,??10:35 > > >? ? You misunderstand the usage of MatGetSubMatrix(). Any process can request ANY row, including rows that are not originally owned by that process. > >? ? Barry > > On Dec 1, 2009, at 8:29 AM, ming zhu wrote: > > > It seems that MatGetSubMatrix() only get the local matrix for the processor? If U is global(PETSC_COMM_WORLD), the local matrix may not store the column or row I wanted. For example, if U is 4*4, and there are 4 processors, processors one has local matrix 2*2, but i need the third row, Then,MatGetSubmatrix() may not work > > > > --- 09?12?1????, Barry Smith ??? > > > > ???: Barry Smith > > ??: Re: How to copy global data to local ? > > ???: "PETSc users list" > > ??: 2009?12?1?,??,??10:23 > > > > > > On Nov 30, 2009, at 11:21 PM, ming zhu wrote: > > > > > Hi > > > I have a huge matrix U for all processors (PETSC_COMM_WORLD). I only want to copy only two rows (i,j) for each local processor. i,j is different for each processor and not related to rank.? I was trying to use a vector filter (like, 00000010000). However, if the vector is PETSC_COMM_WORLD, it will be changed by different processor. So, how to make it ? > >? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > >? ? I do not understand what this means. To do the multiply you can and should use a vector of PETSC_COMM_WORLD. > > > >? ? Also multiplying by a vector will not give you back "rows" of a matrix. Do you truly want the entire row of nonzeros of the matrix or something else. If you want the entire row or part of a row then you can use MatGetSubMatrix(). > > > >? ? Barry > > > > > Thank you > > > > > > My original code is > > > > > > Vec filter > > > VecCreate(PETSC_COMM_WORLD,&filter); > > > VecSetsizes(filter,PETSC_DECIDE,m); > > > VecSetFromOptions(filter); > > > > > > Vecset(filter,0); > > > VecSetValue(filter,i,1,INSERT_VALUES); > > > > > > ... > > > MatMult(U, filter,ui); > > > > > > If I create filter with PETSC_COMM_SELF, it is impossible for U and filter to multiply. > > > > > > > > > > > > > > > > > > ????????????????? > > > > > > ????????????????? > > > ????????????????? ___________________________________________________________ ????????????????? http://card.mail.cn.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Wed Dec 2 01:52:50 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Wed, 2 Dec 2009 01:52:50 -0600 Subject: How to copy global data to local ? In-Reply-To: <805175.90302.qm@web15806.mail.cnb.yahoo.com> References: <805175.90302.qm@web15806.mail.cnb.yahoo.com> Message-ID: <42CFE02B-ACA8-466A-874D-37290FED31E0@mcs.anl.gov> Let's move this over to petsc-maint at mcs.anl.gov to cut the traffic on petsc-users See below. On Dec 2, 2009, at 12:33 AM, ming zhu wrote: > OK. I am now use MatGetSubMatrix.My code is as follows > > PetscMalloc(n*sizeof(PetscInt),&indices); > for (j = 0; j < n; j++) > { > indices[j] = j; > } > ISCreateGeneral(PETSC_COMM_SELF,n,indices,&iy); // get all columns > ..... > > PetscMalloc(2*sizeof(PetscInt),&indices); > indices[0] = i; > indices[1] = j; > ISCreateGeneral(PETSC_COMM_SELF,2,indices,&ix); // only get > i,j rows > > Mat ui,uj; > // I am not sure how to set the third parameter : how many "local " > columns. Since I want all columns, I set it to n > ierr = MatGetSubMatrix(U,ix,iy,n, > MAT_INITIAL_MATRIX,&ui);CHKERRQ(ierr); > > What I really hope is to > > for (i = 0; i < n; i++) > { > PetscInt row = 0; > MatGetValues(ui,1,&row,1,&i,&u_ik); > } > It does not work. I tried to change the n to PETSC_DECIDE, it still > does not work ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^^^^^^^^^^^^^^^^ Saying "it does not work" is extremely uninformative and makes it difficult for us to know what happened and thus make useful suggestions. Please say exactly what goes wrong and cut and paste all error messages. At this point we would be totally guessing what is happening. Barry > > So, I really doubt that whether I can get the entire row of the > matrix. > > BTW, the matrix is created as follows: > > MatCreateMPIDense > (PETSC_COMM_WORLD,PETSC_DECIDE,PETSC_DECIDE,m,n,PETSC_NULL,&U) > > THank you > --- 09?12?2????, Barry Smith ? > ?? > > ???: Barry Smith > ??: Re: How to copy global data to local ? > ???: "PETSc users list" > ??: 2009?12?2?,??,??1:46 > > > Don't know what MatGetSubMatrixRaw() is, but based on the calling > sequence you are asking for the ith row whatever that is, and n > columns in the array indices > > For MatGetSubMatrix() each process can ask for any rows it wants, > but all the processors have to ask for the same columns that are > wanted. > > Barry > > On Dec 1, 2009, at 9:59 PM, ming zhu wrote: > > > Hi > > I tried MatGetSubMatrix() but I am a little confused by the column > parameter. For example > > My matrix is U (m * n). I want to get i,j rows to local. > > my code is > > > > PetscInt* rowindex,colindex; > > PetscMalloc... > > for (k= 0; k < n; k++) > > colindex[k] = k; > > > > rowindex[0] = i; > > rowindex[1] = j; > > > > MatGetSubMatrixRaw(U,1,&i,n,indices,n,MAT_INITIAL_MATRIX,&newmat); > > > > What I hope is newmat is 2 * n matrix. But I failed. > > > > Thank you > > > > > > --- 09?12?1????, Barry Smith ? > ?? > > > > ???: Barry Smith > > ??: Re: How to copy global data to local ? > > ???: "PETSc users list" > > ??: 2009?12?1?,??,??10:35 > > > > > > You misunderstand the usage of MatGetSubMatrix(). Any process > can request ANY row, including rows that are not originally owned by > that process. > > > > Barry > > > > On Dec 1, 2009, at 8:29 AM, ming zhu wrote: > > > > > It seems that MatGetSubMatrix() only get the local matrix for > the processor If U is global(PETSC_COMM_WORLD), the local matrix > may not store the column or row I wanted. For example, if U is 4*4, > and there are 4 processors, processors one has local matrix 2*2, but > i need the third row, Then,MatGetSubmatrix() may not work > > > > > > --- 09?12?1????, Barry Smith ? > ?? > > > > > > ???: Barry Smith > > > ??: Re: How to copy global data to local ? > > > ???: "PETSc users list" > > > ??: 2009?12?1?,??,??10:23 > > > > > > > > > On Nov 30, 2009, at 11:21 PM, ming zhu wrote: > > > > > > > Hi > > > > I have a huge matrix U for all processors (PETSC_COMM_WORLD). > I only want to copy only two rows (i,j) for each local processor. > i,j is different for each processor and not related to rank. I was > trying to use a vector filter (like, 00000010000). However, if the > vector is PETSC_COMM_WORLD, it will be changed by different > processor. So, how to make it ? > > > > > ^ > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > > > I do not understand what this means. To do the multiply you > can and should use a vector of PETSC_COMM_WORLD. > > > > > > Also multiplying by a vector will not give you back "rows" of > a matrix. Do you truly want the entire row of nonzeros of the matrix > or something else. If you want the entire row or part of a row then > you can use MatGetSubMatrix(). > > > > > > Barry > > > > > > > Thank you > > > > > > > > My original code is > > > > > > > > Vec filter > > > > VecCreate(PETSC_COMM_WORLD,&filter); > > > > VecSetsizes(filter,PETSC_DECIDE,m); > > > > VecSetFromOptions(filter); > > > > > > > > Vecset(filter,0); > > > > VecSetValue(filter,i,1,INSERT_VALUES); > > > > > > > > ... > > > > MatMult(U, filter,ui); > > > > > > > > If I create filter with PETSC_COMM_SELF, it is impossible for > U and filter to multiply. > > > > > > > > > > > > > > > > > > > > > > > > ????????????????? > > > > > > > > > ????????????????? > > > > > > ????????????????? > > > ????????????????? From craig-tanis at utc.edu Wed Dec 2 09:21:39 2009 From: craig-tanis at utc.edu (Craig Tanis) Date: Wed, 2 Dec 2009 10:21:39 -0500 Subject: optimized complex number kernel Message-ID: Hi, The Petsc 3 manual (pdf)mentions using an optimized fortran kernel for complex numbers, that somehow uses the same C interface. It refers to a document on how to build these kernels, but that document does not appear to be in the tarball (or on the anl.gov website). Furthermore, the FAQ on the website only mentions C and C++ in the section on complex number performance... If someone could clarify what was possible, and where to look for more information, that would be great! thanks, Craig From balay at mcs.anl.gov Wed Dec 2 11:09:50 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Wed, 2 Dec 2009 11:09:50 -0600 (CST) Subject: optimized complex number kernel In-Reply-To: References: Message-ID: The performance difference between c/c++ kernels and fortran kernels - or c-complex/c++-complex can be compiler specific. You can build all relavent versions [each with a different PETSC_ARCH] and see if it makes a difference for you code. The relavent configure options are: --with-fortran-kernels=generic [default 'none'] --with-clanguage=cxx [or default 'c'] --with-scalar-type=complex [default 'real'] Satish On Wed, 2 Dec 2009, Craig Tanis wrote: > Hi, > > The Petsc 3 manual (pdf)mentions using an optimized fortran kernel for complex numbers, that somehow uses the same C interface. It refers to a document on how to build these kernels, but that document does not appear to be in the tarball (or on the anl.gov website). > > Furthermore, the FAQ on the website only mentions C and C++ in the section on complex number performance... > > If someone could clarify what was possible, and where to look for more information, that would be great! > thanks, > Craig From foolishzhu at yahoo.com.cn Wed Dec 2 12:17:48 2009 From: foolishzhu at yahoo.com.cn (ming zhu) Date: Thu, 3 Dec 2009 02:17:48 +0800 (CST) Subject: =?utf-8?B?6L2s5Y+ROiBSZTogSG93IHRvIGNvcHkgZ2xvYmFsIGRhdGEgdG8gbG9jYWwg?= =?utf-8?B?Pw==?= Message-ID: <289364.29019.qm@web15802.mail.cnb.yahoo.com> --- 09?12?2????, ming zhu ??? ???: ming zhu ??: Re: How to copy global data to local ? ???: "petsc-maint Maintenance" ??: 2009?12?2?,??,??10:32 Sorry. OK The problem is if I use // n is 5 the total column number for U ierr = MatGetSubMatrix(U,ix,iy,n, MAT_INITIAL_MATRIX,&ui);CHKERRQ(ierr); ? when I run mpiexec -np 2 ./program it reports Sum of local lengths 10 does not equal global length 5, my local length 5 if I use ierr = MatGetSubMatrix(U,ix,iy,PETSC_DECIDE, MAT_INITIAL_MATRIX,&ui);CHKERRQ(ierr); it reports Only local values currently supported! --- 09?12?2????, Barry Smith ??? ???: Barry Smith ??: Re: How to copy global data to local ? ???: "PETSc users list" , "petsc-maint Maintenance" ??: 2009?12?2?,??,??3:52 ? Let's move this over to petsc-maint at mcs.anl.gov to cut the traffic on petsc-users See below. On Dec 2, 2009, at 12:33 AM, ming zhu wrote: > OK. I am now use MatGetSubMatrix.My code is as follows > >???PetscMalloc(n*sizeof(PetscInt),&indices); >???for (j = 0; j < n; j++) >???{ >? ? ???indices[j] = j; >???} >???ISCreateGeneral(PETSC_COMM_SELF,n,indices,&iy); // get all columns >? ..... > >? ? PetscMalloc(2*sizeof(PetscInt),&indices); >? ???indices[0] = i; >? ???indices[1] = j; >? ???ISCreateGeneral(PETSC_COMM_SELF,2,indices,&ix);? ???// only get i,j rows > >? ???Mat ui,uj; > // I am not sure how to set the third parameter : how many "local " columns. Since I want all columns, I set it to n >? ? ? ierr = MatGetSubMatrix(U,ix,iy,n, MAT_INITIAL_MATRIX,&ui);CHKERRQ(ierr); > > What I really hope is to > >? ???for (i = 0; i < n; i++) > { >? ? ? ? ? ? ? ???PetscInt row = 0; >? ? ? ? ???MatGetValues(ui,1,&row,1,&i,&u_ik); > } > It does not work. I tried to change the n to PETSC_DECIDE, it still does not work ? ? ? ^^^^^^^^^^^^^^^? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ???^^^^^^^^^^^^^^^^^ ???Saying "it does not work" is extremely uninformative and makes it difficult for us to know what happened and thus make useful suggestions. Please say exactly what goes wrong and cut and paste all error messages. At this point we would be totally guessing what is happening. ???Barry > > So, I really doubt that whether I can get the entire row of the matrix. > > BTW, the matrix is created as follows: >? MatCreateMPIDense(PETSC_COMM_WORLD,PETSC_DECIDE,PETSC_DECIDE,m,n,PETSC_NULL,&U) > > THank you > --- 09?12?2????, Barry Smith ??? > > ???: Barry Smith > ??: Re: How to copy global data to local ? > ???: "PETSc users list" > ??: 2009?12?2?,??,??1:46 > > >? ? Don't know what MatGetSubMatrixRaw() is, but based on the calling sequence you are asking for the ith row whatever that is, and n columns in the array indices > >? ? For MatGetSubMatrix() each process can ask for any rows it wants, but all the processors have to ask for the same columns that are wanted. > >? ? Barry > > On Dec 1, 2009, at 9:59 PM, ming zhu wrote: > > > Hi > > I tried MatGetSubMatrix() but I am a little confused by the column parameter. For example > > My matrix is U (m * n). I want to get i,j rows to local. > > my code is > > > > PetscInt* rowindex,colindex; > > PetscMalloc... > > for (k= 0; k < n; k++) > >? ? colindex[k] = k; > > > > rowindex[0] = i; > > rowindex[1] = j; > > > > MatGetSubMatrixRaw(U,1,&i,n,indices,n,MAT_INITIAL_MATRIX,&newmat); > > > > What I hope is newmat is 2 * n matrix. But I failed. > > > > Thank you > > > > > > --- 09?12?1????, Barry Smith ??? > > > > ???: Barry Smith > > ??: Re: How to copy global data to local ? > > ???: "PETSc users list" > > ??: 2009?12?1?,??,??10:35 > > > > > >? ? You misunderstand the usage of MatGetSubMatrix(). Any process can request ANY row, including rows that are not originally owned by that process. > > > >? ? Barry > > > > On Dec 1, 2009, at 8:29 AM, ming zhu wrote: > > > > > It seems that MatGetSubMatrix() only get the local matrix for the processor? If U is global(PETSC_COMM_WORLD), the local matrix may not store the column or row I wanted. For example, if U is 4*4, and there are 4 processors, processors one has local matrix 2*2, but i need the third row, Then,MatGetSubmatrix() may not work > > > > > > --- 09?12?1????, Barry Smith ??? > > > > > > ???: Barry Smith > > > ??: Re: How to copy global data to local ? > > > ???: "PETSc users list" > > > ??: 2009?12?1?,??,??10:23 > > > > > > > > > On Nov 30, 2009, at 11:21 PM, ming zhu wrote: > > > > > > > Hi > > > > I have a huge matrix U for all processors (PETSC_COMM_WORLD). I only want to copy only two rows (i,j) for each local processor. i,j is different for each processor and not related to rank.? I was trying to use a vector filter (like, 00000010000). However, if the vector is PETSC_COMM_WORLD, it will be changed by different processor. So, how to make it ? > > >? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > > > > >? ? I do not understand what this means. To do the multiply you can and should use a vector of PETSC_COMM_WORLD. > > > > > >? ? Also multiplying by a vector will not give you back "rows" of a matrix. Do you truly want the entire row of nonzeros of the matrix or something else. If you want the entire row or part of a row then you can use MatGetSubMatrix(). > > > > > >? ? Barry > > > > > > > Thank you > > > > > > > > My original code is > > > > > > > > Vec filter > > > > VecCreate(PETSC_COMM_WORLD,&filter); > > > > VecSetsizes(filter,PETSC_DECIDE,m); > > > > VecSetFromOptions(filter); > > > > > > > > Vecset(filter,0); > > > > VecSetValue(filter,i,1,INSERT_VALUES); > > > > > > > > ... > > > > MatMult(U, filter,ui); > > > > > > > > If I create filter with PETSC_COMM_SELF, it is impossible for U and filter to multiply. > > > > > > > > > > > > > > > > > > > > > > > > ????????????????? > > > > > > > > > ????????????????? > > > > > > ????????????????? > > > ????????????????? ????????????????? ___________________________________________________________ ????????????????? http://card.mail.cn.yahoo.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Wed Dec 2 13:20:43 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Wed, 2 Dec 2009 13:20:43 -0600 Subject: optimized complex number kernel In-Reply-To: References: Message-ID: <1A3391B8-4DFB-4A39-B54A-0CEA487D9B89@mcs.anl.gov> Craig, Thanks for pointing this out. I have updated the manual and installation.html in PETSc-dev to explicitly provide this information. Barry On Dec 2, 2009, at 11:09 AM, Satish Balay wrote: > The performance difference between c/c++ kernels and fortran kernels - > or c-complex/c++-complex can be compiler specific. You can build all > relavent versions [each with a different PETSC_ARCH] and see if it > makes a difference for you code. > > The relavent configure options are: > --with-fortran-kernels=generic [default 'none'] > --with-clanguage=cxx [or default 'c'] > --with-scalar-type=complex [default 'real'] > > Satish > > On Wed, 2 Dec 2009, Craig Tanis wrote: > >> Hi, >> >> The Petsc 3 manual (pdf)mentions using an optimized fortran kernel >> for complex numbers, that somehow uses the same C interface. It >> refers to a document on how to build these kernels, but that >> document does not appear to be in the tarball (or on the anl.gov >> website). >> >> Furthermore, the FAQ on the website only mentions C and C++ in the >> section on complex number performance... >> >> If someone could clarify what was possible, and where to look for >> more information, that would be great! >> thanks, >> Craig > From jarunan at ascomp.ch Thu Dec 3 04:40:14 2009 From: jarunan at ascomp.ch (jarunan at ascomp.ch) Date: Thu, 03 Dec 2009 11:40:14 +0100 Subject: MATMPIAIJ vs MATMPIBAIJ In-Reply-To: <1A3391B8-4DFB-4A39-B54A-0CEA487D9B89@mcs.anl.gov> References: <1A3391B8-4DFB-4A39-B54A-0CEA487D9B89@mcs.anl.gov> Message-ID: <20091203114014.7r88xebgo4og0ks4@webmail.ascomp.ch> Dear PETSc team, I would like to ask about the different of MATMPIAIJ and MATMPIBAIJ. I am using MATMPIAIJ type and want to try other structure of the matrix. I read about BAIJ format, which should be more efficient in setting value, MatSetValuesBlock(). It seems that I have to define the block sizes then every block will have the same size, right? Could I use BAIJ format if my block size is not the same in each block? At the end of the day, would these 2 structures of matrix affect differently in solving performance such as speed up? Thank you Jarunan -- Jarunan Panyasantisuk Development Engineer ASCOMP GmbH, Technoparkstr. 1 CH-8005 Zurich, Switzerland Phone : +41 44 445 4072 Fax : +41 44 445 4075 E-mail: jarunan at ascomp.ch www.ascomp.ch From jed at 59A2.org Thu Dec 3 05:48:39 2009 From: jed at 59A2.org (Jed Brown) Date: Thu, 03 Dec 2009 12:48:39 +0100 Subject: MATMPIAIJ vs MATMPIBAIJ In-Reply-To: <20091203114014.7r88xebgo4og0ks4@webmail.ascomp.ch> References: <20091203114014.7r88xebgo4og0ks4@webmail.ascomp.ch> Message-ID: <87ocmge0rs.fsf@59A2.org> On Thu, 03 Dec 2009 11:40:14 +0100, jarunan at ascomp.ch wrote: > Could I use BAIJ format if my block size is not the same in each > block? No, but AIJ uses Inodes when you have adjacent rows with the same nonzero pattern, this gives some advantages of BAIJ in sparse matrix kernels (MatMult, MatSolve, MatRelax). > At the end of the day, would these 2 structures of matrix affect > differently in solving performance such as speed up? This is very dependent on the preconditioner. BAIJ reduces memory usage from 12 bytes per nonzero to about 8 (assuming scalar=double, 32-bit indices), and makes memory access slightly more regular. Despite AIJ using Inodes, I frequently see BAIJ being faster by this ratio (8/12). BAIJ can reduce setup time (factorization) by a larger factor. Sometimes it is worth storing a small number of explicit zeros in order to have constant block size. Note that many third-party preconditioners can not use BAIJ, but if you insert values with MatSetValuesBlock, you can still always run with -mat_type aij. Jed From jarunan at ascomp.ch Thu Dec 3 08:51:00 2009 From: jarunan at ascomp.ch (jarunan at ascomp.ch) Date: Thu, 03 Dec 2009 15:51:00 +0100 Subject: MATMPIAIJ vs MATMPIBAIJ In-Reply-To: <87ocmge0rs.fsf@59A2.org> References: <20091203114014.7r88xebgo4og0ks4@webmail.ascomp.ch> <87ocmge0rs.fsf@59A2.org> Message-ID: <20091203155100.w0lwf8gkuo8gowos@webmail.ascomp.ch> Thank you very much, Jed. I understand it now. Jarunan Quoting Jed Brown : > On Thu, 03 Dec 2009 11:40:14 +0100, jarunan at ascomp.ch wrote: >> Could I use BAIJ format if my block size is not the same in each >> block? > > No, but AIJ uses Inodes when you have adjacent rows with the same > nonzero pattern, this gives some advantages of BAIJ in sparse matrix > kernels (MatMult, MatSolve, MatRelax). > >> At the end of the day, would these 2 structures of matrix affect >> differently in solving performance such as speed up? > > This is very dependent on the preconditioner. BAIJ reduces memory usage > from 12 bytes per nonzero to about 8 (assuming scalar=double, 32-bit > indices), and makes memory access slightly more regular. Despite AIJ > using Inodes, I frequently see BAIJ being faster by this ratio (8/12). > BAIJ can reduce setup time (factorization) by a larger factor. > > Sometimes it is worth storing a small number of explicit zeros in order > to have constant block size. Note that many third-party preconditioners > can not use BAIJ, but if you insert values with MatSetValuesBlock, you > can still always run with -mat_type aij. > > Jed > -- Jarunan Panyasantisuk Development Engineer ASCOMP GmbH, Technoparkstr. 1 CH-8005 Zurich, Switzerland Phone : +41 44 445 4072 Fax : +41 44 445 4075 E-mail: jarunan at ascomp.ch www.ascomp.ch From irfan.khan at gatech.edu Thu Dec 3 12:59:17 2009 From: irfan.khan at gatech.edu (irfan.khan at gatech.edu) Date: Thu, 3 Dec 2009 13:59:17 -0500 (EST) Subject: Multiple communicators In-Reply-To: <801773037.2731401259866203311.JavaMail.root@mail8.gatech.edu> Message-ID: <1240662771.2733881259866757413.JavaMail.root@mail8.gatech.edu> Thank you for the response Barry. You are right, the command line options do work. ----- Original Message ----- From: "Barry Smith" To: "PETSc users list" Sent: Tuesday, November 24, 2009 11:50:02 PM GMT -05:00 US/Canada Eastern Subject: Re: Multiple communicators On Nov 24, 2009, at 7:13 PM, irfan.khan at gatech.edu wrote: > I use seperete communicators for fluid and solid ranks in a fluid- > structure interaction code. I use PETSc tools (KSP) to solve for the > solid phase (FEA) which is carried out under a different > communicator (FEA_Comm). > > Unless I am doing something wrong, I have found that the command > line options: -ksp_type; -mat_partitioning_type, don't work if there > are 2 communicators. Are you sure that they don't work? Or is it just printing the message? WARNING! There are options you set that were not used! WARNING! could be spelling mistake, etc! Option left: name:-ksp_type value: cg Option left: name:-mat_partitioning_type value: parmetis Any option that is not accessed on PROCESS ZERO will be listed here as unused, even if it may be used on some process. I suppose we could/should fix this by adding some complicated communication that determines just the options that are never used. I never liked this warning, only added it after pressure from people who couldn't type. > But for single communicator they work. Please see the attached files > containing output of -log_summary for 2 different codes (scroll down > to the end). One with single communicator and the other with two > communicators. Both the output have been generated with the same > PETSc compilation. > > Futher -log_summary results are not able to detect all the events > that have been registered if they are not in the WORLD communicator. Is your concern here that it does not print the name of the event, it leaves the name blank? If so this is likely the type of problem as the print of options; we don't have a mechanism to get them to process 0 to print. In summary, yes these are some weaknesses of PETSc. If you switch the two communicators you create and use the one that has process 0 of MPI_COMM_WORLD for the PETSc stuff then it will look nicer and hide these two problems. Barry > > > Thank you > Irfan > ----- Original Message ----- > From: "Matthew Knepley" > To: "PETSc users list" > Sent: Tuesday, November 24, 2009 8:03:00 PM GMT -05:00 US/Canada > Eastern > Subject: Re: Multiple communicators > > On Tue, Nov 24, 2009 at 6:59 PM, wrote: > Hello > > Does the procedure for providing command line options and to obtain > profiling data through -log_summary change if there are multiple MPI > communicators in a petsc code? > > There is always WORLD, so it should be fine unless I misunderstand > your question. > > Matt > > If so, can somebody point me to information, references on how to > provide command line options if there are multiple communicators? > > Thank you > Irfan > > -- > PhD Candidate > G.W. Woodruff School of Mechanical Engineering > Georgia Institute of Technology > Atlanta, GA (30332) > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which > their experiments lead. > -- Norbert Wiener > > > -- > PhD Candidate > G.W. Woodruff School of Mechanical Engineering > Georgia Institute of Technology > Atlanta, GA (30332) > <1communicator.out><2communicators.out> -- PhD Candidate G.W. Woodruff School of Mechanical Engineering Georgia Institute of Technology Atlanta, GA (30332) From irfan.khan at gatech.edu Thu Dec 3 13:00:34 2009 From: irfan.khan at gatech.edu (irfan.khan at gatech.edu) Date: Thu, 3 Dec 2009 14:00:34 -0500 (EST) Subject: Petsc configure error In-Reply-To: <1790386789.2734261259866818582.JavaMail.root@mail8.gatech.edu> Message-ID: <1578866036.2734411259866834611.JavaMail.root@mail8.gatech.edu> Hello Petsc Team Have there been any more developments on using TAU with PETSc? I have tried to use tau_cc.sh to compile a petsc code. I have attached the error message with this email. Is is necessary to compile MPICH, PETSc and TAU with fortran support? Thank you Irfan ----- Original Message ----- From: "Satish Balay" To: "PETSc users list" Sent: Wednesday, June 24, 2009 5:52:36 PM GMT -05:00 US/Canada Eastern Subject: Re: Petsc configure error TAU isn't tested with petsc in the past few years. So thing could be broken. I'll have to check on this. One comment though.. If you have tau built with mpi - you should use that mpi & wrappers with tau and not use --download-mpich. [but this is also likely broken] Satish On Wed, 24 Jun 2009, Ryan Yan wrote: > Hi all, > I got configuration errors, when I trying to built PETSC with Tau. > Basically, I followed the instruction on the installation webpage of PETSc. > > In the attached file, please find the configure log. > > I do built TAU and PDT seperately, and TAU with mpi and PDT. > > If any more information is needed, please let me know. > > Thanks, > > Yan > -- PhD Candidate G.W. Woodruff School of Mechanical Engineering Georgia Institute of Technology Atlanta, GA (30332) -------------- next part -------------- A non-text attachment was scrubbed... Name: make.error Type: application/octet-stream Size: 4603 bytes Desc: not available URL: From bsmith at mcs.anl.gov Thu Dec 3 13:08:36 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Thu, 3 Dec 2009 13:08:36 -0600 Subject: Petsc configure error In-Reply-To: <1578866036.2734411259866834611.JavaMail.root@mail8.gatech.edu> References: <1578866036.2734411259866834611.JavaMail.root@mail8.gatech.edu> Message-ID: <50607B45-3087-4D7D-858D-2C5F168543A1@mcs.anl.gov> It looks like the TAU folks implicitly assumed that MPI was built with Fortran support. So my guess is you have to build MPI with Fortran support in order for this TAU to build and link properly. PETSc does not need to be built with Fortran support if you don't want it. Note that this means that this isn't really a PETSc issue at all. Barry On Dec 3, 2009, at 1:00 PM, irfan.khan at gatech.edu wrote: > Hello Petsc Team > Have there been any more developments on using TAU with PETSc? I > have tried to use tau_cc.sh to compile a petsc code. I have attached > the error message with this email. Is is necessary to compile MPICH, > PETSc and TAU with fortran support? > > Thank you > Irfan > > ----- Original Message ----- > From: "Satish Balay" > To: "PETSc users list" > Sent: Wednesday, June 24, 2009 5:52:36 PM GMT -05:00 US/Canada Eastern > Subject: Re: Petsc configure error > > TAU isn't tested with petsc in the past few years. So thing could be > broken. I'll have to check on this. > > One comment though.. If you have tau built with mpi - you should use > that mpi & wrappers with tau and not use --download-mpich. [but this > is also likely broken] > > Satish > > On Wed, 24 Jun 2009, Ryan Yan wrote: > >> Hi all, >> I got configuration errors, when I trying to built PETSC with Tau. >> Basically, I followed the instruction on the installation webpage >> of PETSc. >> >> In the attached file, please find the configure log. >> >> I do built TAU and PDT seperately, and TAU with mpi and PDT. >> >> If any more information is needed, please let me know. >> >> Thanks, >> >> Yan >> > > > -- > PhD Candidate > G.W. Woodruff School of Mechanical Engineering > Georgia Institute of Technology > Atlanta, GA (30332) > From bsmith at mcs.anl.gov Thu Dec 3 13:12:25 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Thu, 3 Dec 2009 13:12:25 -0600 Subject: Multiple communicators In-Reply-To: <1240662771.2733881259866757413.JavaMail.root@mail8.gatech.edu> References: <1240662771.2733881259866757413.JavaMail.root@mail8.gatech.edu> Message-ID: <870BD5AF-8080-425D-9603-2B32393C76EB@mcs.anl.gov> On Dec 3, 2009, at 12:59 PM, irfan.khan at gatech.edu wrote: > Thank you for the response Barry. You are right, the command line > options do work. Good. I'm sorry that we don't have a good method of handling the 1) printing of unused options and 2) printing of global log summaries when PETSc is only used on a subset of communicators. This processing is done over PETSC_COMM_WORLD and I cannot wrap my head around any way of properly handling these types of things cleanly and transparently when using subcommunicators. Barry > > > > ----- Original Message ----- > From: "Barry Smith" > To: "PETSc users list" > Sent: Tuesday, November 24, 2009 11:50:02 PM GMT -05:00 US/Canada > Eastern > Subject: Re: Multiple communicators > > > On Nov 24, 2009, at 7:13 PM, irfan.khan at gatech.edu wrote: > >> I use seperete communicators for fluid and solid ranks in a fluid- >> structure interaction code. I use PETSc tools (KSP) to solve for the >> solid phase (FEA) which is carried out under a different >> communicator (FEA_Comm). >> >> Unless I am doing something wrong, I have found that the command >> line options: -ksp_type; -mat_partitioning_type, don't work if there >> are 2 communicators. > > Are you sure that they don't work? Or is it just printing the > message? > > WARNING! There are options you set that were not used! > WARNING! could be spelling mistake, etc! > Option left: name:-ksp_type value: cg > Option left: name:-mat_partitioning_type value: parmetis > > Any option that is not accessed on PROCESS ZERO will be listed > here as unused, even if it may be used on some process. I suppose we > could/should fix this by adding some complicated communication that > determines just the options that are never used. I never liked this > warning, only added it after pressure from people who couldn't type. > >> But for single communicator they work. Please see the attached files >> containing output of -log_summary for 2 different codes (scroll down >> to the end). One with single communicator and the other with two >> communicators. Both the output have been generated with the same >> PETSc compilation. >> >> Futher -log_summary results are not able to detect all the events >> that have been registered if they are not in the WORLD communicator. > > Is your concern here that it does not print the name of the event, > it leaves the name blank? If so this is likely the type of problem as > the print of options; we don't have a mechanism to get them to process > 0 to print. > > In summary, yes these are some weaknesses of PETSc. If you switch > the two communicators you create and use the one that has process 0 of > MPI_COMM_WORLD for the PETSc stuff then it will look nicer and hide > these two problems. > > Barry > >> >> >> Thank you >> Irfan >> ----- Original Message ----- >> From: "Matthew Knepley" >> To: "PETSc users list" >> Sent: Tuesday, November 24, 2009 8:03:00 PM GMT -05:00 US/Canada >> Eastern >> Subject: Re: Multiple communicators >> >> On Tue, Nov 24, 2009 at 6:59 PM, wrote: >> Hello >> >> Does the procedure for providing command line options and to obtain >> profiling data through -log_summary change if there are multiple MPI >> communicators in a petsc code? >> >> There is always WORLD, so it should be fine unless I misunderstand >> your question. >> >> Matt >> >> If so, can somebody point me to information, references on how to >> provide command line options if there are multiple communicators? >> >> Thank you >> Irfan >> >> -- >> PhD Candidate >> G.W. Woodruff School of Mechanical Engineering >> Georgia Institute of Technology >> Atlanta, GA (30332) >> >> >> >> -- >> What most experimenters take for granted before they begin their >> experiments is infinitely more interesting than any results to which >> their experiments lead. >> -- Norbert Wiener >> >> >> -- >> PhD Candidate >> G.W. Woodruff School of Mechanical Engineering >> Georgia Institute of Technology >> Atlanta, GA (30332) >> <1communicator.out><2communicators.out> > > > -- > PhD Candidate > G.W. Woodruff School of Mechanical Engineering > Georgia Institute of Technology > Atlanta, GA (30332) From jarunan at ascomp.ch Fri Dec 4 04:25:11 2009 From: jarunan at ascomp.ch (jarunan at ascomp.ch) Date: Fri, 04 Dec 2009 11:25:11 +0100 Subject: extracting work vectors Message-ID: <20091204112511.5nnvoaiyyo8ssoco@webmail.ascomp.ch> Hello, I would like to use user-defined preconditioner PCSHELL for GMRES, from which I need the work vector(Right hand side during solving which is residual) and approx solution. I saw the function KSPGetRHS() which might give the exact right hand side that I defined for the system. Is there any command to extract the work vector? From PCShellSetApply(pc,apply) where 'apply' define as PetscErrorCode apply (void *ptr,Vec xin,Vec xout) Is xin automatically the approx solution? Regards, Jarunan -- Jarunan Panyasantisuk Development Engineer ASCOMP GmbH, Technoparkstr. 1 CH-8005 Zurich, Switzerland Phone : +41 44 445 4072 Fax : +41 44 445 4075 E-mail: jarunan at ascomp.ch www.ascomp.ch From jed at 59A2.org Fri Dec 4 04:54:23 2009 From: jed at 59A2.org (Jed Brown) Date: Fri, 04 Dec 2009 11:54:23 +0100 Subject: extracting work vectors In-Reply-To: <20091204112511.5nnvoaiyyo8ssoco@webmail.ascomp.ch> References: <20091204112511.5nnvoaiyyo8ssoco@webmail.ascomp.ch> Message-ID: <87my1z3t7k.fsf@59A2.org> On Fri, 04 Dec 2009 11:25:11 +0100, jarunan at ascomp.ch wrote: > I would like to use user-defined preconditioner PCSHELL for GMRES, > from which I need the work vector(Right hand side during solving which > is residual) and approx solution. A preconditioner for a Krylov iteration cannot use this information, maybe you're thinking of preconditioned Richardson iteration in which case, see PCShellSetApplyRicharson. > From PCShellSetApply(pc,apply) > > where 'apply' define as PetscErrorCode apply (void *ptr,Vec xin,Vec xout) should be PetscErrorCode apply(PC pc,Vec xin,Vec xout); use PCShellGetContext() to retrieve your pointer from the PC. > Is xin automatically the approx solution? No, it's the vector that the KSP needs you to apply your preconditioner to. The relationship between this vector and the "approximate solution" is different at every iteration of every Krylov method, and different with right versus left preconditioning. GMRES does not even build the "approximate solution" during the iteration, it is only built once you have converged. Application of your preconditioner *only* uses xin. Jed From jarunan at ascomp.ch Fri Dec 4 05:51:27 2009 From: jarunan at ascomp.ch (jarunan at ascomp.ch) Date: Fri, 04 Dec 2009 12:51:27 +0100 Subject: extracting work vectors In-Reply-To: <87my1z3t7k.fsf@59A2.org> References: <20091204112511.5nnvoaiyyo8ssoco@webmail.ascomp.ch> <87my1z3t7k.fsf@59A2.org> Message-ID: <20091204125127.8cu7ldfk008s8scg@webmail.ascomp.ch> Hi Jed, Thanks for the advice. I took a look in PCShellSetApplyRicharson() and its apply function. PetscErrorCode apply (PC pc,Vec b,Vec x,Vec r,PetscReal rtol,PetscReal abstol,PetscReal dtol,PetscInt maxits) b - right-hand-side x - current iterate r - work space 1. Can I use PCShellSetApplyRicharson() with KSPGMRES? or it is restrict only for Richardson solver. 2. Is x equivalent to xin in PCShellSetApply(pc,apply(PC pc,Vec xin,Vec xout))? 3. Are b vector is the right hand side specified by user and r the work vector in the iterations? Jarunan Quoting Jed Brown : > On Fri, 04 Dec 2009 11:25:11 +0100, jarunan at ascomp.ch wrote: >> I would like to use user-defined preconditioner PCSHELL for GMRES, >> from which I need the work vector(Right hand side during solving which >> is residual) and approx solution. > > A preconditioner for a Krylov iteration cannot use this information, > maybe you're thinking of preconditioned Richardson iteration in which > case, see PCShellSetApplyRicharson. > >> From PCShellSetApply(pc,apply) >> >> where 'apply' define as PetscErrorCode apply (void *ptr,Vec xin,Vec xout) > > should be > > PetscErrorCode apply(PC pc,Vec xin,Vec xout); > > use PCShellGetContext() to retrieve your pointer from the PC. > >> Is xin automatically the approx solution? > > No, it's the vector that the KSP needs you to apply your preconditioner > to. The relationship between this vector and the "approximate solution" > is different at every iteration of every Krylov method, and different > with right versus left preconditioning. GMRES does not even build the > "approximate solution" during the iteration, it is only built once you > have converged. Application of your preconditioner *only* uses xin. > > Jed > -- Jarunan Panyasantisuk Development Engineer ASCOMP GmbH, Technoparkstr. 1 CH-8005 Zurich, Switzerland Phone : +41 44 445 4072 Fax : +41 44 445 4075 E-mail: jarunan at ascomp.ch www.ascomp.ch From jed at 59A2.org Fri Dec 4 06:06:35 2009 From: jed at 59A2.org (Jed Brown) Date: Fri, 04 Dec 2009 13:06:35 +0100 Subject: extracting work vectors In-Reply-To: <20091204125127.8cu7ldfk008s8scg@webmail.ascomp.ch> References: <20091204112511.5nnvoaiyyo8ssoco@webmail.ascomp.ch> <87my1z3t7k.fsf@59A2.org> <20091204125127.8cu7ldfk008s8scg@webmail.ascomp.ch> Message-ID: <87ljhj3pv8.fsf@59A2.org> On Fri, 04 Dec 2009 12:51:27 +0100, jarunan at ascomp.ch wrote: > > Hi Jed, > > Thanks for the advice. I took a look in PCShellSetApplyRicharson() and > its apply function. > > PetscErrorCode apply (PC pc,Vec b,Vec x,Vec r,PetscReal rtol,PetscReal > abstol,PetscReal dtol,PetscInt maxits) > > b - right-hand-side > x - current iterate > r - work space > > 1. Can I use PCShellSetApplyRicharson() with KSPGMRES? or it is > restrict only for Richardson solver. Richardson only. > 2. Is x equivalent to xin in PCShellSetApply(pc,apply(PC pc,Vec > xin,Vec xout))? No, preconditioning Richardson is a different beast entirely. > 3. Are b vector is the right hand side specified by user and r the > work vector in the iterations? Yes, r is just work space, you are not required to use it. It's unlikely that you actually want to use Richardson, you should write apply(PC,Vec,Vec). Jed From jarunan at ascomp.ch Fri Dec 4 09:47:27 2009 From: jarunan at ascomp.ch (Jarunan Panyasantisuk) Date: Fri, 04 Dec 2009 16:47:27 +0100 Subject: extracting work vectors In-Reply-To: <87ljhj3pv8.fsf@59A2.org> References: <20091204112511.5nnvoaiyyo8ssoco@webmail.ascomp.ch> <87my1z3t7k.fsf@59A2.org> <20091204125127.8cu7ldfk008s8scg@webmail.ascomp.ch> <87ljhj3pv8.fsf@59A2.org> Message-ID: <4B192F0F.6060904@ascomp.ch> I am using GMRES and BICGSTAB, not Richardson. Actually, I have never tried it. About PCSHELL, I am sorry if this will annoy you but please let me explain what I understand. When define a linear system Ax = b GMRES does Ax' = r where r is residual, acts as a new RHS and supposed to be minimized x' is a new solution vector, used in the iterations MyProcond(r, x', rtol, niter) which will solve the system Ax' = r for niter iterations Then, return new x' which will be the preconditioned vector or y in apply(pc,x',y) It is clear about the vector which preconditioner will be applied, x' here. In my case, I am looking for my right hand side, r, which I do not know how can I get this. If there is no way to access it, I apologize for asking several times. Regards, Jarunan Jed Brown wrote: > On Fri, 04 Dec 2009 12:51:27 +0100, jarunan at ascomp.ch wrote: > >> Hi Jed, >> >> Thanks for the advice. I took a look in PCShellSetApplyRicharson() and >> its apply function. >> >> PetscErrorCode apply (PC pc,Vec b,Vec x,Vec r,PetscReal rtol,PetscReal >> abstol,PetscReal dtol,PetscInt maxits) >> >> b - right-hand-side >> x - current iterate >> r - work space >> >> 1. Can I use PCShellSetApplyRicharson() with KSPGMRES? or it is >> restrict only for Richardson solver. >> > > Richardson only. > > >> 2. Is x equivalent to xin in PCShellSetApply(pc,apply(PC pc,Vec >> xin,Vec xout))? >> > > No, preconditioning Richardson is a different beast entirely. > > >> 3. Are b vector is the right hand side specified by user and r the >> work vector in the iterations? >> > > Yes, r is just work space, you are not required to use it. > > It's unlikely that you actually want to use Richardson, you should write > apply(PC,Vec,Vec). > > Jed > -- Jarunan Panyasantisuk Development Engineer ASCOMP GmbH, Technoparkstr. 1 CH-8005 Zurich, Switzerland Phone : +41 44 445 4072 Fax : +41 44 445 4075 E-mail: jarunan at ascomp.ch www.ascomp.ch From craig-tanis at utc.edu Fri Dec 4 09:52:50 2009 From: craig-tanis at utc.edu (Craig Tanis) Date: Fri, 4 Dec 2009 10:52:50 -0500 Subject: getting vector values using local block indices Message-ID: Hi, I have a vector that I've manipulated using local indexing configured with VecSetLocalToGlobalMappingBlock, now I've done a linear solve using this vector as the RHS, and I need to extract values from the solution.. There appears to be no VecGetValuesBlockedLocal function.. What's the best way to pull these out? thanks, Craig From jed at 59A2.org Fri Dec 4 10:54:46 2009 From: jed at 59A2.org (Jed Brown) Date: Fri, 04 Dec 2009 17:54:46 +0100 Subject: extracting work vectors In-Reply-To: <4B192F0F.6060904@ascomp.ch> References: <20091204112511.5nnvoaiyyo8ssoco@webmail.ascomp.ch> <87my1z3t7k.fsf@59A2.org> <20091204125127.8cu7ldfk008s8scg@webmail.ascomp.ch> <87ljhj3pv8.fsf@59A2.org> <4B192F0F.6060904@ascomp.ch> Message-ID: <874oo6znl5.fsf@59A2.org> On Fri, 04 Dec 2009 16:47:27 +0100, Jarunan Panyasantisuk wrote: > About PCSHELL, I am sorry if this will annoy you but please let me > explain what I understand. > When define a linear system Ax = b > GMRES does Ax' = r > where r is residual, acts as a new RHS and supposed to be minimized > x' is a new solution vector, used in the iterations GMRES minimizes the residual over span{Pb, PAPb, (PA)^2Pb, (PA)^3Pb,...} this x' thing is not formed until the end. P is the preconditioner, it should have the property that PA is "close" to the identity. The operation PCApply(pc,x,y) should be doing y := Px. Where x comes from is none of your business and you can't connect it to an approximate solution x' or residual r. > which will solve the system Ax' = r for niter iterations Don't use PCShell for this. -pc_type ksp -ksp_ksp_type chebychev -ksp_pc_type sor -ksp_ksp_max_its 8 preconditions the original system using 8 Chebychev iterations preconditioned by SOR. If the inner solver is non-constant, you should use -ksp_type fgmres for the other iteration. Jed From jed at 59A2.org Fri Dec 4 11:17:28 2009 From: jed at 59A2.org (Jed Brown) Date: Fri, 04 Dec 2009 18:17:28 +0100 Subject: getting vector values using local block indices In-Reply-To: References: Message-ID: <873a3qzmjb.fsf@59A2.org> On Fri, 4 Dec 2009 10:52:50 -0500, Craig Tanis wrote: > Hi, I have a vector that I've manipulated using local indexing configured with VecSetLocalToGlobalMappingBlock, > now I've done a linear solve using this vector as the RHS, and I need > to extract values from the solution.. The most common thing is to have a local vector and a VecScatter from the global vector to the local vector. Then you just get the array for the local vector, work with it, and scatter to the global vector when you're done. This is usually a nicer API than setting values using VecSetValues, which is most useful as a quick way to set a small number of remote values without bothering to figure out who owns them. > There appears to be no VecGetValuesBlockedLocal function.. What's the > best way to pull these out? It would be easy to write a VecGetValuesBlockedLocal that could retrieve owned values (just LocalToGlobalMappingApply and then fetch them by global index). I think that making it work with remote values (VecGetValues currently only gets owned values) is really not worthwhile because creating the VecScatter is less work and offers a better API. Jed From craig-tanis at utc.edu Fri Dec 4 12:58:02 2009 From: craig-tanis at utc.edu (Craig Tanis) Date: Fri, 4 Dec 2009 13:58:02 -0500 Subject: zero'ing parts of blocks Message-ID: First of all, thanks for all the help on my recent questions! Here's a new one: I have multiple degrees of freedom per node in an unstructured mesh. I have set up an AO to get the PETSC ordering for these global nodes, and then a LocalToGlobalMapping to map local indices to these AO-renumbered global nodes. This appears to be working correctly. I create a Mat of type MATMPIBAIJ, and I use MatSetValuesBlockedLocal to add things to my matrix, as expected. I have some boundary conditions that require certain rows within certain blocks to be zeroed out. Conceptually, I would like to use MatZeroRowsLocal (which appears to operate on individual rows.. not on constituent blocks). The problem is that this call complains that I have not set a LocalToGlobalMapping (since I've only set the block one). Is it common (or even possible) to register a LocalToGlobalMapping a LocalToGlobalMappingBlock for a given Mat? Is there a way to extrapolate one from the other? If there is no way to Zero these rows individually, am I forced to get the block values, zero out the rows manually and then INSERT them back in? thanks again, Craig From bsmith at mcs.anl.gov Fri Dec 4 13:37:12 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Fri, 4 Dec 2009 13:37:12 -0600 Subject: extracting work vectors In-Reply-To: <4B192F0F.6060904@ascomp.ch> References: <20091204112511.5nnvoaiyyo8ssoco@webmail.ascomp.ch> <87my1z3t7k.fsf@59A2.org> <20091204125127.8cu7ldfk008s8scg@webmail.ascomp.ch> <87ljhj3pv8.fsf@59A2.org> <4B192F0F.6060904@ascomp.ch> Message-ID: Here is how preconditioners ALWAYS work (you are getting your tangled round and round and making this much more complicated then it really is). Given a vector x any preconditioner returns a new vector y that approximates the inv(A) x ; there are only two vectors involved and there is NEVER "an initial guess to y" (or you can think of y as being exactly zero). Note the x passed into PCApply() has NOTHING to do with the current solution x in the gmres method nor is it the current residual in the GMRES method it is just something that the Krylov method has generated. In GMRES for example the current solution and residual are not even computed until the GMRES restart, they are simply not available during the running of GMRES. So any PCApply() you provide takes x as input and computes an approximation to y = inv(A) x; Note the variable names x and y in PCApply are just dummy names and mean nothing, calling them x and y in the source code and documention is probably a mistake, think of them as input and output. Barry On Dec 4, 2009, at 9:47 AM, Jarunan Panyasantisuk wrote: > I am using GMRES and BICGSTAB, not Richardson. Actually, I have never > tried it. > > About PCSHELL, I am sorry if this will annoy you but please let me > explain what I understand. > When define a linear system Ax = b > GMRES does Ax' = r > where r is residual, acts as a new RHS and supposed to be minimized > x' is a new solution vector, used in the iterations > > MyProcond(r, x', rtol, niter) > > which will solve the system Ax' = r for niter iterations > Then, return new x' which will be the preconditioned vector or y in > > apply(pc,x',y) > > It is clear about the vector which preconditioner will be applied, > x' here. > In my case, I am looking for my right hand side, r, which I do not > know > how can I get this. > > If there is no way to access it, I apologize for asking several times. > > Regards, > Jarunan > > > > Jed Brown wrote: >> On Fri, 04 Dec 2009 12:51:27 +0100, jarunan at ascomp.ch wrote: >> >>> Hi Jed, >>> >>> Thanks for the advice. I took a look in PCShellSetApplyRicharson() >>> and >>> its apply function. >>> >>> PetscErrorCode apply (PC pc,Vec b,Vec x,Vec r,PetscReal >>> rtol,PetscReal >>> abstol,PetscReal dtol,PetscInt maxits) >>> >>> b - right-hand-side >>> x - current iterate >>> r - work space >>> >>> 1. Can I use PCShellSetApplyRicharson() with KSPGMRES? or it is >>> restrict only for Richardson solver. >>> >> >> Richardson only. >> >> >>> 2. Is x equivalent to xin in PCShellSetApply(pc,apply(PC pc,Vec >>> xin,Vec xout))? >>> >> >> No, preconditioning Richardson is a different beast entirely. >> >> >>> 3. Are b vector is the right hand side specified by user and r the >>> work vector in the iterations? >>> >> >> Yes, r is just work space, you are not required to use it. >> >> It's unlikely that you actually want to use Richardson, you should >> write >> apply(PC,Vec,Vec). >> >> Jed >> > > > -- > Jarunan Panyasantisuk > Development Engineer > ASCOMP GmbH, Technoparkstr. 1 > CH-8005 Zurich, Switzerland > Phone : +41 44 445 4072 > Fax : +41 44 445 4075 > E-mail: jarunan at ascomp.ch > www.ascomp.ch > > From knepley at gmail.com Fri Dec 4 13:53:31 2009 From: knepley at gmail.com (Matthew Knepley) Date: Fri, 4 Dec 2009 13:53:31 -0600 Subject: zero'ing parts of blocks In-Reply-To: References: Message-ID: On Fri, Dec 4, 2009 at 12:58 PM, Craig Tanis wrote: > First of all, thanks for all the help on my recent questions! Here's a new > one: > > I have multiple degrees of freedom per node in an unstructured mesh. I > have set up an AO to get the PETSC ordering for these global nodes, and > then a LocalToGlobalMapping to map local indices to these AO-renumbered > global nodes. This appears to be working correctly. > > I create a Mat of type MATMPIBAIJ, and I use MatSetValuesBlockedLocal to > add things to my matrix, as expected. I have some boundary conditions that > require certain rows within certain blocks to be zeroed out. Conceptually, > I would like to use MatZeroRowsLocal (which appears to operate on individual > rows.. not on constituent blocks). The problem is that this call complains > that I have not set a LocalToGlobalMapping (since I've only set the block > one). > > Is it common (or even possible) to register a LocalToGlobalMapping a > LocalToGlobalMappingBlock for a given Mat? > Is there a way to extrapolate one from the other? > The easiest thing to do is take your block l2g mapping and produce a row-wise l2g mapping by unrolling the blocks. Set that in the matrix. Then the MatZeroRowsLocal will work. Matt > If there is no way to Zero these rows individually, am I forced to get the > block values, zero out the rows manually and then INSERT them back in? > > thanks again, > Craig -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From vyan2000 at gmail.com Sat Dec 5 22:24:21 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Sat, 5 Dec 2009 23:24:21 -0500 Subject: Line search question Message-ID: Hi All, I am trying to figure out how the line search is actually working in PETSc and I am looking at this link, http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/SNES/SNESLineSearchGetParams.html Can anyone help to explain why there is a J in the amijo condition? *alpha *- The scalar such that .5*f_{n+1} . f_{n+1} <= .5*f_n . f_n - alpha |f_n . J . f_n| Considering the fact that the newton direction p_n provide a J^{-1} and the gradient of the merit function( 1/2 f . f) provide a J, isn't correct to get rid of J in the definition above? Thanks for any suggestions, Yan -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Sun Dec 6 11:43:15 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Sun, 6 Dec 2009 11:43:15 -0600 Subject: Line search question In-Reply-To: References: Message-ID: I think the confusion comes from the fact that the Amijo condition is almost always in the literature for minimization; not for nonlinear equations. If we minimize F(x) the condition is F(x + alpha p) <= F(x) + c alpha p' grad F(x) with c near 1. Here ' denotes transpose For the PETSc nonlinear solver F(x) = .5 f(x)' f(x). Ok, now just compute grad F in this case and the Jacobian pops right out. grad F(x) = J f Hmm, looks like the comment is wrong where it says f_n . J . f_n, it should say p_n. J. f_n Barry On Dec 5, 2009, at 10:24 PM, Ryan Yan wrote: > Hi All, > I am trying to figure out how the line search is actually working in > PETSc and I am looking at this link, > > http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/SNES/SNESLineSearchGetParams.html > F(x > Can anyone help to explain why there is a J in the amijo condition? > > alpha - The scalar such that .5*f_{n+1} . f_{n+1} <= .5*f_n . f_n - > alpha |f_n . J . f_n| > > > Considering the fact that the newton direction p_n provide a J^{-1} > and the gradient of the merit function( 1/2 f . f) provide a J, > isn't correct to get rid of J in the definition above? > > Thanks for any suggestions, > > Yan From bsmith at mcs.anl.gov Sun Dec 6 11:54:07 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Sun, 6 Dec 2009 11:54:07 -0600 Subject: Line search question In-Reply-To: References: Message-ID: <6928390D-42AA-4548-8FFB-41CA52777303@mcs.anl.gov> On Dec 6, 2009, at 11:43 AM, Barry Smith wrote: > > I think the confusion comes from the fact that the Amijo condition > is almost always in the literature for minimization; not for > nonlinear equations. > > If we minimize F(x) the condition is F(x + alpha p) <= F(x) + c > alpha p' grad F(x) with c near 1. Here ' denotes transpose > > For the PETSc nonlinear solver F(x) = .5 f(x)' f(x). Ok, now just > compute grad F in this case and the Jacobian pops right out. grad > F(x) = J f Correction; it is actually grad F(x) = J'f hence in the code it computes f' (J p) so it does not need to apply J' Barry > > Hmm, looks like the comment is wrong where it says f_n . J . f_n, it > should say p_n. J. f_n > > Barry > > > On Dec 5, 2009, at 10:24 PM, Ryan Yan wrote: > >> Hi All, >> I am trying to figure out how the line search is actually working >> in PETSc and I am looking at this link, >> >> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/SNES/SNESLineSearchGetParams.html >> F(x >> Can anyone help to explain why there is a J in the amijo condition? >> >> alpha - The scalar such that .5*f_{n+1} . f_{n+1} <= .5*f_n . f_n - >> alpha |f_n . J . f_n| >> >> >> Considering the fact that the newton direction p_n provide a J^{-1} >> and the gradient of the merit function( 1/2 f . f) provide a J, >> isn't correct to get rid of J in the definition above? >> >> Thanks for any suggestions, >> >> Yan > From vyan2000 at gmail.com Sun Dec 6 12:37:46 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Sun, 6 Dec 2009 13:37:46 -0500 Subject: Line search question In-Reply-To: <6928390D-42AA-4548-8FFB-41CA52777303@mcs.anl.gov> References: <6928390D-42AA-4548-8FFB-41CA52777303@mcs.anl.gov> Message-ID: Hi Barry, Thank you very much for the clarification and comment. The p_n. J'. f_n makes perfect sense. Yan On Sun, Dec 6, 2009 at 12:54 PM, Barry Smith wrote: > > On Dec 6, 2009, at 11:43 AM, Barry Smith wrote: > > >> I think the confusion comes from the fact that the Amijo condition is >> almost always in the literature for minimization; not for nonlinear >> equations. >> >> If we minimize F(x) the condition is F(x + alpha p) <= F(x) + c alpha p' >> grad F(x) with c near 1. Here ' denotes transpose >> >> For the PETSc nonlinear solver F(x) = .5 f(x)' f(x). Ok, now just compute >> grad F in this case and the Jacobian pops right out. grad F(x) = J f >> > > Correction; it is actually grad F(x) = J'f hence in the code it > computes f' (J p) so it does not need to apply J' > > Barry > > > >> Hmm, looks like the comment is wrong where it says f_n . J . f_n, it >> should say p_n. J. f_n >> >> Barry >> >> >> On Dec 5, 2009, at 10:24 PM, Ryan Yan wrote: >> >> Hi All, >>> I am trying to figure out how the line search is actually working in >>> PETSc and I am looking at this link, >>> >>> >>> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/SNES/SNESLineSearchGetParams.html >>> F(x >>> Can anyone help to explain why there is a J in the amijo condition? >>> >>> alpha - The scalar such that .5*f_{n+1} . f_{n+1} <= .5*f_n . f_n - alpha >>> |f_n . J . f_n| >>> >>> >>> Considering the fact that the newton direction p_n provide a J^{-1} and >>> the gradient of the merit function( 1/2 f . f) provide a J, isn't correct to >>> get rid of J in the definition above? >>> >>> Thanks for any suggestions, >>> >>> Yan >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hxie at umn.edu Mon Dec 7 11:52:01 2009 From: hxie at umn.edu (hxie at umn.edu) Date: 07 Dec 2009 11:52:01 -0600 Subject: How to declare an array of ksp object in fortran? In-Reply-To: References: Message-ID: Hi, I try to customize the subksp for block jacobi method. Does anybody have an fortran example for this? For c language, we can declare "ksp *subksp". Then how for fortran? Thanks. Bests, Hui From likask at civil.gla.ac.uk Mon Dec 7 12:58:38 2009 From: likask at civil.gla.ac.uk (Lukasz Kaczmarczyk) Date: Mon, 7 Dec 2009 18:58:38 +0000 Subject: parallel matrix multiplication ATA Message-ID: <202E687C-1D06-4529-91C7-3CB0282EB54A@civil.gla.ac.uk> Hello, I have to multiply rectangular parallel matrix A by its transpose (ATA). Matrix A is computed as result of some non standard hybrid approximation method. Columns of the matrix are associated with tetrahedral faces, rows are associated with tetrahedral. In order to compute elements of matrix A interprocess communication is not needed. In addition faces are shared maximally with two processes, faces can have only two neighbour elements. I have created matrix A using MatCreateMPIAIJWithSplitArrays, and create matrix ATA using MatPtAP which some diagonal scaling. The time consuming part of my algorithm is construction of matrix ATA. I looking for advice, if its worth to write own problem tailored multiplication operator or is better way to speedup algorithm using standard PETSc functions. I looking forward for any advice. Kind regards, Lukasz From knepley at gmail.com Mon Dec 7 14:00:26 2009 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 7 Dec 2009 14:00:26 -0600 Subject: How to declare an array of ksp object in fortran? In-Reply-To: References: Message-ID: 1) Always use options. It makes you code generic and process more flexible 2) If after thinking for a few hours, you still really want to do it in the code: http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/PC/PCBJacobiGetSubKSP.html Matt On Mon, Dec 7, 2009 at 11:52 AM, wrote: > Hi, > > I try to customize the subksp for block jacobi method. Does anybody have an > fortran example for this? > For c language, we can declare "ksp *subksp". Then how for fortran? Thanks. > > Bests, > Hui > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Mon Dec 7 14:02:48 2009 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 7 Dec 2009 14:02:48 -0600 Subject: How to declare an array of ksp object in fortran? In-Reply-To: References: Message-ID: I realized you only wanted to know how to declare the array. It is just a normal F77 array. Matt On Mon, Dec 7, 2009 at 2:00 PM, Matthew Knepley wrote: > 1) Always use options. It makes you code generic and process more flexible > > 2) If after thinking for a few hours, you still really want to do it in the > code: > > > http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/PC/PCBJacobiGetSubKSP.html > > Matt > > On Mon, Dec 7, 2009 at 11:52 AM, wrote: > >> Hi, >> >> I try to customize the subksp for block jacobi method. Does anybody have >> an fortran example for this? >> For c language, we can declare "ksp *subksp". Then how for fortran? >> Thanks. >> >> Bests, >> Hui >> > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > -- Norbert Wiener > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Mon Dec 7 15:01:29 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 7 Dec 2009 15:01:29 -0600 Subject: parallel matrix multiplication ATA In-Reply-To: <202E687C-1D06-4529-91C7-3CB0282EB54A@civil.gla.ac.uk> References: <202E687C-1D06-4529-91C7-3CB0282EB54A@civil.gla.ac.uk> Message-ID: <57868720-209C-4DB5-A5D8-7D14EA2FA530@mcs.anl.gov> First, change your code to use a call to MatPtAPSymbolic() followed by a call to MatPtAPNumeric() and run (using PETSc ./ configured with the option --with-debugging=0) with the flag -info and save all the output to a file. Then search that file for the string "Use MatPtAP", from this you will find the best fill factor. The run it a second time with the option -log_summary and that "best fill factor" A table will be printed, look at how much time in the table is devoted to the symbolic and numeric part of the product and the flop rate to see if it looks reasonable. Feel free to send that out to petsc-maint at mcs.anl.gov and from that we can conjecture if there is a way to speed it up enough to make ti worth new codeing. Barry On Dec 7, 2009, at 12:58 PM, Lukasz Kaczmarczyk wrote: > Hello, > > I have to multiply rectangular parallel matrix A by its transpose > (ATA). Matrix A is computed as result of some non standard hybrid > approximation method. Columns of the matrix are associated with > tetrahedral faces, rows are associated with tetrahedral. In order to > compute elements of matrix A interprocess communication is not > needed. In addition faces are shared maximally with two processes, > faces can have only two neighbour elements. > > I have created matrix A using MatCreateMPIAIJWithSplitArrays, and > create matrix ATA using MatPtAP which some diagonal scaling. The > time consuming part of my algorithm is construction of matrix ATA. > I looking for advice, if its worth to write own problem tailored > multiplication operator or is better way to speedup algorithm using > standard PETSc functions. > > I looking forward for any advice. > > Kind regards, > Lukasz > > > > From bsmith at mcs.anl.gov Mon Dec 7 15:08:45 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 7 Dec 2009 15:08:45 -0600 Subject: How to declare an array of ksp object in fortran? In-Reply-To: References: Message-ID: <49467EDF-07E4-4746-AC93-0E75539D31B5@mcs.anl.gov> In Fortran you need to declare an array that is "big enough", so, for example, if you know there are always less then 10 block per process you can do KSP subksp(10) less than 100 then use KSP subksp(100) note that since this is just an array of pointers it takes very little space. Barry On Dec 7, 2009, at 2:02 PM, Matthew Knepley wrote: > I realized you only wanted to know how to declare the array. It is > just a normal F77 array. > > Matt > > On Mon, Dec 7, 2009 at 2:00 PM, Matthew Knepley > wrote: > 1) Always use options. It makes you code generic and process more > flexible > > 2) If after thinking for a few hours, you still really want to do it > in the code: > > http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/PC/PCBJacobiGetSubKSP.html > > Matt > > On Mon, Dec 7, 2009 at 11:52 AM, wrote: > Hi, > > I try to customize the subksp for block jacobi method. Does anybody > have an fortran example for this? > For c language, we can declare "ksp *subksp". Then how for fortran? > Thanks. > > Bests, > Hui > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which > their experiments lead. > -- Norbert Wiener > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which > their experiments lead. > -- Norbert Wiener From hxie at umn.edu Mon Dec 7 17:22:08 2009 From: hxie at umn.edu (hxie at umn.edu) Date: 07 Dec 2009 17:22:08 -0600 Subject: Petsc command line options are ignored by PBS submission In-Reply-To: References: Message-ID: Hi, I compile the petsc by ----- ./config/configure.py COPTFLAGS=-O3 FOPTFLAGS=-O3 --download-f-blas-lapack=1 ----- (.bashrc: export PETSC_DIR=$HOME/lib/petsc-3.0.0-p8 export PETSC_ARCH=linux-gnu-c-opt ) and the "make all" runs OK but the "make test" always fails (probably because the queueing system won't let the script launch an interactive multiprocessor job. The interactive command should be "mpirun -np 4 -hostfile hosts ~/ex1"). After compiling the petsc, my code runs OK except I cannot use the command line options. That is really inconvenient. Any idea for this? My code is written in Fortran 90. Thanks. Part of error messages after running "make test" ------ Running test examples to verify correct installation Possible error running C/C++ src/snes/examples/tutorials/ex19 with 1 MPI process See http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html mpirun_ssh: option `-n' is ambiguous mpirun_ssh -timeout 200 -paramfile paramfile.11115 -n 1 ./ex19 -dmmg_nlevels 4 failed! Removing temporary paramfile paramfile.11115 ------ Bests, Hui From knepley at gmail.com Mon Dec 7 17:24:29 2009 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 7 Dec 2009 17:24:29 -0600 Subject: Petsc command line options are ignored by PBS submission In-Reply-To: References: Message-ID: On Mon, Dec 7, 2009 at 5:22 PM, wrote: > Hi, > > I compile the petsc by > ----- > ./config/configure.py COPTFLAGS=-O3 FOPTFLAGS=-O3 > --download-f-blas-lapack=1 > ----- > (.bashrc: > export PETSC_DIR=$HOME/lib/petsc-3.0.0-p8 > export PETSC_ARCH=linux-gnu-c-opt > ) > and the "make all" runs OK but the "make test" always fails (probably > because the queueing > system won't let the script launch an interactive multiprocessor job. The > interactive command should be > "mpirun -np 4 -hostfile hosts ~/ex1"). After compiling the petsc, my code runs OK except I cannot use the command > line options. That is really inconvenient. Any idea for this? My code is > written in Fortran 90. It sounds like it has to do with your queuing system. I recommend you ask the local sysadmin for that cluster. Matt > Thanks. > > Part of error messages after running "make test" > ------ > Running test examples to verify correct installation > Possible error running C/C++ src/snes/examples/tutorials/ex19 with 1 MPI > process > See > http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html > mpirun_ssh: option `-n' is ambiguous > mpirun_ssh -timeout 200 -paramfile paramfile.11115 -n 1 ./ex19 > -dmmg_nlevels 4 failed! > Removing temporary paramfile paramfile.11115 > ------ > > > Bests, > Hui > > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Mon Dec 7 19:06:00 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 7 Dec 2009 19:06:00 -0600 Subject: Petsc command line options are ignored by PBS submission In-Reply-To: References: Message-ID: <1BA6278E-A572-4518-ADA6-596E3541A315@mcs.anl.gov> cd src/vec/vec/examples/tutorials ; make ex1 ex1f Then submit ex1 and ex1f to the batch system as needed with the command line option -info after the ex1 and ex1f Does it cause additional information about the run to be printed? Does it print that additional information only for ex1 or for both ex1f? The reason to do the test is to determine if your batch submission system is passing command line options at all and then to determine if something only with the Fortran compiler is preventing the command line options. If the option works with ex1 and not ex1f then send petsc-maint at mcs.anl.gov the file configure.log Barry On Dec 7, 2009, at 5:22 PM, hxie at umn.edu wrote: > Hi, > > I compile the petsc by > ----- > ./config/configure.py COPTFLAGS=-O3 FOPTFLAGS=-O3 --download-f-blas- > lapack=1 > ----- > (.bashrc: > export PETSC_DIR=$HOME/lib/petsc-3.0.0-p8 > export PETSC_ARCH=linux-gnu-c-opt > ) > and the "make all" runs OK but the "make test" always fails > (probably because the queueing > system won't let the script launch an interactive multiprocessor > job. The interactive command should be > "mpirun -np 4 -hostfile hosts ~/ex1"). > > After compiling the petsc, my code runs OK except I cannot use the > command line options. That is really inconvenient. Any idea for > this? My code is written in Fortran 90. Thanks. > > Part of error messages after running "make test" > ------ > Running test examples to verify correct installation > Possible error running C/C++ src/snes/examples/tutorials/ex19 with 1 > MPI process > See http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html > mpirun_ssh: option `-n' is ambiguous > mpirun_ssh -timeout 200 -paramfile paramfile.11115 -n 1 ./ex19 - > dmmg_nlevels 4 failed! > Removing temporary paramfile paramfile.11115 > ------ > > > Bests, > Hui > From achatter at cse.psu.edu Tue Dec 8 16:05:31 2009 From: achatter at cse.psu.edu (Anirban Chatterjee) Date: Tue, 08 Dec 2009 17:05:31 -0500 Subject: Assembling a matrix Message-ID: <4B1ECDAB.5050906@cse.psu.edu> Hi, I have an nxn matrix A, a column vector v and a scalar c. I want to assemble a matrix B as follows, B = [A v; v^T c] Can someone tell me the easiest and most efficient way to do this. --Anirban From knepley at gmail.com Tue Dec 8 16:10:14 2009 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 8 Dec 2009 16:10:14 -0600 Subject: Assembling a matrix In-Reply-To: <4B1ECDAB.5050906@cse.psu.edu> References: <4B1ECDAB.5050906@cse.psu.edu> Message-ID: Are you sure you want to assemble it? Unless you factor it, maybe maintaining it unassembled is better. Matt On Tue, Dec 8, 2009 at 4:05 PM, Anirban Chatterjee wrote: > Hi, > > I have an nxn matrix A, a column vector v and a scalar c. I want to > assemble a matrix B as follows, > B = [A v; > v^T c] > Can someone tell me the easiest and most efficient way to do this. > > --Anirban > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From achatter at cse.psu.edu Tue Dec 8 16:13:47 2009 From: achatter at cse.psu.edu (Anirban Chatterjee) Date: Tue, 08 Dec 2009 17:13:47 -0500 Subject: Assembling a matrix In-Reply-To: References: <4B1ECDAB.5050906@cse.psu.edu> Message-ID: <4B1ECF9B.70606@cse.psu.edu> Hi Mathew, This is being done as part of one of my functions and I finally I need to get the matrix B to proceed. --Anirban Matthew Knepley wrote: > Are you sure you want to assemble it? Unless you factor it, maybe > maintaining it unassembled is better. > > Matt > > On Tue, Dec 8, 2009 at 4:05 PM, Anirban Chatterjee > > wrote: > > Hi, > > I have an nxn matrix A, a column vector v and a scalar c. I want > to assemble a matrix B as follows, > B = [A v; > v^T c] > Can someone tell me the easiest and most efficient way to do this. > > --Anirban > > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which > their experiments lead. > -- Norbert Wiener From bsmith at mcs.anl.gov Tue Dec 8 16:26:50 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Tue, 8 Dec 2009 16:26:50 -0600 Subject: Assembling a matrix In-Reply-To: <4B1ECDAB.5050906@cse.psu.edu> References: <4B1ECDAB.5050906@cse.psu.edu> Message-ID: <557D3D23-5868-4BC0-A24E-D2E8240AFDB9@mcs.anl.gov> Where will the "new" row live? On the last process, why that one? Does the matrix A have to be completely assembled before the v is computed? Or can the entries of A be computed at the same time as the v? PETSc doesn't have code to efficiently dynamically change the size of a matrix. Thus generating a new matrix from a given sparse matrix plus a new row requires a complete copy of the starting matrix into the new matrix data structure. If you assemble the entire matrix together without first generating the smaller matrix A then it is easy; just generate the preallocation structure of A with the one additional row/column information and call MatSetValues() to put in the parts of A and the parts of v. Barry On Dec 8, 2009, at 4:05 PM, Anirban Chatterjee wrote: > Hi, > > I have an nxn matrix A, a column vector v and a scalar c. I want to > assemble a matrix B as follows, > B = [A v; > v^T c] > Can someone tell me the easiest and most efficient way to do this. > > --Anirban From hxie at umn.edu Tue Dec 8 16:29:23 2009 From: hxie at umn.edu (hxie at umn.edu) Date: 08 Dec 2009 16:29:23 -0600 Subject: command line option "-sub_pc_factor_levels 1" does not work in fortran In-Reply-To: References: Message-ID: Hi, I want to change the ilu levels for block jacobi method. What is the command line option for it? Or should I use "PCFactorSetLevels" in the code? The "-sub_pc_factor_levels 1" does not work in fortran. Thanks. Bests, Hui From knepley at gmail.com Tue Dec 8 17:01:28 2009 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 8 Dec 2009 17:01:28 -0600 Subject: command line option "-sub_pc_factor_levels 1" does not work in fortran In-Reply-To: References: Message-ID: Works for me knepley at khan:/PETSc3/petsc/petsc-dev/src/ksp/ksp/examples/tutorials$ ./ex2 -ksp_view -sub_pc_factor_levels 1 -pc_type bjacobi KSP Object: type: gmres GMRES: restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement GMRES: happy breakdown tolerance 1e-30 maximum iterations=10000, initial guess is zero tolerances: relative=0.000138889, absolute=1e-50, divergence=10000 left preconditioning using PRECONDITIONED norm type for convergence test PC Object: type: bjacobi block Jacobi: number of blocks = 1 Local solve is same for all blocks, in the following KSP and PC objects: KSP Object:(sub_) type: preonly maximum iterations=10000, initial guess is zero tolerances: relative=1e-05, absolute=1e-50, divergence=10000 left preconditioning using PRECONDITIONED norm type for convergence test PC Object:(sub_) type: ilu ILU: 1 level of fill ILU: factor fill ratio allocated 1 ILU: tolerance for zero pivot 1e-12 ILU: using diagonal shift to prevent zero pivot ILU: using diagonal shift on blocks to prevent zero pivot out-of-place factorization matrix ordering: natural ILU: factor fill ratio needed 1.336 Factored matrix follows Matrix Object: type=seqaij, rows=56, cols=56 package used to perform factorization: petsc total: nonzeros=334, allocated nonzeros=334 not using I-node routines linear system matrix = precond matrix: Matrix Object: type=seqaij, rows=56, cols=56 total: nonzeros=250, allocated nonzeros=280 not using I-node routines linear system matrix = precond matrix: Matrix Object: type=seqaij, rows=56, cols=56 total: nonzeros=250, allocated nonzeros=280 not using I-node routines Norm of error 0.000280658 iterations 4 Matt On Tue, Dec 8, 2009 at 4:29 PM, wrote: > Hi, > > I want to change the ilu levels for block jacobi method. What is the > command line option for it? Or should I use "PCFactorSetLevels" in the code? > The "-sub_pc_factor_levels 1" does not work in fortran. Thanks. > > Bests, > Hui > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominik at itis.ethz.ch Wed Dec 9 11:45:43 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Wed, 09 Dec 2009 18:45:43 +0100 Subject: clarification about convergence Message-ID: <4B1FE247.6050208@itis.ethz.ch> I am using -ksp_rtol 0 -ksp_atol 1e-6 (defaults for all the rest) and observe for most of the times convergence, as expected. Starting KSPSolve 0 KSP Residual norm 6.315132950112e-04 1 KSP Residual norm 9.139539245601e-05 2 KSP Residual norm 1.869750068013e-05 3 KSP Residual norm 6.788145356909e-06 4 KSP Residual norm 1.729115712274e-06 5 KSP Residual norm 7.214445966641e-07 solved in 2.328146e+00/4.144644e+00 s solution converged in 5 iterations ||Ax-b|| = 7.21445e-07 with ||...|| being residue computed on my own for a check. However, SOMETIMES, I do observe: Starting KSPSolve 0 KSP Residual norm 1.228562818225e-02 1 KSP Residual norm 4.045833318123e-04 2 KSP Residual norm 6.589999324657e-05 3 KSP Residual norm 1.494849372638e-05 4 KSP Residual norm 4.311592172896e-06 solved in 1.368086e+00/2.235830e+00 s solution converged in 4 iterations ||Ax-b|| = 4.31159e-06 which means that the iterations break sooner than they should. Again, this is not often, but worries me why this should happen... Using or not -ksp_converged_use_initial_residual_norm does not make any difference to this behavior: the last output Residual norm is sometimes higher than the requested atol. Any clarifications are highly appreciated. Dominik From knepley at gmail.com Wed Dec 9 12:38:19 2009 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 9 Dec 2009 12:38:19 -0600 Subject: clarification about convergence In-Reply-To: <4B1FE247.6050208@itis.ethz.ch> References: <4B1FE247.6050208@itis.ethz.ch> Message-ID: Did you use -ksp_converged_reason to determine why PETSc stopped iterating? Matt On Wed, Dec 9, 2009 at 11:45 AM, Dominik Szczerba wrote: > I am using > > -ksp_rtol 0 -ksp_atol 1e-6 (defaults for all the rest) > > and observe for most of the times convergence, as expected. > > Starting KSPSolve > 0 KSP Residual norm 6.315132950112e-04 > 1 KSP Residual norm 9.139539245601e-05 > 2 KSP Residual norm 1.869750068013e-05 > 3 KSP Residual norm 6.788145356909e-06 > 4 KSP Residual norm 1.729115712274e-06 > 5 KSP Residual norm 7.214445966641e-07 > solved in 2.328146e+00/4.144644e+00 s > solution converged in 5 iterations > ||Ax-b|| = 7.21445e-07 > > with ||...|| being residue computed on my own for a check. > > However, SOMETIMES, I do observe: > > Starting KSPSolve > 0 KSP Residual norm 1.228562818225e-02 > 1 KSP Residual norm 4.045833318123e-04 > 2 KSP Residual norm 6.589999324657e-05 > 3 KSP Residual norm 1.494849372638e-05 > 4 KSP Residual norm 4.311592172896e-06 > solved in 1.368086e+00/2.235830e+00 s > solution converged in 4 iterations > ||Ax-b|| = 4.31159e-06 > > which means that the iterations break sooner than they should. Again, this > is not often, but worries me why this should happen... Using or not > -ksp_converged_use_initial_residual_norm does not make any difference to > this behavior: the last output Residual norm is sometimes higher than the > requested atol. > > Any clarifications are highly appreciated. > > Dominik > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominik at itis.ethz.ch Wed Dec 9 12:49:58 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Wed, 09 Dec 2009 19:49:58 +0100 Subject: clarification about convergence In-Reply-To: References: <4B1FE247.6050208@itis.ethz.ch> Message-ID: <4B1FF156.5070001@itis.ethz.ch> Excellent point. Where it broke the reason was: Starting KSPSolve 0 KSP Residual norm 7.841852910113e-04 1 KSP Residual norm 8.927576540999e-05 2 KSP Residual norm 1.694401713084e-05 3 KSP Residual norm 5.069425875318e-06 Linear solve converged due to CONVERGED_RTOL iterations 3 which I assume means that the norm became exactly 0 HOWEVER: putting -ksp_rtol -1 still does not eliminate the problem. Any further suggestions? Dominik Matthew Knepley wrote: > Did you use -ksp_converged_reason to determine why PETSc stopped iterating? > > Matt > > On Wed, Dec 9, 2009 at 11:45 AM, Dominik Szczerba > wrote: > > I am using > > -ksp_rtol 0 -ksp_atol 1e-6 (defaults for all the rest) > > and observe for most of the times convergence, as expected. > > Starting KSPSolve > 0 KSP Residual norm 6.315132950112e-04 > 1 KSP Residual norm 9.139539245601e-05 > 2 KSP Residual norm 1.869750068013e-05 > 3 KSP Residual norm 6.788145356909e-06 > 4 KSP Residual norm 1.729115712274e-06 > 5 KSP Residual norm 7.214445966641e-07 > solved in 2.328146e+00/4.144644e+00 s > solution converged in 5 iterations > ||Ax-b|| = 7.21445e-07 > > with ||...|| being residue computed on my own for a check. > > However, SOMETIMES, I do observe: > > Starting KSPSolve > 0 KSP Residual norm 1.228562818225e-02 > 1 KSP Residual norm 4.045833318123e-04 > 2 KSP Residual norm 6.589999324657e-05 > 3 KSP Residual norm 1.494849372638e-05 > 4 KSP Residual norm 4.311592172896e-06 > solved in 1.368086e+00/2.235830e+00 s > solution converged in 4 iterations > ||Ax-b|| = 4.31159e-06 > > which means that the iterations break sooner than they should. > Again, this is not often, but worries me why this should happen... > Using or not -ksp_converged_use_initial_residual_norm does not make > any difference to this behavior: the last output Residual norm is > sometimes higher than the requested atol. > > Any clarifications are highly appreciated. > > Dominik > > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which > their experiments lead. > -- Norbert Wiener From knepley at gmail.com Wed Dec 9 13:04:20 2009 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 9 Dec 2009 13:04:20 -0600 Subject: clarification about convergence In-Reply-To: <4B1FF156.5070001@itis.ethz.ch> References: <4B1FE247.6050208@itis.ethz.ch> <4B1FF156.5070001@itis.ethz.ch> Message-ID: On Wed, Dec 9, 2009 at 12:49 PM, Dominik Szczerba wrote: > Excellent point. Where it broke the reason was: > > Starting KSPSolve > 0 KSP Residual norm 7.841852910113e-04 > 1 KSP Residual norm 8.927576540999e-05 > 2 KSP Residual norm 1.694401713084e-05 > 3 KSP Residual norm 5.069425875318e-06 > Linear solve converged due to CONVERGED_RTOL iterations 3 > > which I assume means that the norm became exactly 0 > I don't think so. It would have printed that for the residual. > HOWEVER: putting -ksp_rtol -1 still does not eliminate the problem. Any > further suggestions? > You -ksp_view to see the tolerances used. Matt > Dominik > > Matthew Knepley wrote: > >> Did you use -ksp_converged_reason to determine why PETSc stopped >> iterating? >> >> Matt >> >> On Wed, Dec 9, 2009 at 11:45 AM, Dominik Szczerba > dominik at itis.ethz.ch>> wrote: >> >> I am using >> >> -ksp_rtol 0 -ksp_atol 1e-6 (defaults for all the rest) >> >> and observe for most of the times convergence, as expected. >> >> Starting KSPSolve >> 0 KSP Residual norm 6.315132950112e-04 >> 1 KSP Residual norm 9.139539245601e-05 >> 2 KSP Residual norm 1.869750068013e-05 >> 3 KSP Residual norm 6.788145356909e-06 >> 4 KSP Residual norm 1.729115712274e-06 >> 5 KSP Residual norm 7.214445966641e-07 >> solved in 2.328146e+00/4.144644e+00 s >> solution converged in 5 iterations >> ||Ax-b|| = 7.21445e-07 >> >> with ||...|| being residue computed on my own for a check. >> >> However, SOMETIMES, I do observe: >> >> Starting KSPSolve >> 0 KSP Residual norm 1.228562818225e-02 >> 1 KSP Residual norm 4.045833318123e-04 >> 2 KSP Residual norm 6.589999324657e-05 >> 3 KSP Residual norm 1.494849372638e-05 >> 4 KSP Residual norm 4.311592172896e-06 >> solved in 1.368086e+00/2.235830e+00 s >> solution converged in 4 iterations >> ||Ax-b|| = 4.31159e-06 >> >> which means that the iterations break sooner than they should. >> Again, this is not often, but worries me why this should happen... >> Using or not -ksp_converged_use_initial_residual_norm does not make >> any difference to this behavior: the last output Residual norm is >> sometimes higher than the requested atol. >> >> Any clarifications are highly appreciated. >> >> Dominik >> >> >> >> >> -- >> What most experimenters take for granted before they begin their >> experiments is infinitely more interesting than any results to which their >> experiments lead. >> -- Norbert Wiener >> > > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominik at itis.ethz.ch Wed Dec 9 14:06:46 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Wed, 09 Dec 2009 21:06:46 +0100 Subject: clarification about convergence In-Reply-To: References: <4B1FE247.6050208@itis.ethz.ch> <4B1FF156.5070001@itis.ethz.ch> Message-ID: <4B200356.8090809@itis.ethz.ch> Great hint, I found the tolerances not as I was setting them... Which brings me to the problem how to consistently set them. I am calling first: PetscOptionsInsertString() where I obtain the string from a user config file, and then am calling several times later: KSPSetFromOptions() I found experimentally that only the options ABSENT in the config string are eventually accepted from the command line. Those that were PRESENT will not be overwriten from the commandline - behavior not quite intuitive. Or am I doing something wrong? Is there a way to completely disable processing of the options from the command line? Or at least to specify what has higher priority? I prefer to set the options only in one way not to confuse the users. Many thanks, Dominik Matthew Knepley wrote: > On Wed, Dec 9, 2009 at 12:49 PM, Dominik Szczerba > wrote: > > Excellent point. Where it broke the reason was: > > Starting KSPSolve > 0 KSP Residual norm 7.841852910113e-04 > 1 KSP Residual norm 8.927576540999e-05 > 2 KSP Residual norm 1.694401713084e-05 > 3 KSP Residual norm 5.069425875318e-06 > Linear solve converged due to CONVERGED_RTOL iterations 3 > > which I assume means that the norm became exactly 0 > > > I don't think so. It would have printed that for the residual. > > > HOWEVER: putting -ksp_rtol -1 still does not eliminate the problem. > Any further suggestions? > > > You -ksp_view to see the tolerances used. > > Matt > > > Dominik > > Matthew Knepley wrote: > > Did you use -ksp_converged_reason to determine why PETSc stopped > iterating? > > Matt > > On Wed, Dec 9, 2009 at 11:45 AM, Dominik Szczerba > > >> wrote: > > I am using > > -ksp_rtol 0 -ksp_atol 1e-6 (defaults for all the rest) > > and observe for most of the times convergence, as expected. > > Starting KSPSolve > 0 KSP Residual norm 6.315132950112e-04 > 1 KSP Residual norm 9.139539245601e-05 > 2 KSP Residual norm 1.869750068013e-05 > 3 KSP Residual norm 6.788145356909e-06 > 4 KSP Residual norm 1.729115712274e-06 > 5 KSP Residual norm 7.214445966641e-07 > solved in 2.328146e+00/4.144644e+00 s > solution converged in 5 iterations > ||Ax-b|| = 7.21445e-07 > > with ||...|| being residue computed on my own for a check. > > However, SOMETIMES, I do observe: > > Starting KSPSolve > 0 KSP Residual norm 1.228562818225e-02 > 1 KSP Residual norm 4.045833318123e-04 > 2 KSP Residual norm 6.589999324657e-05 > 3 KSP Residual norm 1.494849372638e-05 > 4 KSP Residual norm 4.311592172896e-06 > solved in 1.368086e+00/2.235830e+00 s > solution converged in 4 iterations > ||Ax-b|| = 4.31159e-06 > > which means that the iterations break sooner than they should. > Again, this is not often, but worries me why this should > happen... > Using or not -ksp_converged_use_initial_residual_norm does > not make > any difference to this behavior: the last output Residual norm is > sometimes higher than the requested atol. > > Any clarifications are highly appreciated. > > Dominik > > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to > which their experiments lead. > -- Norbert Wiener > > > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which > their experiments lead. > -- Norbert Wiener From bsmith at mcs.anl.gov Wed Dec 9 14:13:45 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Wed, 9 Dec 2009 14:13:45 -0600 Subject: clarification about convergence In-Reply-To: <4B200356.8090809@itis.ethz.ch> References: <4B1FE247.6050208@itis.ethz.ch> <4B1FF156.5070001@itis.ethz.ch> <4B200356.8090809@itis.ethz.ch> Message-ID: <7AD6C828-5E53-4A18-A4E7-69ED1C1BC5C1@mcs.anl.gov> On Dec 9, 2009, at 2:06 PM, Dominik Szczerba wrote: > Great hint, I found the tolerances not as I was setting them... > > Which brings me to the problem how to consistently set them. I am > calling first: > > PetscOptionsInsertString() > > where I obtain the string from a user config file, and then am > calling several times later: > > KSPSetFromOptions() > > I found experimentally that only the options ABSENT in the config > string are eventually accepted from the command line. Those that > were PRESENT will not be overwriten from the commandline - behavior > not quite intuitive. Or am I doing something wrong? You call PetscInitialize(args) then PetscOptionsInsertString(). The args are processed before the string since it comes first. If you want to process the string first then the args you can do: PetscInitialize(args); PetscOptionsInsertString(); PetscOptionsInsert(args); now the args will overwrite the string. You can also pass PetscOptionsInsertFile() to pass options directly from a file Barry > > Is there a way to completely disable processing of the options from > the command line? Or at least to specify what has higher priority? I > prefer to set the options only in one way not to confuse the users. > > Many thanks, > Dominik > > Matthew Knepley wrote: >> On Wed, Dec 9, 2009 at 12:49 PM, Dominik Szczerba > > wrote: >> Excellent point. Where it broke the reason was: >> Starting KSPSolve >> 0 KSP Residual norm 7.841852910113e-04 >> 1 KSP Residual norm 8.927576540999e-05 >> 2 KSP Residual norm 1.694401713084e-05 >> 3 KSP Residual norm 5.069425875318e-06 >> Linear solve converged due to CONVERGED_RTOL iterations 3 >> which I assume means that the norm became exactly 0 >> I don't think so. It would have printed that for the residual. >> HOWEVER: putting -ksp_rtol -1 still does not eliminate the >> problem. >> Any further suggestions? >> You -ksp_view to see the tolerances used. >> Matt >> Dominik >> Matthew Knepley wrote: >> Did you use -ksp_converged_reason to determine why PETSc >> stopped >> iterating? >> Matt >> On Wed, Dec 9, 2009 at 11:45 AM, Dominik Szczerba >> >> >> >> wrote: >> I am using >> -ksp_rtol 0 -ksp_atol 1e-6 (defaults for all the rest) >> and observe for most of the times convergence, as expected. >> Starting KSPSolve >> 0 KSP Residual norm 6.315132950112e-04 >> 1 KSP Residual norm 9.139539245601e-05 >> 2 KSP Residual norm 1.869750068013e-05 >> 3 KSP Residual norm 6.788145356909e-06 >> 4 KSP Residual norm 1.729115712274e-06 >> 5 KSP Residual norm 7.214445966641e-07 >> solved in 2.328146e+00/4.144644e+00 s >> solution converged in 5 iterations >> ||Ax-b|| = 7.21445e-07 >> with ||...|| being residue computed on my own for a check. >> However, SOMETIMES, I do observe: >> Starting KSPSolve >> 0 KSP Residual norm 1.228562818225e-02 >> 1 KSP Residual norm 4.045833318123e-04 >> 2 KSP Residual norm 6.589999324657e-05 >> 3 KSP Residual norm 1.494849372638e-05 >> 4 KSP Residual norm 4.311592172896e-06 >> solved in 1.368086e+00/2.235830e+00 s >> solution converged in 4 iterations >> ||Ax-b|| = 4.31159e-06 >> which means that the iterations break sooner than they >> should. >> Again, this is not often, but worries me why this should >> happen... >> Using or not -ksp_converged_use_initial_residual_norm does >> not make >> any difference to this behavior: the last output Residual >> norm is >> sometimes higher than the requested atol. >> Any clarifications are highly appreciated. >> Dominik >> -- What most experimenters take for granted before >> they begin their >> experiments is infinitely more interesting than any results to >> which their experiments lead. >> -- Norbert Wiener >> -- >> What most experimenters take for granted before they begin their >> experiments is infinitely more interesting than any results to >> which their experiments lead. >> -- Norbert Wiener > From dominik at itis.ethz.ch Wed Dec 9 14:44:12 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Wed, 09 Dec 2009 21:44:12 +0100 Subject: clarification about convergence In-Reply-To: <7AD6C828-5E53-4A18-A4E7-69ED1C1BC5C1@mcs.anl.gov> References: <4B1FE247.6050208@itis.ethz.ch> <4B1FF156.5070001@itis.ethz.ch> <4B200356.8090809@itis.ethz.ch> <7AD6C828-5E53-4A18-A4E7-69ED1C1BC5C1@mcs.anl.gov> Message-ID: <4B200C1C.4090104@itis.ethz.ch> Barry Smith wrote: > On Dec 9, 2009, at 2:06 PM, Dominik Szczerba wrote: > >> Great hint, I found the tolerances not as I was setting them... >> >> Which brings me to the problem how to consistently set them. I am >> calling first: >> >> PetscOptionsInsertString() >> >> where I obtain the string from a user config file, and then am >> calling several times later: >> >> KSPSetFromOptions() >> >> I found experimentally that only the options ABSENT in the config >> string are eventually accepted from the command line. Those that >> were PRESENT will not be overwriten from the commandline - behavior >> not quite intuitive. Or am I doing something wrong? > > You call PetscInitialize(args) then PetscOptionsInsertString(). > The args are processed before the string since it comes first. If you > want to process the string first then the args you can do: > PetscInitialize(args); PetscOptionsInsertString(); > PetscOptionsInsert(args); now the args will overwrite the string. Great! Thanks a lot. Dominik > > You can also pass PetscOptionsInsertFile() to pass options > directly from a file > > Barry > >> Is there a way to completely disable processing of the options from >> the command line? Or at least to specify what has higher priority? I >> prefer to set the options only in one way not to confuse the users. >> >> Many thanks, >> Dominik >> >> Matthew Knepley wrote: >>> On Wed, Dec 9, 2009 at 12:49 PM, Dominik Szczerba >> > wrote: >>> Excellent point. Where it broke the reason was: >>> Starting KSPSolve >>> 0 KSP Residual norm 7.841852910113e-04 >>> 1 KSP Residual norm 8.927576540999e-05 >>> 2 KSP Residual norm 1.694401713084e-05 >>> 3 KSP Residual norm 5.069425875318e-06 >>> Linear solve converged due to CONVERGED_RTOL iterations 3 >>> which I assume means that the norm became exactly 0 >>> I don't think so. It would have printed that for the residual. >>> HOWEVER: putting -ksp_rtol -1 still does not eliminate the >>> problem. >>> Any further suggestions? >>> You -ksp_view to see the tolerances used. >>> Matt >>> Dominik >>> Matthew Knepley wrote: >>> Did you use -ksp_converged_reason to determine why PETSc >>> stopped >>> iterating? >>> Matt >>> On Wed, Dec 9, 2009 at 11:45 AM, Dominik Szczerba >>> >>> >> >>> wrote: >>> I am using >>> -ksp_rtol 0 -ksp_atol 1e-6 (defaults for all the rest) >>> and observe for most of the times convergence, as expected. >>> Starting KSPSolve >>> 0 KSP Residual norm 6.315132950112e-04 >>> 1 KSP Residual norm 9.139539245601e-05 >>> 2 KSP Residual norm 1.869750068013e-05 >>> 3 KSP Residual norm 6.788145356909e-06 >>> 4 KSP Residual norm 1.729115712274e-06 >>> 5 KSP Residual norm 7.214445966641e-07 >>> solved in 2.328146e+00/4.144644e+00 s >>> solution converged in 5 iterations >>> ||Ax-b|| = 7.21445e-07 >>> with ||...|| being residue computed on my own for a check. >>> However, SOMETIMES, I do observe: >>> Starting KSPSolve >>> 0 KSP Residual norm 1.228562818225e-02 >>> 1 KSP Residual norm 4.045833318123e-04 >>> 2 KSP Residual norm 6.589999324657e-05 >>> 3 KSP Residual norm 1.494849372638e-05 >>> 4 KSP Residual norm 4.311592172896e-06 >>> solved in 1.368086e+00/2.235830e+00 s >>> solution converged in 4 iterations >>> ||Ax-b|| = 4.31159e-06 >>> which means that the iterations break sooner than they >>> should. >>> Again, this is not often, but worries me why this should >>> happen... >>> Using or not -ksp_converged_use_initial_residual_norm does >>> not make >>> any difference to this behavior: the last output Residual >>> norm is >>> sometimes higher than the requested atol. >>> Any clarifications are highly appreciated. >>> Dominik >>> -- What most experimenters take for granted before >>> they begin their >>> experiments is infinitely more interesting than any results to >>> which their experiments lead. >>> -- Norbert Wiener >>> -- >>> What most experimenters take for granted before they begin their >>> experiments is infinitely more interesting than any results to >>> which their experiments lead. >>> -- Norbert Wiener > From zonexo at gmail.com Thu Dec 10 02:44:02 2009 From: zonexo at gmail.com (Wee-Beng Tay) Date: Thu, 10 Dec 2009 16:44:02 +0800 Subject: Which way to decompose domain/grid Message-ID: <804ab5d40912100044r53bc1bd4td273ab906b1253a6@mail.gmail.com> Hi, I'm working on a 2D Cartesian grid and I'm going to decompose the grid for MPI for my CFD Fortran code. The grid size is in the ratio of 110 x 70. I wonder how I should decompose the grid - horizontally or vertically? For e.g., for 2 processors, to 2 55x70 grids, or 2 110x35 grids. I thought that communication between grids will be less if I do 55x70 because communication will only involve 70 values. However, if it's 110x35, it'll involve 110 values Hence does it matter in PETSc how the decomposition is done? On the other hand, since Fortran is column major and hence I do the calculation: do j=1,size_y do i=1,size_x f(i,j)=.... end do end do I'll need to "package" the 70 values in a chunk for efficient sending. However, if it's in 110x35, I can use mpi_isend directly since it's contagious data. So is there a better option since there seems to be a conflict? I read about the use of DMMG. Will this problem be dealt with much better if I use DMMG instead? Thank you very much -------------- next part -------------- An HTML attachment was scrubbed... URL: From jed at 59A2.org Thu Dec 10 03:09:20 2009 From: jed at 59A2.org (Jed Brown) Date: Thu, 10 Dec 2009 10:09:20 +0100 Subject: Which way to decompose domain/grid In-Reply-To: <804ab5d40912100044r53bc1bd4td273ab906b1253a6@mail.gmail.com> References: <804ab5d40912100044r53bc1bd4td273ab906b1253a6@mail.gmail.com> Message-ID: <87fx7jw5z3.fsf@59A2.org> On Thu, 10 Dec 2009 16:44:02 +0800, Wee-Beng Tay wrote: > Hi, > > I'm working on a 2D Cartesian grid and I'm going to decompose the grid for > MPI for my CFD Fortran code. The grid size is in the ratio of 110 x 70. I > wonder how I should decompose the grid - horizontally or vertically? Both > I'll need to "package" the 70 values in a chunk for efficient sending. > However, if it's in 110x35, I can use mpi_isend directly since it's > contagious data. This will make no performance difference and would make things very fragile. The cost of packing the ghosted values is trivial compared to the cost of sending them (which is mostly due to latency so it doesn't matter much how many values are sent). > So is there a better option since there seems to be a conflict? I read about > the use of DMMG. Will this problem be dealt with much better if I use DMMG > instead? DMMG is for multigrid, start with a DA, as in DACreate2d(PETSC_COMM_WORLD,wrap,stencil_type,110,70,PETSC_DECIDE,PETSC_DECIDE,...) The user's manual has a good section on this. Jed From stephen.wornom at sophia.inria.fr Thu Dec 10 05:55:13 2009 From: stephen.wornom at sophia.inria.fr (Stephen Wornom) Date: Thu, 10 Dec 2009 12:55:13 +0100 Subject: Which way to decompose domain/grid In-Reply-To: <804ab5d40912100044r53bc1bd4td273ab906b1253a6@mail.gmail.com> References: <804ab5d40912100044r53bc1bd4td273ab906b1253a6@mail.gmail.com> Message-ID: <4B20E1A1.2060301@sophia.inria.fr> Wee-Beng Tay wrote: > Hi, > > I'm working on a 2D Cartesian grid and I'm going to decompose the grid > for MPI for my CFD Fortran code. The grid size is in the ratio of 110 > x 70. I wonder how I should decompose the grid - horizontally or > vertically? > > For e.g., for 2 processors, to 2 55x70 grids, or 2 110x35 grids. > > I thought that communication between grids will be less if I do 55x70 > because communication will only involve 70 values. I wrote a Cartesian mesh partitioner that partitions in slices as it involves the minimum communication time. For general meshes I partition with METIS. Question: I would like to use the PETSC partitioner if use one has the option to partition on in the x-y coordinates. Is that possible? Hope my question is clear. Stephen > However, if it's 110x35, it'll involve 110 values > > Hence does it matter in PETSc how the decomposition is done? > > On the other hand, since Fortran is column major and hence I do the > calculation: > > do j=1,size_y > > do i=1,size_x > > f(i,j)=.... > > end do > > end do > > I'll need to "package" the 70 values in a chunk for efficient sending. > However, if it's in 110x35, I can use mpi_isend directly since it's > contagious data. > > So is there a better option since there seems to be a conflict? I read > about the use of DMMG. Will this problem be dealt with much better if > I use DMMG instead? > > Thank you very much -- stephen.wornom at sophia.inria.fr 2004 route des lucioles - BP93 Sophia Antipolis 06902 CEDEX Tel: 04 92 38 50 54 Fax: 04 97 15 53 51 -------------- next part -------------- A non-text attachment was scrubbed... Name: stephen_wornom.vcf Type: text/x-vcard Size: 160 bytes Desc: not available URL: From jed at 59A2.org Thu Dec 10 07:10:55 2009 From: jed at 59A2.org (Jed Brown) Date: Thu, 10 Dec 2009 14:10:55 +0100 Subject: Which way to decompose domain/grid In-Reply-To: <4B20E1A1.2060301@sophia.inria.fr> References: <4B20E1A1.2060301@sophia.inria.fr> Message-ID: <87bpi7vusg.fsf@59A2.org> On Thu, 10 Dec 2009 12:55:13 +0100, Stephen Wornom wrote: > I wrote a Cartesian mesh partitioner that partitions in slices as it > involves the minimum communication time. Many people have the perception that the goal of partitioning is to minimize the number of neighbor processes. This actually has little impact on communication costs and is usually detrimental to solver performance. A partitioner should produce "equal-aspect" (after suitable nondimensionalization) subdomains, which is similar to keeping the number of ghost nodes low (actually what graph partitioners do). Put a different way, define the distance between two subdomains A and B as the minimum number of subdomains that have to be visited on a path from A to B. Then iteration count depends on the longest distance between any two subdomains in your model. Neither of these statements are precise, but they should give a sense for why partitioning into thin slices is probably not desirable. > For general meshes I partition with METIS. Question: I would like to use > the PETSC partitioner if use one has the option to partition on in the > x-y coordinates. Is that possible? I'm not sure exactly what you're looking for, PETSc partitioners use topology and weights, I don't believe any of them currently use coordinates. But if you have a coordinate-aware partitioning algorithm, you can register it and use it with -mat_partitioning_type your_algorithm. Additionally, e.g. the ParMETIS interface could be extended to optionally use ParMETIS_V3_PartGeomKway when vertex coordinates are available (it currently only uses ParMETIS_V3_PartKway). Jed From vyan2000 at gmail.com Thu Dec 10 14:09:22 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Thu, 10 Dec 2009 15:09:22 -0500 Subject: ksp tutorial ex22 Message-ID: Hi all, I was looking at the ex22 of ksp. If I call: ... ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr); ierr = DACreate3d(PETSC_COMM_WORLD,DA_NONPERIODIC,DA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr); ... How many grid pts should I have on the finest level? Is it 27, considering I am set 3 as the global dimension in each direction of the array? When I run ex22 with -ksp_view, I saw that on the finest level there are 9 pts on each direction. Is that because I have 3 level? Yan -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Thu Dec 10 14:12:24 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Thu, 10 Dec 2009 14:12:24 -0600 Subject: ksp tutorial ex22 In-Reply-To: References: Message-ID: <1716B0BA-FB43-4432-AAD2-AC87E6926444@mcs.anl.gov> On Dec 10, 2009, at 2:09 PM, Ryan Yan wrote: > Hi all, > I was looking at the ex22 of ksp. > > If I call: > ... > ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr); > ierr = > DACreate3d > (PETSC_COMM_WORLD > ,DA_NONPERIODIC > ,DA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE, > 1,1,0,0,0,&da);CHKERRQ(ierr); > ... > > How many grid pts should I have on the finest level? Is it 27, > considering I am set 3 as the global dimension in each direction of > the array? > > When I run ex22 with -ksp_view, I saw that on the finest level > there are 9 pts on each direction. > > Is that because I have 3 level? Yes. The DA you create initially is for the coarsest grid, finer ones are automatically created by the DMMG. Barry > > Yan > From vyan2000 at gmail.com Thu Dec 10 14:14:12 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Thu, 10 Dec 2009 15:14:12 -0500 Subject: ksp tutorial ex22 In-Reply-To: <1716B0BA-FB43-4432-AAD2-AC87E6926444@mcs.anl.gov> References: <1716B0BA-FB43-4432-AAD2-AC87E6926444@mcs.anl.gov> Message-ID: Hi Barry, Thank you very much for the confirm. Yan On Thu, Dec 10, 2009 at 3:12 PM, Barry Smith wrote: > > On Dec 10, 2009, at 2:09 PM, Ryan Yan wrote: > > Hi all, >> I was looking at the ex22 of ksp. >> >> If I call: >> ... >> ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr); >> ierr = >> DACreate3d(PETSC_COMM_WORLD,DA_NONPERIODIC,DA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr); >> ... >> >> How many grid pts should I have on the finest level? Is it 27, considering >> I am set 3 as the global dimension in each direction of the array? >> >> When I run ex22 with -ksp_view, I saw that on the finest level there are >> 9 pts on each direction. >> >> Is that because I have 3 level? >> > > Yes. The DA you create initially is for the coarsest grid, finer ones are > automatically created by the DMMG. > > Barry > > >> Yan >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zonexo at gmail.com Fri Dec 11 00:44:04 2009 From: zonexo at gmail.com (Wee-Beng Tay) Date: Fri, 11 Dec 2009 14:44:04 +0800 Subject: ksp tutorial ex22 In-Reply-To: References: <1716B0BA-FB43-4432-AAD2-AC87E6926444@mcs.anl.gov> Message-ID: <804ab5d40912102244q1f51121m8db9a0ade7ad8c74@mail.gmail.com> Hi, I'm also looking at the fortran version of ex22. I have some questions: 1. M,N,P are global dimension in each direction of the array. I'm abit confused. Do you mean the no. of grid pts at the coarse level? Hence, if my problem has 27x27 grid pts, do I use M=N=9 with 3 multigrid levels or M=N=3 with 9 lvls? What is the guideline in choosing the number of multigrid levels? 2. What is stencil width (s)? Seems to be 1 in both ex22 and ex29. 3. What are arrays containing the number of nodes in each cell along the x/y/z coordinates? Is it ok to just use the default PETSC_NULL_INTEGER? 4. There's a subroutine ComputeJacobian which computes the jacobian. However, what is it actually calculating? Is it simply calculating the coefficient arising from the discretization of the matrix? 5. My objective is to solve for the poisson equation arising from the Navier Stokes equations. ie div grad P = F, which F can be calculated separately. The boundary conditions are Neumann which is dp/dx, dp/dy=0. Is this a good example to follow? Or is ex29 a better example, although I need time to digest the C syntax. thanks alot! On Fri, Dec 11, 2009 at 4:14 AM, Ryan Yan wrote: > Hi Barry, > Thank you very much for the confirm. > > Yan > > > On Thu, Dec 10, 2009 at 3:12 PM, Barry Smith wrote: > >> >> On Dec 10, 2009, at 2:09 PM, Ryan Yan wrote: >> >> Hi all, >>> I was looking at the ex22 of ksp. >>> >>> If I call: >>> ... >>> ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr); >>> ierr = >>> DACreate3d(PETSC_COMM_WORLD,DA_NONPERIODIC,DA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr); >>> ... >>> >>> How many grid pts should I have on the finest level? Is it 27, >>> considering I am set 3 as the global dimension in each direction of the >>> array? >>> >>> When I run ex22 with -ksp_view, I saw that on the finest level there are >>> 9 pts on each direction. >>> >>> Is that because I have 3 level? >>> >> >> Yes. The DA you create initially is for the coarsest grid, finer ones >> are automatically created by the DMMG. >> >> Barry >> >> >>> Yan >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zonexo at gmail.com Fri Dec 11 04:24:58 2009 From: zonexo at gmail.com (Wee-Beng Tay) Date: Fri, 11 Dec 2009 18:24:58 +0800 Subject: Which way to decompose domain/grid In-Reply-To: <87fx7jw5z3.fsf@59A2.org> References: <804ab5d40912100044r53bc1bd4td273ab906b1253a6@mail.gmail.com> <87fx7jw5z3.fsf@59A2.org> Message-ID: <804ab5d40912110224k51e701d1pd91b04c0f1910593@mail.gmail.com> Hi Jed, Thanks for the answers. However, I'm still abit confused. My question is below. Also, you mention in the later mail that "Many people have the perception that the goal of partitioning is to minimize the number of neighbor processes. This actually has little impact on communication costs and is usually detrimental to solver performance.? But you mention abt latency, so shouldn't minimizing the number of neighbor processes reduce latency and improve performance? On Thu, Dec 10, 2009 at 5:09 PM, Jed Brown wrote: > On Thu, 10 Dec 2009 16:44:02 +0800, Wee-Beng Tay wrote: > > Hi, > > > > I'm working on a 2D Cartesian grid and I'm going to decompose the grid > for > > MPI for my CFD Fortran code. The grid size is in the ratio of 110 x 70. I > > wonder how I should decompose the grid - horizontally or vertically? > > Both > For both do u mean dividing 1 big grid into 4 55x35 grids? > > > I'll need to "package" the 70 values in a chunk for efficient sending. > > However, if it's in 110x35, I can use mpi_isend directly since it's > > contagious data. > > This will make no performance difference and would make things very > fragile. The cost of packing the ghosted values is trivial compared to > the cost of sending them (which is mostly due to latency so it doesn't > matter much how many values are sent). > so whichever method I use (horizontal or vertical) doesn't matter? But splitting to 4 55x35 grids will be better? > > > So is there a better option since there seems to be a conflict? I read > about > > the use of DMMG. Will this problem be dealt with much better if I use > DMMG > > instead? > > DMMG is for multigrid, start with a DA, as in > > > DACreate2d(PETSC_COMM_WORLD,wrap,stencil_type,110,70,PETSC_DECIDE,PETSC_DECIDE,...) > > The user's manual has a good section on this. > > > Jed > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jed at 59A2.org Fri Dec 11 05:00:14 2009 From: jed at 59A2.org (Jed Brown) Date: Fri, 11 Dec 2009 12:00:14 +0100 Subject: Which way to decompose domain/grid In-Reply-To: <804ab5d40912110224k51e701d1pd91b04c0f1910593@mail.gmail.com> References: <804ab5d40912100044r53bc1bd4td273ab906b1253a6@mail.gmail.com> <87fx7jw5z3.fsf@59A2.org> <804ab5d40912110224k51e701d1pd91b04c0f1910593@mail.gmail.com> Message-ID: <87aaxpojwh.fsf@59A2.org> On Fri, 11 Dec 2009 18:24:58 +0800, Wee-Beng Tay wrote: > But you mention abt latency, so shouldn't minimizing the number of neighbor > processes reduce latency and improve performance? Perhaps, depending on your network. But there are many tricks to hide latency of ghost updates, global reductions (in dot products) are harder especially since MPI collectives are synchronous. The higher iteration counts are way more painful than marginally higher update cost. > For both do u mean dividing 1 big grid into 4 55x35 grids? Yes, instead of 4 thin slices. And so on as you refine. DA does this automatically, just don't choose a prime number of processes (because then it would be forced into doing slices). > so whichever method I use (horizontal or vertical) doesn't matter? But > splitting to 4 55x35 grids will be better? Trying to send directly from some contiguous array is not a worthwhile optimization. My comment about latency was to guide against another "optimization" of sending some components of a vector problem separately when not all components "need" updating (it's likely faster to do one update of 5 values per ghost node than to do two separate updates of 1 value per node). Splitting into 4 subdomains isn't "better" than 2 subdomains, but when using many subdomains, they should not be thin slices. DA manages all of this. If you have some compelling reason *not* to use DA, you won't go far wrong by copying the design decisions in DA. Jed From vyan2000 at gmail.com Fri Dec 11 09:57:54 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Fri, 11 Dec 2009 10:57:54 -0500 Subject: ksp tutorial ex22 In-Reply-To: <804ab5d40912102244q1f51121m8db9a0ade7ad8c74@mail.gmail.com> References: <1716B0BA-FB43-4432-AAD2-AC87E6926444@mcs.anl.gov> <804ab5d40912102244q1f51121m8db9a0ade7ad8c74@mail.gmail.com> Message-ID: Hi Wee-Beng, Here are my understanding for ex22. Correct me please, if there is any mis-understanding, since I am also new to dmmg. Yan On Fri, Dec 11, 2009 at 1:44 AM, Wee-Beng Tay wrote: > Hi, > > I'm also looking at the fortran version of ex22. I have some questions: > > 1. M,N,P are global dimension in each direction of the array. I'm abit > confused. Do you mean the no. of grid pts at the coarse level? Hence, if my > problem has 27x27 grid pts, do I use M=N=9 with 3 multigrid levels or M=N=3 > with 9 lvls? What is the guideline in choosing the number of multigrid > levels? > > M,N, P are the #s of grid points in each direction (x,y,z) of your *coarsest* mesh. The way that PETSc always starts from the coarsest level to initialize the mesh is convenient for generating a series of mesh, I guess . If you want to solve a 2D problem with 27x27 mesh points, you can do a test to see how many levels can bring you the resolution close to what you want. > 2. What is stencil width (s)? Seems to be 1 in both ex22 and ex29. > > you are correct, see here: http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DA/DACreate3d.html > 3. What are arrays containing the number of nodes in each cell along the > x/y/z coordinates? Is it ok to just use the default PETSC_NULL_INTEGER? > > I think, if you want to specify a DA with you own partitioning(how many points on each process on each direction), then you need to set up these arrarys correctly. You can do a test on passing the PETSC_NULL_INTEGER to see whether PETSc complains. > 4. There's a subroutine ComputeJacobian which computes the jacobian. > However, what is it actually calculating? Is it simply calculating the > coefficient arising from the discretization of the matrix? > > For both ex22 and ex29, it is solving a linear system, the Jacobian is just your coefficient matrix, (or 7 pt stencil matrix). > 5. My objective is to solve for the poisson equation arising from the > Navier Stokes equations. ie div grad P = F, which F can be calculated > separately. The boundary conditions are Neumann which is dp/dx, dp/dy=0. Is > this a good example to follow? Or is ex29 a better example, although I need > time to digest the C syntax. > > thanks alot! > > If you are solving 3D problem, you should also look at the ex22 to see how to correctly set up the 3D stencil. Ex22 are only dealing with Dirichlet B.C.s, so care has to be taken for the Neumann boundary conditions. Also, for Neumann B.C.s, one should be aware of there is a null space of your coefficient matrix A. ex29 has a piece of code for that. DMMGSetNullSpace() > > On Fri, Dec 11, 2009 at 4:14 AM, Ryan Yan wrote: > >> Hi Barry, >> Thank you very much for the confirm. >> >> Yan >> >> >> On Thu, Dec 10, 2009 at 3:12 PM, Barry Smith wrote: >> >>> >>> On Dec 10, 2009, at 2:09 PM, Ryan Yan wrote: >>> >>> Hi all, >>>> I was looking at the ex22 of ksp. >>>> >>>> If I call: >>>> ... >>>> ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr); >>>> ierr = >>>> DACreate3d(PETSC_COMM_WORLD,DA_NONPERIODIC,DA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr); >>>> ... >>>> >>>> How many grid pts should I have on the finest level? Is it 27, >>>> considering I am set 3 as the global dimension in each direction of the >>>> array? >>>> >>>> When I run ex22 with -ksp_view, I saw that on the finest level there >>>> are 9 pts on each direction. >>>> >>>> Is that because I have 3 level? >>>> >>> >>> Yes. The DA you create initially is for the coarsest grid, finer ones >>> are automatically created by the DMMG. >>> >>> Barry >>> >>> >>>> Yan >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vyan2000 at gmail.com Fri Dec 11 10:25:33 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Fri, 11 Dec 2009 11:25:33 -0500 Subject: ksp tutorial ex22 In-Reply-To: <804ab5d40912102244q1f51121m8db9a0ade7ad8c74@mail.gmail.com> References: <1716B0BA-FB43-4432-AAD2-AC87E6926444@mcs.anl.gov> <804ab5d40912102244q1f51121m8db9a0ade7ad8c74@mail.gmail.com> Message-ID: On Fri, Dec 11, 2009 at 1:44 AM, Wee-Beng Tay wrote: > Hi, > > I'm also looking at the fortran version of ex22. I have some questions: > > 1. M,N,P are global dimension in each direction of the array. I'm abit > confused. Do you mean the no. of grid pts at the coarse level? Hence, if my > problem has 27x27 grid pts, do I use M=N=9 with 3 multigrid levels or M=N=3 > with 9 lvls? What is the guideline in choosing the number of multigrid > levels? > > 2. What is stencil width (s)? Seems to be 1 in both ex22 and ex29. > > 3. What are arrays containing the number of nodes in each cell along the > x/y/z coordinates? Is it ok to just use the default PETSC_NULL_INTEGER? > > 4. There's a subroutine ComputeJacobian which computes the jacobian. > However, what is it actually calculating? Is it simply calculating the > coefficient arising from the discretization of the matrix? > > I just realized that you are looking at Fortran version ex22f.F for this question. In fact, my answer still applies. You may want to make a comparison between: http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DMMG/DMMGSetSNES.html http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DMMG/DMMGSetKSP.html > 5. My objective is to solve for the poisson equation arising from the > Navier Stokes equations. ie div grad P = F, which F can be calculated > separately. The boundary conditions are Neumann which is dp/dx, dp/dy=0. Is > this a good example to follow? Or is ex29 a better example, although I need > time to digest the C syntax. > > thanks alot! > > > On Fri, Dec 11, 2009 at 4:14 AM, Ryan Yan wrote: > >> Hi Barry, >> Thank you very much for the confirm. >> >> Yan >> >> >> On Thu, Dec 10, 2009 at 3:12 PM, Barry Smith wrote: >> >>> >>> On Dec 10, 2009, at 2:09 PM, Ryan Yan wrote: >>> >>> Hi all, >>>> I was looking at the ex22 of ksp. >>>> >>>> If I call: >>>> ... >>>> ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr); >>>> ierr = >>>> DACreate3d(PETSC_COMM_WORLD,DA_NONPERIODIC,DA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr); >>>> ... >>>> >>>> How many grid pts should I have on the finest level? Is it 27, >>>> considering I am set 3 as the global dimension in each direction of the >>>> array? >>>> >>>> When I run ex22 with -ksp_view, I saw that on the finest level there >>>> are 9 pts on each direction. >>>> >>>> Is that because I have 3 level? >>>> >>> >>> Yes. The DA you create initially is for the coarsest grid, finer ones >>> are automatically created by the DMMG. >>> >>> Barry >>> >>> >>>> Yan >>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominik at itis.ethz.ch Fri Dec 11 13:36:35 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Fri, 11 Dec 2009 20:36:35 +0100 Subject: intercepting residues as array Message-ID: <4B229F43.1000103@itis.ethz.ch> Would it be easy to intercept the rnorms as computed in e.g. fgmres into an array? E.g. have 0 KSP Residual norm 5.955965225039e-04 1 KSP Residual norm 8.064336982160e-05 2 KSP Residual norm 2.550695121313e-05 3 KSP Residual norm 7.872959324551e-06 4 KSP Residual norm 2.084257872716e-06 as {5.955965225039e-04, 8.064336982160e-05, ...} for independent logging etc. I know how I can do it the long way (e.g. writing my own convergence test where I have an access to rnorm), but I was wondering if there was a short way. with regards, Dominik From bsmith at mcs.anl.gov Fri Dec 11 13:38:49 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Fri, 11 Dec 2009 13:38:49 -0600 Subject: intercepting residues as array In-Reply-To: <4B229F43.1000103@itis.ethz.ch> References: <4B229F43.1000103@itis.ethz.ch> Message-ID: <08346DE5-E053-493C-A8B0-945C825BE9C9@mcs.anl.gov> See the manual page for KSPSetResidualHistory() Let us know if it does not provide the functionality you need. Barry On Dec 11, 2009, at 1:36 PM, Dominik Szczerba wrote: > Would it be easy to intercept the rnorms as computed in e.g. fgmres > into an array? E.g. have > > 0 KSP Residual norm 5.955965225039e-04 > 1 KSP Residual norm 8.064336982160e-05 > 2 KSP Residual norm 2.550695121313e-05 > 3 KSP Residual norm 7.872959324551e-06 > 4 KSP Residual norm 2.084257872716e-06 > > as {5.955965225039e-04, 8.064336982160e-05, ...} for independent > logging etc. > > I know how I can do it the long way (e.g. writing my own convergence > test where I have an access to rnorm), but I was wondering if there > was a short way. > > with regards, > Dominik From jed at 59A2.org Fri Dec 11 13:42:29 2009 From: jed at 59A2.org (Jed Brown) Date: Fri, 11 Dec 2009 20:42:29 +0100 Subject: intercepting residues as array In-Reply-To: <4B229F43.1000103@itis.ethz.ch> References: <4B229F43.1000103@itis.ethz.ch> Message-ID: <874onxnvq2.fsf@59A2.org> On Fri, 11 Dec 2009 20:36:35 +0100, Dominik Szczerba wrote: > Would it be easy to intercept the rnorms as computed in e.g. fgmres into > an array? E.g. have > > 0 KSP Residual norm 5.955965225039e-04 > 1 KSP Residual norm 8.064336982160e-05 > 2 KSP Residual norm 2.550695121313e-05 > 3 KSP Residual norm 7.872959324551e-06 > 4 KSP Residual norm 2.084257872716e-06 > > as {5.955965225039e-04, 8.064336982160e-05, ...} for independent logging > etc. > > I know how I can do it the long way (e.g. writing my own convergence > test where I have an access to rnorm), but I was wondering if there was > a short way. See KSPMonitorSet, ksp/ksp/examples/tutorials/ex9.c Jed From vyan2000 at gmail.com Fri Dec 11 15:40:38 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Fri, 11 Dec 2009 16:40:38 -0500 Subject: ksp ex29.c B.C.s and Forcing terms. Message-ID: Hi All, I am tring to understand the example in ksp tutorials ex29.c http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/ksp/ksp/examples/tutorials/ex29.c.html For the forcing terms of codes, array[j][i] = PetscExpScalar(-((PetscReal)i*Hx)*((PetscReal)i*Hx)/user->nu)*PetscExpScalar(-((PetscReal)j*Hy)*((PetscReal)j*Hy)/user->nu)*Hx*Hy; if ignoring the scaling, then it is actually calculating a forcing function: f = e^{-( x)^2/\nu} e^{-( y)^2/\nu}, which is different with the one given in the comments of the code. Or did I miss somthing here? For the Dirichlet B.C.s, I did not understand the coefficients **given below. Isn't correct to set the v[0]=Hx*Hy here? if (i==0 || j==0 || i==mx-1 || j==my-1) { if (user->bcType == DIRICHLET) { v[0] = 2.0*rho*(HxdHy + HydHx); } } Also, for Nueman B.C.s, are we solving for du/dx+du/dy=0? Sorry for so many detail questions, and thank you very much for any suggestions. Yan -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Fri Dec 11 17:13:49 2009 From: knepley at gmail.com (Matthew Knepley) Date: Fri, 11 Dec 2009 17:13:49 -0600 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: References: Message-ID: On Fri, Dec 11, 2009 at 3:40 PM, Ryan Yan wrote: > Hi All, > I am tring to understand the example in ksp tutorials ex29.c > > http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/ksp/ksp/examples/tutorials/ex29.c.html > > For the forcing terms of codes, > > array[j][i] = > PetscExpScalar(-((PetscReal)i*Hx)*((PetscReal)i*Hx)/user->nu)*PetscExpScalar(-((PetscReal)j*Hy)*((PetscReal)j*Hy)/user->nu)*Hx*Hy; > > if ignoring the scaling, then it is actually calculating a forcing > function: > > f = e^{-( x)^2/\nu} e^{-( y)^2/\nu}, which is different with the one given > in the comments of the code. Or did I miss somthing here? > Yes, it appears the comment is in error. > For the Dirichlet B.C.s, I did not understand the coefficients **given > below. Isn't correct to set the v[0]=Hx*Hy here? > > if (i==0 || j==0 || i==mx-1 || j==my-1) { > > if (user->bcType == DIRICHLET) { > v[0] = 2.0*rho*(HxdHy + HydHx); > } > } > This is the proper scaling. > Also, for Nueman B.C.s, are we solving for du/dx+du/dy=0? > Homogeneous Neumann conditions would be \hat n \cdot \nabla u = 0. Matt > Sorry for so many detail questions, and thank you very much for any > suggestions. > > Yan > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From vyan2000 at gmail.com Fri Dec 11 19:18:53 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Fri, 11 Dec 2009 20:18:53 -0500 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: References: Message-ID: Hi Matt, Thank you very much for the reply. Now, I got the Neumann part. But I am still a bit confused about the Dirichlet part. Please see the following quote. Yan For the Dirichlet B.C.s, I did not understand the coefficients **given >> below. Isn't correct to set the v[0]=Hx*Hy here? >> >> if (i==0 || j==0 || i==mx-1 || j==my-1) { >> >> if (user->bcType == DIRICHLET) { >> v[0] = 2.0*rho*(HxdHy + HydHx); >> } >> } >> > > This is the proper scaling. > > the Dirichlet B.C.s: Which scaling do you think is proper, "v[0]=Hx*Hy" or 2.0*rho*(HxdHy + HydHx)? If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more about why is this one? I only see a factor of Hx*Hy when we set up the RHS. Did I miss something? Matt > > > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > -- Norbert Wiener > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Fri Dec 11 19:28:02 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Fri, 11 Dec 2009 19:28:02 -0600 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: References: Message-ID: On Dec 11, 2009, at 7:18 PM, Ryan Yan wrote: > Hi Matt, > Thank you very much for the reply. Now, I got the Neumann part. But > I am still a bit confused about the Dirichlet part. Please see the > following quote. > > Yan > > > For the Dirichlet B.C.s, I did not understand the coefficients given > below. Isn't correct to set the v[0]=Hx*Hy here? > if (i==0 || j==0 || i==mx-1 || j==my-1) { > if (user->bcType == DIRICHLET) { > v[0] = 2.0*rho*(HxdHy + HydHx); > } > } > > This is the proper scaling. > > the Dirichlet B.C.s: > Which scaling do you think is proper, "v[0]=Hx*Hy" or > 2.0*rho*(HxdHy + HydHx)? > If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more > about why is this one? I only see a factor of Hx*Hy when we set up > the RHS. Did I miss something? > Ryan, You can scale the equations for Dirichlet boundary conditions anyway you want; you could multiply them by 1,000,000 if you want. The answer in exact precision with direct solvers will be the same. The reason we use the given scaling is to make the scaling work well with multigrid. If you use a different scaling the Dirichlet boundary conditions on the coarser grid matrices would have a different scaling then the interior equations and this would slow down MG's convergence rate. For toy problems people usually eliminate the Dirichlet boundary conditions, then there is no scaling issue for multigrid. Barry > > Matt > > > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which > their experiments lead. > -- Norbert Wiener > From vyan2000 at gmail.com Fri Dec 11 20:14:49 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Fri, 11 Dec 2009 21:14:49 -0500 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: References: Message-ID: Hi Barry, Thank you very much for the suggestion. I totally agree with you on using the same scaling for all the points include the Boundary points. Yan On Fri, Dec 11, 2009 at 8:28 PM, Barry Smith wrote: > > On Dec 11, 2009, at 7:18 PM, Ryan Yan wrote: > > Hi Matt, >> Thank you very much for the reply. Now, I got the Neumann part. But I am >> still a bit confused about the Dirichlet part. Please see the following >> quote. >> >> Yan >> >> >> For the Dirichlet B.C.s, I did not understand the coefficients given >> below. Isn't correct to set the v[0]=Hx*Hy here? >> if (i==0 || j==0 || i==mx-1 || j==my-1) { >> if (user->bcType == DIRICHLET) { >> v[0] = 2.0*rho*(HxdHy + HydHx); >> } >> } >> >> This is the proper scaling. >> >> the Dirichlet B.C.s: >> Which scaling do you think is proper, "v[0]=Hx*Hy" or 2.0*rho*(HxdHy + >> HydHx)? >> If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more about why >> is this one? I only see a factor of Hx*Hy when we set up the RHS. Did I >> miss something? >> >> Ryan, > > You can scale the equations for Dirichlet boundary conditions anyway > you want; you could multiply them by 1,000,000 if you want. The answer in > exact precision with direct solvers will be the same. The reason we use the > given scaling is to make the scaling work well with multigrid. If you use a > different scaling the Dirichlet boundary conditions on the coarser grid > matrices would have a different scaling then the interior equations and this > would slow down MG's convergence rate. For toy problems people usually > eliminate the Dirichlet boundary conditions, then there is no scaling issue > for multigrid. > > > Barry > > > >> Matt >> >> >> >> >> >> -- >> What most experimenters take for granted before they begin their >> experiments is infinitely more interesting than any results to which their >> experiments lead. >> -- Norbert Wiener >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominik at itis.ethz.ch Sat Dec 12 07:48:00 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Sat, 12 Dec 2009 14:48:00 +0100 Subject: intercepting residues as array In-Reply-To: <08346DE5-E053-493C-A8B0-945C825BE9C9@mcs.anl.gov> References: <4B229F43.1000103@itis.ethz.ch> <08346DE5-E053-493C-A8B0-945C825BE9C9@mcs.anl.gov> Message-ID: <4B239F10.1090303@itis.ethz.ch> Dear Barry and Jed, Many thanks for the useful hints, the functions provide the functionality I needed. Dominik Barry Smith wrote: > See the manual page for KSPSetResidualHistory() > > Let us know if it does not provide the functionality you need. > > Barry > > On Dec 11, 2009, at 1:36 PM, Dominik Szczerba wrote: > >> Would it be easy to intercept the rnorms as computed in e.g. fgmres >> into an array? E.g. have >> >> 0 KSP Residual norm 5.955965225039e-04 >> 1 KSP Residual norm 8.064336982160e-05 >> 2 KSP Residual norm 2.550695121313e-05 >> 3 KSP Residual norm 7.872959324551e-06 >> 4 KSP Residual norm 2.084257872716e-06 >> >> as {5.955965225039e-04, 8.064336982160e-05, ...} for independent >> logging etc. >> >> I know how I can do it the long way (e.g. writing my own convergence >> test where I have an access to rnorm), but I was wondering if there >> was a short way. >> >> with regards, >> Dominik > From amari at cpht.polytechnique.fr Sat Dec 12 12:31:53 2009 From: amari at cpht.polytechnique.fr (Tahar Amari) Date: Sat, 12 Dec 2009 19:31:53 +0100 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: References: Message-ID: <119136AB-933B-4770-B67F-898EC14E6489@cpht.polytechnique.fr> Hello, SOrry. I took this very interesting discussion a bit late, but one of my major problem is to understand if all this is valid for node centered variables for u or cell centered. Usually the best way of solving Neuwman BC for this equation is having cell centered unknowns to have derivatives given on the domain boundary. This then have some impact on handling ghost values transfer between subdomains with MPI.Is all this transparent for us and PETSC handle it . I guess no, right ? Tahar Le 12 d?c. 09 ? 02:28, Barry Smith a ?crit : > > On Dec 11, 2009, at 7:18 PM, Ryan Yan wrote: > >> Hi Matt, >> Thank you very much for the reply. Now, I got the Neumann part. >> But I am still a bit confused about the Dirichlet part. Please see >> the following quote. >> >> Yan >> >> >> For the Dirichlet B.C.s, I did not understand the coefficients >> given below. Isn't correct to set the v[0]=Hx*Hy here? >> if (i==0 || j==0 || i==mx-1 || j==my-1) { >> if (user->bcType == DIRICHLET) { >> v[0] = 2.0*rho*(HxdHy + HydHx); >> } >> } >> >> This is the proper scaling. >> >> the Dirichlet B.C.s: >> Which scaling do you think is proper, "v[0]=Hx*Hy" or >> 2.0*rho*(HxdHy + HydHx)? >> If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more >> about why is this one? I only see a factor of Hx*Hy when we set up >> the RHS. Did I miss something? >> > Ryan, > > You can scale the equations for Dirichlet boundary conditions > anyway you want; you could multiply them by 1,000,000 if you want. > The answer in exact precision with direct solvers will be the same. > The reason we use the given scaling is to make the scaling work well > with multigrid. If you use a different scaling the Dirichlet > boundary conditions on the coarser grid matrices would have a > different scaling then the interior equations and this would slow > down MG's convergence rate. For toy problems people usually > eliminate the Dirichlet boundary conditions, then there is no > scaling issue for multigrid. > > > Barry > >> >> Matt >> >> >> >> >> >> -- >> What most experimenters take for granted before they begin their >> experiments is infinitely more interesting than any results to >> which their experiments lead. >> -- Norbert Wiener >> -------------------------------------------- T. Amari Centre de Physique Theorique Ecole Polytechnique 91128 Palaiseau Cedex France tel : 33 1 69 33 42 52 fax: 33 1 69 33 49 49 email: URL : http://www.cpht.polytechnique.fr/cpht/amari From bsmith at mcs.anl.gov Sat Dec 12 13:57:38 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Sat, 12 Dec 2009 13:57:38 -0600 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: <119136AB-933B-4770-B67F-898EC14E6489@cpht.polytechnique.fr> References: <119136AB-933B-4770-B67F-898EC14E6489@cpht.polytechnique.fr> Message-ID: <0337AE08-5BBF-4CB2-AEC4-B27ADE5F43B4@mcs.anl.gov> On Dec 12, 2009, at 12:31 PM, Tahar Amari wrote: > Hello, > > SOrry. I took this very interesting discussion a bit late, but one > of my major problem is to understand if all this is valid for node > centered > variables for u or cell centered. > Usually the best way of solving Neuwman BC for this equation is > having cell centered unknowns to have derivatives > given on the domain boundary. > This then have some impact on handling ghost values transfer between > subdomains with MPI.Is all this transparent for > us and PETSC handle it . I guess no, right ? If you have only cell centered unknowns the ghost point updates are the same. See src/ksp/ksp/examples/tutorials/ex32.c Having some Neuman and some Dirichlet boundary conditions is then trickery with cell centered. If you have some cell-centered and some vertex centered unknowns (staggered grid), DA does not handle this well, you have to "cheat" to match up variables on the cells and vertices. Barry > > Tahar > > > Le 12 d?c. 09 ? 02:28, Barry Smith a ?crit : > >> >> On Dec 11, 2009, at 7:18 PM, Ryan Yan wrote: >> >>> Hi Matt, >>> Thank you very much for the reply. Now, I got the Neumann part. >>> But I am still a bit confused about the Dirichlet part. Please see >>> the following quote. >>> >>> Yan >>> >>> >>> For the Dirichlet B.C.s, I did not understand the coefficients >>> given below. Isn't correct to set the v[0]=Hx*Hy here? >>> if (i==0 || j==0 || i==mx-1 || j==my-1) { >>> if (user->bcType == DIRICHLET) { >>> v[0] = 2.0*rho*(HxdHy + HydHx); >>> } >>> } >>> >>> This is the proper scaling. >>> >>> the Dirichlet B.C.s: >>> Which scaling do you think is proper, "v[0]=Hx*Hy" or >>> 2.0*rho*(HxdHy + HydHx)? >>> If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more >>> about why is this one? I only see a factor of Hx*Hy when we set up >>> the RHS. Did I miss something? >>> >> Ryan, >> >> You can scale the equations for Dirichlet boundary conditions >> anyway you want; you could multiply them by 1,000,000 if you want. >> The answer in exact precision with direct solvers will be the same. >> The reason we use the given scaling is to make the scaling work >> well with multigrid. If you use a different scaling the Dirichlet >> boundary conditions on the coarser grid matrices would have a >> different scaling then the interior equations and this would slow >> down MG's convergence rate. For toy problems people usually >> eliminate the Dirichlet boundary conditions, then there is no >> scaling issue for multigrid. >> >> >> Barry >> >>> >>> Matt >>> >>> >>> >>> >>> >>> -- >>> What most experimenters take for granted before they begin their >>> experiments is infinitely more interesting than any results to >>> which their experiments lead. >>> -- Norbert Wiener >>> > > -------------------------------------------- > T. Amari > Centre de Physique Theorique > Ecole Polytechnique > 91128 Palaiseau Cedex France > tel : 33 1 69 33 42 52 > fax: 33 1 69 33 49 49 > email: > URL : http://www.cpht.polytechnique.fr/cpht/amari > > > > > From eugen.wintersberger at jku.at Sat Dec 12 14:12:19 2009 From: eugen.wintersberger at jku.at (Eugen Wintersberger) Date: Sat, 12 Dec 2009 21:12:19 +0100 Subject: Threading in petsc Message-ID: Hi there I am entirely new to petsc. I would like to know if communication between Jobs on a single node is done via threads or mpi. Thanks in advance Eugen wintersberger From bsmith at mcs.anl.gov Sat Dec 12 14:15:03 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Sat, 12 Dec 2009 14:15:03 -0600 Subject: Threading in petsc In-Reply-To: References: Message-ID: On Dec 12, 2009, at 2:12 PM, Eugen Wintersberger wrote: > Hi there > I am entirely new to petsc. I would like to know if communication > between Jobs on a single node is done via threads or mpi. The standard model is to have 1 MPI process per core so there is no need for or use of threads. There is some code in place that allows one to have one MPI process per node and use threads within the node to compute the users nonlinear function. Barry > Thanks in advance > Eugen wintersberger From amari at cpht.polytechnique.fr Sat Dec 12 14:20:19 2009 From: amari at cpht.polytechnique.fr (Tahar Amari) Date: Sat, 12 Dec 2009 21:20:19 +0100 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: <0337AE08-5BBF-4CB2-AEC4-B27ADE5F43B4@mcs.anl.gov> References: <119136AB-933B-4770-B67F-898EC14E6489@cpht.polytechnique.fr> <0337AE08-5BBF-4CB2-AEC4-B27ADE5F43B4@mcs.anl.gov> Message-ID: <7169B315-9047-4158-A8C3-45AD896F63D3@cpht.polytechnique.fr> Thanks a lot. Tahar Le 12 d?c. 09 ? 20:57, Barry Smith a ?crit : > > On Dec 12, 2009, at 12:31 PM, Tahar Amari wrote: > >> Hello, >> >> SOrry. I took this very interesting discussion a bit late, but one >> of my major problem is to understand if all this is valid for node >> centered >> variables for u or cell centered. >> Usually the best way of solving Neuwman BC for this equation is >> having cell centered unknowns to have derivatives >> given on the domain boundary. >> This then have some impact on handling ghost values transfer >> between subdomains with MPI.Is all this transparent for >> us and PETSC handle it . I guess no, right ? > > If you have only cell centered unknowns the ghost point updates are > the same. See src/ksp/ksp/examples/tutorials/ex32.c Having some > Neuman and some Dirichlet boundary conditions is then trickery with > cell centered. > > If you have some cell-centered and some vertex centered unknowns > (staggered grid), DA does not handle this well, you have to "cheat" > to match up variables on the cells and vertices. > > > Barry > >> >> Tahar >> >> >> Le 12 d?c. 09 ? 02:28, Barry Smith a ?crit : >> >>> >>> On Dec 11, 2009, at 7:18 PM, Ryan Yan wrote: >>> >>>> Hi Matt, >>>> Thank you very much for the reply. Now, I got the Neumann part. >>>> But I am still a bit confused about the Dirichlet part. Please >>>> see the following quote. >>>> >>>> Yan >>>> >>>> >>>> For the Dirichlet B.C.s, I did not understand the coefficients >>>> given below. Isn't correct to set the v[0]=Hx*Hy here? >>>> if (i==0 || j==0 || i==mx-1 || j==my-1) { >>>> if (user->bcType == DIRICHLET) { >>>> v[0] = 2.0*rho*(HxdHy + HydHx); >>>> } >>>> } >>>> >>>> This is the proper scaling. >>>> >>>> the Dirichlet B.C.s: >>>> Which scaling do you think is proper, "v[0]=Hx*Hy" or >>>> 2.0*rho*(HxdHy + HydHx)? >>>> If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more >>>> about why is this one? I only see a factor of Hx*Hy when we set >>>> up the RHS. Did I miss something? >>>> >>> Ryan, >>> >>> You can scale the equations for Dirichlet boundary conditions >>> anyway you want; you could multiply them by 1,000,000 if you want. >>> The answer in exact precision with direct solvers will be the >>> same. The reason we use the given scaling is to make the scaling >>> work well with multigrid. If you use a different scaling the >>> Dirichlet boundary conditions on the coarser grid matrices would >>> have a different scaling then the interior equations and this >>> would slow down MG's convergence rate. For toy problems people >>> usually eliminate the Dirichlet boundary conditions, then there is >>> no scaling issue for multigrid. >>> >>> >>> Barry >>> >>>> >>>> Matt >>>> >>>> >>>> >>>> >>>> >>>> -- >>>> What most experimenters take for granted before they begin their >>>> experiments is infinitely more interesting than any results to >>>> which their experiments lead. >>>> -- Norbert Wiener >>>> >> >> -------------------------------------------- >> T. Amari >> Centre de Physique Theorique >> Ecole Polytechnique >> 91128 Palaiseau Cedex France >> tel : 33 1 69 33 42 52 >> fax: 33 1 69 33 49 49 >> email: >> URL : http://www.cpht.polytechnique.fr/cpht/amari >> >> >> >> >> -------------------------------------------- T. Amari Centre de Physique Theorique Ecole Polytechnique 91128 Palaiseau Cedex France tel : 33 1 69 33 42 52 fax: 33 1 69 33 49 49 email: URL : http://www.cpht.polytechnique.fr/cpht/amari From vyan2000 at gmail.com Sat Dec 12 16:34:01 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Sat, 12 Dec 2009 17:34:01 -0500 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: <0337AE08-5BBF-4CB2-AEC4-B27ADE5F43B4@mcs.anl.gov> References: <119136AB-933B-4770-B67F-898EC14E6489@cpht.polytechnique.fr> <0337AE08-5BBF-4CB2-AEC4-B27ADE5F43B4@mcs.anl.gov> Message-ID: Hi Barry, Since the ex32.c has been brought up to make comparison with ex29.c. Can I just get a confirm that, in ex29.c, the instance with Neumann B.C.s is the case where one has cell centered unknown for the u, with vertex centered f. Feel free to criticize this comment please, and this is where I get very confused. Thanks, Yan On Sat, Dec 12, 2009 at 2:57 PM, Barry Smith wrote: > > On Dec 12, 2009, at 12:31 PM, Tahar Amari wrote: > > Hello, >> >> SOrry. I took this very interesting discussion a bit late, but one of my >> major problem is to understand if all this is valid for node centered >> variables for u or cell centered. >> Usually the best way of solving Neuwman BC for this equation is having >> cell centered unknowns to have derivatives >> given on the domain boundary. >> This then have some impact on handling ghost values transfer between >> subdomains with MPI.Is all this transparent for >> us and PETSC handle it . I guess no, right ? >> > > If you have only cell centered unknowns the ghost point updates are the > same. See src/ksp/ksp/examples/tutorials/ex32.c Having some Neuman and some > Dirichlet boundary conditions is then trickery with cell centered. > > If you have some cell-centered and some vertex centered unknowns > (staggered grid), DA does not handle this well, you have to "cheat" to match > up variables on the cells and vertices. > > > Barry > > > >> Tahar >> >> >> Le 12 d?c. 09 ? 02:28, Barry Smith a ?crit : >> >> >>> On Dec 11, 2009, at 7:18 PM, Ryan Yan wrote: >>> >>> Hi Matt, >>>> Thank you very much for the reply. Now, I got the Neumann part. But I >>>> am still a bit confused about the Dirichlet part. Please see the following >>>> quote. >>>> >>>> Yan >>>> >>>> >>>> For the Dirichlet B.C.s, I did not understand the coefficients given >>>> below. Isn't correct to set the v[0]=Hx*Hy here? >>>> if (i==0 || j==0 || i==mx-1 || j==my-1) { >>>> if (user->bcType == DIRICHLET) { >>>> v[0] = 2.0*rho*(HxdHy + HydHx); >>>> } >>>> } >>>> >>>> This is the proper scaling. >>>> >>>> the Dirichlet B.C.s: >>>> Which scaling do you think is proper, "v[0]=Hx*Hy" or 2.0*rho*(HxdHy + >>>> HydHx)? >>>> If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more about >>>> why is this one? I only see a factor of Hx*Hy when we set up the RHS. Did I >>>> miss something? >>>> >>>> Ryan, >>> >>> You can scale the equations for Dirichlet boundary conditions anyway >>> you want; you could multiply them by 1,000,000 if you want. The answer in >>> exact precision with direct solvers will be the same. The reason we use the >>> given scaling is to make the scaling work well with multigrid. If you use a >>> different scaling the Dirichlet boundary conditions on the coarser grid >>> matrices would have a different scaling then the interior equations and this >>> would slow down MG's convergence rate. For toy problems people usually >>> eliminate the Dirichlet boundary conditions, then there is no scaling issue >>> for multigrid. >>> >>> >>> Barry >>> >>> >>>> Matt >>>> >>>> >>>> >>>> >>>> >>>> -- >>>> What most experimenters take for granted before they begin their >>>> experiments is infinitely more interesting than any results to which their >>>> experiments lead. >>>> -- Norbert Wiener >>>> >>>> >> -------------------------------------------- >> T. Amari >> Centre de Physique Theorique >> Ecole Polytechnique >> 91128 Palaiseau Cedex France >> tel : 33 1 69 33 42 52 >> fax: 33 1 69 33 49 49 >> email: >> URL : http://www.cpht.polytechnique.fr/cpht/amari >> >> >> >> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Sat Dec 12 16:35:16 2009 From: knepley at gmail.com (Matthew Knepley) Date: Sat, 12 Dec 2009 16:35:16 -0600 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: References: <119136AB-933B-4770-B67F-898EC14E6489@cpht.polytechnique.fr> <0337AE08-5BBF-4CB2-AEC4-B27ADE5F43B4@mcs.anl.gov> Message-ID: On Sat, Dec 12, 2009 at 4:34 PM, Ryan Yan wrote: > Hi Barry, > Since the ex32.c has been brought up to make comparison with ex29.c. Can I > just get a confirm that, in ex29.c, the instance with Neumann B.C.s is the > case where one has cell centered unknown for the u, with vertex centered f. > No, Neumann constraints mean that we fix the normal derivative of the potential rather than the potential itself on the boundary. Matt > Feel free to criticize this comment please, and this is where I get very > confused. > > Thanks, > > Yan > > > > On Sat, Dec 12, 2009 at 2:57 PM, Barry Smith wrote: > >> >> On Dec 12, 2009, at 12:31 PM, Tahar Amari wrote: >> >> Hello, >>> >>> SOrry. I took this very interesting discussion a bit late, but one of my >>> major problem is to understand if all this is valid for node centered >>> variables for u or cell centered. >>> Usually the best way of solving Neuwman BC for this equation is having >>> cell centered unknowns to have derivatives >>> given on the domain boundary. >>> This then have some impact on handling ghost values transfer between >>> subdomains with MPI.Is all this transparent for >>> us and PETSC handle it . I guess no, right ? >>> >> >> If you have only cell centered unknowns the ghost point updates are the >> same. See src/ksp/ksp/examples/tutorials/ex32.c Having some Neuman and some >> Dirichlet boundary conditions is then trickery with cell centered. >> >> If you have some cell-centered and some vertex centered unknowns >> (staggered grid), DA does not handle this well, you have to "cheat" to match >> up variables on the cells and vertices. >> >> >> Barry >> >> >> >>> Tahar >>> >>> >>> Le 12 d?c. 09 ? 02:28, Barry Smith a ?crit : >>> >>> >>>> On Dec 11, 2009, at 7:18 PM, Ryan Yan wrote: >>>> >>>> Hi Matt, >>>>> Thank you very much for the reply. Now, I got the Neumann part. But I >>>>> am still a bit confused about the Dirichlet part. Please see the following >>>>> quote. >>>>> >>>>> Yan >>>>> >>>>> >>>>> For the Dirichlet B.C.s, I did not understand the coefficients given >>>>> below. Isn't correct to set the v[0]=Hx*Hy here? >>>>> if (i==0 || j==0 || i==mx-1 || j==my-1) { >>>>> if (user->bcType == DIRICHLET) { >>>>> v[0] = 2.0*rho*(HxdHy + HydHx); >>>>> } >>>>> } >>>>> >>>>> This is the proper scaling. >>>>> >>>>> the Dirichlet B.C.s: >>>>> Which scaling do you think is proper, "v[0]=Hx*Hy" or 2.0*rho*(HxdHy >>>>> + HydHx)? >>>>> If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more about >>>>> why is this one? I only see a factor of Hx*Hy when we set up the RHS. Did I >>>>> miss something? >>>>> >>>>> Ryan, >>>> >>>> You can scale the equations for Dirichlet boundary conditions anyway >>>> you want; you could multiply them by 1,000,000 if you want. The answer in >>>> exact precision with direct solvers will be the same. The reason we use the >>>> given scaling is to make the scaling work well with multigrid. If you use a >>>> different scaling the Dirichlet boundary conditions on the coarser grid >>>> matrices would have a different scaling then the interior equations and this >>>> would slow down MG's convergence rate. For toy problems people usually >>>> eliminate the Dirichlet boundary conditions, then there is no scaling issue >>>> for multigrid. >>>> >>>> >>>> Barry >>>> >>>> >>>>> Matt >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> What most experimenters take for granted before they begin their >>>>> experiments is infinitely more interesting than any results to which their >>>>> experiments lead. >>>>> -- Norbert Wiener >>>>> >>>>> >>> -------------------------------------------- >>> T. Amari >>> Centre de Physique Theorique >>> Ecole Polytechnique >>> 91128 Palaiseau Cedex France >>> tel : 33 1 69 33 42 52 >>> fax: 33 1 69 33 49 49 >>> email: >>> URL : http://www.cpht.polytechnique.fr/cpht/amari >>> >>> >>> >>> >>> >>> >> > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Sat Dec 12 16:35:16 2009 From: knepley at gmail.com (Matthew Knepley) Date: Sat, 12 Dec 2009 16:35:16 -0600 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: References: <119136AB-933B-4770-B67F-898EC14E6489@cpht.polytechnique.fr> <0337AE08-5BBF-4CB2-AEC4-B27ADE5F43B4@mcs.anl.gov> Message-ID: On Sat, Dec 12, 2009 at 4:34 PM, Ryan Yan wrote: > Hi Barry, > Since the ex32.c has been brought up to make comparison with ex29.c. Can I > just get a confirm that, in ex29.c, the instance with Neumann B.C.s is the > case where one has cell centered unknown for the u, with vertex centered f. > No, Neumann constraints mean that we fix the normal derivative of the potential rather than the potential itself on the boundary. Matt > Feel free to criticize this comment please, and this is where I get very > confused. > > Thanks, > > Yan > > > > On Sat, Dec 12, 2009 at 2:57 PM, Barry Smith wrote: > >> >> On Dec 12, 2009, at 12:31 PM, Tahar Amari wrote: >> >> Hello, >>> >>> SOrry. I took this very interesting discussion a bit late, but one of my >>> major problem is to understand if all this is valid for node centered >>> variables for u or cell centered. >>> Usually the best way of solving Neuwman BC for this equation is having >>> cell centered unknowns to have derivatives >>> given on the domain boundary. >>> This then have some impact on handling ghost values transfer between >>> subdomains with MPI.Is all this transparent for >>> us and PETSC handle it . I guess no, right ? >>> >> >> If you have only cell centered unknowns the ghost point updates are the >> same. See src/ksp/ksp/examples/tutorials/ex32.c Having some Neuman and some >> Dirichlet boundary conditions is then trickery with cell centered. >> >> If you have some cell-centered and some vertex centered unknowns >> (staggered grid), DA does not handle this well, you have to "cheat" to match >> up variables on the cells and vertices. >> >> >> Barry >> >> >> >>> Tahar >>> >>> >>> Le 12 d?c. 09 ? 02:28, Barry Smith a ?crit : >>> >>> >>>> On Dec 11, 2009, at 7:18 PM, Ryan Yan wrote: >>>> >>>> Hi Matt, >>>>> Thank you very much for the reply. Now, I got the Neumann part. But I >>>>> am still a bit confused about the Dirichlet part. Please see the following >>>>> quote. >>>>> >>>>> Yan >>>>> >>>>> >>>>> For the Dirichlet B.C.s, I did not understand the coefficients given >>>>> below. Isn't correct to set the v[0]=Hx*Hy here? >>>>> if (i==0 || j==0 || i==mx-1 || j==my-1) { >>>>> if (user->bcType == DIRICHLET) { >>>>> v[0] = 2.0*rho*(HxdHy + HydHx); >>>>> } >>>>> } >>>>> >>>>> This is the proper scaling. >>>>> >>>>> the Dirichlet B.C.s: >>>>> Which scaling do you think is proper, "v[0]=Hx*Hy" or 2.0*rho*(HxdHy >>>>> + HydHx)? >>>>> If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more about >>>>> why is this one? I only see a factor of Hx*Hy when we set up the RHS. Did I >>>>> miss something? >>>>> >>>>> Ryan, >>>> >>>> You can scale the equations for Dirichlet boundary conditions anyway >>>> you want; you could multiply them by 1,000,000 if you want. The answer in >>>> exact precision with direct solvers will be the same. The reason we use the >>>> given scaling is to make the scaling work well with multigrid. If you use a >>>> different scaling the Dirichlet boundary conditions on the coarser grid >>>> matrices would have a different scaling then the interior equations and this >>>> would slow down MG's convergence rate. For toy problems people usually >>>> eliminate the Dirichlet boundary conditions, then there is no scaling issue >>>> for multigrid. >>>> >>>> >>>> Barry >>>> >>>> >>>>> Matt >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> What most experimenters take for granted before they begin their >>>>> experiments is infinitely more interesting than any results to which their >>>>> experiments lead. >>>>> -- Norbert Wiener >>>>> >>>>> >>> -------------------------------------------- >>> T. Amari >>> Centre de Physique Theorique >>> Ecole Polytechnique >>> 91128 Palaiseau Cedex France >>> tel : 33 1 69 33 42 52 >>> fax: 33 1 69 33 49 49 >>> email: >>> URL : http://www.cpht.polytechnique.fr/cpht/amari >>> >>> >>> >>> >>> >>> >> > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From vyan2000 at gmail.com Sat Dec 12 16:44:22 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Sat, 12 Dec 2009 17:44:22 -0500 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: References: <119136AB-933B-4770-B67F-898EC14E6489@cpht.polytechnique.fr> <0337AE08-5BBF-4CB2-AEC4-B27ADE5F43B4@mcs.anl.gov> Message-ID: Hi Matt, I am not fixing the potential for Newman constraints, and that's why we get only 3 or 2 fluxes in and out "the boundary cell" instead of 4 fluxes for the full cell. Maybe I should ask this question first, are we using Finite Volume discretization for ex29.c? Thanks, Yan On Sat, Dec 12, 2009 at 5:35 PM, Matthew Knepley wrote: > On Sat, Dec 12, 2009 at 4:34 PM, Ryan Yan wrote: > >> Hi Barry, >> Since the ex32.c has been brought up to make comparison with ex29.c. Can I >> just get a confirm that, in ex29.c, the instance with Neumann B.C.s is the >> case where one has cell centered unknown for the u, with vertex centered f. >> > > No, Neumann constraints mean that we fix the normal derivative of the > potential rather than the potential itself on the boundary. > > Matt > > >> Feel free to criticize this comment please, and this is where I get very >> confused. >> >> Thanks, >> >> Yan >> >> >> >> On Sat, Dec 12, 2009 at 2:57 PM, Barry Smith wrote: >> >>> >>> On Dec 12, 2009, at 12:31 PM, Tahar Amari wrote: >>> >>> Hello, >>>> >>>> SOrry. I took this very interesting discussion a bit late, but one of my >>>> major problem is to understand if all this is valid for node centered >>>> variables for u or cell centered. >>>> Usually the best way of solving Neuwman BC for this equation is having >>>> cell centered unknowns to have derivatives >>>> given on the domain boundary. >>>> This then have some impact on handling ghost values transfer between >>>> subdomains with MPI.Is all this transparent for >>>> us and PETSC handle it . I guess no, right ? >>>> >>> >>> If you have only cell centered unknowns the ghost point updates are the >>> same. See src/ksp/ksp/examples/tutorials/ex32.c Having some Neuman and some >>> Dirichlet boundary conditions is then trickery with cell centered. >>> >>> If you have some cell-centered and some vertex centered unknowns >>> (staggered grid), DA does not handle this well, you have to "cheat" to match >>> up variables on the cells and vertices. >>> >>> >>> Barry >>> >>> >>> >>>> Tahar >>>> >>>> >>>> Le 12 d?c. 09 ? 02:28, Barry Smith a ?crit : >>>> >>>> >>>>> On Dec 11, 2009, at 7:18 PM, Ryan Yan wrote: >>>>> >>>>> Hi Matt, >>>>>> Thank you very much for the reply. Now, I got the Neumann part. But I >>>>>> am still a bit confused about the Dirichlet part. Please see the following >>>>>> quote. >>>>>> >>>>>> Yan >>>>>> >>>>>> >>>>>> For the Dirichlet B.C.s, I did not understand the coefficients given >>>>>> below. Isn't correct to set the v[0]=Hx*Hy here? >>>>>> if (i==0 || j==0 || i==mx-1 || j==my-1) { >>>>>> if (user->bcType == DIRICHLET) { >>>>>> v[0] = 2.0*rho*(HxdHy + HydHx); >>>>>> } >>>>>> } >>>>>> >>>>>> This is the proper scaling. >>>>>> >>>>>> the Dirichlet B.C.s: >>>>>> Which scaling do you think is proper, "v[0]=Hx*Hy" or 2.0*rho*(HxdHy >>>>>> + HydHx)? >>>>>> If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more about >>>>>> why is this one? I only see a factor of Hx*Hy when we set up the RHS. Did I >>>>>> miss something? >>>>>> >>>>>> Ryan, >>>>> >>>>> You can scale the equations for Dirichlet boundary conditions anyway >>>>> you want; you could multiply them by 1,000,000 if you want. The answer in >>>>> exact precision with direct solvers will be the same. The reason we use the >>>>> given scaling is to make the scaling work well with multigrid. If you use a >>>>> different scaling the Dirichlet boundary conditions on the coarser grid >>>>> matrices would have a different scaling then the interior equations and this >>>>> would slow down MG's convergence rate. For toy problems people usually >>>>> eliminate the Dirichlet boundary conditions, then there is no scaling issue >>>>> for multigrid. >>>>> >>>>> >>>>> Barry >>>>> >>>>> >>>>>> Matt >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> What most experimenters take for granted before they begin their >>>>>> experiments is infinitely more interesting than any results to which their >>>>>> experiments lead. >>>>>> -- Norbert Wiener >>>>>> >>>>>> >>>> -------------------------------------------- >>>> T. Amari >>>> Centre de Physique Theorique >>>> Ecole Polytechnique >>>> 91128 Palaiseau Cedex France >>>> tel : 33 1 69 33 42 52 >>>> fax: 33 1 69 33 49 49 >>>> email: >>>> URL : http://www.cpht.polytechnique.fr/cpht/amari >>>> >>>> >>>> >>>> >>>> >>>> >>> >> > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > -- Norbert Wiener > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Sat Dec 12 16:47:28 2009 From: knepley at gmail.com (Matthew Knepley) Date: Sat, 12 Dec 2009 16:47:28 -0600 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: References: <119136AB-933B-4770-B67F-898EC14E6489@cpht.polytechnique.fr> <0337AE08-5BBF-4CB2-AEC4-B27ADE5F43B4@mcs.anl.gov> Message-ID: On Sat, Dec 12, 2009 at 4:44 PM, Ryan Yan wrote: > Hi Matt, > I am not fixing the potential for Newman constraints, and that's why we > get only 3 or 2 fluxes in and out "the boundary cell" instead of 4 fluxes > for the full cell. > > Maybe I should ask this question first, are we using Finite Volume > discretization for ex29.c? > No, its FD. Homogeneous Neumann conditions in this case mean fix nothing. Matt > Thanks, > Yan > > > > On Sat, Dec 12, 2009 at 5:35 PM, Matthew Knepley wrote: > >> On Sat, Dec 12, 2009 at 4:34 PM, Ryan Yan wrote: >> >>> Hi Barry, >>> Since the ex32.c has been brought up to make comparison with ex29.c. Can >>> I just get a confirm that, in ex29.c, the instance with Neumann B.C.s is the >>> case where one has cell centered unknown for the u, with vertex centered f. >>> >> >> No, Neumann constraints mean that we fix the normal derivative of the >> potential rather than the potential itself on the boundary. >> >> Matt >> >> >>> Feel free to criticize this comment please, and this is where I get very >>> confused. >>> >>> Thanks, >>> >>> Yan >>> >>> >>> >>> On Sat, Dec 12, 2009 at 2:57 PM, Barry Smith wrote: >>> >>>> >>>> On Dec 12, 2009, at 12:31 PM, Tahar Amari wrote: >>>> >>>> Hello, >>>>> >>>>> SOrry. I took this very interesting discussion a bit late, but one of >>>>> my major problem is to understand if all this is valid for node centered >>>>> variables for u or cell centered. >>>>> Usually the best way of solving Neuwman BC for this equation is having >>>>> cell centered unknowns to have derivatives >>>>> given on the domain boundary. >>>>> This then have some impact on handling ghost values transfer between >>>>> subdomains with MPI.Is all this transparent for >>>>> us and PETSC handle it . I guess no, right ? >>>>> >>>> >>>> If you have only cell centered unknowns the ghost point updates are the >>>> same. See src/ksp/ksp/examples/tutorials/ex32.c Having some Neuman and some >>>> Dirichlet boundary conditions is then trickery with cell centered. >>>> >>>> If you have some cell-centered and some vertex centered unknowns >>>> (staggered grid), DA does not handle this well, you have to "cheat" to match >>>> up variables on the cells and vertices. >>>> >>>> >>>> Barry >>>> >>>> >>>> >>>>> Tahar >>>>> >>>>> >>>>> Le 12 d?c. 09 ? 02:28, Barry Smith a ?crit : >>>>> >>>>> >>>>>> On Dec 11, 2009, at 7:18 PM, Ryan Yan wrote: >>>>>> >>>>>> Hi Matt, >>>>>>> Thank you very much for the reply. Now, I got the Neumann part. But >>>>>>> I am still a bit confused about the Dirichlet part. Please see the following >>>>>>> quote. >>>>>>> >>>>>>> Yan >>>>>>> >>>>>>> >>>>>>> For the Dirichlet B.C.s, I did not understand the coefficients given >>>>>>> below. Isn't correct to set the v[0]=Hx*Hy here? >>>>>>> if (i==0 || j==0 || i==mx-1 || j==my-1) { >>>>>>> if (user->bcType == DIRICHLET) { >>>>>>> v[0] = 2.0*rho*(HxdHy + HydHx); >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> This is the proper scaling. >>>>>>> >>>>>>> the Dirichlet B.C.s: >>>>>>> Which scaling do you think is proper, "v[0]=Hx*Hy" or >>>>>>> 2.0*rho*(HxdHy + HydHx)? >>>>>>> If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more about >>>>>>> why is this one? I only see a factor of Hx*Hy when we set up the RHS. Did I >>>>>>> miss something? >>>>>>> >>>>>>> Ryan, >>>>>> >>>>>> You can scale the equations for Dirichlet boundary conditions anyway >>>>>> you want; you could multiply them by 1,000,000 if you want. The answer in >>>>>> exact precision with direct solvers will be the same. The reason we use the >>>>>> given scaling is to make the scaling work well with multigrid. If you use a >>>>>> different scaling the Dirichlet boundary conditions on the coarser grid >>>>>> matrices would have a different scaling then the interior equations and this >>>>>> would slow down MG's convergence rate. For toy problems people usually >>>>>> eliminate the Dirichlet boundary conditions, then there is no scaling issue >>>>>> for multigrid. >>>>>> >>>>>> >>>>>> Barry >>>>>> >>>>>> >>>>>>> Matt >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> What most experimenters take for granted before they begin their >>>>>>> experiments is infinitely more interesting than any results to which their >>>>>>> experiments lead. >>>>>>> -- Norbert Wiener >>>>>>> >>>>>>> >>>>> -------------------------------------------- >>>>> T. Amari >>>>> Centre de Physique Theorique >>>>> Ecole Polytechnique >>>>> 91128 Palaiseau Cedex France >>>>> tel : 33 1 69 33 42 52 >>>>> fax: 33 1 69 33 49 49 >>>>> email: >>>>> URL : http://www.cpht.polytechnique.fr/cpht/amari >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>> >> >> >> -- >> What most experimenters take for granted before they begin their >> experiments is infinitely more interesting than any results to which their >> experiments lead. >> -- Norbert Wiener >> > > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From vyan2000 at gmail.com Sat Dec 12 17:31:47 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Sat, 12 Dec 2009 18:31:47 -0500 Subject: ksp ex29.c B.C.s and Forcing terms. In-Reply-To: References: <119136AB-933B-4770-B67F-898EC14E6489@cpht.polytechnique.fr> <0337AE08-5BBF-4CB2-AEC4-B27ADE5F43B4@mcs.anl.gov> Message-ID: Hi Matt, Thank you very much for the comment, agreed on 29.c. Yan On Sat, Dec 12, 2009 at 5:47 PM, Matthew Knepley wrote: > On Sat, Dec 12, 2009 at 4:44 PM, Ryan Yan wrote: > >> Hi Matt, >> I am not fixing the potential for Newman constraints, and that's why we >> get only 3 or 2 fluxes in and out "the boundary cell" instead of 4 fluxes >> for the full cell. >> >> Maybe I should ask this question first, are we using Finite Volume >> discretization for ex29.c? >> > > No, its FD. Homogeneous Neumann conditions in this case mean fix nothing. > > Matt > > >> Thanks, >> Yan >> >> >> >> On Sat, Dec 12, 2009 at 5:35 PM, Matthew Knepley wrote: >> >>> On Sat, Dec 12, 2009 at 4:34 PM, Ryan Yan wrote: >>> >>>> Hi Barry, >>>> Since the ex32.c has been brought up to make comparison with ex29.c. Can >>>> I just get a confirm that, in ex29.c, the instance with Neumann B.C.s is the >>>> case where one has cell centered unknown for the u, with vertex centered f. >>>> >>> >>> No, Neumann constraints mean that we fix the normal derivative of the >>> potential rather than the potential itself on the boundary. >>> >>> Matt >>> >>> >>>> Feel free to criticize this comment please, and this is where I get very >>>> confused. >>>> >>>> Thanks, >>>> >>>> Yan >>>> >>>> >>>> >>>> On Sat, Dec 12, 2009 at 2:57 PM, Barry Smith wrote: >>>> >>>>> >>>>> On Dec 12, 2009, at 12:31 PM, Tahar Amari wrote: >>>>> >>>>> Hello, >>>>>> >>>>>> SOrry. I took this very interesting discussion a bit late, but one of >>>>>> my major problem is to understand if all this is valid for node centered >>>>>> variables for u or cell centered. >>>>>> Usually the best way of solving Neuwman BC for this equation is having >>>>>> cell centered unknowns to have derivatives >>>>>> given on the domain boundary. >>>>>> This then have some impact on handling ghost values transfer between >>>>>> subdomains with MPI.Is all this transparent for >>>>>> us and PETSC handle it . I guess no, right ? >>>>>> >>>>> >>>>> If you have only cell centered unknowns the ghost point updates are >>>>> the same. See src/ksp/ksp/examples/tutorials/ex32.c Having some Neuman and >>>>> some Dirichlet boundary conditions is then trickery with cell centered. >>>>> >>>>> If you have some cell-centered and some vertex centered unknowns >>>>> (staggered grid), DA does not handle this well, you have to "cheat" to match >>>>> up variables on the cells and vertices. >>>>> >>>>> >>>>> Barry >>>>> >>>>> >>>>> >>>>>> Tahar >>>>>> >>>>>> >>>>>> Le 12 d?c. 09 ? 02:28, Barry Smith a ?crit : >>>>>> >>>>>> >>>>>>> On Dec 11, 2009, at 7:18 PM, Ryan Yan wrote: >>>>>>> >>>>>>> Hi Matt, >>>>>>>> Thank you very much for the reply. Now, I got the Neumann part. But >>>>>>>> I am still a bit confused about the Dirichlet part. Please see the following >>>>>>>> quote. >>>>>>>> >>>>>>>> Yan >>>>>>>> >>>>>>>> >>>>>>>> For the Dirichlet B.C.s, I did not understand the coefficients given >>>>>>>> below. Isn't correct to set the v[0]=Hx*Hy here? >>>>>>>> if (i==0 || j==0 || i==mx-1 || j==my-1) { >>>>>>>> if (user->bcType == DIRICHLET) { >>>>>>>> v[0] = 2.0*rho*(HxdHy + HydHx); >>>>>>>> } >>>>>>>> } >>>>>>>> >>>>>>>> This is the proper scaling. >>>>>>>> >>>>>>>> the Dirichlet B.C.s: >>>>>>>> Which scaling do you think is proper, "v[0]=Hx*Hy" or >>>>>>>> 2.0*rho*(HxdHy + HydHx)? >>>>>>>> If it is 2.0*rho*(HxdHy + HydHx), can you say a little bit more >>>>>>>> about why is this one? I only see a factor of Hx*Hy when we set up the RHS. >>>>>>>> Did I miss something? >>>>>>>> >>>>>>>> Ryan, >>>>>>> >>>>>>> You can scale the equations for Dirichlet boundary conditions >>>>>>> anyway you want; you could multiply them by 1,000,000 if you want. The >>>>>>> answer in exact precision with direct solvers will be the same. The reason >>>>>>> we use the given scaling is to make the scaling work well with multigrid. If >>>>>>> you use a different scaling the Dirichlet boundary conditions on the coarser >>>>>>> grid matrices would have a different scaling then the interior equations and >>>>>>> this would slow down MG's convergence rate. For toy problems people usually >>>>>>> eliminate the Dirichlet boundary conditions, then there is no scaling issue >>>>>>> for multigrid. >>>>>>> >>>>>>> >>>>>>> Barry >>>>>>> >>>>>>> >>>>>>>> Matt >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> What most experimenters take for granted before they begin their >>>>>>>> experiments is infinitely more interesting than any results to which their >>>>>>>> experiments lead. >>>>>>>> -- Norbert Wiener >>>>>>>> >>>>>>>> >>>>>> -------------------------------------------- >>>>>> T. Amari >>>>>> Centre de Physique Theorique >>>>>> Ecole Polytechnique >>>>>> 91128 Palaiseau Cedex France >>>>>> tel : 33 1 69 33 42 52 >>>>>> fax: 33 1 69 33 49 49 >>>>>> email: >>>>>> URL : http://www.cpht.polytechnique.fr/cpht/amari >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>> >>> >>> -- >>> What most experimenters take for granted before they begin their >>> experiments is infinitely more interesting than any results to which their >>> experiments lead. >>> -- Norbert Wiener >>> >> >> > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which their > experiments lead. > -- Norbert Wiener > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zonexo at gmail.com Mon Dec 14 01:00:59 2009 From: zonexo at gmail.com (Wee-Beng Tay) Date: Mon, 14 Dec 2009 15:00:59 +0800 Subject: Which way to decompose domain/grid In-Reply-To: <87aaxpojwh.fsf@59A2.org> References: <804ab5d40912100044r53bc1bd4td273ab906b1253a6@mail.gmail.com> <87fx7jw5z3.fsf@59A2.org> <804ab5d40912110224k51e701d1pd91b04c0f1910593@mail.gmail.com> <87aaxpojwh.fsf@59A2.org> Message-ID: <804ab5d40912132300k719d924bo817c9e3d362f4ff3@mail.gmail.com> Hi Jed, I've a better understanding now. I think I can use it for my poisson eqn solving which has pressure at the cell center. However, my U and V are staggered. May I right to say that I can still use DA to help the domain spilting process even for this scenario? However, can i solve my momentum eqn with DA still since there's staggering? Thanks alot! On Fri, Dec 11, 2009 at 7:00 PM, Jed Brown wrote: > On Fri, 11 Dec 2009 18:24:58 +0800, Wee-Beng Tay wrote: > > > But you mention abt latency, so shouldn't minimizing the number of > neighbor > > processes reduce latency and improve performance? > > Perhaps, depending on your network. But there are many tricks to hide > latency of ghost updates, global reductions (in dot products) are > harder especially since MPI collectives are synchronous. The higher > iteration counts are way more painful than marginally higher update > cost. > > > For both do u mean dividing 1 big grid into 4 55x35 grids? > > Yes, instead of 4 thin slices. And so on as you refine. DA does this > automatically, just don't choose a prime number of processes (because > then it would be forced into doing slices). > > > so whichever method I use (horizontal or vertical) doesn't matter? But > > splitting to 4 55x35 grids will be better? > > Trying to send directly from some contiguous array is not a worthwhile > optimization. My comment about latency was to guide against another > "optimization" of sending some components of a vector problem separately > when not all components "need" updating (it's likely faster to do one > update of 5 values per ghost node than to do two separate updates of 1 > value per node). > > Splitting into 4 subdomains isn't "better" than 2 subdomains, but when > using many subdomains, they should not be thin slices. > > DA manages all of this. If you have some compelling reason *not* to use > DA, you won't go far wrong by copying the design decisions in DA. > > > Jed > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jed at 59A2.org Mon Dec 14 08:09:57 2009 From: jed at 59A2.org (Jed Brown) Date: Mon, 14 Dec 2009 15:09:57 +0100 Subject: Which way to decompose domain/grid In-Reply-To: <804ab5d40912132300k719d924bo817c9e3d362f4ff3@mail.gmail.com> References: <804ab5d40912100044r53bc1bd4td273ab906b1253a6@mail.gmail.com> <87fx7jw5z3.fsf@59A2.org> <804ab5d40912110224k51e701d1pd91b04c0f1910593@mail.gmail.com> <87aaxpojwh.fsf@59A2.org> <804ab5d40912132300k719d924bo817c9e3d362f4ff3@mail.gmail.com> Message-ID: <878wd5ir4a.fsf@59A2.org> On Mon, 14 Dec 2009 15:00:59 +0800, Wee-Beng Tay wrote: > Hi Jed, > > I've a better understanding now. I think I can use it for my poisson eqn > solving which has pressure at the cell center. However, my U and V are > staggered. May I right to say that I can still use DA to help the domain > spilting process even for this scenario? However, can i solve my momentum > eqn with DA still since there's staggering? You can still use a DA, the details depend on how the staggering is done (i.e. B or C grid). You also have a choice between using separate DAs for momentum and pressure, or one DA (with more dofs per node/cell). In the latter case, you end up with a fringe of "unused" values (which should not cause any performance hit). Jed From jarunan at ascomp.ch Mon Dec 14 08:36:24 2009 From: jarunan at ascomp.ch (jarunan at ascomp.ch) Date: Mon, 14 Dec 2009 15:36:24 +0100 Subject: KSP Tolerances In-Reply-To: <4B229F43.1000103@itis.ethz.ch> References: <4B229F43.1000103@itis.ethz.ch> Message-ID: <20091214153624.io6ji47xk0goksc4@webmail.ascomp.ch> Dear Petsc Team, There is something not clear for me about divergence tolerance. Firstly, my computation diverges with the reason of dtol (-4), which was set by default (10000). When I increased dtol to 1.0e+8, it became converged. However, the relative residual where it was diverged is less than the default dtol. I would like to know, how it is exactly calculated. ----------I describe my problem more in detail here.------------------- As I set the tolerances for the solver as below, my problem diverges with converged reason -4 (from divergence tolerance) call KSPSetTolerances(ksp,1.0e-06,1.0e-20, PETSC_DEFAULT_DOUBLE_PRECISION,10000,ierr) I monitor the residual. it printed the information below and quit the computation.(I delete the true residual norm and Ax/Ae. Please tell me if you need them.) 0 KSP preconditioned resid norm 5.139790011051e+02 With -ksp_view, it shows that default value of dtol is 10000. I increased dtol to 1.0e+8, then the solver solved the problem. With -ksp_monitor_true_residual, the first 5 iterations read: 0 KSP preconditioned resid norm 5.139790011051e+02 1 KSP preconditioned resid norm 1.840751662590e+01 2 KSP preconditioned resid norm 3.653339750400e+00 3 KSP preconditioned resid norm 2.538794826933e+00 4 KSP preconditioned resid norm 2.299844715275e-01 Here, from iteration 0 to iteration 1,the relative residual is 0.03580, much less than 1.0e+4 the default dtol value. So, why was it diverged at the first time? ---------------------------------------------------------------------------- Regards, Jarunan -- Jarunan Panyasantisuk Development Engineer ASCOMP GmbH, Technoparkstr. 1 CH-8005 Zurich, Switzerland Phone : +41 44 445 4072 Fax : +41 44 445 4075 E-mail: jarunan at ascomp.ch www.ascomp.ch From knepley at gmail.com Mon Dec 14 08:40:49 2009 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 14 Dec 2009 08:40:49 -0600 Subject: KSP Tolerances In-Reply-To: <20091214153624.io6ji47xk0goksc4@webmail.ascomp.ch> References: <4B229F43.1000103@itis.ethz.ch> <20091214153624.io6ji47xk0goksc4@webmail.ascomp.ch> Message-ID: Run with -ksp_view -ksp_monitor -info and send us all the output. Matt On Mon, Dec 14, 2009 at 8:36 AM, wrote: > > Dear Petsc Team, > > There is something not clear for me about divergence tolerance. Firstly, my > computation diverges with the reason of dtol (-4), which was set by default > (10000). When I increased dtol to 1.0e+8, it became converged. However, the > relative residual where it was diverged is less than the default dtol. I > would like to know, how it is exactly calculated. > > ----------I describe my problem more in detail here.------------------- > As I set the tolerances for the solver as below, my problem diverges with > converged reason -4 (from divergence tolerance) > > call KSPSetTolerances(ksp,1.0e-06,1.0e-20, > PETSC_DEFAULT_DOUBLE_PRECISION,10000,ierr) > > I monitor the residual. it printed the information below and quit the > computation.(I delete the true residual norm and Ax/Ae. Please tell me if > you need them.) > > 0 KSP preconditioned resid norm 5.139790011051e+02 > > With -ksp_view, it shows that default value of dtol is 10000. I increased > dtol to 1.0e+8, then the solver solved the problem. With > -ksp_monitor_true_residual, the first 5 iterations read: > > 0 KSP preconditioned resid norm 5.139790011051e+02 > 1 KSP preconditioned resid norm 1.840751662590e+01 > 2 KSP preconditioned resid norm 3.653339750400e+00 > 3 KSP preconditioned resid norm 2.538794826933e+00 > 4 KSP preconditioned resid norm 2.299844715275e-01 > > Here, from iteration 0 to iteration 1,the relative residual is 0.03580, > much less than 1.0e+4 the default dtol value. So, why was it diverged at the > first time? > > ---------------------------------------------------------------------------- > > Regards, > Jarunan > > > > > -- > Jarunan Panyasantisuk > Development Engineer > ASCOMP GmbH, Technoparkstr. 1 > CH-8005 Zurich, Switzerland > Phone : +41 44 445 4072 > Fax : +41 44 445 4075 > E-mail: jarunan at ascomp.ch > www.ascomp.ch > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From jarunan at ascomp.ch Mon Dec 14 09:07:16 2009 From: jarunan at ascomp.ch (jarunan at ascomp.ch) Date: Mon, 14 Dec 2009 16:07:16 +0100 Subject: KSP Tolerances In-Reply-To: References: <4B229F43.1000103@itis.ethz.ch> <20091214153624.io6ji47xk0goksc4@webmail.ascomp.ch> Message-ID: <20091214160716.2rhzz2dz8k8k80o8@webmail.ascomp.ch> Hi, Thank you for your advice. With this mail I attach the output file run.log. My grid is 2-level grid. The coarse grid is computed first then the fine grid. The problem occur in the fine grid. You can see at lines 3098, 4552 and 6127 where it is diverged. Regards, Jarunan Quoting Matthew Knepley : > Run with -ksp_view -ksp_monitor -info and send us all the output. > > Matt > > On Mon, Dec 14, 2009 at 8:36 AM, wrote: > >> >> Dear Petsc Team, >> >> There is something not clear for me about divergence tolerance. Firstly, my >> computation diverges with the reason of dtol (-4), which was set by default >> (10000). When I increased dtol to 1.0e+8, it became converged. However, the >> relative residual where it was diverged is less than the default dtol. I >> would like to know, how it is exactly calculated. >> >> ----------I describe my problem more in detail here.------------------- >> As I set the tolerances for the solver as below, my problem diverges with >> converged reason -4 (from divergence tolerance) >> >> call KSPSetTolerances(ksp,1.0e-06,1.0e-20, >> PETSC_DEFAULT_DOUBLE_PRECISION,10000,ierr) >> >> I monitor the residual. it printed the information below and quit the >> computation.(I delete the true residual norm and Ax/Ae. Please tell me if >> you need them.) >> >> 0 KSP preconditioned resid norm 5.139790011051e+02 >> >> With -ksp_view, it shows that default value of dtol is 10000. I increased >> dtol to 1.0e+8, then the solver solved the problem. With >> -ksp_monitor_true_residual, the first 5 iterations read: >> >> 0 KSP preconditioned resid norm 5.139790011051e+02 >> 1 KSP preconditioned resid norm 1.840751662590e+01 >> 2 KSP preconditioned resid norm 3.653339750400e+00 >> 3 KSP preconditioned resid norm 2.538794826933e+00 >> 4 KSP preconditioned resid norm 2.299844715275e-01 >> >> Here, from iteration 0 to iteration 1,the relative residual is 0.03580, >> much less than 1.0e+4 the default dtol value. So, why was it diverged at the >> first time? >> >> ---------------------------------------------------------------------------- >> >> Regards, >> Jarunan >> >> >> >> >> -- >> Jarunan Panyasantisuk >> Development Engineer >> ASCOMP GmbH, Technoparkstr. 1 >> CH-8005 Zurich, Switzerland >> Phone : +41 44 445 4072 >> Fax : +41 44 445 4075 >> E-mail: jarunan at ascomp.ch >> www.ascomp.ch >> > > > > -- > What most experimenters take for granted before they begin their experiments > is infinitely more interesting than any results to which their experiments > lead. > -- Norbert Wiener > -- Jarunan Panyasantisuk Development Engineer ASCOMP GmbH, Technoparkstr. 1 CH-8005 Zurich, Switzerland Phone : +41 44 445 4072 Fax : +41 44 445 4075 E-mail: jarunan at ascomp.ch www.ascomp.ch -------------- next part -------------- A non-text attachment was scrubbed... Name: run.log Type: text/x-log Size: 407259 bytes Desc: not available URL: From knepley at gmail.com Mon Dec 14 09:18:43 2009 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 14 Dec 2009 09:18:43 -0600 Subject: KSP Tolerances In-Reply-To: <20091214160716.2rhzz2dz8k8k80o8@webmail.ascomp.ch> References: <4B229F43.1000103@itis.ethz.ch> <20091214153624.io6ji47xk0goksc4@webmail.ascomp.ch> <20091214160716.2rhzz2dz8k8k80o8@webmail.ascomp.ch> Message-ID: You can see in the info output what is happening. The test is rnorm >= ksp->divtol*ksp->rnorm0 Here ||r_0|| = ||b|| = 0.00331536 and ||r|| = 513.979, and thus it results in divergence. It appears that ILU(0) is very bad for this problem. Matt On Mon, Dec 14, 2009 at 9:07 AM, wrote: > Hi, > > Thank you for your advice. With this mail I attach the output file run.log. > My grid is 2-level grid. The coarse grid is computed first then the fine > grid. The problem occur in the fine grid. You can see at lines 3098, 4552 > and 6127 where it is diverged. > > Regards, > Jarunan > > > > > > Quoting Matthew Knepley : > > Run with -ksp_view -ksp_monitor -info and send us all the output. >> >> Matt >> >> On Mon, Dec 14, 2009 at 8:36 AM, wrote: >> >> >>> Dear Petsc Team, >>> >>> There is something not clear for me about divergence tolerance. Firstly, >>> my >>> computation diverges with the reason of dtol (-4), which was set by >>> default >>> (10000). When I increased dtol to 1.0e+8, it became converged. However, >>> the >>> relative residual where it was diverged is less than the default dtol. I >>> would like to know, how it is exactly calculated. >>> >>> ----------I describe my problem more in detail here.------------------- >>> As I set the tolerances for the solver as below, my problem diverges with >>> converged reason -4 (from divergence tolerance) >>> >>> call KSPSetTolerances(ksp,1.0e-06,1.0e-20, >>> PETSC_DEFAULT_DOUBLE_PRECISION,10000,ierr) >>> >>> I monitor the residual. it printed the information below and quit the >>> computation.(I delete the true residual norm and Ax/Ae. Please tell me if >>> you need them.) >>> >>> 0 KSP preconditioned resid norm 5.139790011051e+02 >>> >>> With -ksp_view, it shows that default value of dtol is 10000. I increased >>> dtol to 1.0e+8, then the solver solved the problem. With >>> -ksp_monitor_true_residual, the first 5 iterations read: >>> >>> 0 KSP preconditioned resid norm 5.139790011051e+02 >>> 1 KSP preconditioned resid norm 1.840751662590e+01 >>> 2 KSP preconditioned resid norm 3.653339750400e+00 >>> 3 KSP preconditioned resid norm 2.538794826933e+00 >>> 4 KSP preconditioned resid norm 2.299844715275e-01 >>> >>> Here, from iteration 0 to iteration 1,the relative residual is 0.03580, >>> much less than 1.0e+4 the default dtol value. So, why was it diverged at >>> the >>> first time? >>> >>> >>> ---------------------------------------------------------------------------- >>> >>> Regards, >>> Jarunan >>> >>> >>> >>> >>> -- >>> Jarunan Panyasantisuk >>> Development Engineer >>> ASCOMP GmbH, Technoparkstr. 1 >>> CH-8005 Zurich, Switzerland >>> Phone : +41 44 445 4072 >>> Fax : +41 44 445 4075 >>> E-mail: jarunan at ascomp.ch >>> www.ascomp.ch >>> >>> >> >> >> -- >> What most experimenters take for granted before they begin their >> experiments >> is infinitely more interesting than any results to which their experiments >> lead. >> -- Norbert Wiener >> >> > > > -- > Jarunan Panyasantisuk > Development Engineer > ASCOMP GmbH, Technoparkstr. 1 > CH-8005 Zurich, Switzerland > Phone : +41 44 445 4072 > Fax : +41 44 445 4075 > E-mail: jarunan at ascomp.ch > www.ascomp.ch > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From jarunan at ascomp.ch Mon Dec 14 09:40:06 2009 From: jarunan at ascomp.ch (Jarunan Panyasantisuk) Date: Mon, 14 Dec 2009 16:40:06 +0100 Subject: KSP Tolerances In-Reply-To: References: <4B229F43.1000103@itis.ethz.ch> <20091214153624.io6ji47xk0goksc4@webmail.ascomp.ch> <20091214160716.2rhzz2dz8k8k80o8@webmail.ascomp.ch> Message-ID: <4B265C56.4020804@ascomp.ch> Thank you. I see it. I also see in the output file that sometimes the initial residual ||r_0|| = ||b|| is simply rnorm ||r|| at iteration 0. Does it change the reference during the computation? Jarunan Matthew Knepley wrote: > You can see in the info output what is happening. The test is > > rnorm >= ksp->divtol*ksp->rnorm0 > > Here ||r_0|| = ||b|| = 0.00331536 and ||r|| = 513.979, and thus it results > in divergence. It appears that ILU(0) is very bad for this problem. > > Matt > > On Mon, Dec 14, 2009 at 9:07 AM, > wrote: > > Hi, > > Thank you for your advice. With this mail I attach the output file > run.log. > My grid is 2-level grid. The coarse grid is computed first then > the fine grid. The problem occur in the fine grid. You can see at > lines 3098, 4552 and 6127 where it is diverged. > > Regards, > Jarunan > > > > Quoting Matthew Knepley >: > > Run with -ksp_view -ksp_monitor -info and send us all the output. > > Matt > > On Mon, Dec 14, 2009 at 8:36 AM, > wrote: > > > Dear Petsc Team, > > There is something not clear for me about divergence > tolerance. Firstly, my > computation diverges with the reason of dtol (-4), which > was set by default > (10000). When I increased dtol to 1.0e+8, it became > converged. However, the > relative residual where it was diverged is less than the > default dtol. I > would like to know, how it is exactly calculated. > > ----------I describe my problem more in detail > here.------------------- > As I set the tolerances for the solver as below, my > problem diverges with > converged reason -4 (from divergence tolerance) > > call KSPSetTolerances(ksp,1.0e-06,1.0e-20, > PETSC_DEFAULT_DOUBLE_PRECISION,10000,ierr) > > I monitor the residual. it printed the information below > and quit the > computation.(I delete the true residual norm and Ax/Ae. > Please tell me if > you need them.) > > 0 KSP preconditioned resid norm 5.139790011051e+02 > > With -ksp_view, it shows that default value of dtol is > 10000. I increased > dtol to 1.0e+8, then the solver solved the problem. With > -ksp_monitor_true_residual, the first 5 iterations read: > > 0 KSP preconditioned resid norm 5.139790011051e+02 > 1 KSP preconditioned resid norm 1.840751662590e+01 > 2 KSP preconditioned resid norm 3.653339750400e+00 > 3 KSP preconditioned resid norm 2.538794826933e+00 > 4 KSP preconditioned resid norm 2.299844715275e-01 > > Here, from iteration 0 to iteration 1,the relative > residual is 0.03580, > much less than 1.0e+4 the default dtol value. So, why was > it diverged at the > first time? > > ---------------------------------------------------------------------------- > > Regards, > Jarunan > > > > > -- > Jarunan Panyasantisuk > Development Engineer > ASCOMP GmbH, Technoparkstr. 1 > CH-8005 Zurich, Switzerland > Phone : +41 44 445 4072 > Fax : +41 44 445 4075 > E-mail: jarunan at ascomp.ch > www.ascomp.ch > > > > > -- > What most experimenters take for granted before they begin > their experiments > is infinitely more interesting than any results to which their > experiments > lead. > -- Norbert Wiener > > > > > -- > Jarunan Panyasantisuk > Development Engineer > ASCOMP GmbH, Technoparkstr. 1 > CH-8005 Zurich, Switzerland > Phone : +41 44 445 4072 > Fax : +41 44 445 4075 > E-mail: jarunan at ascomp.ch > www.ascomp.ch > > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which > their experiments lead. > -- Norbert Wiener -- Jarunan Panyasantisuk Development Engineer ASCOMP GmbH, Technoparkstr. 1 CH-8005 Zurich, Switzerland Phone : +41 44 445 4072 Fax : +41 44 445 4075 E-mail: jarunan at ascomp.ch www.ascomp.ch From knepley at gmail.com Mon Dec 14 09:47:00 2009 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 14 Dec 2009 09:47:00 -0600 Subject: KSP Tolerances In-Reply-To: <4B265C56.4020804@ascomp.ch> References: <4B229F43.1000103@itis.ethz.ch> <20091214153624.io6ji47xk0goksc4@webmail.ascomp.ch> <20091214160716.2rhzz2dz8k8k80o8@webmail.ascomp.ch> <4B265C56.4020804@ascomp.ch> Message-ID: No. On Mon, Dec 14, 2009 at 9:40 AM, Jarunan Panyasantisuk wrote: > Thank you. I see it. > I also see in the output file that sometimes the initial residual > ||r_0|| = ||b|| is simply rnorm ||r|| at iteration 0. Does it change > the reference during the computation? > > Jarunan > > > Matthew Knepley wrote: > > You can see in the info output what is happening. The test is > > > > rnorm >= ksp->divtol*ksp->rnorm0 > > > > Here ||r_0|| = ||b|| = 0.00331536 and ||r|| = 513.979, and thus it > results > > in divergence. It appears that ILU(0) is very bad for this problem. > > > > Matt > > > > On Mon, Dec 14, 2009 at 9:07 AM, > > wrote: > > > > Hi, > > > > Thank you for your advice. With this mail I attach the output file > > run.log. > > My grid is 2-level grid. The coarse grid is computed first then > > the fine grid. The problem occur in the fine grid. You can see at > > lines 3098, 4552 and 6127 where it is diverged. > > > > Regards, > > Jarunan > > > > > > > > Quoting Matthew Knepley > >: > > > > Run with -ksp_view -ksp_monitor -info and send us all the output. > > > > Matt > > > > On Mon, Dec 14, 2009 at 8:36 AM, > > wrote: > > > > > > Dear Petsc Team, > > > > There is something not clear for me about divergence > > tolerance. Firstly, my > > computation diverges with the reason of dtol (-4), which > > was set by default > > (10000). When I increased dtol to 1.0e+8, it became > > converged. However, the > > relative residual where it was diverged is less than the > > default dtol. I > > would like to know, how it is exactly calculated. > > > > ----------I describe my problem more in detail > > here.------------------- > > As I set the tolerances for the solver as below, my > > problem diverges with > > converged reason -4 (from divergence tolerance) > > > > call KSPSetTolerances(ksp,1.0e-06,1.0e-20, > > PETSC_DEFAULT_DOUBLE_PRECISION,10000,ierr) > > > > I monitor the residual. it printed the information below > > and quit the > > computation.(I delete the true residual norm and Ax/Ae. > > Please tell me if > > you need them.) > > > > 0 KSP preconditioned resid norm 5.139790011051e+02 > > > > With -ksp_view, it shows that default value of dtol is > > 10000. I increased > > dtol to 1.0e+8, then the solver solved the problem. With > > -ksp_monitor_true_residual, the first 5 iterations read: > > > > 0 KSP preconditioned resid norm 5.139790011051e+02 > > 1 KSP preconditioned resid norm 1.840751662590e+01 > > 2 KSP preconditioned resid norm 3.653339750400e+00 > > 3 KSP preconditioned resid norm 2.538794826933e+00 > > 4 KSP preconditioned resid norm 2.299844715275e-01 > > > > Here, from iteration 0 to iteration 1,the relative > > residual is 0.03580, > > much less than 1.0e+4 the default dtol value. So, why was > > it diverged at the > > first time? > > > > > ---------------------------------------------------------------------------- > > > > Regards, > > Jarunan > > > > > > > > > > -- > > Jarunan Panyasantisuk > > Development Engineer > > ASCOMP GmbH, Technoparkstr. 1 > > CH-8005 Zurich, Switzerland > > Phone : +41 44 445 4072 > > Fax : +41 44 445 4075 > > E-mail: jarunan at ascomp.ch > > www.ascomp.ch > > > > > > > > > > -- > > What most experimenters take for granted before they begin > > their experiments > > is infinitely more interesting than any results to which their > > experiments > > lead. > > -- Norbert Wiener > > > > > > > > > > -- > > Jarunan Panyasantisuk > > Development Engineer > > ASCOMP GmbH, Technoparkstr. 1 > > CH-8005 Zurich, Switzerland > > Phone : +41 44 445 4072 > > Fax : +41 44 445 4075 > > E-mail: jarunan at ascomp.ch > > www.ascomp.ch > > > > > > > > > > -- > > What most experimenters take for granted before they begin their > > experiments is infinitely more interesting than any results to which > > their experiments lead. > > -- Norbert Wiener > > > -- > Jarunan Panyasantisuk > Development Engineer > ASCOMP GmbH, Technoparkstr. 1 > CH-8005 Zurich, Switzerland > Phone : +41 44 445 4072 > Fax : +41 44 445 4075 > E-mail: jarunan at ascomp.ch > www.ascomp.ch > > > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From vyan2000 at gmail.com Mon Dec 14 17:06:24 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Mon, 14 Dec 2009 18:06:24 -0500 Subject: SetSNESLocali Message-ID: Hi All, I was looking at the snes ex19, and wondering whether there is a maual page for the following two functions. DMMGSetSNESLocali, DMMGSetSNESLocalib, Thanks, Yan -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Mon Dec 14 18:22:29 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 14 Dec 2009 18:22:29 -0600 Subject: SetSNESLocali In-Reply-To: References: Message-ID: <0E6EEBFD-3066-442F-9CBF-44AD696FE591@mcs.anl.gov> These are not documented because they are experimental code and not intended to be used. Barry On Dec 14, 2009, at 5:06 PM, Ryan Yan wrote: > Hi All, > I was looking at the snes ex19, and wondering whether there is a > maual page for the following two functions. > > DMMGSetSNESLocali, > DMMGSetSNESLocalib, > > Thanks, > > Yan From vyan2000 at gmail.com Mon Dec 14 19:34:24 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Mon, 14 Dec 2009 20:34:24 -0500 Subject: SetSNESLocali In-Reply-To: <0E6EEBFD-3066-442F-9CBF-44AD696FE591@mcs.anl.gov> References: <0E6EEBFD-3066-442F-9CBF-44AD696FE591@mcs.anl.gov> Message-ID: Hi Barry, Thanks for letting me know. Yan On Mon, Dec 14, 2009 at 7:22 PM, Barry Smith wrote: > > These are not documented because they are experimental code and not > intended to be used. > > Barry > > > On Dec 14, 2009, at 5:06 PM, Ryan Yan wrote: > > Hi All, >> I was looking at the snes ex19, and wondering whether there is a maual >> page for the following two functions. >> >> DMMGSetSNESLocali, >> DMMGSetSNESLocalib, >> >> Thanks, >> >> Yan >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vyan2000 at gmail.com Mon Dec 14 22:09:44 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Mon, 14 Dec 2009 23:09:44 -0500 Subject: KSPPREONLY Message-ID: Hi All, I have the following output from -snes_view with the default snes setting., but I don't know what the KSPPREONLY does on the coarse grid. Can anyone provide some hints on this? Assuming: A_{coarse} * e_{coarse} =r _{coarse} Thanks a lot, Yan ------------------------------------------------------------------------------ SNES Object: type: ls line search variant: SNESLineSearchCubic alpha=0.0001, maxstep=1e+08 maximum iterations=50, maximum function evaluations=10000 tolerances: relative=1e-08, absolute=1e-50, solution=1e-08 total number of linear solver iterations=32 total number of function evaluations=5 KSP Object: type: fgmres GMRES: restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement GMRES: happy breakdown tolerance 1e-30 maximum iterations=10000, initial guess is zero tolerances: relative=1e-05, absolute=1e-50, divergence=10000 right preconditioning PC Object: type: mg MG: type is FULL, levels=2 cycles=v Coarse gride solver -- level 0 presmooths=1 postsmooths=1 ----- KSP Object:(mg_coarse_) type: preonly maximum iterations=1, initial guess is zero tolerances: relative=1e-05, absolute=1e-50, divergence=10000 left preconditioning PC Object:(mg_coarse_) type: lu LU: out-of-place factorization matrix ordering: nd LU: tolerance for zero pivot 1e-12 LU: factor fill ratio needed 5.02244 Factored matrix follows Matrix Object: type=seqaij, rows=4096, cols=4096 package used to perform factorization: petsc total: nonzeros=401152, allocated nonzeros=401152 using I-node routines: found 1024 nodes, limit used is 5 linear system matrix = precond matrix: Matrix Object: type=seqaij, rows=4096, cols=4096 total: nonzeros=79872, allocated nonzeros=79872 using I-node routines: found 1024 nodes, limit used is 5 Down solver (pre-smoother) ...... -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Mon Dec 14 22:16:02 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 14 Dec 2009 22:16:02 -0600 Subject: KSPPREONLY In-Reply-To: References: Message-ID: <01CF526B-ABC5-4CD3-B425-CF52F8E055BF@mcs.anl.gov> preonly means apply the preconditioner to the right hand side only, don't do any iterations. Since LU is the preconditioner in this case preonly means it is using LU as a direct solver. On Dec 14, 2009, at 10:09 PM, Ryan Yan wrote: > Hi All, > I have the following output from -snes_view with the default snes > setting., but I don't know what the KSPPREONLY does on the coarse > grid. Can anyone provide some hints on this? > > Assuming: > A_{coarse} * e_{coarse} =r _{coarse} > > > Thanks a lot, > > Yan > > > ------------------------------------------------------------------------------ > SNES Object: > type: ls > line search variant: SNESLineSearchCubic > alpha=0.0001, maxstep=1e+08 > maximum iterations=50, maximum function evaluations=10000 > tolerances: relative=1e-08, absolute=1e-50, solution=1e-08 > total number of linear solver iterations=32 > total number of function evaluations=5 > KSP Object: > type: fgmres > GMRES: restart=30, using Classical (unmodified) Gram-Schmidt > Orthogonalization with no iterative refinement > GMRES: happy breakdown tolerance 1e-30 > maximum iterations=10000, initial guess is zero > tolerances: relative=1e-05, absolute=1e-50, divergence=10000 > right preconditioning > PC Object: > type: mg > MG: type is FULL, levels=2 cycles=v > Coarse gride solver -- level 0 presmooths=1 postsmooths=1 ----- > KSP Object:(mg_coarse_) > type: preonly > maximum iterations=1, initial guess is zero > tolerances: relative=1e-05, absolute=1e-50, divergence=10000 > left preconditioning > PC Object:(mg_coarse_) > type: lu > LU: out-of-place factorization > matrix ordering: nd > LU: tolerance for zero pivot 1e-12 > LU: factor fill ratio needed 5.02244 > Factored matrix follows > Matrix Object: > type=seqaij, rows=4096, cols=4096 > package used to perform factorization: petsc > total: nonzeros=401152, allocated nonzeros=401152 > using I-node routines: found 1024 nodes, limit > used is 5 > linear system matrix = precond matrix: > Matrix Object: > type=seqaij, rows=4096, cols=4096 > total: nonzeros=79872, allocated nonzeros=79872 > using I-node routines: found 1024 nodes, limit used is 5 > Down solver (pre-smoother) ...... > From vyan2000 at gmail.com Mon Dec 14 22:19:01 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Mon, 14 Dec 2009 23:19:01 -0500 Subject: KSPPREONLY In-Reply-To: <01CF526B-ABC5-4CD3-B425-CF52F8E055BF@mcs.anl.gov> References: <01CF526B-ABC5-4CD3-B425-CF52F8E055BF@mcs.anl.gov> Message-ID: Hi, Barry, Thanks a lot. So this is equivalent to using ksp richardson +pclu with 1 iteration on the coarse grid, right? Yan On Mon, Dec 14, 2009 at 11:16 PM, Barry Smith wrote: > > preonly means apply the preconditioner to the right hand side only, don't > do any iterations. Since LU is the preconditioner in this case preonly means > it is using LU as a direct solver. > > > > On Dec 14, 2009, at 10:09 PM, Ryan Yan wrote: > > Hi All, >> I have the following output from -snes_view with the default snes >> setting., but I don't know what the KSPPREONLY does on the coarse grid. Can >> anyone provide some hints on this? >> >> Assuming: >> A_{coarse} * e_{coarse} =r _{coarse} >> >> >> Thanks a lot, >> >> Yan >> >> >> >> ------------------------------------------------------------------------------ >> SNES Object: >> type: ls >> line search variant: SNESLineSearchCubic >> alpha=0.0001, maxstep=1e+08 >> maximum iterations=50, maximum function evaluations=10000 >> tolerances: relative=1e-08, absolute=1e-50, solution=1e-08 >> total number of linear solver iterations=32 >> total number of function evaluations=5 >> KSP Object: >> type: fgmres >> GMRES: restart=30, using Classical (unmodified) Gram-Schmidt >> Orthogonalization with no iterative refinement >> GMRES: happy breakdown tolerance 1e-30 >> maximum iterations=10000, initial guess is zero >> tolerances: relative=1e-05, absolute=1e-50, divergence=10000 >> right preconditioning >> PC Object: >> type: mg >> MG: type is FULL, levels=2 cycles=v >> Coarse gride solver -- level 0 presmooths=1 postsmooths=1 ----- >> KSP Object:(mg_coarse_) >> type: preonly >> maximum iterations=1, initial guess is zero >> tolerances: relative=1e-05, absolute=1e-50, divergence=10000 >> left preconditioning >> PC Object:(mg_coarse_) >> type: lu >> LU: out-of-place factorization >> matrix ordering: nd >> LU: tolerance for zero pivot 1e-12 >> LU: factor fill ratio needed 5.02244 >> Factored matrix follows >> Matrix Object: >> type=seqaij, rows=4096, cols=4096 >> package used to perform factorization: petsc >> total: nonzeros=401152, allocated nonzeros=401152 >> using I-node routines: found 1024 nodes, limit used is 5 >> linear system matrix = precond matrix: >> Matrix Object: >> type=seqaij, rows=4096, cols=4096 >> total: nonzeros=79872, allocated nonzeros=79872 >> using I-node routines: found 1024 nodes, limit used is 5 >> Down solver (pre-smoother) ...... >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Mon Dec 14 22:23:34 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 14 Dec 2009 22:23:34 -0600 Subject: KSPPREONLY In-Reply-To: References: <01CF526B-ABC5-4CD3-B425-CF52F8E055BF@mcs.anl.gov> Message-ID: <897C4F88-880A-408C-B1C8-35DA7ECCEBD6@mcs.anl.gov> Yes On Dec 14, 2009, at 10:19 PM, Ryan Yan wrote: > Hi, Barry, > Thanks a lot. > So this is equivalent to using ksp richardson +pclu with 1 iteration > on the coarse grid, right? > > Yan > > On Mon, Dec 14, 2009 at 11:16 PM, Barry Smith > wrote: > > preonly means apply the preconditioner to the right hand side only, > don't do any iterations. Since LU is the preconditioner in this case > preonly means it is using LU as a direct solver. > > > > On Dec 14, 2009, at 10:09 PM, Ryan Yan wrote: > > Hi All, > I have the following output from -snes_view with the default snes > setting., but I don't know what the KSPPREONLY does on the coarse > grid. Can anyone provide some hints on this? > > Assuming: > A_{coarse} * e_{coarse} =r _{coarse} > > > Thanks a lot, > > Yan > > > ------------------------------------------------------------------------------ > SNES Object: > type: ls > line search variant: SNESLineSearchCubic > alpha=0.0001, maxstep=1e+08 > maximum iterations=50, maximum function evaluations=10000 > tolerances: relative=1e-08, absolute=1e-50, solution=1e-08 > total number of linear solver iterations=32 > total number of function evaluations=5 > KSP Object: > type: fgmres > GMRES: restart=30, using Classical (unmodified) Gram-Schmidt > Orthogonalization with no iterative refinement > GMRES: happy breakdown tolerance 1e-30 > maximum iterations=10000, initial guess is zero > tolerances: relative=1e-05, absolute=1e-50, divergence=10000 > right preconditioning > PC Object: > type: mg > MG: type is FULL, levels=2 cycles=v > Coarse gride solver -- level 0 presmooths=1 postsmooths=1 ----- > KSP Object:(mg_coarse_) > type: preonly > maximum iterations=1, initial guess is zero > tolerances: relative=1e-05, absolute=1e-50, divergence=10000 > left preconditioning > PC Object:(mg_coarse_) > type: lu > LU: out-of-place factorization > matrix ordering: nd > LU: tolerance for zero pivot 1e-12 > LU: factor fill ratio needed 5.02244 > Factored matrix follows > Matrix Object: > type=seqaij, rows=4096, cols=4096 > package used to perform factorization: petsc > total: nonzeros=401152, allocated nonzeros=401152 > using I-node routines: found 1024 nodes, limit used > is 5 > linear system matrix = precond matrix: > Matrix Object: > type=seqaij, rows=4096, cols=4096 > total: nonzeros=79872, allocated nonzeros=79872 > using I-node routines: found 1024 nodes, limit used is 5 > Down solver (pre-smoother) ...... > > > From vyan2000 at gmail.com Mon Dec 14 22:24:31 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Mon, 14 Dec 2009 23:24:31 -0500 Subject: KSPPREONLY In-Reply-To: <897C4F88-880A-408C-B1C8-35DA7ECCEBD6@mcs.anl.gov> References: <01CF526B-ABC5-4CD3-B425-CF52F8E055BF@mcs.anl.gov> <897C4F88-880A-408C-B1C8-35DA7ECCEBD6@mcs.anl.gov> Message-ID: Thanks a lot, Yan On Mon, Dec 14, 2009 at 11:23 PM, Barry Smith wrote: > > Yes > > > On Dec 14, 2009, at 10:19 PM, Ryan Yan wrote: > > Hi, Barry, >> Thanks a lot. >> So this is equivalent to using ksp richardson +pclu with 1 iteration on >> the coarse grid, right? >> >> Yan >> >> On Mon, Dec 14, 2009 at 11:16 PM, Barry Smith wrote: >> >> preonly means apply the preconditioner to the right hand side only, don't >> do any iterations. Since LU is the preconditioner in this case preonly means >> it is using LU as a direct solver. >> >> >> >> On Dec 14, 2009, at 10:09 PM, Ryan Yan wrote: >> >> Hi All, >> I have the following output from -snes_view with the default snes >> setting., but I don't know what the KSPPREONLY does on the coarse grid. Can >> anyone provide some hints on this? >> >> Assuming: >> A_{coarse} * e_{coarse} =r _{coarse} >> >> >> Thanks a lot, >> >> Yan >> >> >> >> ------------------------------------------------------------------------------ >> SNES Object: >> type: ls >> line search variant: SNESLineSearchCubic >> alpha=0.0001, maxstep=1e+08 >> maximum iterations=50, maximum function evaluations=10000 >> tolerances: relative=1e-08, absolute=1e-50, solution=1e-08 >> total number of linear solver iterations=32 >> total number of function evaluations=5 >> KSP Object: >> type: fgmres >> GMRES: restart=30, using Classical (unmodified) Gram-Schmidt >> Orthogonalization with no iterative refinement >> GMRES: happy breakdown tolerance 1e-30 >> maximum iterations=10000, initial guess is zero >> tolerances: relative=1e-05, absolute=1e-50, divergence=10000 >> right preconditioning >> PC Object: >> type: mg >> MG: type is FULL, levels=2 cycles=v >> Coarse gride solver -- level 0 presmooths=1 postsmooths=1 ----- >> KSP Object:(mg_coarse_) >> type: preonly >> maximum iterations=1, initial guess is zero >> tolerances: relative=1e-05, absolute=1e-50, divergence=10000 >> left preconditioning >> PC Object:(mg_coarse_) >> type: lu >> LU: out-of-place factorization >> matrix ordering: nd >> LU: tolerance for zero pivot 1e-12 >> LU: factor fill ratio needed 5.02244 >> Factored matrix follows >> Matrix Object: >> type=seqaij, rows=4096, cols=4096 >> package used to perform factorization: petsc >> total: nonzeros=401152, allocated nonzeros=401152 >> using I-node routines: found 1024 nodes, limit used is 5 >> linear system matrix = precond matrix: >> Matrix Object: >> type=seqaij, rows=4096, cols=4096 >> total: nonzeros=79872, allocated nonzeros=79872 >> using I-node routines: found 1024 nodes, limit used is 5 >> Down solver (pre-smoother) ...... >> >> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hxie at umn.edu Tue Dec 15 10:51:22 2009 From: hxie at umn.edu (hxie at umn.edu) Date: 15 Dec 2009 10:51:22 -0600 Subject: How to visualize a matrix object from a remote machine? In-Reply-To: References: Message-ID: Hi, I use X11 to connect the server and I want to draw the nonzero structure of matrix. The option '-mat_view_draw' gives some error messages. How to fix it? Thanks. Bests, Hui From balay at mcs.anl.gov Tue Dec 15 10:57:53 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Tue, 15 Dec 2009 10:57:53 -0600 (CST) Subject: How to visualize a matrix object from a remote machine? In-Reply-To: References: Message-ID: On Tue, 15 Dec 2009, hxie at umn.edu wrote: > Hi, > > I use X11 to connect the server and I want to draw the nonzero structure of > matrix. The option '-mat_view_draw' gives some error messages. How to fix it? > Thanks. What error message? Normally you can do the following: ssh -Y remotemachine ./petscbinary -mat_view_draw -draw_pause -1 or ./petscbinary -mat_view_draw -draw_pause -1 -display $DISPLAY Satish From hxie at umn.edu Tue Dec 15 12:24:09 2009 From: hxie at umn.edu (hxie at umn.edu) Date: 15 Dec 2009 12:24:09 -0600 Subject: How to visualize a matrix object from a remote machine? In-Reply-To: References: Message-ID: Following your instruction, I got the error message: X connection to localhost:15.0 broken (explicit kill or server shutdown). mpirun_ssh -timeout 200 -paramfile paramfile.6617 -np 4 -hostfile hosts /home/bc2/xieh2/bin/cats3d.1 -mat_view_draw -draw_pause -1 -display localhost:15.0 failed! > >Message: 3 >Date: Tue, 15 Dec 2009 10:57:53 -0600 (CST) >From: Satish Balay >Subject: Re: How to visualize a matrix object from a remote machine? >To: PETSc users list >Message-ID: >Content-Type: TEXT/PLAIN; charset=US-ASCII > >On Tue, 15 Dec 2009, hxie at umn.edu wrote: > >> Hi, >> >> I use X11 to connect the server and I want to draw the nonzero >> structure of >> matrix. The option '-mat_view_draw' gives some error messages. How to >> fix it? >> Thanks. > >What error message? > > >Normally you can do the following: > > >ssh -Y remotemachine > > >./petscbinary -mat_view_draw -draw_pause -1 > >or > >./petscbinary -mat_view_draw -draw_pause -1 -display $DISPLAY > >Satish > > >------------------------------ > >_______________________________________________ >petsc-users mailing list >petsc-users at mcs.anl.gov >https://lists.mcs.anl.gov/mailman/listinfo/petsc-users > > >End of petsc-users Digest, Vol 12, Issue 24 >******************************************* > From balay at mcs.anl.gov Tue Dec 15 12:43:00 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Tue, 15 Dec 2009 12:43:00 -0600 (CST) Subject: How to visualize a matrix object from a remote machine? In-Reply-To: References: Message-ID: If you are running on a cluster - the cluster nodes won't usually have access to the X11-server-port on the front-end node. So - its best to do '-mat_view_draw' on a non-cluster environment. If you really need to do this on the cluster - the following methods are possible: 1) assuming you know the host-file before invoking the 'mpirun' command [which appears to be the case here ]- you would do: - establish an ssh-x11 tunnel into node1 [in the node-file list] 'ssh -Y node1' - find out the display value for this tunnel echo $DISPLAY - now use this value with 'mpirun binary -mat_view_draw -draw_pause -1 -display display_value' Note: If there are seq matrices created in your solve - you might need ssh-x11 tunnels to *all* the nodes [and hope you get the same 'localhost:10' value on all of them] 2. Open up a x11-tcp port on the cluster-front-end - but for that - you need to be root on that machine - or convice your sys-admin this is a safe thing to do. [this can be limited to ssh-x11-forwared port by modifying the sshd_config i.e - enable GatewayPorts] Satish On Tue, 15 Dec 2009, hxie at umn.edu wrote: > > > Following your instruction, I got the error message: > > X connection to localhost:15.0 broken (explicit kill or server shutdown). > > mpirun_ssh -timeout 200 -paramfile paramfile.6617 -np 4 -hostfile hosts > /home/bc2/xieh2/bin/cats3d.1 -mat_view_draw -draw_pause -1 -display > localhost:15.0 failed! > > > > > > > Message: 3 > > Date: Tue, 15 Dec 2009 10:57:53 -0600 (CST) > > From: Satish Balay > > Subject: Re: How to visualize a matrix object from a remote machine? > > To: PETSc users list > > Message-ID: > > Content-Type: TEXT/PLAIN; charset=US-ASCII > > > > On Tue, 15 Dec 2009, hxie at umn.edu wrote: > > > > > Hi, > > > > > > I use X11 to connect the server and I want to draw the nonzero structure > > > of > > > matrix. The option '-mat_view_draw' gives some error messages. How to fix > > > it? > > > Thanks. > > > > What error message? > > > > > > Normally you can do the following: > > > > > > ssh -Y remotemachine > > > > > > ./petscbinary -mat_view_draw -draw_pause -1 > > > > or > > > > ./petscbinary -mat_view_draw -draw_pause -1 -display $DISPLAY > > > > Satish > > > > > > ------------------------------ > > > > _______________________________________________ > > petsc-users mailing list > > petsc-users at mcs.anl.gov > > https://lists.mcs.anl.gov/mailman/listinfo/petsc-users > > > > > > End of petsc-users Digest, Vol 12, Issue 24 > > ******************************************* > > > From balay at mcs.anl.gov Tue Dec 15 12:58:44 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Tue, 15 Dec 2009 12:58:44 -0600 (CST) Subject: How to visualize a matrix object from a remote machine? In-Reply-To: References: Message-ID: BTW: - if your 'mpirun' startup mechanism already uses 'ssh' - then perhaps yu can direct this ssh to enable X11 forwarding? - add 'ForwardX11Trusted yes' to you ~/.ssh/config - run: mpirun_ssh -timeout 200 -np 4 -hostfile hosts xterm [and see if you get the 4 xterms] [if so - PETSc should also work the same way] satish On Tue, 15 Dec 2009, Satish Balay wrote: > If you are running on a cluster - the cluster nodes won't usually have > access to the X11-server-port on the front-end node. > > So - its best to do '-mat_view_draw' on a non-cluster environment. > > If you really need to do this on the cluster - the following methods > are possible: > > 1) assuming you know the host-file before invoking the 'mpirun' > command [which appears to be the case here ]- you would do: > > - establish an ssh-x11 tunnel into node1 [in the node-file list] > 'ssh -Y node1' > - find out the display value for this tunnel > echo $DISPLAY > - now use this value with 'mpirun binary -mat_view_draw -draw_pause -1 -display display_value' > > Note: If there are seq matrices created in your solve - you might need > ssh-x11 tunnels to *all* the nodes [and hope you get the same > 'localhost:10' value on all of them] > > 2. Open up a x11-tcp port on the cluster-front-end - but for that - > you need to be root on that machine - or convice your sys-admin this > is a safe thing to do. [this can be limited to ssh-x11-forwared port > by modifying the sshd_config i.e - enable GatewayPorts] > > > Satish > > On Tue, 15 Dec 2009, hxie at umn.edu wrote: > > > > > > > Following your instruction, I got the error message: > > > > X connection to localhost:15.0 broken (explicit kill or server shutdown). > > > > mpirun_ssh -timeout 200 -paramfile paramfile.6617 -np 4 -hostfile hosts > > /home/bc2/xieh2/bin/cats3d.1 -mat_view_draw -draw_pause -1 -display > > localhost:15.0 failed! > > > > > > > > > > > > Message: 3 > > > Date: Tue, 15 Dec 2009 10:57:53 -0600 (CST) > > > From: Satish Balay > > > Subject: Re: How to visualize a matrix object from a remote machine? > > > To: PETSc users list > > > Message-ID: > > > Content-Type: TEXT/PLAIN; charset=US-ASCII > > > > > > On Tue, 15 Dec 2009, hxie at umn.edu wrote: > > > > > > > Hi, > > > > > > > > I use X11 to connect the server and I want to draw the nonzero structure > > > > of > > > > matrix. The option '-mat_view_draw' gives some error messages. How to fix > > > > it? > > > > Thanks. > > > > > > What error message? > > > > > > > > > Normally you can do the following: > > > > > > > > > ssh -Y remotemachine > > > > > > > > > ./petscbinary -mat_view_draw -draw_pause -1 > > > > > > or > > > > > > ./petscbinary -mat_view_draw -draw_pause -1 -display $DISPLAY > > > > > > Satish > > > > > > > > > ------------------------------ > > > > > > _______________________________________________ > > > petsc-users mailing list > > > petsc-users at mcs.anl.gov > > > https://lists.mcs.anl.gov/mailman/listinfo/petsc-users > > > > > > > > > End of petsc-users Digest, Vol 12, Issue 24 > > > ******************************************* > > > > > > > From baraip at ornl.gov Tue Dec 15 13:59:38 2009 From: baraip at ornl.gov (Barai, Pallab) Date: Tue, 15 Dec 2009 14:59:38 -0500 Subject: Problems with VecGetArray in Fortran Message-ID: <236B18D117B37C449E470367EFCEC00303B5773161A4@EXCHMB.ornl.gov> Hello, I am initializing a Petsc Vector with 1.0 using the VecSet function. When I try to extract the values using VecGetArray, I get junk output in Fortran. I implemented the same thing in C and it works fine in C. The output and test code for both the Fortran and C are given below. Is this a problem with the VecGetArray or am I missing something in my Fortran version of the code. Any help will be highly appreciated. I ran it on 1 processor in a Cray XT-4 machine using PGI compilers. Thanking you. Pallab The output from Fortran code looks like: [The correct value is 1.0] ******************************************** arr( 1 )= 4.5088266034982808E-313 arr( 2 )= 4.5088266034982808E-313 arr( 3 )= 4.5088266034982808E-313 arr( 4 )= 4.5088266034982808E-313 arr( 5 )= 4.5088266034982808E-313 arr( 6 )= 4.5088266034982808E-313 arr( 7 )= 4.5088266034982808E-313 arr( 8 )= 4.5088266034982808E-313 arr( 9 )= 4.5088266034982808E-313 arr( 10 )= 4.5088266034982808E-313 *********************************************** The output from the C code is: [this is the correct output] ************************************************ arr[0] = 1.000000 arr[1] = 1.000000 arr[2] = 1.000000 arr[3] = 1.000000 arr[4] = 1.000000 arr[5] = 1.000000 arr[6] = 1.000000 arr[7] = 1.000000 arr[8] = 1.000000 arr[9] = 1.000000 ************************************************** The test codes are as follows: Fortran: ************************************************** program F_test_Vec #include "finclude/petsc.h" #include "finclude/petscvec.h" Vec tmp PetscScalar arr(1) integer i PetscOffset i_x call PetscInitialize(PETSC_NULL_CHARACTER,ierr) call VecCreate(PETSC_COMM_WORLD, tmp, ierr) call VecSetSizes(tmp, 10, PETSC_DECIDE, ierr) call VecSetType(tmp,VECSEQ,ierr) call VecSet(tmp, 1.0, ierr) call VecGetArray(tmp, arr, i_x, ierr) do i=1,10 write(*,*) 'arr(',i,')=',arr(i_x+i) enddo call VecRestoreArray(tmp, arr, i_x, ierr) call VecDestroy(tmp, ierr) call PetscFinalize(ierr) end ********************************************************** C: *********************************************************** #include "petsc.h" #include "petscvec.h" #include "stdio.h" int main(int argc, char** argv) { Vec tmp; PetscScalar* arr; int i; PetscInitialize(&argc, &argv, NULL, NULL); VecCreate(PETSC_COMM_WORLD, &tmp); VecSetSizes(tmp, 10, PETSC_DECIDE); VecSetType(tmp,VECSEQ); VecSet(tmp, 1.0); VecGetArray(tmp, &arr); for(i = 0; i < 10; i++) { printf("arr[%d] = %lf\n", i, arr[i]); } VecRestoreArray(tmp, &arr); VecDestroy(tmp); PetscFinalize(); } **************************************************** From balay at mcs.anl.gov Tue Dec 15 14:05:45 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Tue, 15 Dec 2009 14:05:45 -0600 (CST) Subject: Problems with VecGetArray in Fortran In-Reply-To: <236B18D117B37C449E470367EFCEC00303B5773161A4@EXCHMB.ornl.gov> References: <236B18D117B37C449E470367EFCEC00303B5773161A4@EXCHMB.ornl.gov> Message-ID: In fortran - try and avoid passing constants with implicit types - and explicitly define them. i.e PetscScalar one one = 1.0d0 call VecSet(tmp, one, ierr) etc.. Also - VecGetArrayF90() can be prefered over the old VecGetArray() [assuming f77 is nolonger needed] Satish On Tue, 15 Dec 2009, Barai, Pallab wrote: > Hello, > > I am initializing a Petsc Vector with 1.0 using the VecSet function. When I try to extract the values using VecGetArray, I get junk output in Fortran. I implemented the same thing in C and it works fine in C. > > The output and test code for both the Fortran and C are given below. > > Is this a problem with the VecGetArray or am I missing something in my Fortran version of the code. Any help will be highly appreciated. > > I ran it on 1 processor in a Cray XT-4 machine using PGI compilers. > > Thanking you. > Pallab > > > > The output from Fortran code looks like: [The correct value is 1.0] > > ******************************************** > arr( 1 )= 4.5088266034982808E-313 > arr( 2 )= 4.5088266034982808E-313 > arr( 3 )= 4.5088266034982808E-313 > arr( 4 )= 4.5088266034982808E-313 > arr( 5 )= 4.5088266034982808E-313 > arr( 6 )= 4.5088266034982808E-313 > arr( 7 )= 4.5088266034982808E-313 > arr( 8 )= 4.5088266034982808E-313 > arr( 9 )= 4.5088266034982808E-313 > arr( 10 )= 4.5088266034982808E-313 > *********************************************** > > The output from the C code is: [this is the correct output] > > ************************************************ > arr[0] = 1.000000 > arr[1] = 1.000000 > arr[2] = 1.000000 > arr[3] = 1.000000 > arr[4] = 1.000000 > arr[5] = 1.000000 > arr[6] = 1.000000 > arr[7] = 1.000000 > arr[8] = 1.000000 > arr[9] = 1.000000 > ************************************************** > > > The test codes are as follows: > > Fortran: > ************************************************** > program F_test_Vec > > #include "finclude/petsc.h" > #include "finclude/petscvec.h" > > Vec tmp > PetscScalar arr(1) > integer i > PetscOffset i_x > > call PetscInitialize(PETSC_NULL_CHARACTER,ierr) > > call VecCreate(PETSC_COMM_WORLD, tmp, ierr) > call VecSetSizes(tmp, 10, PETSC_DECIDE, ierr) > call VecSetType(tmp,VECSEQ,ierr) > call VecSet(tmp, 1.0, ierr) > > call VecGetArray(tmp, arr, i_x, ierr) > > do i=1,10 > write(*,*) 'arr(',i,')=',arr(i_x+i) > enddo > > call VecRestoreArray(tmp, arr, i_x, ierr) > > call VecDestroy(tmp, ierr) > > call PetscFinalize(ierr) > end > ********************************************************** > > > > C: > *********************************************************** > #include "petsc.h" > #include "petscvec.h" > #include "stdio.h" > > int main(int argc, char** argv) { > Vec tmp; > PetscScalar* arr; > int i; > > PetscInitialize(&argc, &argv, NULL, NULL); > > VecCreate(PETSC_COMM_WORLD, &tmp); > VecSetSizes(tmp, 10, PETSC_DECIDE); > VecSetType(tmp,VECSEQ); > VecSet(tmp, 1.0); > > VecGetArray(tmp, &arr); > > for(i = 0; i < 10; i++) { > printf("arr[%d] = %lf\n", i, arr[i]); > } > > VecRestoreArray(tmp, &arr); > > VecDestroy(tmp); > > PetscFinalize(); > } > **************************************************** From mafunk at nmsu.edu Tue Dec 15 16:58:44 2009 From: mafunk at nmsu.edu (Matt Funk) Date: Tue, 15 Dec 2009 15:58:44 -0700 Subject: matrix building question Message-ID: <200912151558.44544.mafunk@nmsu.edu> Hi, i was wondering if it is mandetory that when i populate a parallel matrix, that all rows owned by given processor are continously numbered? I.e. say that a given process owns 500 rows. Could i build the matrix such that the first 250 rows have row numbers: 0-250 and the second 250 rows have row numbers, say: 750-1000? Or do they HAVE to be numbered continous, for example: 0-500 or 250-750? I was under the impression that they had to be continously numbered due to the example given on p.55 of the user manual. However, i might have simply misunderstood what it is saying. Also, reading the section on paritioning makes me think that it might be possible to break the numbering up as mentioned above. I hope i am making sense ... thanks matt From bsmith at mcs.anl.gov Tue Dec 15 17:43:30 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Tue, 15 Dec 2009 17:43:30 -0600 Subject: matrix building question In-Reply-To: <200912151558.44544.mafunk@nmsu.edu> References: <200912151558.44544.mafunk@nmsu.edu> Message-ID: <67EF9049-7D34-463C-8FFA-A2B554B991D2@mcs.anl.gov> No, there cannot be holes in the rows of matrix. Barry On Dec 15, 2009, at 4:58 PM, Matt Funk wrote: > Hi, > > i was wondering if it is mandetory that when i populate a parallel > matrix, > that all rows owned by given processor are continously numbered? > > I.e. say that a given process owns 500 rows. Could i build the > matrix such > that the first 250 rows have row numbers: 0-250 and the second 250 > rows have > row numbers, say: 750-1000? > > Or do they HAVE to be numbered continous, for example: 0-500 or > 250-750? > > I was under the impression that they had to be continously numbered > due to the > example given on p.55 of the user manual. However, i might have simply > misunderstood what it is saying. > Also, reading the section on paritioning makes me think that it > might be > possible to break the numbering up as mentioned above. > > I hope i am making sense ... > > > thanks > matt From mafunk at nmsu.edu Tue Dec 15 17:55:55 2009 From: mafunk at nmsu.edu (Matt Funk) Date: Tue, 15 Dec 2009 16:55:55 -0700 Subject: matrix building question In-Reply-To: <67EF9049-7D34-463C-8FFA-A2B554B991D2@mcs.anl.gov> References: <200912151558.44544.mafunk@nmsu.edu> <67EF9049-7D34-463C-8FFA-A2B554B991D2@mcs.anl.gov> Message-ID: <200912151655.55391.mafunk@nmsu.edu> Sorry, i should have been more specific. Of course there cannot be 'holes': What i meant was this: could i, in theory, build a matrix that with the following layout: rows: 0-249 owned by proc0 rows: 250-499 owned by proc1 rows: 500-749 owned by proc0 rows: 750-999 owned by proc1 or does it have be like such: rows: 0-499 owned by proc0 rows: 500-999 owned by proc1 matt On Tuesday 15 December 2009, Barry Smith wrote: > No, there cannot be holes in the rows of matrix. > > Barry > > On Dec 15, 2009, at 4:58 PM, Matt Funk wrote: > > Hi, > > > > i was wondering if it is mandetory that when i populate a parallel > > matrix, > > that all rows owned by given processor are continously numbered? > > > > I.e. say that a given process owns 500 rows. Could i build the > > matrix such > > that the first 250 rows have row numbers: 0-250 and the second 250 > > rows have > > row numbers, say: 750-1000? > > > > Or do they HAVE to be numbered continous, for example: 0-500 or > > 250-750? > > > > I was under the impression that they had to be continously numbered > > due to the > > example given on p.55 of the user manual. However, i might have simply > > misunderstood what it is saying. > > Also, reading the section on paritioning makes me think that it > > might be > > possible to break the numbering up as mentioned above. > > > > I hope i am making sense ... > > > > > > thanks > > matt > From bsmith at mcs.anl.gov Tue Dec 15 17:58:05 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Tue, 15 Dec 2009 17:58:05 -0600 Subject: matrix building question In-Reply-To: <200912151655.55391.mafunk@nmsu.edu> References: <200912151558.44544.mafunk@nmsu.edu> <67EF9049-7D34-463C-8FFA-A2B554B991D2@mcs.anl.gov> <200912151655.55391.mafunk@nmsu.edu> Message-ID: On Dec 15, 2009, at 5:55 PM, Matt Funk wrote: > Sorry, > > i should have been more specific. Of course there cannot be 'holes': > What i meant was this: > > could i, in theory, build a matrix that with the following layout: > rows: 0-249 owned by proc0 > rows: 250-499 owned by proc1 > rows: 500-749 owned by proc0 > rows: 750-999 owned by proc1 > No, you cannot do this. Barry > or does it have be like such: > rows: 0-499 owned by proc0 > rows: 500-999 owned by proc1 > > > matt > > On Tuesday 15 December 2009, Barry Smith wrote: >> No, there cannot be holes in the rows of matrix. >> >> Barry >> >> On Dec 15, 2009, at 4:58 PM, Matt Funk wrote: >>> Hi, >>> >>> i was wondering if it is mandetory that when i populate a parallel >>> matrix, >>> that all rows owned by given processor are continously numbered? >>> >>> I.e. say that a given process owns 500 rows. Could i build the >>> matrix such >>> that the first 250 rows have row numbers: 0-250 and the second 250 >>> rows have >>> row numbers, say: 750-1000? >>> >>> Or do they HAVE to be numbered continous, for example: 0-500 or >>> 250-750? >>> >>> I was under the impression that they had to be continously numbered >>> due to the >>> example given on p.55 of the user manual. However, i might have >>> simply >>> misunderstood what it is saying. >>> Also, reading the section on paritioning makes me think that it >>> might be >>> possible to break the numbering up as mentioned above. >>> >>> I hope i am making sense ... >>> >>> >>> thanks >>> matt >> > From vyan2000 at gmail.com Tue Dec 15 20:46:38 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Tue, 15 Dec 2009 21:46:38 -0500 Subject: Mesh resolution Message-ID: Hi All, I was ignoring the importance of fixing the mesh size. For instance, if I want to compare the effect of mesh sequencing on the solver, I will use one level with 256 pt on each direction in 2d, in the first run. My question is, in the second run, how to set up the number of points on the coarsest grid and pre-fix the level of the grid so that DMMG can bring me the exact resolution of 256 pt on each direction on the finest grid. Only this way, the two different solver are solving the problem of the same size. Thanks a lot, Yan -------------- next part -------------- An HTML attachment was scrubbed... URL: From xy2102 at columbia.edu Tue Dec 15 20:55:00 2009 From: xy2102 at columbia.edu ((Rebecca) Xuefei YUAN) Date: Tue, 15 Dec 2009 21:55:00 -0500 Subject: Mesh resolution In-Reply-To: References: Message-ID: <20091215215500.kkvhh1dkkkw0s8wo@cubmail.cc.columbia.edu> The relation between the coarser grid and finer grid is always half spacing in either x-, y-, or z-direction. Thus, for your finest grid being 257x257x257, you need a coarser grid of 129x129x129 on the coarse grid if your level is 2. Hope this is helpful. R Quoting Ryan Yan : > Hi All, > I was ignoring the importance of fixing the mesh size. > For instance, if I want to compare the effect of mesh sequencing on the > solver, I will use one level with 256 pt on each direction in 2d, in the > first run. > > My question is, in the second run, how to set up the number of points on > the coarsest grid and pre-fix the level of the grid so that DMMG > can bring me the exact resolution of 256 pt on each direction on the finest > grid. Only this way, the two different solver are solving the problem of the > same > size. > > Thanks a lot, > > Yan > -- (Rebecca) Xuefei YUAN Department of Applied Physics and Applied Mathematics Columbia University Tel:917-399-8032 www.columbia.edu/~xy2102 From vyan2000 at gmail.com Tue Dec 15 21:25:10 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Tue, 15 Dec 2009 22:25:10 -0500 Subject: Mesh resolution In-Reply-To: References: <20091215215500.kkvhh1dkkkw0s8wo@cubmail.cc.columbia.edu> Message-ID: Sorry, I forgot to cc to the group. BTW, if this is designed to have only odd number of points on the finer level grid, can anyone provide a hint on the reasoning behind this? Thanks a lot, Yan On Tue, Dec 15, 2009 at 10:09 PM, Ryan Yan wrote: > Hi Rebecca, > Thanks for the info. I noticed that rule; yet, it seems very difficult to > bring up a finest grid with *even* number of pts. > > Yan > > > On Tue, Dec 15, 2009 at 9:55 PM, (Rebecca) Xuefei YUAN < > xy2102 at columbia.edu> wrote: > >> The relation between the coarser grid and finer grid is always half >> spacing in either x-, y-, or z-direction. >> >> Thus, for your finest grid being 257x257x257, you need a coarser grid of >> 129x129x129 on the coarse grid if your level is 2. >> >> Hope this is helpful. >> >> R >> >> >> >> Quoting Ryan Yan : >> >> Hi All, >>> I was ignoring the importance of fixing the mesh size. >>> For instance, if I want to compare the effect of mesh sequencing on the >>> solver, I will use one level with 256 pt on each direction in 2d, in the >>> first run. >>> >>> My question is, in the second run, how to set up the number of points on >>> the coarsest grid and pre-fix the level of the grid so that DMMG >>> can bring me the exact resolution of 256 pt on each direction on the >>> finest >>> grid. Only this way, the two different solver are solving the problem of >>> the >>> same >>> size. >>> >>> Thanks a lot, >>> >>> Yan >>> >>> >> >> >> -- >> (Rebecca) Xuefei YUAN >> Department of Applied Physics and Applied Mathematics >> Columbia University >> Tel:917-399-8032 >> www.columbia.edu/~xy2102 >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From xy2102 at columbia.edu Tue Dec 15 21:37:31 2009 From: xy2102 at columbia.edu ((Rebecca) Xuefei YUAN) Date: Tue, 15 Dec 2009 22:37:31 -0500 Subject: Mesh resolution In-Reply-To: References: <20091215215500.kkvhh1dkkkw0s8wo@cubmail.cc.columbia.edu> Message-ID: <20091215223731.92wautb800ww4s4o@cubmail.cc.columbia.edu> Now PETSc treats the multigrid based on the half spacing strategy, thus they always do odd number of grids. R Quoting Ryan Yan : > Sorry, I forgot to cc to the group. > > BTW, if this is designed to have only odd number of points on the finer > level grid, can anyone provide a hint on the reasoning behind this? > > Thanks a lot, > > Yan > > On Tue, Dec 15, 2009 at 10:09 PM, Ryan Yan wrote: > >> Hi Rebecca, >> Thanks for the info. I noticed that rule; yet, it seems very difficult to >> bring up a finest grid with *even* number of pts. >> >> Yan >> >> >> On Tue, Dec 15, 2009 at 9:55 PM, (Rebecca) Xuefei YUAN < >> xy2102 at columbia.edu> wrote: >> >>> The relation between the coarser grid and finer grid is always half >>> spacing in either x-, y-, or z-direction. >>> >>> Thus, for your finest grid being 257x257x257, you need a coarser grid of >>> 129x129x129 on the coarse grid if your level is 2. >>> >>> Hope this is helpful. >>> >>> R >>> >>> >>> >>> Quoting Ryan Yan : >>> >>> Hi All, >>>> I was ignoring the importance of fixing the mesh size. >>>> For instance, if I want to compare the effect of mesh sequencing on the >>>> solver, I will use one level with 256 pt on each direction in 2d, in the >>>> first run. >>>> >>>> My question is, in the second run, how to set up the number of points on >>>> the coarsest grid and pre-fix the level of the grid so that DMMG >>>> can bring me the exact resolution of 256 pt on each direction on the >>>> finest >>>> grid. Only this way, the two different solver are solving the problem of >>>> the >>>> same >>>> size. >>>> >>>> Thanks a lot, >>>> >>>> Yan >>>> >>>> >>> >>> >>> -- >>> (Rebecca) Xuefei YUAN >>> Department of Applied Physics and Applied Mathematics >>> Columbia University >>> Tel:917-399-8032 >>> www.columbia.edu/~xy2102 >>> >>> >> > -- (Rebecca) Xuefei YUAN Department of Applied Physics and Applied Mathematics Columbia University Tel:917-399-8032 www.columbia.edu/~xy2102 From vyan2000 at gmail.com Tue Dec 15 21:42:10 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Tue, 15 Dec 2009 22:42:10 -0500 Subject: Mesh resolution In-Reply-To: <20091215223731.92wautb800ww4s4o@cubmail.cc.columbia.edu> References: <20091215215500.kkvhh1dkkkw0s8wo@cubmail.cc.columbia.edu> <20091215223731.92wautb800ww4s4o@cubmail.cc.columbia.edu> Message-ID: Hi Rebecca, Thanks for reminding me the half-spacing strategy, the 3*7 restriction matrix in 1-D. Yan On Tue, Dec 15, 2009 at 10:37 PM, (Rebecca) Xuefei YUAN wrote: > Now PETSc treats the multigrid based on the half spacing strategy, thus > they always do odd number of grids. > > > R > > Quoting Ryan Yan : > > Sorry, I forgot to cc to the group. >> >> BTW, if this is designed to have only odd number of points on the finer >> level grid, can anyone provide a hint on the reasoning behind this? >> >> Thanks a lot, >> >> Yan >> >> On Tue, Dec 15, 2009 at 10:09 PM, Ryan Yan wrote: >> >> Hi Rebecca, >>> Thanks for the info. I noticed that rule; yet, it seems very difficult to >>> bring up a finest grid with *even* number of pts. >>> >>> Yan >>> >>> >>> On Tue, Dec 15, 2009 at 9:55 PM, (Rebecca) Xuefei YUAN < >>> xy2102 at columbia.edu> wrote: >>> >>> The relation between the coarser grid and finer grid is always half >>>> spacing in either x-, y-, or z-direction. >>>> >>>> Thus, for your finest grid being 257x257x257, you need a coarser grid of >>>> 129x129x129 on the coarse grid if your level is 2. >>>> >>>> Hope this is helpful. >>>> >>>> R >>>> >>>> >>>> >>>> Quoting Ryan Yan : >>>> >>>> Hi All, >>>> >>>>> I was ignoring the importance of fixing the mesh size. >>>>> For instance, if I want to compare the effect of mesh sequencing on the >>>>> solver, I will use one level with 256 pt on each direction in 2d, in >>>>> the >>>>> first run. >>>>> >>>>> My question is, in the second run, how to set up the number of points >>>>> on >>>>> the coarsest grid and pre-fix the level of the grid so that DMMG >>>>> can bring me the exact resolution of 256 pt on each direction on the >>>>> finest >>>>> grid. Only this way, the two different solver are solving the problem >>>>> of >>>>> the >>>>> same >>>>> size. >>>>> >>>>> Thanks a lot, >>>>> >>>>> Yan >>>>> >>>>> >>>>> >>>> >>>> -- >>>> (Rebecca) Xuefei YUAN >>>> Department of Applied Physics and Applied Mathematics >>>> Columbia University >>>> Tel:917-399-8032 >>>> www.columbia.edu/~xy2102 >>>> >>>> >>>> >>> >> > > > -- > (Rebecca) Xuefei YUAN > Department of Applied Physics and Applied Mathematics > Columbia University > Tel:917-399-8032 > www.columbia.edu/~xy2102 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Wed Dec 16 01:33:24 2009 From: jroman at dsic.upv.es (Jose E. Roman) Date: Wed, 16 Dec 2009 08:33:24 +0100 Subject: matrix building question In-Reply-To: <200912151655.55391.mafunk@nmsu.edu> References: <200912151558.44544.mafunk@nmsu.edu> <67EF9049-7D34-463C-8FFA-A2B554B991D2@mcs.anl.gov> <200912151655.55391.mafunk@nmsu.edu> Message-ID: On 16/12/2009, Matt Funk wrote: > Sorry, > > i should have been more specific. Of course there cannot be 'holes': > What i meant was this: > > could i, in theory, build a matrix that with the following layout: > rows: 0-249 owned by proc0 > rows: 250-499 owned by proc1 > rows: 500-749 owned by proc0 > rows: 750-999 owned by proc1 > > or does it have be like such: > rows: 0-499 owned by proc0 > rows: 500-999 owned by proc1 > > > matt This cannot be done with a PETSc Mat but can be simulated. I sometimes have a matrix with block structure [ A B ] [ C D ] where each block has to be stored separately as a Mat. What I do is represent the large matrix as a SHELL Mat that operates with the blocks (see SLEPc's ex9.c for an example). Then proc0 owns the first chunk corresponding to A,B and the first chunk of C,D, and so on, so the effect is what you wanted. If you do not have independent blocks, then you can always use a renumbering scheme (permutation) that maps the rows you want to contiguous chunks in each processor. Jose From zonexo at gmail.com Wed Dec 16 02:07:00 2009 From: zonexo at gmail.com (Wee-Beng Tay) Date: Wed, 16 Dec 2009 16:07:00 +0800 Subject: ksp tutorial ex22 In-Reply-To: References: <1716B0BA-FB43-4432-AAD2-AC87E6926444@mcs.anl.gov> <804ab5d40912102244q1f51121m8db9a0ade7ad8c74@mail.gmail.com> Message-ID: <804ab5d40912160007h1f7363e5we62a2911ee799997@mail.gmail.com> Hi Ryan, Thanks alot. There's still some parts I don't understand. It'll be great if someone can help: In ex22f.f90, there's a : MatStencil row(4),col(4,7) I understand that the 7 is due to the 7-pt stencil. However, why is there a "4"? In that eg., coarsest grid has dimension 3 with 3 lvl. it seems that in eg. ex29.c, it is only given as "row", not array As for Neumann B.C.s, it's mentioned there's null space of the coefficient matrix A. looking at ex29, if (user->bcType == NEUMANN) { MatNullSpace nullspace; KSPGetNullSpace (dmmg->ksp,&nullspace); MatNullSpaceRemove (nullspace,b,PETSC_NULL ); } I don't really understand what it is trying to do. My BC has du/dx=0 and du/dy = 0 and I believe it's the same as that of ex29.c if I do it in Fortran, is it the same? Thanks again! On Sat, Dec 12, 2009 at 12:25 AM, Ryan Yan wrote: > > > On Fri, Dec 11, 2009 at 1:44 AM, Wee-Beng Tay wrote: > >> Hi, >> >> I'm also looking at the fortran version of ex22. I have some questions: >> >> 1. M,N,P are global dimension in each direction of the array. I'm abit >> confused. Do you mean the no. of grid pts at the coarse level? Hence, if my >> problem has 27x27 grid pts, do I use M=N=9 with 3 multigrid levels or M=N=3 >> with 9 lvls? What is the guideline in choosing the number of multigrid >> levels? >> >> 2. What is stencil width (s)? Seems to be 1 in both ex22 and ex29. >> >> 3. What are arrays containing the number of nodes in each cell along the >> x/y/z coordinates? Is it ok to just use the default PETSC_NULL_INTEGER? >> >> 4. There's a subroutine ComputeJacobian which computes the jacobian. >> However, what is it actually calculating? Is it simply calculating the >> coefficient arising from the discretization of the matrix? >> >> > I just realized that you are looking at Fortran version ex22f.F for this > question. > In fact, my answer still applies. > You may want to make a comparison between: > > http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DMMG/DMMGSetSNES.html > > http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DMMG/DMMGSetKSP.html > > > >> 5. My objective is to solve for the poisson equation arising from the >> Navier Stokes equations. ie div grad P = F, which F can be calculated >> separately. The boundary conditions are Neumann which is dp/dx, dp/dy=0. Is >> this a good example to follow? Or is ex29 a better example, although I need >> time to digest the C syntax. >> >> thanks alot! >> >> >> On Fri, Dec 11, 2009 at 4:14 AM, Ryan Yan wrote: >> >>> Hi Barry, >>> Thank you very much for the confirm. >>> >>> Yan >>> >>> >>> On Thu, Dec 10, 2009 at 3:12 PM, Barry Smith wrote: >>> >>>> >>>> On Dec 10, 2009, at 2:09 PM, Ryan Yan wrote: >>>> >>>> Hi all, >>>>> I was looking at the ex22 of ksp. >>>>> >>>>> If I call: >>>>> ... >>>>> ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr); >>>>> ierr = >>>>> DACreate3d(PETSC_COMM_WORLD,DA_NONPERIODIC,DA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr); >>>>> ... >>>>> >>>>> How many grid pts should I have on the finest level? Is it 27, >>>>> considering I am set 3 as the global dimension in each direction of the >>>>> array? >>>>> >>>>> When I run ex22 with -ksp_view, I saw that on the finest level there >>>>> are 9 pts on each direction. >>>>> >>>>> Is that because I have 3 level? >>>>> >>>> >>>> Yes. The DA you create initially is for the coarsest grid, finer ones >>>> are automatically created by the DMMG. >>>> >>>> Barry >>>> >>>> >>>>> Yan >>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jed at 59A2.org Wed Dec 16 09:21:57 2009 From: jed at 59A2.org (Jed Brown) Date: Wed, 16 Dec 2009 16:21:57 +0100 Subject: ksp tutorial ex22 In-Reply-To: <804ab5d40912160007h1f7363e5we62a2911ee799997@mail.gmail.com> References: <1716B0BA-FB43-4432-AAD2-AC87E6926444@mcs.anl.gov> <804ab5d40912102244q1f51121m8db9a0ade7ad8c74@mail.gmail.com> <804ab5d40912160007h1f7363e5we62a2911ee799997@mail.gmail.com> Message-ID: <87pr6fgd0q.fsf@59A2.org> On Wed, 16 Dec 2009 16:07:00 +0800, Wee-Beng Tay wrote: > Hi Ryan, > > Thanks alot. > > There's still some parts I don't understand. It'll be great if someone can > help: > > In ex22f.f90, there's a : > > MatStencil row(4),col(4,7) > > I understand that the 7 is due to the 7-pt stencil. However, why is there a > "4"? In that eg., coarsest grid has dimension 3 with 3 lvl. it seems that in > eg. ex29.c, it is only given as "row", not array Fortran 77 has a severely crippled type system, the 4 comes from the size of this data structure. http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatStencil.html > As for Neumann B.C.s, it's mentioned there's null space of the coefficient > matrix A. looking at ex29, > > if (user->bcType == NEUMANN) { > MatNullSpace > nullspace; > > KSPGetNullSpace > (dmmg->ksp,&nullspace); > MatNullSpaceRemove > (nullspace,b,PETSC_NULL > ); > } > > I don't really understand what it is trying to do. Since the matrix is singular due to the constant null space, it's range is a subspace with codimension 1. An arbitrary right hand side may not lie within this subspace, MatNullSpaceRemove is projecting it into the range of the operator. > if I do it in Fortran, is it the same? Yes Jed From vyan2000 at gmail.com Wed Dec 16 09:25:53 2009 From: vyan2000 at gmail.com (Ryan Yan) Date: Wed, 16 Dec 2009 10:25:53 -0500 Subject: ksp tutorial ex22 In-Reply-To: <804ab5d40912160007h1f7363e5we62a2911ee799997@mail.gmail.com> References: <1716B0BA-FB43-4432-AAD2-AC87E6926444@mcs.anl.gov> <804ab5d40912102244q1f51121m8db9a0ade7ad8c74@mail.gmail.com> <804ab5d40912160007h1f7363e5we62a2911ee799997@mail.gmail.com> Message-ID: Hi Wee-Beng, See the reply below, On Wed, Dec 16, 2009 at 3:07 AM, Wee-Beng Tay wrote: > Hi Ryan, > > Thanks alot. > > There's still some parts I don't understand. It'll be great if someone can > help: > > In ex22f.f90, there's a : > > MatStencil row(4),col(4,7) > > I understand that the 7 is due to the 7-pt stencil. However, why is there a > "4"? You may want to check example 28.c, on line 107, to see why there is a 4. From my understanding, row() is an indicator of the global location of the current grid point that you are looking at. I think the 4th entry of row() is reserved for time dependent problem. In that eg., coarsest grid has dimension 3 with 3 lvl. it seems that in eg. > ex29.c, it is only given as "row", not array > As for Neumann B.C.s, it's mentioned there's null space of the coefficient > matrix A. looking at ex29, > > if (user->bcType == NEUMANN) { > MatNullSpace nullspace; > > KSPGetNullSpace (dmmg->ksp,&nullspace); > MatNullSpaceRemove (nullspace,b,PETSC_NULL ); > } > > I don't really understand what it is trying to do. My BC has du/dx=0 and > du/dy = 0 and I believe it's the same as that of ex29.c > > if I do it in Fortran, is it the same? > > Thanks again! > > > > > On Sat, Dec 12, 2009 at 12:25 AM, Ryan Yan wrote: > >> >> >> On Fri, Dec 11, 2009 at 1:44 AM, Wee-Beng Tay wrote: >> >>> Hi, >>> >>> I'm also looking at the fortran version of ex22. I have some questions: >>> >>> 1. M,N,P are global dimension in each direction of the array. I'm abit >>> confused. Do you mean the no. of grid pts at the coarse level? Hence, if my >>> problem has 27x27 grid pts, do I use M=N=9 with 3 multigrid levels or M=N=3 >>> with 9 lvls? What is the guideline in choosing the number of multigrid >>> levels? >>> >>> 2. What is stencil width (s)? Seems to be 1 in both ex22 and ex29. >>> >>> 3. What are arrays containing the number of nodes in each cell along the >>> x/y/z coordinates? Is it ok to just use the default PETSC_NULL_INTEGER? >>> >>> 4. There's a subroutine ComputeJacobian which computes the jacobian. >>> However, what is it actually calculating? Is it simply calculating the >>> coefficient arising from the discretization of the matrix? >>> >>> >> I just realized that you are looking at Fortran version ex22f.F for this >> question. >> In fact, my answer still applies. >> You may want to make a comparison between: >> >> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DMMG/DMMGSetSNES.html >> >> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/DMMG/DMMGSetKSP.html >> >> >> >>> 5. My objective is to solve for the poisson equation arising from the >>> Navier Stokes equations. ie div grad P = F, which F can be calculated >>> separately. The boundary conditions are Neumann which is dp/dx, dp/dy=0. Is >>> this a good example to follow? Or is ex29 a better example, although I need >>> time to digest the C syntax. >>> >>> thanks alot! >>> >>> >>> On Fri, Dec 11, 2009 at 4:14 AM, Ryan Yan wrote: >>> >>>> Hi Barry, >>>> Thank you very much for the confirm. >>>> >>>> Yan >>>> >>>> >>>> On Thu, Dec 10, 2009 at 3:12 PM, Barry Smith wrote: >>>> >>>>> >>>>> On Dec 10, 2009, at 2:09 PM, Ryan Yan wrote: >>>>> >>>>> Hi all, >>>>>> I was looking at the ex22 of ksp. >>>>>> >>>>>> If I call: >>>>>> ... >>>>>> ierr = DMMGCreate(PETSC_COMM_WORLD,3,PETSC_NULL,&dmmg);CHKERRQ(ierr); >>>>>> ierr = >>>>>> DACreate3d(PETSC_COMM_WORLD,DA_NONPERIODIC,DA_STENCIL_STAR,-3,-3,-3,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,1,1,0,0,0,&da);CHKERRQ(ierr); >>>>>> ... >>>>>> >>>>>> How many grid pts should I have on the finest level? Is it 27, >>>>>> considering I am set 3 as the global dimension in each direction of the >>>>>> array? >>>>>> >>>>>> When I run ex22 with -ksp_view, I saw that on the finest level there >>>>>> are 9 pts on each direction. >>>>>> >>>>>> Is that because I have 3 level? >>>>>> >>>>> >>>>> Yes. The DA you create initially is for the coarsest grid, finer ones >>>>> are automatically created by the DMMG. >>>>> >>>>> Barry >>>>> >>>>> >>>>>> Yan >>>>>> >>>>>> >>>>> >>>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arnold at umn.edu Fri Dec 18 17:59:59 2009 From: arnold at umn.edu (Douglas Arnold) Date: Fri, 18 Dec 2009 17:59:59 -0600 Subject: Assembling a matrix Message-ID: <4B2C177F.3090308@umn.edu> Anirban Chatterjee asked how to assemble an (n+1)x(n+1) sparse matrix B = [A v; v^T c] from an nxn sparse matrix A, a vector v, and a scalar c. Matt Knepley and Barry Smith advised against it. I have pretty much the same problem and I want to make sure I understand the situation. In my case, the matrix A comes to me from another application that I would rather not fiddle with. The rank of A is n-1 and v is a vector in its nullspace, c=0. I would like to solve a system with the matrix B by a direct solver, and so I think I need to assemble it. Do I understand correctly that there is no efficient way to do this in PETSc? Even in a sequential computation? -- Doug > Where will the "new" row live? On the last process, why that one? > > Does the matrix A have to be completely assembled before the v is > computed? Or can the entries of A be computed at the same time as the v? > > PETSc doesn't have code to efficiently dynamically change the size > of a matrix. Thus generating a new matrix from a given sparse matrix > plus a new row requires a complete copy of the starting matrix into > the new matrix data structure. If you assemble the entire matrix > together without first generating the smaller matrix A then it is > easy; just generate the preallocation structure of A with the one > additional row/column information and call MatSetValues() to put in > the parts of A and the parts of v. > > Barry > > On Dec 8, 2009, at 4:05 PM, Anirban Chatterjee wrote: > >> Hi, >> >> I have an nxn matrix A, a column vector v and a scalar c. I want to >> assemble a matrix B as follows, >> B = [A v; >> v^T c] >> Can someone tell me the easiest and most efficient way to do this. >> >> --Anirban From bsmith at mcs.anl.gov Fri Dec 18 18:12:44 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Fri, 18 Dec 2009 18:12:44 -0600 Subject: Assembling a matrix In-Reply-To: <4B2C177F.3090308@umn.edu> References: <4B2C177F.3090308@umn.edu> Message-ID: <3B4C55FA-9607-43EF-BAF4-9D723E61B7B5@mcs.anl.gov> The issue is that the data structures that PETSc uses to store the sparse matrices are not designed to allow changing the matrix size, thus if you have the matrix A as a PETSc sparse matrix creating B means copying the entire matrix, thus two copies of the matrix, more memory usage. Now if memory is not an issue for you, the copying can be done efficiently order nz work. I can send you code for the sequential case. If you don't want two copies of the matrix for memory reasons, could you "lie" to the part of the code that generates A and have it create the A with an extra row and column that it simply does not use? So in the MatSetSizes() you just set it 1 larger then it is. Then call the MatSetValues() to fill up A then call the MatSetValues() to put in the v and c part without calling MatAssemblyBegin/End() in between and you will have an efficient code in both time and memory usage. Barry On Dec 18, 2009, at 5:59 PM, Douglas Arnold wrote: > Anirban Chatterjee asked how to assemble an (n+1)x(n+1) sparse matrix > > B = [A v; > v^T c] > > from an nxn sparse matrix A, a vector v, and a scalar c. Matt > Knepley and Barry Smith advised against it. > > I have pretty much the same problem and I want to make sure I > understand the situation. In my case, the matrix A comes to me > from another application that I would rather not fiddle with. > The rank of A is n-1 and v is a vector in its nullspace, c=0. I would > like to solve a system with the matrix B by a direct solver, and > so I think I need to assemble it. Do I understand correctly that > there is no efficient way to do this in PETSc? Even in a sequential > computation? > > -- Doug > > >> Where will the "new" row live? On the last process, why that one? >> >> Does the matrix A have to be completely assembled before the v is >> computed? Or can the entries of A be computed at the same time as >> the v? >> >> PETSc doesn't have code to efficiently dynamically change the size >> of a matrix. Thus generating a new matrix from a given sparse matrix >> plus a new row requires a complete copy of the starting matrix into >> the new matrix data structure. If you assemble the entire matrix >> together without first generating the smaller matrix A then it is >> easy; just generate the preallocation structure of A with the one >> additional row/column information and call MatSetValues() to put in >> the parts of A and the parts of v. >> >> Barry >> >> On Dec 8, 2009, at 4:05 PM, Anirban Chatterjee wrote: >> >>> Hi, >>> >>> I have an nxn matrix A, a column vector v and a scalar c. I want to >>> assemble a matrix B as follows, >>> B = [A v; >>> v^T c] >>> Can someone tell me the easiest and most efficient way to do this. >>> >>> --Anirban From arnold at umn.edu Fri Dec 18 18:16:24 2009 From: arnold at umn.edu (Douglas Arnold) Date: Fri, 18 Dec 2009 18:16:24 -0600 Subject: Assembling a matrix In-Reply-To: <3B4C55FA-9607-43EF-BAF4-9D723E61B7B5@mcs.anl.gov> References: <4B2C177F.3090308@umn.edu> <3B4C55FA-9607-43EF-BAF4-9D723E61B7B5@mcs.anl.gov> Message-ID: <4B2C1B58.90106@umn.edu> For me, two copies of the matrix is not a problem. That is what I was looking for but didn't find, something that efficiently copied a sparse matrix into a bigger sparse matrix. I would appreciate receiving the code for the sequential case, if it is not much bother for you. Thanks. -- Doug On 12/18/2009 06:12 PM, Barry Smith wrote: > > The issue is that the data structures that PETSc uses to store the > sparse matrices are not designed to allow changing the matrix size, thus > if you have the matrix A as a PETSc sparse matrix creating B means > copying the entire matrix, thus two copies of the matrix, more memory > usage. Now if memory is not an issue for you, the copying can be done > efficiently order nz work. I can send you code for the sequential case. > > If you don't want two copies of the matrix for memory reasons, could you > "lie" to the part of the code that generates A and have it create the A > with an extra row and column that it simply does not use? So in the > MatSetSizes() you just set it 1 larger then it is. Then call the > MatSetValues() to fill up A then call the MatSetValues() to put in the v > and c part without calling MatAssemblyBegin/End() in between and you > will have an efficient code in both time and memory usage. > > Barry > > On Dec 18, 2009, at 5:59 PM, Douglas Arnold wrote: > >> Anirban Chatterjee asked how to assemble an (n+1)x(n+1) sparse matrix >> >> B = [A v; >> v^T c] >> >> from an nxn sparse matrix A, a vector v, and a scalar c. Matt >> Knepley and Barry Smith advised against it. >> >> I have pretty much the same problem and I want to make sure I >> understand the situation. In my case, the matrix A comes to me >> from another application that I would rather not fiddle with. >> The rank of A is n-1 and v is a vector in its nullspace, c=0. I would >> like to solve a system with the matrix B by a direct solver, and >> so I think I need to assemble it. Do I understand correctly that >> there is no efficient way to do this in PETSc? Even in a sequential >> computation? >> >> -- Doug >> >> >>> Where will the "new" row live? On the last process, why that one? >>> >>> Does the matrix A have to be completely assembled before the v is >>> computed? Or can the entries of A be computed at the same time as the v? >>> >>> PETSc doesn't have code to efficiently dynamically change the size >>> of a matrix. Thus generating a new matrix from a given sparse matrix >>> plus a new row requires a complete copy of the starting matrix into >>> the new matrix data structure. If you assemble the entire matrix >>> together without first generating the smaller matrix A then it is >>> easy; just generate the preallocation structure of A with the one >>> additional row/column information and call MatSetValues() to put in >>> the parts of A and the parts of v. >>> >>> Barry >>> >>> On Dec 8, 2009, at 4:05 PM, Anirban Chatterjee wrote: >>> >>>> Hi, >>>> >>>> I have an nxn matrix A, a column vector v and a scalar c. I want to >>>> assemble a matrix B as follows, >>>> B = [A v; >>>> v^T c] >>>> Can someone tell me the easiest and most efficient way to do this. >>>> >>>> --Anirban > From niko.karin at gmail.com Sat Dec 19 07:07:53 2009 From: niko.karin at gmail.com (Karin&NiKo) Date: Sat, 19 Dec 2009 14:07:53 +0100 Subject: Assembling a matrix In-Reply-To: <4B2C1B58.90106@umn.edu> References: <4B2C177F.3090308@umn.edu> <3B4C55FA-9607-43EF-BAF4-9D723E61B7B5@mcs.anl.gov> <4B2C1B58.90106@umn.edu> Message-ID: Hi, I would also greatly appreciate reading this code! Perhaps, other users also would! Could you please post it on this mailing list or somewhere on PETSc's web site? Thanks, Nicolas 2009/12/19 Douglas Arnold > For me, two copies of the matrix is not a problem. That is what I was > looking for but didn't find, something that efficiently copied a sparse > matrix into a bigger sparse matrix. I would appreciate > receiving the code for the sequential case, if it is not much > bother for you. > > Thanks. -- Doug > > > On 12/18/2009 06:12 PM, Barry Smith wrote: > >> >> The issue is that the data structures that PETSc uses to store the >> sparse matrices are not designed to allow changing the matrix size, thus >> if you have the matrix A as a PETSc sparse matrix creating B means >> copying the entire matrix, thus two copies of the matrix, more memory >> usage. Now if memory is not an issue for you, the copying can be done >> efficiently order nz work. I can send you code for the sequential case. >> >> If you don't want two copies of the matrix for memory reasons, could you >> "lie" to the part of the code that generates A and have it create the A >> with an extra row and column that it simply does not use? So in the >> MatSetSizes() you just set it 1 larger then it is. Then call the >> MatSetValues() to fill up A then call the MatSetValues() to put in the v >> and c part without calling MatAssemblyBegin/End() in between and you >> will have an efficient code in both time and memory usage. >> >> Barry >> >> On Dec 18, 2009, at 5:59 PM, Douglas Arnold wrote: >> >> Anirban Chatterjee asked how to assemble an (n+1)x(n+1) sparse matrix >>> >>> B = [A v; >>> v^T c] >>> >>> from an nxn sparse matrix A, a vector v, and a scalar c. Matt >>> Knepley and Barry Smith advised against it. >>> >>> I have pretty much the same problem and I want to make sure I >>> understand the situation. In my case, the matrix A comes to me >>> from another application that I would rather not fiddle with. >>> The rank of A is n-1 and v is a vector in its nullspace, c=0. I would >>> like to solve a system with the matrix B by a direct solver, and >>> so I think I need to assemble it. Do I understand correctly that >>> there is no efficient way to do this in PETSc? Even in a sequential >>> computation? >>> >>> -- Doug >>> >>> >>> Where will the "new" row live? On the last process, why that one? >>>> >>>> Does the matrix A have to be completely assembled before the v is >>>> computed? Or can the entries of A be computed at the same time as the v? >>>> >>>> PETSc doesn't have code to efficiently dynamically change the size >>>> of a matrix. Thus generating a new matrix from a given sparse matrix >>>> plus a new row requires a complete copy of the starting matrix into >>>> the new matrix data structure. If you assemble the entire matrix >>>> together without first generating the smaller matrix A then it is >>>> easy; just generate the preallocation structure of A with the one >>>> additional row/column information and call MatSetValues() to put in >>>> the parts of A and the parts of v. >>>> >>>> Barry >>>> >>>> On Dec 8, 2009, at 4:05 PM, Anirban Chatterjee wrote: >>>> >>>> Hi, >>>>> >>>>> I have an nxn matrix A, a column vector v and a scalar c. I want to >>>>> assemble a matrix B as follows, >>>>> B = [A v; >>>>> v^T c] >>>>> Can someone tell me the easiest and most efficient way to do this. >>>>> >>>>> --Anirban >>>>> >>>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Sat Dec 19 14:55:40 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Sat, 19 Dec 2009 14:55:40 -0600 Subject: Assembling a matrix In-Reply-To: <4B2C1B58.90106@umn.edu> References: <4B2C177F.3090308@umn.edu> <3B4C55FA-9607-43EF-BAF4-9D723E61B7B5@mcs.anl.gov> <4B2C1B58.90106@umn.edu> Message-ID: <049FAC89-2490-481C-BE04-9C1514A5CFD8@mcs.anl.gov> Doug, Please find attached the sample program. I have also added it as src/mat/examples/tutorials/ex12.c in petsc-dev Barry On Dec 18, 2009, at 6:16 PM, Douglas Arnold wrote: > For me, two copies of the matrix is not a problem. That is what I > was looking for but didn't find, something that efficiently copied a > sparse matrix into a bigger sparse matrix. I would appreciate > receiving the code for the sequential case, if it is not much > bother for you. > > Thanks. -- Doug > > On 12/18/2009 06:12 PM, Barry Smith wrote: >> >> The issue is that the data structures that PETSc uses to store the >> sparse matrices are not designed to allow changing the matrix size, >> thus >> if you have the matrix A as a PETSc sparse matrix creating B means >> copying the entire matrix, thus two copies of the matrix, more memory >> usage. Now if memory is not an issue for you, the copying can be done >> efficiently order nz work. I can send you code for the sequential >> case. >> >> If you don't want two copies of the matrix for memory reasons, >> could you >> "lie" to the part of the code that generates A and have it create >> the A >> with an extra row and column that it simply does not use? So in the >> MatSetSizes() you just set it 1 larger then it is. Then call the >> MatSetValues() to fill up A then call the MatSetValues() to put in >> the v >> and c part without calling MatAssemblyBegin/End() in between and you >> will have an efficient code in both time and memory usage. >> >> Barry >> >> On Dec 18, 2009, at 5:59 PM, Douglas Arnold wrote: >> >>> Anirban Chatterjee asked how to assemble an (n+1)x(n+1) sparse >>> matrix >>> >>> B = [A v; >>> v^T c] >>> >>> from an nxn sparse matrix A, a vector v, and a scalar c. Matt >>> Knepley and Barry Smith advised against it. >>> >>> I have pretty much the same problem and I want to make sure I >>> understand the situation. In my case, the matrix A comes to me >>> from another application that I would rather not fiddle with. >>> The rank of A is n-1 and v is a vector in its nullspace, c=0. I >>> would >>> like to solve a system with the matrix B by a direct solver, and >>> so I think I need to assemble it. Do I understand correctly that >>> there is no efficient way to do this in PETSc? Even in a sequential >>> computation? >>> >>> -- Doug >>> >>> >>>> Where will the "new" row live? On the last process, why that one? >>>> >>>> Does the matrix A have to be completely assembled before the v is >>>> computed? Or can the entries of A be computed at the same time as >>>> the v? >>>> >>>> PETSc doesn't have code to efficiently dynamically change the size >>>> of a matrix. Thus generating a new matrix from a given sparse >>>> matrix >>>> plus a new row requires a complete copy of the starting matrix into >>>> the new matrix data structure. If you assemble the entire matrix >>>> together without first generating the smaller matrix A then it is >>>> easy; just generate the preallocation structure of A with the one >>>> additional row/column information and call MatSetValues() to put in >>>> the parts of A and the parts of v. >>>> >>>> Barry >>>> >>>> On Dec 8, 2009, at 4:05 PM, Anirban Chatterjee wrote: >>>> >>>>> Hi, >>>>> >>>>> I have an nxn matrix A, a column vector v and a scalar c. I want >>>>> to >>>>> assemble a matrix B as follows, >>>>> B = [A v; >>>>> v^T c] >>>>> Can someone tell me the easiest and most efficient way to do this. >>>>> >>>>> --Anirban >> -------------- next part -------------- A non-text attachment was scrubbed... Name: ex12.c Type: application/octet-stream Size: 3425 bytes Desc: not available URL: From hxie at umn.edu Mon Dec 21 15:04:59 2009 From: hxie at umn.edu (hxie at umn.edu) Date: 21 Dec 2009 15:04:59 -0600 Subject: installation problems in mac machine In-Reply-To: References: Message-ID: Hi, My operation system is Mac OS X 10.6.2. I unzip the petsc under /usr/local/petsc-3.0.0-p10. I use the following to configure petsc. ------- sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with-shared=0 --with-fc=gfortran ------- And I run the following commands: ---- export PETS_ARCH=darwin10.2.0-c-debug; PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR ---- When I run " sudo make all", it gives some errors: ----- makefile:15: /conf/base: No such file or directory makefile:16: /conf/test: No such file or directory make: *** No rule to make target `/conf/test'. Stop. ----- It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" gets "/bin/bash") Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the makefile file? Thanks. Bests, Hui From balay at mcs.anl.gov Mon Dec 21 15:10:00 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Mon, 21 Dec 2009 15:10:00 -0600 (CST) Subject: installation problems in mac machine In-Reply-To: References: Message-ID: Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables properly? Try 'sudo /bin/bash' and do the whole install in that shell. BTW: you have a typo with PETSC_ARCH further down.. And we recommend using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation builds. Satish On Mon, 21 Dec 2009, hxie at umn.edu wrote: > Hi, > > My operation system is Mac OS X 10.6.2. I unzip the petsc under > /usr/local/petsc-3.0.0-p10. > I use the following to configure petsc. > ------- > sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 > --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with-shared=0 > --with-fc=gfortran > ------- > > And I run the following commands: > ---- > export PETS_ARCH=darwin10.2.0-c-debug; > PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR > ---- > > When I run " sudo make all", it gives some errors: > ----- > makefile:15: /conf/base: No such file or directory > makefile:16: /conf/test: No such file or directory > make: *** No rule to make target `/conf/test'. Stop. > ----- > > It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" gets > "/bin/bash") > Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the makefile > file? Thanks. > > Bests, > Hui > > > > From dominik at itis.ethz.ch Mon Dec 21 15:13:56 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Mon, 21 Dec 2009 22:13:56 +0100 Subject: installation problems in mac machine In-Reply-To: References: Message-ID: <4B2FE514.2070900@itis.ethz.ch> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Why use sudo in the first place? I am not a mac user, but normally on unix sudo is the last thing you want to use during everyday work (provided that you are at all allowed to use it). Dominik Satish Balay wrote: > Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables > properly? > > Try 'sudo /bin/bash' and do the whole install in that shell. > > BTW: you have a typo with PETSC_ARCH further down.. And we recommend > using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation builds. > > Satish > > On Mon, 21 Dec 2009, hxie at umn.edu wrote: > >> Hi, >> >> My operation system is Mac OS X 10.6.2. I unzip the petsc under >> /usr/local/petsc-3.0.0-p10. >> I use the following to configure petsc. >> ------- >> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 >> --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with-shared=0 >> --with-fc=gfortran >> ------- >> >> And I run the following commands: >> ---- >> export PETS_ARCH=darwin10.2.0-c-debug; >> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR >> ---- >> >> When I run " sudo make all", it gives some errors: >> ----- >> makefile:15: /conf/base: No such file or directory >> makefile:16: /conf/test: No such file or directory >> make: *** No rule to make target `/conf/test'. Stop. >> ----- >> >> It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" gets >> "/bin/bash") >> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the makefile >> file? Thanks. >> >> Bests, >> Hui >> >> >> >> > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAksv5Q0ACgkQ/EBMh9bUuzJGugCgiCLXN7u5flIjSk2PRDEFMKRy KfUAn1kP90FbNBvFZNsvkIjNnEv4ovJX =KArD -----END PGP SIGNATURE----- From knepley at gmail.com Mon Dec 21 15:15:27 2009 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 21 Dec 2009 15:15:27 -0600 Subject: installation problems in mac machine In-Reply-To: <4B2FE514.2070900@itis.ethz.ch> References: <4B2FE514.2070900@itis.ethz.ch> Message-ID: On Mon, Dec 21, 2009 at 3:13 PM, Dominik Szczerba wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Why use sudo in the first place? > I am not a mac user, but normally on unix sudo is the last thing you > want to use during everyday work (provided that you are at all allowed > to use it). > Not sure why you would think that. In fact, sudo is the safe way to do things and recommended for everyday usage. Matt > Dominik > > Satish Balay wrote: > > Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables > > properly? > > > > Try 'sudo /bin/bash' and do the whole install in that shell. > > > > BTW: you have a typo with PETSC_ARCH further down.. And we recommend > > using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation builds. > > > > Satish > > > > On Mon, 21 Dec 2009, hxie at umn.edu wrote: > > > >> Hi, > >> > >> My operation system is Mac OS X 10.6.2. I unzip the petsc under > >> /usr/local/petsc-3.0.0-p10. > >> I use the following to configure petsc. > >> ------- > >> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 > >> --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with-shared=0 > >> --with-fc=gfortran > >> ------- > >> > >> And I run the following commands: > >> ---- > >> export PETS_ARCH=darwin10.2.0-c-debug; > >> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR > >> ---- > >> > >> When I run " sudo make all", it gives some errors: > >> ----- > >> makefile:15: /conf/base: No such file or directory > >> makefile:16: /conf/test: No such file or directory > >> make: *** No rule to make target `/conf/test'. Stop. > >> ----- > >> > >> It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" gets > >> "/bin/bash") > >> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the > makefile > >> file? Thanks. > >> > >> Bests, > >> Hui > >> > >> > >> > >> > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAksv5Q0ACgkQ/EBMh9bUuzJGugCgiCLXN7u5flIjSk2PRDEFMKRy > KfUAn1kP90FbNBvFZNsvkIjNnEv4ovJX > =KArD > -----END PGP SIGNATURE----- > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From balay at mcs.anl.gov Mon Dec 21 15:19:39 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Mon, 21 Dec 2009 15:19:39 -0600 (CST) Subject: installation problems in mac machine In-Reply-To: References: <4B2FE514.2070900@itis.ethz.ch> Message-ID: On Mon, 21 Dec 2009, Matthew Knepley wrote: > On Mon, Dec 21, 2009 at 3:13 PM, Dominik Szczerba wrote: > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Why use sudo in the first place? > > I am not a mac user, but normally on unix sudo is the last thing you > > want to use during everyday work (provided that you are at all allowed > > to use it). > > > > Not sure why you would think that. In fact, sudo is the safe way to > do things and recommended for everyday usage. :) If stuff needs to be in /usr or such system location - I usually recommend: sudo mkdir /usr/local/petsc sudo chown user:user /usr/local/petsc But if one really wants to install petsc as root on 'sudo' only machines - then I recommend getting a proper shell with 'sudo /bin/bash' Satish From dominik at itis.ethz.ch Mon Dec 21 15:20:05 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Mon, 21 Dec 2009 22:20:05 +0100 Subject: installation problems in mac machine In-Reply-To: References: <4B2FE514.2070900@itis.ethz.ch> Message-ID: <4B2FE685.1040808@itis.ethz.ch> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 With sudo you gain administrative rights (still depends on the actual sudoers config) - in principle you can harm your system by mistake (sudo rm -fr /usr/lib/* ...). That is why it is normally not allowed on large multiuser systems. It should be possible to use any non-system software without it. Dominik Matthew Knepley wrote: > On Mon, Dec 21, 2009 at 3:13 PM, Dominik Szczerba > wrote: > > Why use sudo in the first place? > I am not a mac user, but normally on unix sudo is the last thing you > want to use during everyday work (provided that you are at all allowed > to use it). > > >> Not sure why you would think that. In fact, sudo is the safe way to do >> things >> and recommended for everyday usage. > >> Matt > > > Dominik > > Satish Balay wrote: >> Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables >> properly? > >> Try 'sudo /bin/bash' and do the whole install in that shell. > >> BTW: you have a typo with PETSC_ARCH further down.. And we recommend >> using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation builds. > >> Satish > >> On Mon, 21 Dec 2009, hxie at umn.edu wrote: > >>> Hi, >>> >>> My operation system is Mac OS X 10.6.2. I unzip the petsc under >>> /usr/local/petsc-3.0.0-p10. >>> I use the following to configure petsc. >>> ------- >>> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 >>> --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with-shared=0 >>> --with-fc=gfortran >>> ------- >>> >>> And I run the following commands: >>> ---- >>> export PETS_ARCH=darwin10.2.0-c-debug; >>> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR >>> ---- >>> >>> When I run " sudo make all", it gives some errors: >>> ----- >>> makefile:15: /conf/base: No such file or directory >>> makefile:16: /conf/test: No such file or directory >>> make: *** No rule to make target `/conf/test'. Stop. >>> ----- >>> >>> It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" gets >>> "/bin/bash") >>> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the > makefile >>> file? Thanks. >>> >>> Bests, >>> Hui >>> >>> >>> >>> > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which > their experiments lead. > -- Norbert Wiener -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAksv5oUACgkQ/EBMh9bUuzLRRgCgouQAgRohpINl9jKpSk00V3LQ gq4AoM5hM6RilOkTp1wyIBHIxQSLlAOv =yY0a -----END PGP SIGNATURE----- From knepley at gmail.com Mon Dec 21 15:23:25 2009 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 21 Dec 2009 15:23:25 -0600 Subject: installation problems in mac machine In-Reply-To: <4B2FE685.1040808@itis.ethz.ch> References: <4B2FE514.2070900@itis.ethz.ch> <4B2FE685.1040808@itis.ethz.ch> Message-ID: On Mon, Dec 21, 2009 at 3:20 PM, Dominik Szczerba wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > With sudo you gain administrative rights (still depends on the actual > sudoers config) - in principle you can harm your system by mistake (sudo > rm -fr /usr/lib/* ...). That is why it is normally not allowed on large > multiuser systems. It should be possible to use any non-system software > without it. > Installation is almost always done with root permission. If you want to be pendatic, you can create other users for specific tasks, like the webserver, but you STILL sudo to that user. Matt > Dominik > > > Matthew Knepley wrote: > > On Mon, Dec 21, 2009 at 3:13 PM, Dominik Szczerba > > wrote: > > > > Why use sudo in the first place? > > I am not a mac user, but normally on unix sudo is the last thing you > > want to use during everyday work (provided that you are at all allowed > > to use it). > > > > > >> Not sure why you would think that. In fact, sudo is the safe way to do > >> things > >> and recommended for everyday usage. > > > >> Matt > > > > > > Dominik > > > > Satish Balay wrote: > >> Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables > >> properly? > > > >> Try 'sudo /bin/bash' and do the whole install in that shell. > > > >> BTW: you have a typo with PETSC_ARCH further down.. And we recommend > >> using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation builds. > > > >> Satish > > > >> On Mon, 21 Dec 2009, hxie at umn.edu wrote: > > > >>> Hi, > >>> > >>> My operation system is Mac OS X 10.6.2. I unzip the petsc under > >>> /usr/local/petsc-3.0.0-p10. > >>> I use the following to configure petsc. > >>> ------- > >>> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 > >>> --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with-shared=0 > >>> --with-fc=gfortran > >>> ------- > >>> > >>> And I run the following commands: > >>> ---- > >>> export PETS_ARCH=darwin10.2.0-c-debug; > >>> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR > >>> ---- > >>> > >>> When I run " sudo make all", it gives some errors: > >>> ----- > >>> makefile:15: /conf/base: No such file or directory > >>> makefile:16: /conf/test: No such file or directory > >>> make: *** No rule to make target `/conf/test'. Stop. > >>> ----- > >>> > >>> It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" gets > >>> "/bin/bash") > >>> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the > > makefile > >>> file? Thanks. > >>> > >>> Bests, > >>> Hui > >>> > >>> > >>> > >>> > > > > > > > -- > > What most experimenters take for granted before they begin their > > experiments is infinitely more interesting than any results to which > > their experiments lead. > > -- Norbert Wiener > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAksv5oUACgkQ/EBMh9bUuzLRRgCgouQAgRohpINl9jKpSk00V3LQ > gq4AoM5hM6RilOkTp1wyIBHIxQSLlAOv > =yY0a > -----END PGP SIGNATURE----- > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From balay at mcs.anl.gov Mon Dec 21 15:28:16 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Mon, 21 Dec 2009 15:28:16 -0600 (CST) Subject: installation problems in mac machine In-Reply-To: References: <4B2FE514.2070900@itis.ethz.ch> <4B2FE685.1040808@itis.ethz.ch> Message-ID: On Mon, 21 Dec 2009, Matthew Knepley wrote: > Installation is almost always done with root permission. If you > want to be pendatic, you can create other users for specific tasks, > like the webserver, but you STILL sudo to that user. In most cases - the part thats done as 'root' is minimised [to just copying files in sudo 'make install']. The rest of the stuff - where more complicated things are execute - is done as regular user. Satish From dominik at itis.ethz.ch Mon Dec 21 15:33:35 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Mon, 21 Dec 2009 22:33:35 +0100 Subject: installation problems in mac machine In-Reply-To: References: <4B2FE514.2070900@itis.ethz.ch> <4B2FE685.1040808@itis.ethz.ch> Message-ID: <4B2FE9AF.30307@itis.ethz.ch> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Matthew Knepley wrote: > On Mon, Dec 21, 2009 at 3:20 PM, Dominik Szczerba > wrote: > > With sudo you gain administrative rights (still depends on the actual > sudoers config) - in principle you can harm your system by mistake (sudo > rm -fr /usr/lib/* ...). That is why it is normally not allowed on large > multiuser systems. It should be possible to use any non-system software > without it. > > >> Installation is almost always done with root permission. If you want to >> be pendatic, >> you can create other users for specific tasks, like the webserver, but >> you STILL >> sudo to that user. - From Wikipedia: "The sudo (...) command is a program for some Unix and Unix-like computer operating systems that allows users to run programs with the security privileges of another user (normally the superuser, a.k.a. root)." If "another user" is the superuser (which it often is in popular linux distros) if you are lucky you can render your system non-bootable (if you are not you can lose data). I strongly discourage anybody using superuser for compilation - or God forbid - entrusting oneself to installation scripts of 3rd party programs on critical systems [*]. Dominik [*] General attitude, not just Petsc. > >> Matt > > > Dominik > > > Matthew Knepley wrote: >> On Mon, Dec 21, 2009 at 3:13 PM, Dominik Szczerba > >> >> wrote: > >> Why use sudo in the first place? >> I am not a mac user, but normally on unix sudo is the last thing you >> want to use during everyday work (provided that you are at all allowed >> to use it). > > >>> Not sure why you would think that. In fact, sudo is the safe way > to do >>> things >>> and recommended for everyday usage. > >>> Matt > > >> Dominik > >> Satish Balay wrote: >>> Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables >>> properly? > >>> Try 'sudo /bin/bash' and do the whole install in that shell. > >>> BTW: you have a typo with PETSC_ARCH further down.. And we recommend >>> using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation > builds. > >>> Satish > >>> On Mon, 21 Dec 2009, hxie at umn.edu > > wrote: > >>>> Hi, >>>> >>>> My operation system is Mac OS X 10.6.2. I unzip the petsc under >>>> /usr/local/petsc-3.0.0-p10. >>>> I use the following to configure petsc. >>>> ------- >>>> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 >>>> --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran > --with-shared=0 >>>> --with-fc=gfortran >>>> ------- >>>> >>>> And I run the following commands: >>>> ---- >>>> export PETS_ARCH=darwin10.2.0-c-debug; >>>> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR >>>> ---- >>>> >>>> When I run " sudo make all", it gives some errors: >>>> ----- >>>> makefile:15: /conf/base: No such file or directory >>>> makefile:16: /conf/test: No such file or directory >>>> make: *** No rule to make target `/conf/test'. Stop. >>>> ----- >>>> >>>> It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" > gets >>>> "/bin/bash") >>>> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the >> makefile >>>> file? Thanks. >>>> >>>> Bests, >>>> Hui >>>> >>>> >>>> >>>> > > > >> -- >> What most experimenters take for granted before they begin their >> experiments is infinitely more interesting than any results to which >> their experiments lead. >> -- Norbert Wiener > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which > their experiments lead. > -- Norbert Wiener -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAksv6akACgkQ/EBMh9bUuzI6OgCfbVX3klLEC1hxmvP3Oi+ONrC+ N+EAoK+JjmWiGo6MzszvRmoEK7p/vJao =UNSb -----END PGP SIGNATURE----- From hxie at umn.edu Mon Dec 21 15:34:02 2009 From: hxie at umn.edu (hxie at umn.edu) Date: 21 Dec 2009 15:34:02 -0600 Subject: installation problems in mac machine In-Reply-To: References: Message-ID: When I run "make all", I saw many warnings like --- f90_fwrap.F:124.72: subroutine F90Array2dCreateScalar(array,start1,len1, 1 Warning: Line truncated at (1) f90_fwrap.F:130.72: real(kind=selected_real_kind(10)), target :: --- It seems the it does not support f90. I smell something wrong, am I right? I installed the xcode and gfortran in the mac machine. On Dec 21 2009, petsc-users-request at mcs.anl.gov wrote: >Send petsc-users mailing list submissions to > petsc-users at mcs.anl.gov > >To subscribe or unsubscribe via the World Wide Web, visit > https://lists.mcs.anl.gov/mailman/listinfo/petsc-users >or, via email, send a message with subject or body 'help' to > petsc-users-request at mcs.anl.gov > >You can reach the person managing the list at > petsc-users-owner at mcs.anl.gov > >When replying, please edit your Subject line so it is more specific >than "Re: Contents of petsc-users digest..." > > >Today's Topics: > > 1. installation problems in mac machine (hxie at umn.edu) > 2. Re: installation problems in mac machine (Satish Balay) > 3. Re: installation problems in mac machine (Dominik Szczerba) > 4. Re: installation problems in mac machine (Matthew Knepley) > 5. Re: installation problems in mac machine (Satish Balay) > 6. Re: installation problems in mac machine (Dominik Szczerba) > 7. Re: installation problems in mac machine (Matthew Knepley) > > >---------------------------------------------------------------------- > >Message: 1 >Date: 21 Dec 2009 15:04:59 -0600 >From: hxie at umn.edu >Subject: installation problems in mac machine >To: petsc-users at mcs.anl.gov >Message-ID: >Content-Type: text/plain; format=flowed; charset=UTF-8 > >Hi, > >My operation system is Mac OS X 10.6.2. I unzip the petsc under >/usr/local/petsc-3.0.0-p10. >I use the following to configure petsc. >------- > sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 >--with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with-shared=0 >--with-fc=gfortran >------- > >And I run the following commands: >---- >export PETS_ARCH=darwin10.2.0-c-debug; >PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR >---- > >When I run " sudo make all", it gives some errors: >----- >makefile:15: /conf/base: No such file or directory >makefile:16: /conf/test: No such file or directory >make: *** No rule to make target `/conf/test'. Stop. >----- > >It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" gets >"/bin/bash") >Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the makefile >file? Thanks. > >Bests, >Hui > > > > > >------------------------------ > >Message: 2 >Date: Mon, 21 Dec 2009 15:10:00 -0600 (CST) >From: Satish Balay >Subject: Re: installation problems in mac machine >To: PETSc users list >Message-ID: >Content-Type: TEXT/PLAIN; charset=US-ASCII > >Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables >properly? > >Try 'sudo /bin/bash' and do the whole install in that shell. > >BTW: you have a typo with PETSC_ARCH further down.. And we recommend >using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation builds. > >Satish > >On Mon, 21 Dec 2009, hxie at umn.edu wrote: > >> Hi, >> >> My operation system is Mac OS X 10.6.2. I unzip the petsc under >> /usr/local/petsc-3.0.0-p10. >> I use the following to configure petsc. >> ------- >> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 >> --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with-shared=0 >> --with-fc=gfortran >> ------- >> >> And I run the following commands: >> ---- >> export PETS_ARCH=darwin10.2.0-c-debug; >> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR >> ---- >> >> When I run " sudo make all", it gives some errors: >> ----- >> makefile:15: /conf/base: No such file or directory >> makefile:16: /conf/test: No such file or directory >> make: *** No rule to make target `/conf/test'. Stop. >> ----- >> >> It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" gets >> "/bin/bash") >> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the makefile >> file? Thanks. >> >> Bests, >> Hui >> >> >> >> > > > >------------------------------ > >Message: 3 >Date: Mon, 21 Dec 2009 22:13:56 +0100 >From: Dominik Szczerba >Subject: Re: installation problems in mac machine >To: PETSc users list >Message-ID: <4B2FE514.2070900 at itis.ethz.ch> >Content-Type: text/plain; charset=US-ASCII > >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA1 > >Why use sudo in the first place? >I am not a mac user, but normally on unix sudo is the last thing you >want to use during everyday work (provided that you are at all allowed >to use it). > >Dominik > >Satish Balay wrote: >> Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables >> properly? >> >> Try 'sudo /bin/bash' and do the whole install in that shell. >> >> BTW: you have a typo with PETSC_ARCH further down.. And we recommend >> using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation builds. >> >> Satish >> >> On Mon, 21 Dec 2009, hxie at umn.edu wrote: >> >>> Hi, >>> >>> My operation system is Mac OS X 10.6.2. I unzip the petsc under >>> /usr/local/petsc-3.0.0-p10. >>> I use the following to configure petsc. >>> ------- >>> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 >>> --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with-shared=0 >>> --with-fc=gfortran >>> ------- >>> >>> And I run the following commands: >>> ---- >>> export PETS_ARCH=darwin10.2.0-c-debug; >>> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR >>> ---- >>> >>> When I run " sudo make all", it gives some errors: >>> ----- >>> makefile:15: /conf/base: No such file or directory >>> makefile:16: /conf/test: No such file or directory >>> make: *** No rule to make target `/conf/test'. Stop. >>> ----- >>> >>> It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" gets >>> "/bin/bash") >>> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the >>> makefile >>> file? Thanks. >>> >>> Bests, >>> Hui >>> >>> >>> >>> >> > >-----BEGIN PGP SIGNATURE----- >Version: GnuPG v1.4.9 (GNU/Linux) > >iEYEARECAAYFAksv5Q0ACgkQ/EBMh9bUuzJGugCgiCLXN7u5flIjSk2PRDEFMKRy >KfUAn1kP90FbNBvFZNsvkIjNnEv4ovJX >=KArD >-----END PGP SIGNATURE----- > > >------------------------------ > >Message: 4 >Date: Mon, 21 Dec 2009 15:15:27 -0600 >From: Matthew Knepley >Subject: Re: installation problems in mac machine >To: PETSc users list >Message-ID: > >Content-Type: text/plain; charset="iso-8859-1" > > On Mon, Dec 21, 2009 at 3:13 PM, Dominik Szczerba > wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Why use sudo in the first place? >> I am not a mac user, but normally on unix sudo is the last thing you >> want to use during everyday work (provided that you are at all allowed >> to use it). >> > >Not sure why you would think that. In fact, sudo is the safe way to do >things >and recommended for everyday usage. > > Matt > > >> Dominik >> >> Satish Balay wrote: >> > Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables >> > properly? >> > >> > Try 'sudo /bin/bash' and do the whole install in that shell. >> > >> > BTW: you have a typo with PETSC_ARCH further down.. And we recommend >> > using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation builds. >> > >> > Satish >> > >> > On Mon, 21 Dec 2009, hxie at umn.edu wrote: >> > >> >> Hi, >> >> >> >> My operation system is Mac OS X 10.6.2. I unzip the petsc under >> >> /usr/local/petsc-3.0.0-p10. >> >> I use the following to configure petsc. >> >> ------- >> >> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 >> >> --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with-shared=0 >> >> --with-fc=gfortran >> >> ------- >> >> >> >> And I run the following commands: >> >> ---- >> >> export PETS_ARCH=darwin10.2.0-c-debug; >> >> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR >> >> ---- >> >> >> >> When I run " sudo make all", it gives some errors: >> >> ----- >> >> makefile:15: /conf/base: No such file or directory >> >> makefile:16: /conf/test: No such file or directory >> >> make: *** No rule to make target `/conf/test'. Stop. >> >> ----- >> >> >> >> It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" gets >> >> "/bin/bash") >> >> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the >> makefile >> >> file? Thanks. >> >> >> >> Bests, >> >> Hui >> >> >> >> >> >> >> >> >> > >> >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.9 (GNU/Linux) >> >> iEYEARECAAYFAksv5Q0ACgkQ/EBMh9bUuzJGugCgiCLXN7u5flIjSk2PRDEFMKRy >> KfUAn1kP90FbNBvFZNsvkIjNnEv4ovJX >> =KArD >> -----END PGP SIGNATURE----- >> > > > > From knepley at gmail.com Mon Dec 21 15:35:26 2009 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 21 Dec 2009 15:35:26 -0600 Subject: installation problems in mac machine In-Reply-To: <4B2FE9AF.30307@itis.ethz.ch> References: <4B2FE514.2070900@itis.ethz.ch> <4B2FE685.1040808@itis.ethz.ch> <4B2FE9AF.30307@itis.ethz.ch> Message-ID: On Mon, Dec 21, 2009 at 3:33 PM, Dominik Szczerba wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Matthew Knepley wrote: > > On Mon, Dec 21, 2009 at 3:20 PM, Dominik Szczerba > > wrote: > > > > With sudo you gain administrative rights (still depends on the actual > > sudoers config) - in principle you can harm your system by mistake (sudo > > rm -fr /usr/lib/* ...). That is why it is normally not allowed on large > > multiuser systems. It should be possible to use any non-system software > > without it. > > > > > >> Installation is almost always done with root permission. If you want to > >> be pendatic, > >> you can create other users for specific tasks, like the webserver, but > >> you STILL > >> sudo to that user. > > - From Wikipedia: > > "The sudo (...) command is a program for some Unix and Unix-like > computer operating systems that allows users to run programs with the > security privileges of another user (normally the superuser, a.k.a. root)." > > If "another user" is the superuser (which it often is in popular linux > distros) if you are lucky you can render your system non-bootable (if > you are not you can lose data). > > I strongly discourage anybody using superuser for compilation - or God > forbid - entrusting oneself to installation scripts of 3rd party > programs on critical systems [*]. > So if its own Wikipedia, it must be correct. This is silly. Using sudo for installation is standard. If you do not want to do it, don't. Matt > Dominik > > [*] General attitude, not just Petsc. > > > > >> Matt > > > > > > Dominik > > > > > > Matthew Knepley wrote: > >> On Mon, Dec 21, 2009 at 3:13 PM, Dominik Szczerba > > > >> >> wrote: > > > >> Why use sudo in the first place? > >> I am not a mac user, but normally on unix sudo is the last thing you > >> want to use during everyday work (provided that you are at all allowed > >> to use it). > > > > > >>> Not sure why you would think that. In fact, sudo is the safe way > > to do > >>> things > >>> and recommended for everyday usage. > > > >>> Matt > > > > > >> Dominik > > > >> Satish Balay wrote: > >>> Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables > >>> properly? > > > >>> Try 'sudo /bin/bash' and do the whole install in that shell. > > > >>> BTW: you have a typo with PETSC_ARCH further down.. And we recommend > >>> using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation > > builds. > > > >>> Satish > > > >>> On Mon, 21 Dec 2009, hxie at umn.edu > > > wrote: > > > >>>> Hi, > >>>> > >>>> My operation system is Mac OS X 10.6.2. I unzip the petsc under > >>>> /usr/local/petsc-3.0.0-p10. > >>>> I use the following to configure petsc. > >>>> ------- > >>>> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 > >>>> --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran > > --with-shared=0 > >>>> --with-fc=gfortran > >>>> ------- > >>>> > >>>> And I run the following commands: > >>>> ---- > >>>> export PETS_ARCH=darwin10.2.0-c-debug; > >>>> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR > >>>> ---- > >>>> > >>>> When I run " sudo make all", it gives some errors: > >>>> ----- > >>>> makefile:15: /conf/base: No such file or directory > >>>> makefile:16: /conf/test: No such file or directory > >>>> make: *** No rule to make target `/conf/test'. Stop. > >>>> ----- > >>>> > >>>> It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" > > gets > >>>> "/bin/bash") > >>>> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the > >> makefile > >>>> file? Thanks. > >>>> > >>>> Bests, > >>>> Hui > >>>> > >>>> > >>>> > >>>> > > > > > > > >> -- > >> What most experimenters take for granted before they begin their > >> experiments is infinitely more interesting than any results to which > >> their experiments lead. > >> -- Norbert Wiener > > > > > -- > > What most experimenters take for granted before they begin their > > experiments is infinitely more interesting than any results to which > > their experiments lead. > > -- Norbert Wiener > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAksv6akACgkQ/EBMh9bUuzI6OgCfbVX3klLEC1hxmvP3Oi+ONrC+ > N+EAoK+JjmWiGo6MzszvRmoEK7p/vJao > =UNSb > -----END PGP SIGNATURE----- > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominik at itis.ethz.ch Mon Dec 21 15:58:18 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Mon, 21 Dec 2009 22:58:18 +0100 Subject: tag in subjects Message-ID: <4B2FEF7A.2090101@itis.ethz.ch> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Would it be desirable to have [Petsc] automatically prepended to all list messages? I am receiving loads of emails daily from multiple mailing lists and it would greatly help sorting. Dominik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAksv73QACgkQ/EBMh9bUuzKiJACdFt+A5n+vIYQ78Ufjb1TBOBoW vO4AoNcBF9K9vX3gElAl4TuDwzerYOlt =Evo9 -----END PGP SIGNATURE----- From balay at mcs.anl.gov Mon Dec 21 16:08:12 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Mon, 21 Dec 2009 16:08:12 -0600 (CST) Subject: [petsc-users] tag in subjects In-Reply-To: <4B2FEF7A.2090101@itis.ethz.ch> References: <4B2FEF7A.2090101@itis.ethz.ch> Message-ID: added now. Satish On Mon, 21 Dec 2009, Dominik Szczerba wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Would it be desirable to have [Petsc] automatically prepended to all > list messages? I am receiving loads of emails daily from multiple > mailing lists and it would greatly help sorting. > > Dominik > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAksv73QACgkQ/EBMh9bUuzKiJACdFt+A5n+vIYQ78Ufjb1TBOBoW > vO4AoNcBF9K9vX3gElAl4TuDwzerYOlt > =Evo9 > -----END PGP SIGNATURE----- > From dominik at itis.ethz.ch Mon Dec 21 16:23:42 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Mon, 21 Dec 2009 23:23:42 +0100 Subject: [petsc-users] tag in subjects In-Reply-To: References: <4B2FEF7A.2090101@itis.ethz.ch> Message-ID: <4B2FF56E.8060609@itis.ethz.ch> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thanks a lot! Satish Balay wrote: > added now. > > Satish > > On Mon, 21 Dec 2009, Dominik Szczerba wrote: > > Would it be desirable to have [Petsc] automatically prepended to all > list messages? I am receiving loads of emails daily from multiple > mailing lists and it would greatly help sorting. > > Dominik >> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAksv9WUACgkQ/EBMh9bUuzKlRACgpXAbXFo05VeeyrblgyOUHAf4 THoAn3r0iocAsyLhMXD7Y+Nyxi0u5oJm =bPCD -----END PGP SIGNATURE----- From u.tabak at tudelft.nl Mon Dec 21 17:01:31 2009 From: u.tabak at tudelft.nl (Umut Tabak) Date: Tue, 22 Dec 2009 00:01:31 +0100 Subject: [petsc-users] create a matrix in C++ constructor Message-ID: <4B2FFE4B.9040701@tudelft.nl> Dear all, I was trying to wrap around some Petsc code into a class, so that there is a neat interface and implementation, I got into a problem at the very beginning and did not understand the reason maybe some of you could help me to understand this. I have a Matrix A in the private section of my simple class. And I would like to create this matrix inside the class ctor. Whenever I call the MatCreate function I get a segmentation fault with MatCreate(MPI_COMM_SELF, &A) I checked the documentation that the Matrices in Petsc are also pointers. The point I did not understand is that if there is a pointer member of a class, say ... private: int* b ... I can initialize that to null in the constructor and make the necessary allocation with some member functions. With the same reasoning I thought that If I do not apply similar null pointer assignment for the matrix(there is not such thing I suppose) that I would like to initialize in the ctor, I will get a segfault. I could not figure my way out and wondered when you write the topdown code. I mean in the code below, Mat A; MatCreate(MPI_COMM_SELF, &A); MatSetSizes(A, m, n, 0, 0); MatSetType(A,MATSEQAIJ); "Mat A" initializes the pointer to null internally, am I right? Is there sth similar for the above class situation or am I mistaken at some other point(which could be highly likely)? Any pointers are appreciated. Umut From knepley at gmail.com Mon Dec 21 17:06:36 2009 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 21 Dec 2009 17:06:36 -0600 Subject: [petsc-users] create a matrix in C++ constructor In-Reply-To: <4B2FFE4B.9040701@tudelft.nl> References: <4B2FFE4B.9040701@tudelft.nl> Message-ID: On Mon, Dec 21, 2009 at 5:01 PM, Umut Tabak wrote: > Dear all, > > I was trying to wrap around some Petsc code into a class, so that there is > a neat interface and implementation, I got into a problem at the very > beginning and did not understand the reason maybe some of you could help me > to understand this. > > I have a Matrix A in the private section of my simple class. > > And I would like to create this matrix inside the class ctor. Whenever I > call the MatCreate function I get a segmentation fault with > Without seeing the code, we cannot say anything, but I bet you misdeclared A. Matt > MatCreate(MPI_COMM_SELF, &A) > > I checked the documentation that the Matrices in Petsc are also pointers. > > The point I did not understand is that if there is a pointer member of a > class, say > ... > private: > int* b > ... > > I can initialize that to null in the constructor and make the necessary > allocation with some member functions. With the same reasoning I thought > that If I do not apply similar null pointer assignment for the matrix(there > is not such thing I suppose) that I would like to initialize in the ctor, I > will get a segfault. I could not figure my way out and wondered when you > write the topdown code. I mean in the code below, > > Mat A; > > MatCreate(MPI_COMM_SELF, &A); > MatSetSizes(A, m, n, 0, 0); > MatSetType(A,MATSEQAIJ); > > "Mat A" initializes the pointer to null internally, am I right? Is there > sth similar for the above class situation or am I mistaken at some other > point(which could be highly likely)? > > Any pointers are appreciated. > Umut > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From u.tabak at tudelft.nl Mon Dec 21 17:11:51 2009 From: u.tabak at tudelft.nl (Umut Tabak) Date: Tue, 22 Dec 2009 00:11:51 +0100 Subject: [petsc-users] create a matrix in C++ constructor In-Reply-To: References: <4B2FFE4B.9040701@tudelft.nl> Message-ID: <4B3000B7.9040309@tudelft.nl> Matthew Knepley wrote: > On Mon, Dec 21, 2009 at 5:01 PM, Umut Tabak > wrote: > > Dear all, > > I was trying to wrap around some Petsc code into a class, so that > there is a neat interface and implementation, I got into a problem > at the very beginning and did not understand the reason maybe some > of you could help me to understand this. > > I have a Matrix A in the private section of my simple class. > > And I would like to create this matrix inside the class ctor. > Whenever I call the MatCreate function I get a segmentation fault with > > > Without seeing the code, we cannot say anything, but I bet you > misdeclared A. > > Dear Matthew, Here is my simple starter design, 8 class petscMatrix 9 { 10 public: 11 petscMatrix(); 12 petscMatrix(PetscInt, PetscInt, char) throw(std::runtime_error); 13 Mat* assignSubMatrix(); 14 int createMatrix(); 15 private: 16 Mat A; // Operation matrix 17 PetscInt m,n; // the row and column count 18 // of the matrix 19 char matType; 20 21}; And its implementation is: 15 petscMatrix::petscMatrix(PetscInt rowSz, PetscInt colSz, char t) throw(runtime_error) 16 { 17 try{ 18 switch(t) 19 { 20 case('d'): // dense 21 matType = t; 22 m = rowSz; 23 n = colSz; 24 case('D'): // dense 25 matType = t; 26 m = rowSz; 27 n = colSz; 28 case('s'): //sparse 29 matType = t; 30 m = rowSz; 31 n = colSz; 32 MatCreate(MPI_COMM_SELF, &A); 33 MatSetSizes(A, m, n, 0, 0); 34 MatSetType(A,MATSEQAIJ); 35 case('S'): //sparse 36 matType = t; 37 m = rowSz; 38 n = colSz; 39 default: 40 throw runtime_error("Matrix type not recognized\nMatrix not initialized\nExiting..."); 41 } 42 } 43 catch(runtime_error &e) 44 { 45 cout << e.what() << endl; 46 exit(1); 47 } 48 } Maybe I am too tired, most probably, there is sth easy that I am missing... From knepley at gmail.com Mon Dec 21 17:25:10 2009 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 21 Dec 2009 17:25:10 -0600 Subject: [petsc-users] create a matrix in C++ constructor In-Reply-To: <4B3000B7.9040309@tudelft.nl> References: <4B2FFE4B.9040701@tudelft.nl> <4B3000B7.9040309@tudelft.nl> Message-ID: Then it is not MatCreate() causing your SEGV. Matt On Mon, Dec 21, 2009 at 5:11 PM, Umut Tabak wrote: > Matthew Knepley wrote: > > On Mon, Dec 21, 2009 at 5:01 PM, Umut Tabak > u.tabak at tudelft.nl>> wrote: >> >> Dear all, >> >> I was trying to wrap around some Petsc code into a class, so that >> there is a neat interface and implementation, I got into a problem >> at the very beginning and did not understand the reason maybe some >> of you could help me to understand this. >> >> I have a Matrix A in the private section of my simple class. >> >> And I would like to create this matrix inside the class ctor. >> Whenever I call the MatCreate function I get a segmentation fault with >> >> >> Without seeing the code, we cannot say anything, but I bet you misdeclared >> A. >> >> >> > Dear Matthew, > > Here is my simple starter design, > 8 class petscMatrix > 9 { > 10 public: > 11 petscMatrix(); > 12 petscMatrix(PetscInt, PetscInt, char) > throw(std::runtime_error); > 13 Mat* assignSubMatrix(); > 14 int createMatrix(); > 15 private: > 16 Mat A; // Operation matrix > 17 PetscInt m,n; // the row and column count > 18 // of the matrix > 19 char matType; > 20 > 21}; > > > And its implementation is: > > 15 petscMatrix::petscMatrix(PetscInt rowSz, PetscInt colSz, char t) > throw(runtime_error) > 16 { > 17 try{ > 18 switch(t) > 19 { > 20 case('d'): // dense > 21 matType = t; > 22 m = rowSz; > 23 n = colSz; > 24 case('D'): // dense > 25 matType = t; > 26 m = rowSz; > 27 n = colSz; > 28 case('s'): //sparse > 29 matType = t; > 30 m = rowSz; > 31 n = colSz; > 32 MatCreate(MPI_COMM_SELF, &A); > 33 MatSetSizes(A, m, n, 0, 0); > 34 MatSetType(A,MATSEQAIJ); > 35 case('S'): //sparse > 36 matType = t; > 37 m = rowSz; > 38 n = colSz; > 39 default: > 40 throw runtime_error("Matrix type not recognized\nMatrix not > initialized\nExiting..."); > 41 } > 42 } > 43 catch(runtime_error &e) > 44 { > 45 cout << e.what() << endl; > 46 exit(1); > 47 } > 48 } > > Maybe I am too tired, most probably, there is sth easy that I am missing... > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From dalcinl at gmail.com Mon Dec 21 17:35:11 2009 From: dalcinl at gmail.com (=?UTF-8?Q?Lisandro_Dalc=C3=ADn?=) Date: Mon, 21 Dec 2009 20:35:11 -0300 Subject: [petsc-users] create a matrix in C++ constructor In-Reply-To: <4B2FFE4B.9040701@tudelft.nl> References: <4B2FFE4B.9040701@tudelft.nl> Message-ID: On Mon, Dec 21, 2009 at 8:01 PM, Umut Tabak wrote: > > "Mat A" initializes the pointer to null internally, am I right? > Mmm... do not rely on that behavior... I would explicitly initialize A(0) in the initialization list of every constructor... -- Lisandro Dalc?n --------------- Centro Internacional de M?todos Computacionales en Ingenier?a (CIMEC) Instituto de Desarrollo Tecnol?gico para la Industria Qu?mica (INTEC) Consejo Nacional de Investigaciones Cient?ficas y T?cnicas (CONICET) PTLC - G?emes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 From u.tabak at tudelft.nl Mon Dec 21 17:54:56 2009 From: u.tabak at tudelft.nl (Umut Tabak) Date: Tue, 22 Dec 2009 00:54:56 +0100 Subject: [petsc-users] create a matrix in C++ constructor In-Reply-To: References: <4B2FFE4B.9040701@tudelft.nl> <4B3000B7.9040309@tudelft.nl> Message-ID: <4B300AD0.4000501@tudelft.nl> Matthew Knepley wrote: > Then it is not MatCreate() causing your SEGV. > > Matt > Dear Matthew, Attached are the makefile and the test codes for this crash. When I check with ddd, I get the crash on that line. Best, Umut -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: makefile URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: petscMatrix.cc Type: text/x-c++src Size: 1587 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: petscMatrix.h Type: text/x-chdr Size: 507 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: testMatrix.cc Type: text/x-c++src Size: 114 bytes Desc: not available URL: From dalcinl at gmail.com Mon Dec 21 18:04:29 2009 From: dalcinl at gmail.com (=?UTF-8?Q?Lisandro_Dalc=C3=ADn?=) Date: Mon, 21 Dec 2009 21:04:29 -0300 Subject: [petsc-users] create a matrix in C++ constructor In-Reply-To: <4B300AD0.4000501@tudelft.nl> References: <4B2FFE4B.9040701@tudelft.nl> <4B3000B7.9040309@tudelft.nl> <4B300AD0.4000501@tudelft.nl> Message-ID: 2009/12/21 Umut Tabak : > Matthew Knepley wrote: >> >> Then it is not MatCreate() causing your SEGV. >> >> ?Matt >> > Dear Matthew, > > Attached are the makefile and the test codes for this crash. When I check > with ddd, I get the crash on that line. You forgot to call PetscInitialize()/PetscFinalize() in testMatrix.cc -- Lisandro Dalc?n --------------- Centro Internacional de M?todos Computacionales en Ingenier?a (CIMEC) Instituto de Desarrollo Tecnol?gico para la Industria Qu?mica (INTEC) Consejo Nacional de Investigaciones Cient?ficas y T?cnicas (CONICET) PTLC - G?emes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 From bsmith at mcs.anl.gov Mon Dec 21 18:32:40 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Mon, 21 Dec 2009 18:32:40 -0600 Subject: [petsc-users] installation problems in mac machine In-Reply-To: References: Message-ID: <8876DE7D-D392-4333-AF18-73D3B0632506@mcs.anl.gov> Please send this type of report to petsc-maint at mcs.anl.gov not petsc-users Please send configure.log and make.log to petsc-maint at mcs.anl.gov Barry On Dec 21, 2009, at 3:34 PM, hxie at umn.edu wrote: > > When I run "make all", I saw many warnings like > --- > f90_fwrap.F:124.72: > > subroutine > F90Array2dCreateScalar > (array > ,start1 > ,len1 > , 1 > Warning: Line truncated at (1) > f90_fwrap.F:130.72: > > real(kind=selected_real_kind(10)), > target :: --- > > It seems the it does not support f90. I smell something wrong, am I > right? I installed the xcode and gfortran in the mac machine. > > > On Dec 21 2009, petsc-users-request at mcs.anl.gov wrote: > >> Send petsc-users mailing list submissions to >> petsc-users at mcs.anl.gov >> >> To subscribe or unsubscribe via the World Wide Web, visit >> https://lists.mcs.anl.gov/mailman/listinfo/petsc-users >> or, via email, send a message with subject or body 'help' to >> petsc-users-request at mcs.anl.gov >> >> You can reach the person managing the list at >> petsc-users-owner at mcs.anl.gov >> >> When replying, please edit your Subject line so it is more specific >> than "Re: Contents of petsc-users digest..." >> >> >> Today's Topics: >> >> 1. installation problems in mac machine (hxie at umn.edu) >> 2. Re: installation problems in mac machine (Satish Balay) >> 3. Re: installation problems in mac machine (Dominik Szczerba) >> 4. Re: installation problems in mac machine (Matthew Knepley) >> 5. Re: installation problems in mac machine (Satish Balay) >> 6. Re: installation problems in mac machine (Dominik Szczerba) >> 7. Re: installation problems in mac machine (Matthew Knepley) >> >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: 21 Dec 2009 15:04:59 -0600 >> From: hxie at umn.edu >> Subject: installation problems in mac machine >> To: petsc-users at mcs.anl.gov >> Message-ID: >> Content-Type: text/plain; format=flowed; charset=UTF-8 >> >> Hi, >> >> My operation system is Mac OS X 10.6.2. I unzip the petsc under / >> usr/local/petsc-3.0.0-p10. >> I use the following to configure petsc. >> ------- >> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 --with-mpi- >> dir=/usr/local/mpich2-1.2.1 --with-fortran --with-shared=0 --with- >> fc=gfortran >> ------- >> >> And I run the following commands: >> ---- >> export PETS_ARCH=darwin10.2.0-c-debug; >> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR >> ---- >> >> When I run " sudo make all", it gives some errors: >> ----- >> makefile:15: /conf/base: No such file or directory >> makefile:16: /conf/test: No such file or directory >> make: *** No rule to make target `/conf/test'. Stop. >> ----- >> >> It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" >> gets "/bin/bash") >> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the >> makefile file? Thanks. >> >> Bests, >> Hui >> >> >> >> >> >> ------------------------------ >> >> Message: 2 >> Date: Mon, 21 Dec 2009 15:10:00 -0600 (CST) >> From: Satish Balay >> Subject: Re: installation problems in mac machine >> To: PETSc users list >> Message-ID: >> Content-Type: TEXT/PLAIN; charset=US-ASCII >> >> Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables >> properly? >> >> Try 'sudo /bin/bash' and do the whole install in that shell. >> >> BTW: you have a typo with PETSC_ARCH further down.. And we recommend >> using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation >> builds. >> >> Satish >> >> On Mon, 21 Dec 2009, hxie at umn.edu wrote: >> >>> Hi, >>> My operation system is Mac OS X 10.6.2. I unzip the petsc under >>> /usr/local/petsc-3.0.0-p10. >>> I use the following to configure petsc. >>> ------- >>> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 >>> --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with- >>> shared=0 >>> --with-fc=gfortran >>> ------- >>> And I run the following commands: >>> ---- >>> export PETS_ARCH=darwin10.2.0-c-debug; >>> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR >>> ---- >>> When I run " sudo make all", it gives some errors: >>> ----- >>> makefile:15: /conf/base: No such file or directory >>> makefile:16: /conf/test: No such file or directory >>> make: *** No rule to make target `/conf/test'. Stop. >>> ----- >>> It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" >>> gets >>> "/bin/bash") >>> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the >>> makefile >>> file? Thanks. >>> Bests, >>> Hui >> >> >> >> ------------------------------ >> >> Message: 3 >> Date: Mon, 21 Dec 2009 22:13:56 +0100 >> From: Dominik Szczerba >> Subject: Re: installation problems in mac machine >> To: PETSc users list >> Message-ID: <4B2FE514.2070900 at itis.ethz.ch> >> Content-Type: text/plain; charset=US-ASCII >> >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> Why use sudo in the first place? >> I am not a mac user, but normally on unix sudo is the last thing you >> want to use during everyday work (provided that you are at all >> allowed >> to use it). >> >> Dominik >> >> Satish Balay wrote: >>> Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables >>> properly? >>> Try 'sudo /bin/bash' and do the whole install in that shell. >>> BTW: you have a typo with PETSC_ARCH further down.. And we >>> recommend >>> using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation >>> builds. >>> Satish >>> On Mon, 21 Dec 2009, hxie at umn.edu wrote: >>>> Hi, >>>> >>>> My operation system is Mac OS X 10.6.2. I unzip the petsc under >>>> /usr/local/petsc-3.0.0-p10. >>>> I use the following to configure petsc. >>>> ------- >>>> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 >>>> --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with- >>>> shared=0 >>>> --with-fc=gfortran >>>> ------- >>>> >>>> And I run the following commands: >>>> ---- >>>> export PETS_ARCH=darwin10.2.0-c-debug; >>>> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR >>>> ---- >>>> >>>> When I run " sudo make all", it gives some errors: >>>> ----- >>>> makefile:15: /conf/base: No such file or directory >>>> makefile:16: /conf/test: No such file or directory >>>> make: *** No rule to make target `/conf/test'. Stop. >>>> ----- >>>> >>>> It seems it cannot find the PETSC_DIR. (I use x11. "echo $SHELL" >>>> gets >>>> "/bin/bash") >>>> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the >>>> makefile >>>> file? Thanks. >>>> >>>> Bests, >>>> Hui >>>> >>>> >>>> >>>> >> >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.9 (GNU/Linux) >> >> iEYEARECAAYFAksv5Q0ACgkQ/EBMh9bUuzJGugCgiCLXN7u5flIjSk2PRDEFMKRy >> KfUAn1kP90FbNBvFZNsvkIjNnEv4ovJX >> =KArD >> -----END PGP SIGNATURE----- >> >> >> ------------------------------ >> >> Message: 4 >> Date: Mon, 21 Dec 2009 15:15:27 -0600 >> From: Matthew Knepley >> Subject: Re: installation problems in mac machine >> To: PETSc users list >> Message-ID: >> >> Content-Type: text/plain; charset="iso-8859-1" >> >> On Mon, Dec 21, 2009 at 3:13 PM, Dominik Szczerba > >wrote: >> >>> -----BEGIN PGP SIGNED MESSAGE----- >>> Hash: SHA1 >>> >>> Why use sudo in the first place? >>> I am not a mac user, but normally on unix sudo is the last thing you >>> want to use during everyday work (provided that you are at all >>> allowed >>> to use it). >>> >> >> Not sure why you would think that. In fact, sudo is the safe way to >> do >> things >> and recommended for everyday usage. >> >> Matt >> >> >>> Dominik >>> >>> Satish Balay wrote: >>> > Perhaps 'sudo' is not proegating PETSC_DIR,PETSC_ARCH variables >>> > properly? >>> > >>> > Try 'sudo /bin/bash' and do the whole install in that shell. >>> > >>> > BTW: you have a typo with PETSC_ARCH further down.. And we >>> recommend >>> > using COPTFLAGS, FOPTFLAGS --with-debugging=0 for optimziation >>> builds. >>> > >>> > Satish >>> > >>> > On Mon, 21 Dec 2009, hxie at umn.edu wrote: >>> > >>> >> Hi, >>> >> >>> >> My operation system is Mac OS X 10.6.2. I unzip the petsc under >>> >> /usr/local/petsc-3.0.0-p10. >>> >> I use the following to configure petsc. >>> >> ------- >>> >> sudo ./config/configure.py --CFLAGS=-O3 --FFLAGS=-O3 >>> >> --with-mpi-dir=/usr/local/mpich2-1.2.1 --with-fortran --with- >>> shared=0 >>> >> --with-fc=gfortran >>> >> ------- >>> >> >>> >> And I run the following commands: >>> >> ---- >>> >> export PETS_ARCH=darwin10.2.0-c-debug; >>> >> PETSC_DIR=/usr/local/petsc-3.0.0-p10; export PETSC_DIR >>> >> ---- >>> >> >>> >> When I run " sudo make all", it gives some errors: >>> >> ----- >>> >> makefile:15: /conf/base: No such file or directory >>> >> makefile:16: /conf/test: No such file or directory >>> >> make: *** No rule to make target `/conf/test'. Stop. >>> >> ----- >>> >> >>> >> It seems it cannot find the PETSC_DIR. (I use x11. "echo >>> $SHELL" gets >>> >> "/bin/bash") >>> >> Do I need to add "PETSC_DIR = /usr/local/petsc-3.0.0-p10" in the >>> makefile >>> >> file? Thanks. >>> >> >>> >> Bests, >>> >> Hui >>> >> >>> >> >>> >> >>> >> >>> > >>> >>> -----BEGIN PGP SIGNATURE----- >>> Version: GnuPG v1.4.9 (GNU/Linux) >>> >>> iEYEARECAAYFAksv5Q0ACgkQ/EBMh9bUuzJGugCgiCLXN7u5flIjSk2PRDEFMKRy >>> KfUAn1kP90FbNBvFZNsvkIjNnEv4ovJX >>> =KArD >>> -----END PGP SIGNATURE----- >>> >> >> >> >> From Robert.G.Ellis at Shaw.ca Tue Dec 22 12:04:12 2009 From: Robert.G.Ellis at Shaw.ca (Rob Ellis) Date: Tue, 22 Dec 2009 10:04:12 -0800 Subject: [petsc-users] Two ways to set Vec values? In-Reply-To: <4B300AD0.4000501@tudelft.nl> References: <4B2FFE4B.9040701@tudelft.nl> <4B3000B7.9040309@tudelft.nl> <4B300AD0.4000501@tudelft.nl> Message-ID: <00f801ca8331$2b0144a0$8103cde0$@G.Ellis@Shaw.ca> Hi Petsc'ers Can someone please let me know if I can set MPI vector values using either of the following methods? I wish to set the values of 'x' from the values in 'work'. Both methods operate correctly, but I would like to know which is more efficient, and/or recommended and why. 1. GetArray/RestoreArray Method: call VecGetOwnershipRange(x,imin,imax,ierr) call VecGetArray(x,x_local_v,x_local_i,ierr) do i=imin,imax-1 x_local(i-imin)=work(i+1) enddo call VecRestoreArray(x,x_local_v,x_local_i,ierr) 2. SetValues/VecAssembly Method: call VecGetOwnershipRange(x,imin,imax,ierr) nx_local = imax-imin do i=imin,imax-1 icol(i-imin+1)=i enddo call VecSetValues(x,nx_local,icol,work(imin+1),INSERT_VALUES,ierr) call VecAssemblyBegin(x,ierr) call VecAssemblyEnd(x,ierr) Method 1 is more compact and does not require the auxiliary column number vector, nor does it require the VecAssembly, however, it seems to be what is suggested by the examples. Also, is it recommended to use VecGetArrayF90? Thanks for your help, Cheers, Rob From dave.mayhem23 at gmail.com Tue Dec 22 12:12:36 2009 From: dave.mayhem23 at gmail.com (Dave May) Date: Tue, 22 Dec 2009 19:12:36 +0100 Subject: [petsc-users] Two ways to set Vec values? In-Reply-To: <692894164009912716@unknownmsgid> References: <4B2FFE4B.9040701@tudelft.nl> <4B3000B7.9040309@tudelft.nl> <4B300AD0.4000501@tudelft.nl> <692894164009912716@unknownmsgid> Message-ID: <956373f0912221012t70a587e8nff2df0519333a657@mail.gmail.com> Hey Rob If you are sure that you only want to insert values locally into x, then option 1 will be faster. Option 2 will communicate values if the inserted values live on another processor. If you don't need to send any data, use Option 1. On Tue, Dec 22, 2009 at 7:04 PM, Rob Ellis wrote: > Hi Petsc'ers > > Can someone please let me know if I can set MPI vector values using either > of the following methods? I wish to set the values of 'x' from the values > in > 'work'. Both methods operate correctly, but I would like to know which is > more efficient, and/or recommended and why. > > > 1. GetArray/RestoreArray Method: > > call VecGetOwnershipRange(x,imin,imax,ierr) > call VecGetArray(x,x_local_v,x_local_i,ierr) > do i=imin,imax-1 > x_local(i-imin)=work(i+1) > enddo > call VecRestoreArray(x,x_local_v,x_local_i,ierr) > > > > 2. SetValues/VecAssembly Method: > > call VecGetOwnershipRange(x,imin,imax,ierr) > nx_local = imax-imin > do i=imin,imax-1 > icol(i-imin+1)=i > enddo > call VecSetValues(x,nx_local,icol,work(imin+1),INSERT_VALUES,ierr) > call VecAssemblyBegin(x,ierr) > call VecAssemblyEnd(x,ierr) > > > Method 1 is more compact and does not require the auxiliary column number > vector, nor does it require the VecAssembly, however, it seems to be what > is > suggested by the examples. Also, is it recommended to use VecGetArrayF90? > > Thanks for your help, > Cheers, > Rob > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Robert.G.Ellis at Shaw.ca Tue Dec 22 13:16:08 2009 From: Robert.G.Ellis at Shaw.ca (Rob Ellis) Date: Tue, 22 Dec 2009 11:16:08 -0800 Subject: [petsc-users] Two ways to set Vec values? In-Reply-To: <956373f0912221012t70a587e8nff2df0519333a657@mail.gmail.com> References: <4B2FFE4B.9040701@tudelft.nl> <4B3000B7.9040309@tudelft.nl> <4B300AD0.4000501@tudelft.nl> <692894164009912716@unknownmsgid> <956373f0912221012t70a587e8nff2df0519333a657@mail.gmail.com> Message-ID: <00fc01ca833b$371f2ea0$a55d8be0$@G.Ellis@Shaw.ca> Hi Dave, Thanks! That's what I needed to know. Cheers, Rob From: petsc-users-bounces at mcs.anl.gov [mailto:petsc-users-bounces at mcs.anl.gov] On Behalf Of Dave May Sent: Tuesday, December 22, 2009 10:13 AM To: PETSc users list Subject: Re: [petsc-users] Two ways to set Vec values? Hey Rob If you are sure that you only want to insert values locally into x, then option 1 will be faster. Option 2 will communicate values if the inserted values live on another processor. If you don't need to send any data, use Option 1. On Tue, Dec 22, 2009 at 7:04 PM, Rob Ellis wrote: Hi Petsc'ers Can someone please let me know if I can set MPI vector values using either of the following methods? I wish to set the values of 'x' from the values in 'work'. Both methods operate correctly, but I would like to know which is more efficient, and/or recommended and why. 1. GetArray/RestoreArray Method: call VecGetOwnershipRange(x,imin,imax,ierr) call VecGetArray(x,x_local_v,x_local_i,ierr) do i=imin,imax-1 x_local(i-imin)=work(i+1) enddo call VecRestoreArray(x,x_local_v,x_local_i,ierr) 2. SetValues/VecAssembly Method: call VecGetOwnershipRange(x,imin,imax,ierr) nx_local = imax-imin do i=imin,imax-1 icol(i-imin+1)=i enddo call VecSetValues(x,nx_local,icol,work(imin+1),INSERT_VALUES,ierr) call VecAssemblyBegin(x,ierr) call VecAssemblyEnd(x,ierr) Method 1 is more compact and does not require the auxiliary column number vector, nor does it require the VecAssembly, however, it seems to be what is suggested by the examples. Also, is it recommended to use VecGetArrayF90? Thanks for your help, Cheers, Rob -------------- next part -------------- An HTML attachment was scrubbed... URL: From jarunan at ascomp.ch Wed Dec 23 05:01:04 2009 From: jarunan at ascomp.ch (jarunan at ascomp.ch) Date: Wed, 23 Dec 2009 12:01:04 +0100 Subject: [petsc-users] KSPBuildResidual In-Reply-To: <00fc01ca833b$371f2ea0$a55d8be0$@G.Ellis@Shaw.ca> References: <4B2FFE4B.9040701@tudelft.nl> <4B3000B7.9040309@tudelft.nl> <4B300AD0.4000501@tudelft.nl> <692894164009912716@unknownmsgid> <956373f0912221012t70a587e8nff2df0519333a657@mail.gmail.com> <00fc01ca833b$371f2ea0$a55d8be0$@G.Ellis@Shaw.ca> Message-ID: <20091223120104.zmdv2i45c0wogsko@webmail.ascomp.ch> Dear Petsc-Team I am using KSPBuildResidual() to calculate true residual and use it as convergence criteria. It means the program will call KSPBuildResidual every iteration. I choose GMRES as a solver but I read in manual, it is written that this command is expensive for GMRES and some other solvers. Is it also expensive for BICGSTAB? Is there other possibility to calculate true residual without calling KSPBuildResidual() or KSPBuildSolution() ? Best regards, Jarunan Quoting Rob Ellis : > Hi Dave, > > Thanks! That's what I needed to know. > > Cheers, > > Rob > > > > From: petsc-users-bounces at mcs.anl.gov > [mailto:petsc-users-bounces at mcs.anl.gov] On Behalf Of Dave May > Sent: Tuesday, December 22, 2009 10:13 AM > To: PETSc users list > Subject: Re: [petsc-users] Two ways to set Vec values? > > > > Hey Rob > If you are sure that you only want to insert values locally into x, then > option 1 will be faster. > Option 2 will communicate values if the inserted values live on another > processor. If you don't need to send any data, use Option 1. > > > > > > On Tue, Dec 22, 2009 at 7:04 PM, Rob Ellis wrote: > > Hi Petsc'ers > > Can someone please let me know if I can set MPI vector values using either > of the following methods? I wish to set the values of 'x' from the values in > 'work'. Both methods operate correctly, but I would like to know which is > more efficient, and/or recommended and why. > > > 1. GetArray/RestoreArray Method: > > call VecGetOwnershipRange(x,imin,imax,ierr) > call VecGetArray(x,x_local_v,x_local_i,ierr) > do i=imin,imax-1 > x_local(i-imin)=work(i+1) > enddo > call VecRestoreArray(x,x_local_v,x_local_i,ierr) > > > > 2. SetValues/VecAssembly Method: > > call VecGetOwnershipRange(x,imin,imax,ierr) > nx_local = imax-imin > do i=imin,imax-1 > icol(i-imin+1)=i > enddo > call VecSetValues(x,nx_local,icol,work(imin+1),INSERT_VALUES,ierr) > call VecAssemblyBegin(x,ierr) > call VecAssemblyEnd(x,ierr) > > > Method 1 is more compact and does not require the auxiliary column number > vector, nor does it require the VecAssembly, however, it seems to be what is > suggested by the examples. Also, is it recommended to use VecGetArrayF90? > > Thanks for your help, > Cheers, > Rob > > > > -- Jarunan Panyasantisuk Development Engineer ASCOMP GmbH, Technoparkstr. 1 CH-8005 Zurich, Switzerland Phone : +41 44 445 4072 Fax : +41 44 445 4075 E-mail: jarunan at ascomp.ch www.ascomp.ch Winter Training on TransAT: Zurich, 20 Feb. 2010. http://ascomp.ch/training.html From bsmith at mcs.anl.gov Wed Dec 23 08:04:30 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Wed, 23 Dec 2009 08:04:30 -0600 Subject: [petsc-users] KSPBuildResidual In-Reply-To: <20091223120104.zmdv2i45c0wogsko@webmail.ascomp.ch> References: <4B2FFE4B.9040701@tudelft.nl> <4B3000B7.9040309@tudelft.nl> <4B300AD0.4000501@tudelft.nl> <692894164009912716@unknownmsgid> <956373f0912221012t70a587e8nff2df0519333a657@mail.gmail.com> <00fc01ca833b$371f2ea0$a55d8be0$@G.Ellis@Shaw.ca> <20091223120104.zmdv2i45c0wogsko@webmail.ascomp.ch> Message-ID: <6C20D028-2EB8-4A58-B8E5-613B40529AC5@mcs.anl.gov> If you want to use the true residual norm then use GMRES with right preconditioning. KSPSetPreconditionerSide() Barry On Dec 23, 2009, at 5:01 AM, jarunan at ascomp.ch wrote: > > Dear Petsc-Team > > I am using KSPBuildResidual() to calculate true residual and use it > as convergence criteria. It means the program will call > KSPBuildResidual every iteration. I choose GMRES as a solver but I > read in manual, it is written that this command is expensive for > GMRES and some other solvers. > > Is it also expensive for BICGSTAB? > Is there other possibility to calculate true residual without > calling KSPBuildResidual() or KSPBuildSolution() ? > > Best regards, > Jarunan > > > Quoting Rob Ellis : > >> Hi Dave, >> >> Thanks! That's what I needed to know. >> >> Cheers, >> >> Rob >> >> >> >> From: petsc-users-bounces at mcs.anl.gov >> [mailto:petsc-users-bounces at mcs.anl.gov] On Behalf Of Dave May >> Sent: Tuesday, December 22, 2009 10:13 AM >> To: PETSc users list >> Subject: Re: [petsc-users] Two ways to set Vec values? >> >> >> >> Hey Rob >> If you are sure that you only want to insert values locally into >> x, then >> option 1 will be faster. >> Option 2 will communicate values if the inserted values live on >> another >> processor. If you don't need to send any data, use Option 1. >> >> >> >> >> >> On Tue, Dec 22, 2009 at 7:04 PM, Rob Ellis >> wrote: >> >> Hi Petsc'ers >> >> Can someone please let me know if I can set MPI vector values using >> either >> of the following methods? I wish to set the values of 'x' from the >> values in >> 'work'. Both methods operate correctly, but I would like to know >> which is >> more efficient, and/or recommended and why. >> >> >> 1. GetArray/RestoreArray Method: >> >> call VecGetOwnershipRange(x,imin,imax,ierr) >> call VecGetArray(x,x_local_v,x_local_i,ierr) >> do i=imin,imax-1 >> x_local(i-imin)=work(i+1) >> enddo >> call VecRestoreArray(x,x_local_v,x_local_i,ierr) >> >> >> >> 2. SetValues/VecAssembly Method: >> >> call VecGetOwnershipRange(x,imin,imax,ierr) >> nx_local = imax-imin >> do i=imin,imax-1 >> icol(i-imin+1)=i >> enddo >> call VecSetValues(x,nx_local,icol,work(imin+1),INSERT_VALUES,ierr) >> call VecAssemblyBegin(x,ierr) >> call VecAssemblyEnd(x,ierr) >> >> >> Method 1 is more compact and does not require the auxiliary column >> number >> vector, nor does it require the VecAssembly, however, it seems to >> be what is >> suggested by the examples. Also, is it recommended to use >> VecGetArrayF90? >> >> Thanks for your help, >> Cheers, >> Rob >> >> >> >> > > > > -- > Jarunan Panyasantisuk > Development Engineer > ASCOMP GmbH, Technoparkstr. 1 > CH-8005 Zurich, Switzerland > Phone : +41 44 445 4072 > Fax : +41 44 445 4075 > E-mail: jarunan at ascomp.ch > www.ascomp.ch > > Winter Training on TransAT: Zurich, 20 Feb. 2010. > http://ascomp.ch/training.html From jarunan at ascomp.ch Wed Dec 23 10:11:58 2009 From: jarunan at ascomp.ch (jarunan at ascomp.ch) Date: Wed, 23 Dec 2009 17:11:58 +0100 Subject: [petsc-users] KSPBuildResidual In-Reply-To: <6C20D028-2EB8-4A58-B8E5-613B40529AC5@mcs.anl.gov> References: <4B2FFE4B.9040701@tudelft.nl> <4B3000B7.9040309@tudelft.nl> <4B300AD0.4000501@tudelft.nl> <692894164009912716@unknownmsgid> <956373f0912221012t70a587e8nff2df0519333a657@mail.gmail.com> <00fc01ca833b$371f2ea0$a55d8be0$@G.Ellis@Shaw.ca> <20091223120104.zmdv2i45c0wogsko@webmail.ascomp.ch> <6C20D028-2EB8-4A58-B8E5-613B40529AC5@mcs.anl.gov> Message-ID: <20091223171158.ywb8nuvzks048884@webmail.ascomp.ch> Thanks for the suggestion. Can I change residual norm from Norm 2 to infinity norm? Regards, Jarunan Quoting Barry Smith : > > If you want to use the true residual norm then use GMRES with right > preconditioning. KSPSetPreconditionerSide() > > Barry > > On Dec 23, 2009, at 5:01 AM, jarunan at ascomp.ch wrote: > >> >> Dear Petsc-Team >> >> I am using KSPBuildResidual() to calculate true residual and use it >> as convergence criteria. It means the program will call >> KSPBuildResidual every iteration. I choose GMRES as a solver but I >> read in manual, it is written that this command is expensive for >> GMRES and some other solvers. >> >> Is it also expensive for BICGSTAB? >> Is there other possibility to calculate true residual without >> calling KSPBuildResidual() or KSPBuildSolution() ? >> >> Best regards, >> Jarunan >> >> >> Quoting Rob Ellis : >> >>> Hi Dave, >>> >>> Thanks! That's what I needed to know. >>> >>> Cheers, >>> >>> Rob >>> >>> >>> >>> From: petsc-users-bounces at mcs.anl.gov >>> [mailto:petsc-users-bounces at mcs.anl.gov] On Behalf Of Dave May >>> Sent: Tuesday, December 22, 2009 10:13 AM >>> To: PETSc users list >>> Subject: Re: [petsc-users] Two ways to set Vec values? >>> >>> >>> >>> Hey Rob >>> If you are sure that you only want to insert values locally into x, then >>> option 1 will be faster. >>> Option 2 will communicate values if the inserted values live on another >>> processor. If you don't need to send any data, use Option 1. >>> >>> >>> >>> >>> >>> On Tue, Dec 22, 2009 at 7:04 PM, Rob Ellis wrote: >>> >>> Hi Petsc'ers >>> >>> Can someone please let me know if I can set MPI vector values using either >>> of the following methods? I wish to set the values of 'x' from the >>> values in >>> 'work'. Both methods operate correctly, but I would like to know which is >>> more efficient, and/or recommended and why. >>> >>> >>> 1. GetArray/RestoreArray Method: >>> >>> call VecGetOwnershipRange(x,imin,imax,ierr) >>> call VecGetArray(x,x_local_v,x_local_i,ierr) >>> do i=imin,imax-1 >>> x_local(i-imin)=work(i+1) >>> enddo >>> call VecRestoreArray(x,x_local_v,x_local_i,ierr) >>> >>> >>> >>> 2. SetValues/VecAssembly Method: >>> >>> call VecGetOwnershipRange(x,imin,imax,ierr) >>> nx_local = imax-imin >>> do i=imin,imax-1 >>> icol(i-imin+1)=i >>> enddo >>> call VecSetValues(x,nx_local,icol,work(imin+1),INSERT_VALUES,ierr) >>> call VecAssemblyBegin(x,ierr) >>> call VecAssemblyEnd(x,ierr) >>> >>> >>> Method 1 is more compact and does not require the auxiliary column number >>> vector, nor does it require the VecAssembly, however, it seems to >>> be what is >>> suggested by the examples. Also, is it recommended to use VecGetArrayF90? >>> >>> Thanks for your help, >>> Cheers, >>> Rob >>> >>> >>> >>> >> >> >> >> -- >> Jarunan Panyasantisuk >> Development Engineer >> ASCOMP GmbH, Technoparkstr. 1 >> CH-8005 Zurich, Switzerland >> Phone : +41 44 445 4072 >> Fax : +41 44 445 4075 >> E-mail: jarunan at ascomp.ch >> www.ascomp.ch >> >> Winter Training on TransAT: Zurich, 20 Feb. 2010. >> http://ascomp.ch/training.html -- Jarunan Panyasantisuk Development Engineer ASCOMP GmbH, Technoparkstr. 1 CH-8005 Zurich, Switzerland Phone : +41 44 445 4072 Fax : +41 44 445 4075 E-mail: jarunan at ascomp.ch www.ascomp.ch Winter Training on TransAT: Zurich, 20 Feb. 2010. http://ascomp.ch/training.html From hxie at umn.edu Wed Dec 23 13:46:07 2009 From: hxie at umn.edu (hxie at umn.edu) Date: 23 Dec 2009 13:46:07 -0600 Subject: [petsc-users] matrix visualization problem In-Reply-To: References: Message-ID: Hi, I installed all the packages in a mac machine. When I run " mpirun -np 4 ~/bin/cats3d.1 -mat_view_draw -draw_pause -1" under X11, I get some errors: ------ [0]PETSC ERROR: --------------------- Error Message ------------------------------------ [0]PETSC ERROR: Argument out of range! [0]PETSC ERROR: ASCII matrix output not allowed for matrices with more than 512 rows, us e binary format instead! ... MatAssemblyEnd error 63 ------ The matrix is with more than 512 rows. How can I use the binary format? Happy holiday, Hui From balay at mcs.anl.gov Wed Dec 23 13:57:13 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Wed, 23 Dec 2009 13:57:13 -0600 (CST) Subject: [petsc-users] matrix visualization problem In-Reply-To: References: Message-ID: well if you need -mat_view_draw - then suggest editing src/mat/impls/aij/mpi/mpiaij.c and increate this cut-off size. [there is now a command-line option to over-ride this limit in petsc-dev] For binary viewer - check mat/examples/tests/ex31.c Satish On Wed, 23 Dec 2009, hxie at umn.edu wrote: > Hi, > > I installed all the packages in a mac machine. When I run " mpirun -np 4 > ~/bin/cats3d.1 -mat_view_draw -draw_pause -1" under X11, I get some errors: > ------ > [0]PETSC ERROR: --------------------- Error Message > ------------------------------------ > [0]PETSC ERROR: Argument out of range! > [0]PETSC ERROR: ASCII matrix output not allowed for matrices with more than > 512 rows, us > e binary format instead! > > ... > MatAssemblyEnd error 63 > > ------ > > The matrix is with more than 512 rows. How can I use the binary format? > > Happy holiday, > Hui > From hxie at umn.edu Wed Dec 23 15:49:10 2009 From: hxie at umn.edu (hxie at umn.edu) Date: 23 Dec 2009 15:49:10 -0600 Subject: [petsc-users] matrix visualization problem In-Reply-To: References: Message-ID: Hi, Thanks. When I try to run with the option "-ksp_xmonitor", no window pops up. Do I need to reinstall the petsc with the option --with-x=1? BTW, if I want to use some external packages, do I have to reinstall the petsc? Happy holiday, Hui ------------- well if you need -mat_view_draw - then suggest editing src/mat/impls/aij/mpi/mpiaij.c and increate this cut-off size. [there is now a command-line option to over-ride this limit in petsc-dev] For binary viewer - check mat/examples/tests/ex31.c Satish From balay at mcs.anl.gov Wed Dec 23 15:57:09 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Wed, 23 Dec 2009 15:57:09 -0600 (CST) Subject: [petsc-users] matrix visualization problem In-Reply-To: References: Message-ID: On Wed, 23 Dec 2009, hxie at umn.edu wrote: > Hi, > > Thanks. When I try to run with the option "-ksp_xmonitor", no window pops up. > Do I need to reinstall the petsc with the option --with-x=1? use -ksp_monitor_draw > BTW, if I want to use some external packages, do I have to reinstall > the petsc? Yes. If you need multiple builds of PETSc -you can use a different PETSC_ARCH for each build. Satish From hxie at umn.edu Wed Dec 23 17:42:53 2009 From: hxie at umn.edu (hxie at umn.edu) Date: 23 Dec 2009 17:42:53 -0600 Subject: [petsc-users] matrix visualization problem In-Reply-To: References: Message-ID: Hi, I put the following in my code: ------ PetscViewer viewer ... call PetscViewerBinaryOpen(PETSC_COMM_WORLD,"matrix.dat",FILE_MODE_WRITE,viewer,pterr); call MatView(ptMat,viewer,pterr) call PetscViewerDestroy(viewer,pterr) ------ Still no window pops up. The code runs OK. Bests, Hui ----------------------- For binary viewer - check mat/examples/tests/ex31.c Satish ------------------------ From balay at mcs.anl.gov Wed Dec 23 18:01:02 2009 From: balay at mcs.anl.gov (Satish Balay) Date: Wed, 23 Dec 2009 18:01:02 -0600 (CST) Subject: [petsc-users] matrix visualization problem In-Reply-To: References: Message-ID: Binary viewer is to dump the matrix into a file - not a mat_view_draw wrt -mat_view_draw - I've already indicated what to do.. satish On Wed, 23 Dec 2009, hxie at umn.edu wrote: > Hi, > > I put the following in my code: > ------ > PetscViewer viewer ... > call > PetscViewerBinaryOpen(PETSC_COMM_WORLD,"matrix.dat",FILE_MODE_WRITE,viewer,pterr); > call MatView(ptMat,viewer,pterr) > call PetscViewerDestroy(viewer,pterr) > ------ > Still no window pops up. The code runs OK. > > Bests, > Hui > > > > ----------------------- > For binary viewer - check mat/examples/tests/ex31.c > > Satish > ------------------------ > From bsmith at mcs.anl.gov Sat Dec 26 15:19:35 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Sat, 26 Dec 2009 15:19:35 -0600 Subject: [petsc-users] KSPBuildResidual In-Reply-To: <20091223171158.ywb8nuvzks048884@webmail.ascomp.ch> References: <4B2FFE4B.9040701@tudelft.nl> <4B3000B7.9040309@tudelft.nl> <4B300AD0.4000501@tudelft.nl> <692894164009912716@unknownmsgid> <956373f0912221012t70a587e8nff2df0519333a657@mail.gmail.com> <00fc01ca833b$371f2ea0$a55d8be0$@G.Ellis@Shaw.ca> <20091223120104.zmdv2i45c0wogsko@webmail.ascomp.ch> <6C20D028-2EB8-4A58-B8E5-613B40529AC5@mcs.anl.gov> <20091223171158.ywb8nuvzks048884@webmail.ascomp.ch> Message-ID: No, the 2 norm of the residual comes out automatically from the GMRES algorithm. To use a different norm would require explicitly computing the residual (expensive) then computing the norm of that. Barry On Dec 23, 2009, at 10:11 AM, jarunan at ascomp.ch wrote: > > Thanks for the suggestion. > > Can I change residual norm from Norm 2 to infinity norm? > > > Regards, > Jarunan > > > > Quoting Barry Smith : > >> >> If you want to use the true residual norm then use GMRES with right >> preconditioning. KSPSetPreconditionerSide() >> >> Barry >> >> On Dec 23, 2009, at 5:01 AM, jarunan at ascomp.ch wrote: >> >>> >>> Dear Petsc-Team >>> >>> I am using KSPBuildResidual() to calculate true residual and use >>> it as convergence criteria. It means the program will call >>> KSPBuildResidual every iteration. I choose GMRES as a solver but >>> I read in manual, it is written that this command is expensive >>> for GMRES and some other solvers. >>> >>> Is it also expensive for BICGSTAB? >>> Is there other possibility to calculate true residual without >>> calling KSPBuildResidual() or KSPBuildSolution() ? >>> >>> Best regards, >>> Jarunan >>> >>> >>> Quoting Rob Ellis : >>> >>>> Hi Dave, >>>> >>>> Thanks! That's what I needed to know. >>>> >>>> Cheers, >>>> >>>> Rob >>>> >>>> >>>> >>>> From: petsc-users-bounces at mcs.anl.gov >>>> [mailto:petsc-users-bounces at mcs.anl.gov] On Behalf Of Dave May >>>> Sent: Tuesday, December 22, 2009 10:13 AM >>>> To: PETSc users list >>>> Subject: Re: [petsc-users] Two ways to set Vec values? >>>> >>>> >>>> >>>> Hey Rob >>>> If you are sure that you only want to insert values locally into >>>> x, then >>>> option 1 will be faster. >>>> Option 2 will communicate values if the inserted values live on >>>> another >>>> processor. If you don't need to send any data, use Option 1. >>>> >>>> >>>> >>>> >>>> >>>> On Tue, Dec 22, 2009 at 7:04 PM, Rob Ellis >>>> wrote: >>>> >>>> Hi Petsc'ers >>>> >>>> Can someone please let me know if I can set MPI vector values >>>> using either >>>> of the following methods? I wish to set the values of 'x' from >>>> the values in >>>> 'work'. Both methods operate correctly, but I would like to know >>>> which is >>>> more efficient, and/or recommended and why. >>>> >>>> >>>> 1. GetArray/RestoreArray Method: >>>> >>>> call VecGetOwnershipRange(x,imin,imax,ierr) >>>> call VecGetArray(x,x_local_v,x_local_i,ierr) >>>> do i=imin,imax-1 >>>> x_local(i-imin)=work(i+1) >>>> enddo >>>> call VecRestoreArray(x,x_local_v,x_local_i,ierr) >>>> >>>> >>>> >>>> 2. SetValues/VecAssembly Method: >>>> >>>> call VecGetOwnershipRange(x,imin,imax,ierr) >>>> nx_local = imax-imin >>>> do i=imin,imax-1 >>>> icol(i-imin+1)=i >>>> enddo >>>> call VecSetValues(x,nx_local,icol,work(imin+1),INSERT_VALUES,ierr) >>>> call VecAssemblyBegin(x,ierr) >>>> call VecAssemblyEnd(x,ierr) >>>> >>>> >>>> Method 1 is more compact and does not require the auxiliary >>>> column number >>>> vector, nor does it require the VecAssembly, however, it seems >>>> to be what is >>>> suggested by the examples. Also, is it recommended to use >>>> VecGetArrayF90? >>>> >>>> Thanks for your help, >>>> Cheers, >>>> Rob >>>> >>>> >>>> >>>> >>> >>> >>> >>> -- >>> Jarunan Panyasantisuk >>> Development Engineer >>> ASCOMP GmbH, Technoparkstr. 1 >>> CH-8005 Zurich, Switzerland >>> Phone : +41 44 445 4072 >>> Fax : +41 44 445 4075 >>> E-mail: jarunan at ascomp.ch >>> www.ascomp.ch >>> >>> Winter Training on TransAT: Zurich, 20 Feb. 2010. >>> http://ascomp.ch/training.html > > > > -- > Jarunan Panyasantisuk > Development Engineer > ASCOMP GmbH, Technoparkstr. 1 > CH-8005 Zurich, Switzerland > Phone : +41 44 445 4072 > Fax : +41 44 445 4075 > E-mail: jarunan at ascomp.ch > www.ascomp.ch > > Winter Training on TransAT: Zurich, 20 Feb. 2010. > http://ascomp.ch/training.html From mossaiby at yahoo.com Mon Dec 28 02:45:24 2009 From: mossaiby at yahoo.com (Farshid Mossaiby) Date: Mon, 28 Dec 2009 00:45:24 -0800 (PST) Subject: [petsc-users] A question In-Reply-To: Message-ID: <559961.3455.qm@web52202.mail.re2.yahoo.com> Hi all, Would somebody please suggest a *free* direct solver for a linux x64 SMP machine? Would be much better, if open source. Anybody has had success in compiling TAUCS with cilk support on linux x64? Best regards, Farshid Mossaiby From ventejuy at yahoo.es Mon Dec 28 03:29:14 2009 From: ventejuy at yahoo.es (ventejuy at yahoo.es) Date: Mon, 28 Dec 2009 09:29:14 -0000 Subject: [petsc-users] A question In-Reply-To: <559961.3455.qm@web52202.mail.re2.yahoo.com> References: <559961.3455.qm@web52202.mail.re2.yahoo.com> Message-ID: I use mumps and superlu, but really a don't know about the license of the code. Best regards, Ventejuy On Mon, 28 Dec 2009 08:45:24 -0000, Farshid Mossaiby wrote: > Hi all, > > Would somebody please suggest a *free* direct solver for a linux x64 SMP > machine? Would be much better, if open source. > > Anybody has had success in compiling TAUCS with cilk support on linux > x64? > > Best regards, > Farshid Mossaiby > > > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ From buerg at kit.edu Mon Dec 28 03:22:29 2009 From: buerg at kit.edu (=?ISO-8859-1?Q?Markus_B=FCrg?=) Date: Mon, 28 Dec 2009 10:22:29 +0100 Subject: [petsc-users] A question In-Reply-To: <559961.3455.qm@web52202.mail.re2.yahoo.com> References: <559961.3455.qm@web52202.mail.re2.yahoo.com> Message-ID: <4B3878D5.10909@kit.edu> Hello Farshid, what about MUMPS, PARDISO or UMFPACK? Best Regards, Markus Farshid Mossaiby schrieb: > Hi all, > > Would somebody please suggest a *free* direct solver for a linux x64 SMP machine? Would be much better, if open source. > > Anybody has had success in compiling TAUCS with cilk support on linux x64? > > Best regards, > Farshid Mossaiby > > > > > From yangchao at iscas.ac.cn Mon Dec 28 21:08:26 2009 From: yangchao at iscas.ac.cn (yangchao at iscas.ac.cn) Date: Tue, 29 Dec 2009 11:08:26 +0800 (CST) Subject: [petsc-users] Threading in petsc Message-ID: <3124.124.16.137.114.1262056106.squirrel@webmail.iscas.ac.cn> Hi Barry, Any example of the code you mentioned? Or any hint on how to do threading withing MPI process? Thanks in advance! Chao Yang On Dec 12, 2009, at 2:12 PM, Eugen Wintersberger wrote: > Hi there > I am entirely new to petsc. I would like to know if communication > between Jobs on a single node is done via threads or mpi. The standard model is to have 1 MPI process per core so there is no need for or use of threads. There is some code in place that allows one to have one MPI process per node and use threads within the node to compute the users nonlinear function. Barry > Thanks in advance > Eugen wintersberger From tyoung at ippt.gov.pl Tue Dec 29 05:10:23 2009 From: tyoung at ippt.gov.pl (Toby D. Young) Date: Tue, 29 Dec 2009 12:10:23 +0100 (CET) Subject: [petsc-users] Unexpected error in compile In-Reply-To: <3124.124.16.137.114.1262056106.squirrel@webmail.iscas.ac.cn> References: <3124.124.16.137.114.1262056106.squirrel@webmail.iscas.ac.cn> Message-ID: Hello, Possibly this is an easy problem to solve, but he has me stumped. Working on an ubuntu cluster, with petsc-3.0.0-p10 I get this error: mpif90 -c -fPIC -Wall -Wno-unused-variable -O -I/home/tyoung/research.code/petsc-3.0.0-p10/linux-gnu-cxx/include -I/home/tyoung/research.code/petsc-3.0.0-p10/include -I/usr/bin/include -o somefort.o somefort.F In file included from somefort.F:11: ../../../include/finclude/petsc.h:10: error: mpif.h: No such file or directory make[7]: [somefort.o] Error 1 (ignored) /usr/bin/ar cr /home/tyoung/research.code/petsc-3.0.0-p10/linux-gnu-cxx/lib/libpetsc.a somefort.o /usr/bin/ar: somefort.o: No such file or directory make[7]: [libf] Error 1 (ignored) I use the following configure sequence: ./config/configure.py --with-mpi=1 --with-shared=1 --with-clanguage=C++ --with-mpi-dir=/usr/bin --with-x=0 --with-debugging=0 Any ideas what I am missing? I guess a part of the UNIX base system(?) I've never seen this error message... :-( Thanks in advance for any pushes. Best, Toby ----- Toby D. Young Assistant Professor Philosophy-Physics Polish Academy of Sciences Warszawa, Polska www: http://www.ippt.gov.pl/~tyoung skype: stenografia From mossaiby at yahoo.com Tue Dec 29 07:07:41 2009 From: mossaiby at yahoo.com (Farshid Mossaiby) Date: Tue, 29 Dec 2009 05:07:41 -0800 (PST) Subject: [petsc-users] A question In-Reply-To: <4B3878D5.10909@kit.edu> Message-ID: <944577.92523.qm@web52202.mail.re2.yahoo.com> Thanks all for the replies and happy new year! I am also trying SuperLU MT for now. Anybody checked IBM Watson Sparse Matrix Package (not open source)? http://www.alphaworks.ibm.com/tech/wsmp/ Any hint on comparison between different solvers, in terms of performance and memory usage for FEM problems? Best regards, Farshid Mossaiby --- On Mon, 12/28/09, Markus B?rg wrote: > From: Markus B?rg > Subject: Re: [petsc-users] A question > To: "PETSc users list" > Date: Monday, December 28, 2009, 12:52 PM > Hello Farshid, > > what about MUMPS, PARDISO or UMFPACK? > > Best Regards, > Markus > > > > Farshid Mossaiby schrieb: > > Hi all, > > > > Would somebody please suggest a *free* direct solver > for a linux x64 SMP machine? Would be much better, if open > source. > > > > Anybody has had success in compiling TAUCS with cilk > support on linux x64? > > > > Best regards, > > Farshid Mossaiby > > > > > >? ? ??? > > > >??? > From knepley at gmail.com Tue Dec 29 07:08:11 2009 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 29 Dec 2009 07:08:11 -0600 Subject: [petsc-users] Unexpected error in compile In-Reply-To: References: <3124.124.16.137.114.1262056106.squirrel@webmail.iscas.ac.cn> Message-ID: It looks like your MPI installation was not built with Fortran bindings. Was it? If not, you can always using --download-mpich. Matt On Tue, Dec 29, 2009 at 5:10 AM, Toby D. Young wrote: > > > Hello, > > Possibly this is an easy problem to solve, but he has me stumped. > > Working on an ubuntu cluster, with petsc-3.0.0-p10 I get this error: > mpif90 -c -fPIC -Wall -Wno-unused-variable -O > -I/home/tyoung/research.code/petsc-3.0.0-p10/linux-gnu-cxx/include > -I/home/tyoung/research.code/petsc-3.0.0-p10/include -I/usr/bin/include > -o somefort.o somefort.F > In file included from somefort.F:11: > ../../../include/finclude/petsc.h:10: error: mpif.h: No such file or > directory > make[7]: [somefort.o] Error 1 (ignored) > /usr/bin/ar cr > /home/tyoung/research.code/petsc-3.0.0-p10/linux-gnu-cxx/lib/libpetsc.a > somefort.o > /usr/bin/ar: somefort.o: No such file or directory > make[7]: [libf] Error 1 (ignored) > > I use the following configure sequence: > ./config/configure.py --with-mpi=1 --with-shared=1 --with-clanguage=C++ > --with-mpi-dir=/usr/bin --with-x=0 --with-debugging=0 > > Any ideas what I am missing? I guess a part of the UNIX base system(?) > I've never seen this error message... :-( > > Thanks in advance for any pushes. > > Best, > Toby > > ----- > > Toby D. Young > Assistant Professor > Philosophy-Physics > Polish Academy of Sciences > Warszawa, Polska > > www: http://www.ippt.gov.pl/~tyoung > skype: stenografia > > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominik at itis.ethz.ch Tue Dec 29 16:38:21 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Tue, 29 Dec 2009 23:38:21 +0100 Subject: [petsc-users] removing small entries from a sparse matrix Message-ID: <4B3A84DD.9040408@itis.ethz.ch> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Is it possible to remove small (subject to given tol) entries in my sparse coefficient matrix after the values have been set (added)? I have a highly convective problem where I ask myself what's better, keep lots of explicit zeros to rescue constant non-zero pattern or eliminate the near-zero entries. Dominik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAks6hNcACgkQ/EBMh9bUuzI1HgCfZElssh2ARTcWCUi4u8GepkcA ljsAoNj6o87hSP9MqjgpC6jCelO098PV =JpNc -----END PGP SIGNATURE----- From knepley at gmail.com Tue Dec 29 16:47:31 2009 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 29 Dec 2009 16:47:31 -0600 Subject: [petsc-users] removing small entries from a sparse matrix In-Reply-To: <4B3A84DD.9040408@itis.ethz.ch> References: <4B3A84DD.9040408@itis.ethz.ch> Message-ID: This does not exist, but the right place would be to modify the behavior of MAT_IGNORE_ZERO_ENTRIES to use a tolerance. Matt On Tue, Dec 29, 2009 at 4:38 PM, Dominik Szczerba wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Is it possible to remove small (subject to given tol) entries in my > sparse coefficient matrix after the values have been set (added)? I have > a highly convective problem where I ask myself what's better, keep lots > of explicit zeros to rescue constant non-zero pattern or eliminate the > near-zero entries. > Dominik > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAks6hNcACgkQ/EBMh9bUuzI1HgCfZElssh2ARTcWCUi4u8GepkcA > ljsAoNj6o87hSP9MqjgpC6jCelO098PV > =JpNc > -----END PGP SIGNATURE----- > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Tue Dec 29 20:40:18 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Tue, 29 Dec 2009 20:40:18 -0600 Subject: [petsc-users] removing small entries from a sparse matrix In-Reply-To: <4B3A84DD.9040408@itis.ethz.ch> References: <4B3A84DD.9040408@itis.ethz.ch> Message-ID: <2828A463-0075-4D26-97F7-017368649915@mcs.anl.gov> Keep the small values. The nonzero structure will also help the convergence of most preconditioners. Barry On Dec 29, 2009, at 4:38 PM, Dominik Szczerba wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Is it possible to remove small (subject to given tol) entries in my > sparse coefficient matrix after the values have been set (added)? I > have > a highly convective problem where I ask myself what's better, keep > lots > of explicit zeros to rescue constant non-zero pattern or eliminate the > near-zero entries. > Dominik > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAks6hNcACgkQ/EBMh9bUuzI1HgCfZElssh2ARTcWCUi4u8GepkcA > ljsAoNj6o87hSP9MqjgpC6jCelO098PV > =JpNc > -----END PGP SIGNATURE----- From dominik at itis.ethz.ch Wed Dec 30 02:35:20 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Wed, 30 Dec 2009 09:35:20 +0100 Subject: [petsc-users] removing small entries from a sparse matrix In-Reply-To: <2828A463-0075-4D26-97F7-017368649915@mcs.anl.gov> References: <4B3A84DD.9040408@itis.ethz.ch> <2828A463-0075-4D26-97F7-017368649915@mcs.anl.gov> Message-ID: <4B3B10C8.5090103@itis.ethz.ch> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Have there been any studies in that matter? Anything I should cite to justify such choice? Dominik Barry Smith wrote: > Keep the small values. The nonzero structure will also help the > convergence of most preconditioners. > > Barry > > On Dec 29, 2009, at 4:38 PM, Dominik Szczerba wrote: > > Is it possible to remove small (subject to given tol) entries in my > sparse coefficient matrix after the values have been set (added)? I > have > a highly convective problem where I ask myself what's better, keep > lots > of explicit zeros to rescue constant non-zero pattern or eliminate the > near-zero entries. > Dominik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAks7EMAACgkQ/EBMh9bUuzJdyQCfSg2aGnJKfgg1QI9FBLBL8jBu prYAoNV08lipWo/SSYrL9nTHxfPfQcV5 =ilAT -----END PGP SIGNATURE----- From hxie at umn.edu Wed Dec 30 11:50:07 2009 From: hxie at umn.edu (hxie at umn.edu) Date: 30 Dec 2009 11:50:07 -0600 Subject: [petsc-users] How to dump the nonzero entries of matrix into a file? In-Reply-To: References: Message-ID: Hi, I am trying to dump the nonzero entries of matrix into a file. I did the following: ----- call PetscViewerBinaryOpen(PETSC_COMM_WORLD,"matrix.dat",FILE_MODE_WRITE,viewer,pterr) call MatView(ptMat,viewer,pterr) ----- Is that correct? The file has a very large size. Bests, Hui From knepley at gmail.com Wed Dec 30 11:52:42 2009 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 30 Dec 2009 11:52:42 -0600 Subject: [petsc-users] How to dump the nonzero entries of matrix into a file? In-Reply-To: References: Message-ID: Yes. On Wed, Dec 30, 2009 at 11:50 AM, wrote: > Hi, > > I am trying to dump the nonzero entries of matrix into a file. I did the > following: > ----- > call > PetscViewerBinaryOpen(PETSC_COMM_WORLD,"matrix.dat",FILE_MODE_WRITE,viewer,pterr) > call MatView(ptMat,viewer,pterr) > ----- > > Is that correct? The file has a very large size. > > Bests, > Hui > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: From hxie at umn.edu Wed Dec 30 12:17:29 2009 From: hxie at umn.edu (hxie at umn.edu) Date: 30 Dec 2009 12:17:29 -0600 Subject: [petsc-users] How to dump the nonzero entries of matrix into a file? In-Reply-To: References: Message-ID: Hi, Thanks. But if I try to dump it into an ascii file using the following: --- call PetscViewerASCIIOpen(PETSC_COMM_WORLD,"matrix.dat",FILE_MODE_WRITE,viewer,pterr) call PetscViewerSetFormat(viewer,PETSC_VIEWER_ASCII_MATLAB,pterr) call MatView(ptMat,viewer,pterr) --- It gives some errors: [0]PETSC ERROR: Caught signal number 10 BUS: Bus Error, possibly illegal memory access Bests, Hui From bsmith at mcs.anl.gov Wed Dec 30 12:36:05 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Wed, 30 Dec 2009 12:36:05 -0600 Subject: [petsc-users] How to dump the nonzero entries of matrix into a file? In-Reply-To: References: Message-ID: <747DEFA6-C884-4F0A-A278-DF7B55055A69@mcs.anl.gov> You are using the wrong calling sequence for PetscViewerASCIIOpen(). Also if you want to read the file in matlab you will do better to use the binary viewer. It will be much faster to save the file and read the file, plus the file will be smaller. Use bin/matlab/PetscBinaryRead.m to read in the binary file to Matlab Barry On Dec 30, 2009, at 12:17 PM, hxie at umn.edu wrote: > Hi, > Thanks. But if I try to dump it into an ascii file using the > following: > --- > call > PetscViewerASCIIOpen > (PETSC_COMM_WORLD,"matrix.dat",FILE_MODE_WRITE,viewer,pterr) > call > PetscViewerSetFormat(viewer,PETSC_VIEWER_ASCII_MATLAB,pterr) > call MatView(ptMat,viewer,pterr) > --- > > It gives some errors: > [0]PETSC ERROR: Caught signal number 10 BUS: Bus Error, possibly > illegal memory access > > > Bests, > Hui > From recrusader at gmail.com Wed Dec 30 14:02:37 2009 From: recrusader at gmail.com (Yujie) Date: Wed, 30 Dec 2009 14:02:37 -0600 Subject: [petsc-users] Any suggestion on solving complex number-based linear equation Message-ID: <7ff0ee010912301202w35cd5c6fr8fec9cfe79bb38fa@mail.gmail.com> Hi, PETSc Developers I am solving a complex number-based linear equation. The matrix is SPD. Do you have any suggestion on solver and preconditioner regarding PETSc and relevant external packages. Thanks a lot. Regards, Yujie -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominik at itis.ethz.ch Wed Dec 30 15:58:23 2009 From: dominik at itis.ethz.ch (Dominik Szczerba) Date: Wed, 30 Dec 2009 22:58:23 +0100 Subject: [petsc-users] diagonal preconditioner? Message-ID: <4B3BCCFF.3060508@itis.ethz.ch> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Does Petsc implement a diagonal preconditioner? The simplest I can see is Jacobi... Dominik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAks7zPoACgkQ/EBMh9bUuzL9LQCgnnIX6BiF0rYT70JjFxIZGfKB y7AAmgOH3Fbh93UEEs/UOCaX743ruDem =vUgf -----END PGP SIGNATURE----- From bsmith at mcs.anl.gov Wed Dec 30 16:12:32 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Wed, 30 Dec 2009 16:12:32 -0600 Subject: [petsc-users] diagonal preconditioner? In-Reply-To: <4B3BCCFF.3060508@itis.ethz.ch> References: <4B3BCCFF.3060508@itis.ethz.ch> Message-ID: <5674C143-779B-49F8-BC05-8EF53BAE3758@mcs.anl.gov> PCJACOBI supports the following options: -pc_jacobi_rowmax / PCJacobiSetUseRowMax() or -pc_jacobi_rowsum / PCJacobiSetUseRowSum() or -pc_jacobi_abs / PCJacobiSetUseAbs() or the default of just using the diagonal entry. If you want to use some other diagonal matrix to build the preconditioner then pass the diagonal matrix as the second matrix to KSPSetOperators() or SNESSetJacobian() and use Jacobi preconditioning with that matrix. Barry On Dec 30, 2009, at 3:58 PM, Dominik Szczerba wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Does Petsc implement a diagonal preconditioner? The simplest I can see > is Jacobi... > > Dominik > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAks7zPoACgkQ/EBMh9bUuzL9LQCgnnIX6BiF0rYT70JjFxIZGfKB > y7AAmgOH3Fbh93UEEs/UOCaX743ruDem > =vUgf > -----END PGP SIGNATURE----- From bsmith at mcs.anl.gov Wed Dec 30 16:13:12 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Wed, 30 Dec 2009 16:13:12 -0600 Subject: [petsc-users] removing small entries from a sparse matrix In-Reply-To: <4B3B10C8.5090103@itis.ethz.ch> References: <4B3A84DD.9040408@itis.ethz.ch> <2828A463-0075-4D26-97F7-017368649915@mcs.anl.gov> <4B3B10C8.5090103@itis.ethz.ch> Message-ID: <0E460E95-F340-4E9D-BAD5-7FD25DACC198@mcs.anl.gov> On Dec 30, 2009, at 2:35 AM, Dominik Szczerba wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Have there been any studies in that matter? Anything I should cite to > justify such choice? Not that I know of. Barry > > Dominik > > Barry Smith wrote: >> Keep the small values. The nonzero structure will also help the >> convergence of most preconditioners. >> >> Barry >> >> On Dec 29, 2009, at 4:38 PM, Dominik Szczerba wrote: >> >> Is it possible to remove small (subject to given tol) entries in my >> sparse coefficient matrix after the values have been set (added)? I >> have >> a highly convective problem where I ask myself what's better, keep >> lots >> of explicit zeros to rescue constant non-zero pattern or eliminate >> the >> near-zero entries. >> Dominik > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (GNU/Linux) > > iEYEARECAAYFAks7EMAACgkQ/EBMh9bUuzJdyQCfSg2aGnJKfgg1QI9FBLBL8jBu > prYAoNV08lipWo/SSYrL9nTHxfPfQcV5 > =ilAT > -----END PGP SIGNATURE----- From bsmith at mcs.anl.gov Wed Dec 30 16:30:23 2009 From: bsmith at mcs.anl.gov (Barry Smith) Date: Wed, 30 Dec 2009 16:30:23 -0600 Subject: [petsc-users] Threading in petsc In-Reply-To: <3124.124.16.137.114.1262056106.squirrel@webmail.iscas.ac.cn> References: <3124.124.16.137.114.1262056106.squirrel@webmail.iscas.ac.cn> Message-ID: Check out the manual pages for PetscOpenMPSpawn(), PetscOpenMPMerge(), PCOpenMPRun(), PetscOpenMPNew(), and their command line options. You can look at src/ksp/pc/impls/openmp/openmp.c to an example of how they are used. Note that it does NOT explicitly use OpenMP, it is a way for one to write OpenMP code that is used with PETSc. There are non-trivial concepts in this code and it is not recommended for most PETSc users who just want to solve some PDE or do some similar computation; they have no reason to use this code. You are on your own to understand this code if you want to play with it. Suggestions on how to improve it are appreciated. Barry On Dec 28, 2009, at 9:08 PM, yangchao at iscas.ac.cn wrote: > Hi Barry, > > Any example of the code you mentioned? Or any hint on how to do > threading withing > MPI process? > Thanks in advance! > > Chao Yang > > On Dec 12, 2009, at 2:12 PM, Eugen Wintersberger wrote: > >> Hi there >> I am entirely new to petsc. I would like to know if communication >> between Jobs on a single node is done via threads or mpi. > > The standard model is to have 1 MPI process per core so there is > no need for or use of threads. > > There is some code in place that allows one to have one MPI > process per node and use threads within the node to compute the users > nonlinear function. > > Barry > >> Thanks in advance >> Eugen wintersberger > > From yangchao at iscas.ac.cn Wed Dec 30 23:26:03 2009 From: yangchao at iscas.ac.cn (Chao Yang) Date: Thu, 31 Dec 2009 13:26:03 +0800 Subject: [petsc-users] Threading in petsc References: <3124.124.16.137.114.1262056106.squirrel@webmail.iscas.ac.cn>, Message-ID: <200912311326033420556@iscas.ac.cn> Hi Barry, Thanks a lot for shedding some lights on PETSc + OpenMP ! I will go into it when I think it's time. Cheers, ------------------ Chao Yang 2009-12-31 ------------------------------------------------------------- From: Barry Smith Date: 2009-12-31 06:25:05 To: yangchao; PETSc users list CC: Subject: Re: [petsc-users] Threading in petsc Check out the manual pages for PetscOpenMPSpawn(), PetscOpenMPMerge(), PCOpenMPRun(), PetscOpenMPNew(), and their command line options. You can look at src/ksp/pc/impls/openmp/openmp.c to an example of how they are used. Note that it does NOT explicitly use OpenMP, it is a way for one to write OpenMP code that is used with PETSc. There are non-trivial concepts in this code and it is not recommended for most PETSc users who just want to solve some PDE or do some similar computation; they have no reason to use this code. You are on your own to understand this code if you want to play with it. Suggestions on how to improve it are appreciated. Barry On Dec 28, 2009, at 9:08 PM, yangchao at iscas.ac.cn wrote: > Hi Barry, > > Any example of the code you mentioned? Or any hint on how to do > threading withing > MPI process? > Thanks in advance! > > Chao Yang > > On Dec 12, 2009, at 2:12 PM, Eugen Wintersberger wrote: > >> Hi there >> I am entirely new to petsc. I would like to know if communication >> between Jobs on a single node is done via threads or mpi. > > The standard model is to have 1 MPI process per core so there is > no need for or use of threads. > > There is some code in place that allows one to have one MPI > process per node and use threads within the node to compute the users > nonlinear function. > > Barry > >> Thanks in advance >> Eugen wintersberger > > From ventejuy at yahoo.es Thu Dec 31 07:05:37 2009 From: ventejuy at yahoo.es (Sr. Yo) Date: Thu, 31 Dec 2009 13:05:37 +0000 (GMT) Subject: [petsc-users] ADDing a row to another one Message-ID: <114247.16877.qm@web27003.mail.ukl.yahoo.com> Hi all, I'm trying to ADD(sum) a row into another on sparce matrix. I was looking for a function on PETSC documentation but no luck, so now a get the entire row to a PetscScalar and them ADD it to another row. It works but is slow, not elegant and no good for a sparce matrix. So, is there a smart way to do this?. Thanks. PD: the actual code is similar to ... // N_N --> number of columns of the matrix // fileHomo --> ifstream to a text file // *valor --> PetscScalar pointer; for(int i=0; i> n1 >> n2; // getting the entire row "n2" to valor ierr=MatGetValues(Pm_global,1,&n2,N_N,ptrFila,valor);CHKERRQ(ierr); // adding valor to "n1" row ierr=MatSetValues(Pm_global,1,&n1,N_N,ptrFila,valor,ADD_VALUES);CHKERRQ(ierr); MatAssemblyBegin(Pm_global,MAT_FINAL_ASSEMBLY); MatAssemblyEnd(Pm_global,MAT_FINAL_ASSEMBLY); } From jed at 59A2.org Thu Dec 31 09:05:07 2009 From: jed at 59A2.org (Jed Brown) Date: Thu, 31 Dec 2009 08:05:07 -0700 Subject: [petsc-users] ADDing a row to another one In-Reply-To: <114247.16877.qm@web27003.mail.ukl.yahoo.com> References: <114247.16877.qm@web27003.mail.ukl.yahoo.com> Message-ID: <87r5qb2nh8.fsf@59A2.org> On Thu, 31 Dec 2009 13:05:37 +0000 (GMT), "Sr. Yo" wrote: > Hi all, > I'm trying to ADD(sum) a row into another on sparce matrix. I was looking for a function on PETSC documentation but no luck, so now a get the entire row to a PetscScalar and them ADD it to another row. It works but is slow, not elegant and no good for a sparce matrix. So, is there a smart way to do this?. MatGetRow(A,source_row,&ncols,&cols,&vals); MatSetValues(A,1,&dest_row,ncols,cols,vals,ADD_VALUES); MatRestoreRow(A,source_row,&ncols,&cols,&vals); http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatGetRow.html Jed