From knepley at gmail.com Mon Oct 1 05:49:41 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 1 Oct 2018 06:49:41 -0400 Subject: [petsc-users] Fwd: Implementing a homotopy solver In-Reply-To: References: <6377AF62-D548-4276-A2A6-158EE4513593@anl.gov> <00D16613-4B28-4801-96EA-7CE2EF8BF8F7@imperial.ac.uk> <29B68A54-9D29-4881-AD80-98A5E510FD82@anl.gov> Message-ID: On Sun, Sep 30, 2018 at 6:06 PM zakaryah wrote: > OK, thanks. > > I'm using a composite DM, DM_packer. To make a separate KSP, I did the > following in the FormJacobian() routine, after assembling the Jacobian > matrix A and the RHS for the tangent vector, b: > > - KSPCreate(PETSC_COMM_WORLD,&ksp) > - KSPSetDM(ksp,DM_packer) > - KSPSetDMActive(ksp,PETSC_FALSE) - because I want to set the operators > - KSPSetOperators(ksp,A,P) > - VecSet(n,0) - set initial guess to zero > - KSPSolve(ksp,b,n) - this solve works correctly > - VecNormalize(n,NULL) > - > MatNullSpaceCreate(PetscObjectComm((PetscObject)A),PETSC_FALSE,1,&n,&nullsp) > - MatSetNullSpace(A,nullsp) > > Then, with -snes_type newtonls -pc_type none -ksp_monitor > -ksp_monitor_true_residual -ksp_view, the output for the KSPSolve described > above, i.e. for the tangent vector, looks correct: > > 0 KSP preconditioned resid norm 1.000000000000e+03 true resid norm > 1.000000000000e+03 ||r(i)||/||b|| 1.000000000000e+00 > ... > > 185 KSP preconditioned resid norm 9.900713131874e-03 true resid norm > 9.900713131904e-03 ||r(i)||/||b|| 9.900713131904e-06 > > Linear solve converged due to CONVERGED_RTOL iterations 185 > > KSP Object: 1 MPI processes > > type: gmres > > restart=30, using Classical (unmodified) Gram-Schmidt > Orthogonalization with no iterative refinement > > happy breakdown tolerance 1e-30 > > 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: 1 MPI processes > > type: none > > linear system matrix = precond matrix: > > Mat Object: 1 MPI processes > > type: seqaij > > rows=78247, cols=78247 > > total: nonzeros=6063481, allocated nonzeros=6063481 > > total number of mallocs used during MatSetValues calls =0 > > using I-node routines: found 26083 nodes, limit used is 5 > > > But the next KSP, i.e. the one in the SNES, doesn't converge in the true > residual: > > > 0 KSP preconditioned resid norm 2.045599092896e-04 true resid norm > 2.803828296212e-04 ||r(i)||/||b|| 1.000000000000e+00 > > 191 KSP preconditioned resid norm 2.009941278534e-09 true resid norm > 1.636010142734e-04 ||r(i)||/||b|| 5.834915586465e-01 > > > KSP Object: 1 MPI processes > > type: gmres > > restart=30, using Classical (unmodified) Gram-Schmidt > Orthogonalization with no iterative refinement > > happy breakdown tolerance 1e-30 > > 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: 1 MPI processes > > type: none > > linear system matrix = precond matrix: > > Mat Object: 1 MPI processes > > type: seqaij > > rows=78247, cols=78247 > > total: nonzeros=6063481, allocated nonzeros=6063481 > > total number of mallocs used during MatSetValues calls =0 > > has attached null space > > using I-node routines: found 26083 nodes, limit used is 5 > > > My guess about what's going on is that the tangent vector n isn't really > in the nullspace of A. > I do not understand the rest, but this is the problem. Maybe it would make more sense if you wrote things in linear algebraic notation. Thanks, Matt > Rather, it's in the nullspace of the m x (m+1) submatrix of A. So, An=c > e_{m+1}, where c is an arbitrary constant and e_{m+1} is the m+1 th basis > vector. The nonlinear function also has an added row, F_{m+1}, which is > set to zero in the FormFunction() routine. I don't care about the value of > F_{m+1}, but I suppose that if it's included in the true residual, and NOT > in the "preconditioned" residual, even with pc_type none, then it will be > tricky to diagnose the performance. Should I be using my own routine to > evaluate the residual, so that F_{m+1} is not included? > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From phil.tooley at sheffield.ac.uk Mon Oct 1 08:59:13 2018 From: phil.tooley at sheffield.ac.uk (Phil Tooley) Date: Mon, 1 Oct 2018 14:59:13 +0100 Subject: [petsc-users] DMDA with dimension of size 1 Message-ID: <754c2a19-a0cc-19dd-7449-aaddc91d507e@sheffield.ac.uk> Hi all, Is it valid to have a DMDA with one of the dimensions of size 1.? I was hoping to avoid having to write explicit logic to handle the case that I am working on a 2D rather than a 3D image for my current application.?? Unfortunately when I try to construct such a DMDA I get an error: [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: Overflow in integer operation: [0]PETSC ERROR: Mesh of 10 by 10 by 1 (dof) is too large for 32 bit indices Is there a workaround other than "write everything twice"? Thanks Phil -- Phil Tooley Research Software Engineering University of Sheffield From patrick.sanan at gmail.com Mon Oct 1 09:55:03 2018 From: patrick.sanan at gmail.com (Patrick Sanan) Date: Mon, 1 Oct 2018 16:55:03 +0200 Subject: [petsc-users] DMDA with dimension of size 1 In-Reply-To: <754c2a19-a0cc-19dd-7449-aaddc91d507e@sheffield.ac.uk> References: <754c2a19-a0cc-19dd-7449-aaddc91d507e@sheffield.ac.uk> Message-ID: Meshes of size 1 should work. Looks like there is a bug in the code to produce this error message (patch for maint attached). It's not outputting the "P" (size in the 3rd dimension) component. This is just speculation without a full error message or code to reproduce, but perhaps the size in the third dimension is an uninitialized value which is triggering this warning with a 10 x 10 x (huge garbage) x 1 (dof) mesh. Am Mo., 1. Okt. 2018 um 15:59 Uhr schrieb Phil Tooley < phil.tooley at sheffield.ac.uk>: > Hi all, > > Is it valid to have a DMDA with one of the dimensions of size 1. I was > hoping to avoid having to write explicit logic to handle the case that I > am working on a 2D rather than a 3D image for my current application. > Unfortunately when I try to construct such a DMDA I get an error: > > [0]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [0]PETSC ERROR: Overflow in integer operation: > [0]PETSC ERROR: Mesh of 10 by 10 by 1 (dof) is too large for 32 bit indices > > Is there a workaround other than "write everything twice"? > > Thanks > > Phil > > -- > Phil Tooley > Research Software Engineering > University of Sheffield > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-DMSetUp_DA_3D-fix-warning-message-for-int32-mesh-siz.patch Type: application/octet-stream Size: 1391 bytes Desc: not available URL: From patrick.sanan at gmail.com Mon Oct 1 09:57:16 2018 From: patrick.sanan at gmail.com (Patrick Sanan) Date: Mon, 1 Oct 2018 16:57:16 +0200 Subject: [petsc-users] DMDA with dimension of size 1 In-Reply-To: References: <754c2a19-a0cc-19dd-7449-aaddc91d507e@sheffield.ac.uk> Message-ID: Whoops, sent that patch too fast (forgot to update SETERRQ3 to SETERRQ4). Updated patch for maint attached. Am Mo., 1. Okt. 2018 um 16:55 Uhr schrieb Patrick Sanan < patrick.sanan at gmail.com>: > Meshes of size 1 should work. > > Looks like there is a bug in the code to produce this error message (patch > for maint attached). It's not outputting the "P" (size in the 3rd > dimension) component. > > This is just speculation without a full error message or code to > reproduce, but perhaps the size in the third dimension is an uninitialized > value which is triggering this warning with a 10 x 10 x (huge garbage) x 1 > (dof) mesh. > > Am Mo., 1. Okt. 2018 um 15:59 Uhr schrieb Phil Tooley < > phil.tooley at sheffield.ac.uk>: > >> Hi all, >> >> Is it valid to have a DMDA with one of the dimensions of size 1. I was >> hoping to avoid having to write explicit logic to handle the case that I >> am working on a 2D rather than a 3D image for my current application. >> Unfortunately when I try to construct such a DMDA I get an error: >> >> [0]PETSC ERROR: --------------------- Error Message >> -------------------------------------------------------------- >> [0]PETSC ERROR: Overflow in integer operation: >> [0]PETSC ERROR: Mesh of 10 by 10 by 1 (dof) is too large for 32 bit >> indices >> >> Is there a workaround other than "write everything twice"? >> >> Thanks >> >> Phil >> >> -- >> Phil Tooley >> Research Software Engineering >> University of Sheffield >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-DMSetUp_DA_3D-fix-warning-message-for-int32-mesh-siz.patch Type: application/octet-stream Size: 1391 bytes Desc: not available URL: From fdkong.jd at gmail.com Mon Oct 1 10:01:15 2018 From: fdkong.jd at gmail.com (Fande Kong) Date: Mon, 1 Oct 2018 09:01:15 -0600 Subject: [petsc-users] MatPtAPNumeric_MPIAIJ_MPIAIJ_scalable In-Reply-To: <878t3llzrm.fsf@jedbrown.org> References: <878t3llzrm.fsf@jedbrown.org> Message-ID: Thanks, Jed. I figured out. I just simply made P more sparse, then the product would not take too much memory. Fande, On Fri, Sep 28, 2018 at 9:59 PM Jed Brown wrote: > It depends entirely on your matrices. For example, if A is an arrowhead > matrix (graph of a star -- one hub and many leaves) then A^2 is dense. > If you have particular stencils for A and P, then we could tell you the > fill ratio. > > Fande Kong writes: > > > Hi All, > > > > I was wondering how much memory is required to get PtAP done? Do you have > > any simple formula to this? So that I can have an estimate. > > > > > > Fande, > > > > > > [132]PETSC ERROR: --------------------- Error Message > > -------------------------------------------------------------- > > [132]PETSC ERROR: Out of memory. This could be due to allocating > > [132]PETSC ERROR: too large an object or bleeding by not properly > > [132]PETSC ERROR: destroying unneeded objects. > > [132]PETSC ERROR: Memory allocated 0 Memory used by process 3249920 > > [132]PETSC ERROR: Try running with -malloc_dump or -malloc_log for info. > > [132]PETSC ERROR: Memory requested 89148704 > > [132]PETSC ERROR: See > http://www.mcs.anl.gov/petsc/documentation/faq.html > > for trouble shooting. > > [132]PETSC ERROR: Petsc Release Version 3.9.4, unknown > > [132]PETSC ERROR: ../../rattlesnake-opt on a arch-theta-avx512-64-opt > named > > nid03830 by fdkong Fri Sep 28 22:43:45 2018 > > [132]PETSC ERROR: Configure options --LIBS=-lstdc++ > > --known-64-bit-blas-indices=0 --known-bits-per-byte=8 > > --known-has-attribute-aligned=1 --known-level1-dcache-assoc=8 > > --known-level1-dcache-linesize=64 --known-level1-dcache-size=32768 > > --known-memcmp-ok=1 --known-mklspblas-supports-zero-based=0 > > --known-mpi-c-double-complex=1 --known-mpi-int64_t=1 > > --known-mpi-long-double=1 --known-mpi-shared-libraries=0 > > --known-sdot-returns-double=0 --known-sizeof-MPI_Comm=4 > > --known-sizeof-MPI_Fint=4 --known-sizeof-char=1 --known-sizeof-double=8 > > --known-sizeof-float=4 --known-sizeof-int=4 --known-sizeof-long-long=8 > > --known-sizeof-long=8 --known-sizeof-short=2 --known-sizeof-size_t=8 > > --known-sizeof-void-p=8 --known-snrm2-returns-double=0 --with-batch=1 > > --with-blaslapack-lib="-mkl > > -L/opt/intel/compilers_and_libraries_2018.0.128/linux/mkl/lib/intel64" > > --with-cc=cc --with-clib-autodetect=0 --with-cxx=CC > > --with-cxxlib-autodetect=0 --with-debugging=0 --with-fc=ftn > > --with-fortranlib-autodetect=0 --with-hdf5=0 --with-memalign=64 > > --with-mpiexec=aprun --with-shared-libraries=0 --download-metis=1 > > --download-parmetis=1 --download-superlu_dist=1 --download-hypre=1 > > --download-ptscotch=1 COPTFLAGS="-O3 -xMIC-AVX512" CXXOPTFLAGS="-O3 > > -xMIC-AVX512" FOPTFLAGS="-O3 -xMIC-AVX512" > > PETSC_ARCH=arch-theta-avx512-64-opt --with-64-bit-indices=1 > > [132]PETSC ERROR: #1 PetscSegBufferCreate() line 64 in > > /gpfs/mira-home/fdkong/petsc/src/sys/utils/segbuffer.c > > [132]PETSC ERROR: #2 PetscSegBufferCreate() line 64 in > > /gpfs/mira-home/fdkong/petsc/src/sys/utils/segbuffer.c > > [132]PETSC ERROR: #3 PetscSegBufferExtractInPlace() line 227 in > > /gpfs/mira-home/fdkong/petsc/src/sys/utils/segbuffer.c > > [132]PETSC ERROR: #4 MatStashScatterBegin_BTS() line 854 in > > /gpfs/mira-home/fdkong/petsc/src/mat/utils/matstash.c > > [132]PETSC ERROR: #5 MatStashScatterBegin_Private() line 461 in > > /gpfs/mira-home/fdkong/petsc/src/mat/utils/matstash.c > > [132]PETSC ERROR: #6 MatAssemblyBegin_MPIAIJ() line 683 in > > /gpfs/mira-home/fdkong/petsc/src/mat/impls/aij/mpi/mpiaij.c > > [132]PETSC ERROR: #7 MatAssemblyBegin() line 5158 in > > /gpfs/mira-home/fdkong/petsc/src/mat/interface/matrix.c > > [132]PETSC ERROR: #8 MatPtAPNumeric_MPIAIJ_MPIAIJ_scalable() line 262 in > > /gpfs/mira-home/fdkong/petsc/src/mat/impls/aij/mpi/mpiptap.c > > [132]PETSC ERROR: #9 MatPtAP_MPIAIJ_MPIAIJ() line 172 in > > /gpfs/mira-home/fdkong/petsc/src/mat/impls/aij/mpi/mpiptap.c > > [132]PETSC ERROR: #10 MatPtAP() line 9182 in > > /gpfs/mira-home/fdkong/petsc/src/mat/interface/matrix.c > > [132]PETSC ERROR: #11 MatGalerkin() line 10615 in > > /gpfs/mira-home/fdkong/petsc/src/mat/interface/matrix.c > > [132]PETSC ERROR: #12 PCSetUp_MG() line 730 in > > /gpfs/mira-home/fdkong/petsc/src/ksp/pc/impls/mg/mg.c > > [132]PETSC ERROR: #13 PCSetUp_HMG() line 336 in > > /gpfs/mira-home/fdkong/petsc/src/ksp/pc/impls/hmg/hmg.c > > [132]PETSC ERROR: #14 PCSetUp() line 923 in > > /gpfs/mira-home/fdkong/petsc/src/ksp/pc/interface/precon.c > > [132]PETSC ERROR: #15 KSPSetUp() line 381 in > > /gpfs/mira-home/fdkong/petsc/src/ksp/ksp/interface/itfunc.c > > [136]PETSC ERROR: --------------------- Error Message > > ---------------------------------------------------------- > -------------- next part -------------- An HTML attachment was scrubbed... URL: From phil.tooley at sheffield.ac.uk Mon Oct 1 10:04:03 2018 From: phil.tooley at sheffield.ac.uk (Phil Tooley) Date: Mon, 1 Oct 2018 16:04:03 +0100 Subject: [petsc-users] DMDA with dimension of size 1 In-Reply-To: References: <754c2a19-a0cc-19dd-7449-aaddc91d507e@sheffield.ac.uk> Message-ID: Hi Patrick, You are spot on, I was copying in a vector and not taking care to pad with 1s to length 3. Thanks Phil On 01/10/2018 15:57, Patrick Sanan wrote: > Whoops, sent that patch too fast (forgot to update SETERRQ3 to > SETERRQ4). Updated patch for maint attached. > > Am Mo., 1. Okt. 2018 um 16:55?Uhr schrieb Patrick Sanan > >: > > Meshes of size 1 should work. > > Looks like there is a bug in the code to produce this error > message (patch for maint attached). It's not outputting the "P" > (size in the 3rd dimension) component. > > This is just speculation without a full error message or code to > reproduce, but perhaps the size in the third dimension is an > uninitialized value which is triggering this warning with a 10 x > 10 x (huge garbage) x 1 (dof) mesh. > > Am Mo., 1. Okt. 2018 um 15:59?Uhr schrieb Phil Tooley > >: > > Hi all, > > Is it valid to have a DMDA with one of the dimensions of size > 1.? I was > hoping to avoid having to write explicit logic to handle the > case that I > am working on a 2D rather than a 3D image for my current > application.?? > Unfortunately when I try to construct such a DMDA I get an error: > > [0]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [0]PETSC ERROR: Overflow in integer operation: > [0]PETSC ERROR: Mesh of 10 by 10 by 1 (dof) is too large for > 32 bit indices > > Is there a workaround other than "write everything twice"? > > Thanks > > Phil > > -- > Phil Tooley > Research Software Engineering > University of Sheffield > -- Phil Tooley Research Software Engineering University of Sheffield -------------- next part -------------- An HTML attachment was scrubbed... URL: From ysjosh.lo at gmail.com Mon Oct 1 13:43:58 2018 From: ysjosh.lo at gmail.com (Josh L) Date: Mon, 1 Oct 2018 13:43:58 -0500 Subject: [petsc-users] Fortran undefined reference Message-ID: Hi, I am using PETSc makefile to compile my code. few DMPlex function , e.g. PetscPartitionerSetType, DMPlexGetCellNumbering etc, fails the linking(undefined reference to xxxxx). I am using PETSc/3.9. Anyone knows what is causing it ? Thanks, Josh -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Mon Oct 1 15:36:29 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 1 Oct 2018 16:36:29 -0400 Subject: [petsc-users] Fortran undefined reference In-Reply-To: References: Message-ID: On Mon, Oct 1, 2018 at 2:44 PM Josh L wrote: > Hi, > > I am using PETSc makefile to compile my code. few DMPlex function , > e.g. PetscPartitionerSetType, DMPlexGetCellNumbering etc, fails the > linking(undefined reference to xxxxx). I am using PETSc/3.9. > Anyone knows what is causing it ? > Yes. We have to write Fortran bindings by hand, so not all functions has them yet. Could you make a list of all the ones you want fixed, and I will do it? Thanks, Matt > Thanks, > Josh > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From weizhuo2 at illinois.edu Mon Oct 1 17:31:22 2018 From: weizhuo2 at illinois.edu (Weizhuo Wang) Date: Mon, 1 Oct 2018 17:31:22 -0500 Subject: [petsc-users] Increasing norm with finer mesh Message-ID: Hi! I'm recently trying out the example code provided with the KSP solver (ex12.c). I noticed that the mean norm of the grid increases as I use finer meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. However at m=100, n=100, mean norm increases to 9.55e-6. This seems counter intuitive, since most of the time error should decreases when using finer grid. Am I doing this wrong? Thanks! -- Wang Weizhuo -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Mon Oct 1 19:44:49 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 1 Oct 2018 20:44:49 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang wrote: > Hi! > > I'm recently trying out the example code provided with the KSP solver > (ex12.c). I noticed that the mean norm of the grid increases as I use finer > meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. However at > m=100, n=100, mean norm increases to 9.55e-6. This seems counter intuitive, > since most of the time error should decreases when using finer grid. Am I > doing this wrong? > The norm is misleading in that it is the l_2 norm, meaning just the sqrt of the sum of the squares of the vector entries. It should be scaled by the volume element to approximate a scale-independent norm (like the L_2 norm). Thanks, Matt > Thanks! > -- > Wang Weizhuo > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From weizhuo2 at illinois.edu Mon Oct 1 19:51:00 2018 From: weizhuo2 at illinois.edu (Weizhuo Wang) Date: Mon, 1 Oct 2018 19:51:00 -0500 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: I also tried to divide the norm by m*n , which is the number of grids, the trend of norm still increases. Thanks! Weizhuo Matthew Knepley ?2018?10?1??? ??7:45??? > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang wrote: > >> Hi! >> >> I'm recently trying out the example code provided with the KSP solver >> (ex12.c). I noticed that the mean norm of the grid increases as I use finer >> meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. However at >> m=100, n=100, mean norm increases to 9.55e-6. This seems counter intuitive, >> since most of the time error should decreases when using finer grid. Am I >> doing this wrong? >> > > The norm is misleading in that it is the l_2 norm, meaning just the sqrt > of the sum of the squares of > the vector entries. It should be scaled by the volume element to > approximate a scale-independent > norm (like the L_2 norm). > > Thanks, > > Matt > > >> Thanks! >> -- >> Wang Weizhuo >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -- Wang Weizhuo -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Mon Oct 1 19:56:46 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 1 Oct 2018 20:56:46 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: On Mon, Oct 1, 2018 at 8:51 PM Weizhuo Wang wrote: > I also tried to divide the norm by m*n , which is the number of grids, the > trend of norm still increases. > We need to be precise. First, look at the initial residual, because that is what you control with the initial guess. You are saying that the initial residual does not asymptote? I would be reluctant to believe that. Thanks, Matt > Thanks! > > Weizhuo > > Matthew Knepley ?2018?10?1??? ??7:45??? > >> On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang >> wrote: >> >>> Hi! >>> >>> I'm recently trying out the example code provided with the KSP solver >>> (ex12.c). I noticed that the mean norm of the grid increases as I use finer >>> meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. However at >>> m=100, n=100, mean norm increases to 9.55e-6. This seems counter intuitive, >>> since most of the time error should decreases when using finer grid. Am I >>> doing this wrong? >>> >> >> The norm is misleading in that it is the l_2 norm, meaning just the sqrt >> of the sum of the squares of >> the vector entries. It should be scaled by the volume element to >> approximate a scale-independent >> norm (like the L_2 norm). >> >> Thanks, >> >> Matt >> >> >>> Thanks! >>> -- >>> Wang Weizhuo >>> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > > > -- > Wang Weizhuo > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Mon Oct 1 23:03:49 2018 From: bsmith at mcs.anl.gov (Smith, Barry F.) Date: Tue, 2 Oct 2018 04:03:49 +0000 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: Please send your version of the example that computes the mean norm of the grid; I suspect we are talking apples and oranges Barry > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang wrote: > > I also tried to divide the norm by m*n , which is the number of grids, the trend of norm still increases. > > Thanks! > > Weizhuo > > Matthew Knepley ?2018?10?1??? ??7:45??? > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang wrote: > Hi! > > I'm recently trying out the example code provided with the KSP solver (ex12.c). I noticed that the mean norm of the grid increases as I use finer meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. However at m=100, n=100, mean norm increases to 9.55e-6. This seems counter intuitive, since most of the time error should decreases when using finer grid. Am I doing this wrong? > > The norm is misleading in that it is the l_2 norm, meaning just the sqrt of the sum of the squares of > the vector entries. It should be scaled by the volume element to approximate a scale-independent > norm (like the L_2 norm). > > Thanks, > > Matt > > Thanks! > -- > Wang Weizhuo > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > > -- > Wang Weizhuo From mfadams at lbl.gov Tue Oct 2 08:29:00 2018 From: mfadams at lbl.gov (Mark Adams) Date: Tue, 2 Oct 2018 09:29:00 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: As Matt said you should see the initial 2-norm residual asymptote to a constant with scaling, but it will rise. I prefer the max norm for this reason. You can use -ksp_monitor_max, but this does compute an extra residual, apparently, but I don't understand why it should ... If this does not asymptotic to constant and your problem is linear, you have a bug. On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang wrote: > Hi! > > I'm recently trying out the example code provided with the KSP solver > (ex12.c). I noticed that the mean norm of the grid increases as I use finer > meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. However at > m=100, n=100, mean norm increases to 9.55e-6. This seems counter intuitive, > since most of the time error should decreases when using finer grid. Am I > doing this wrong? > > Thanks! > -- > Wang Weizhuo > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david97sommer at gmail.com Tue Oct 2 09:58:21 2018 From: david97sommer at gmail.com (David Sommer) Date: Tue, 2 Oct 2018 16:58:21 +0200 Subject: [petsc-users] Parallel LU with MPIDENSE Message-ID: Hello, i was trying to solve a linear system with a MPIDENSE matrix. I did PC pc; KSPGetPC(solver, &pc); PCSetType(pc, PCLU); KSPSetOperators(solver, a_petsc, a_petsc); for some KSP solver and some Mat a_petsc. When i run the code sequentially (mpirun -n 1) it works, but once i start it in parallel it breaks with the error message *[0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/linearsolvertable.html for possible LU and Cholesky solvers [0]PETSC ERROR: Could not locate a solver package. Perhaps you must ./configure with --download- [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.9.3, unknown [0]PETSC ERROR: Unknown Name on a arch-linux2-c-debug named manjaroDesktop by david Tue Oct 2 16:47:10 2018 [0]PETSC ERROR: Configure options --download-superlu_dist --download-parmetis --download-metis --download-ptscotch [0]PETSC ERROR: #1 MatGetFactor() line 4328 in /home/david/lib/petsc/src/mat/interface/matrix.c * I recompiled petsc with the recommended options (and also trying some other options) but the error persists. on the linear solve table there is an X at the required solver package column for dense LU. What does it mean? On https://www.mcs.anl.gov/petsc/petsc-3.2/docs/linearsolvertable.html it says "PLAPACK". Did you deprecate it? What is the replacement? Thanks David Sommer -------------- next part -------------- An HTML attachment was scrubbed... URL: From yangyiwei.yang at mfm.tu-darmstadt.de Tue Oct 2 10:10:15 2018 From: yangyiwei.yang at mfm.tu-darmstadt.de (Y. Yang) Date: Tue, 2 Oct 2018 17:10:15 +0200 Subject: [petsc-users] UCX ERROR KNEM inline copy failed Message-ID: <4f35edc3-b2c3-5b93-7b95-cb60bc51fee8@mfm.tu-darmstadt.de> Dear PETSc team Recently I'm using MOOSE (http://www.mooseframework.org/) which is built with PETSc and, Unfortunately, I encountered some problems with following PETSc options: petsc_options_iname = '-pc_type -ksp_gmres_restart -sub_ksp_type -sub_pc_type -pc_asm_overlap -pc_factor_mat_solver_package' petsc_options_value = 'asm? ? ? ? ? 1201 ?preonly? ? ? ? ? ? ?ilu? ? ? ? ? ? ? ? ? ?4 ? ?superlu_dist' the error message is: Time Step 1, time = 1 ??????????????? dt = 1 ??? |residual|_2 of individual variables: ??????????????????????? c:?? 779.034 ??????????????????????? w:?? 0 ??????????????????????? T:?? 6.57948e+07 ??????????????????????? gr0: 211.617 ??????????????????????? gr1: 206.973 ??????????????????????? gr2: 209.382 ??????????????????????? gr3: 191.089 ??????????????????????? gr4: 185.242 ??????????????????????? gr5: 157.361 ??????????????????????? gr6: 128.473 ??????????????????????? gr7: 87.6029 ?0 Nonlinear |R| = 6.579482e+07 [1538482623.976180] [hpb0085:22501:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482605.111342] [hpb0085:22502:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482606.761138] [hpb0085:22502:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482607.107478] [hpb0085:22502:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482605.882817] [hpb0085:22503:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482607.133543] [hpb0085:22503:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482621.905475] [hpb0085:22510:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482626.531234] [hpb0085:22510:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482627.613343] [hpb0085:22515:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482627.830489] [hpb0085:22515:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482629.852351] [hpb0085:22515:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482630.194620] [hpb0085:22515:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482630.280636] [hpb0085:22515:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482600.219314] [hpb0085:22516:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482658.960350] [hpb0085:22516:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482622.949471] [hpb0085:22517:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482612.502017] [hpb0085:22500:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482613.231970] [hpb0085:22500:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482621.417530] [hpb0085:22520:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482622.020998] [hpb0085:22520:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482606.221292] [hpb0085:22521:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482606.676987] [hpb0085:22521:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482606.896865] [hpb0085:22521:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482639.611427] [hpb0085:22522:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482631.435277] [hpb0085:22523:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482658.278343] [hpb0085:22512:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482658.396945] [hpb0085:22512:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482659.917476] [hpb0085:22512:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument [1538482660.162064] [hpb0085:22512:0]??????? knem_ep.c:84?? UCX ERROR KNEM inline copy failed, err = -1 Invalid argument 2 total processes killed (some possibly by mpirun during cleanup) Here's the status of the simulation Parallelism: ? Num Processors:? ? ? ? ? 100 ? Num Threads:? ? ? ? ? ? ?1 Mesh: ? Parallel Type:? ? ? ? ? ?distributed ? Mesh Dimension:? ? ? ? ? 3 ? Spatial Dimension:? ? ? ?3 ? Nodes: ? ? Total:? ? ? ? ? ? ? ? ?2065551 ? ? Local:? ? ? ? ? ? ? ? ?22774 ? Elems: ? ? Total:? ? ? ? ? ? ? ? ?2000000 ? ? Local:? ? ? ? ? ? ? ? ?20006 ? Num Subdomains:? ? ? ? ? 1 ? Num Partitions:? ? ? ? ? 100 ? Partitioner:? ? ? ? ? ? ?parmetis Nonlinear System: ? Num DOFs:? ? ? ? ? ? ? ? 18589959 ? Num Local DOFs:? ? ? ? ? 204966 ? Variables:? ? ? ? ? ? ? ?{ "c" "w" "T" "gr0" "gr1" "gr2" "gr3" "gr4" "gr5" } ? Finite Element Types:? ? "LAGRANGE" ? Approximation Orders:? ? "FIRST" Auxiliary System: ? Num DOFs:? ? ? ? ? ? ? ? 10065551 ? Num Local DOFs:? ? ? ? ? 102798 ? Variables:? ? ? ? ? ? ? ?"bnds" { "var_indices" "unique_grains" } { "M" "dM/dT" } ? Finite Element Types:? ? "LAGRANGE" "MONOMIAL" "MONOMIAL" ? Approximation Orders:? ? "FIRST" "CONSTANT" "CONSTANT" Relationship Managers: ? Geometric? ? ? ? ? ? ? ? : GrainTrackerHaloRM (2 layers) Execution Information: ? Executioner:? ? ? ? ? ? ?Transient ? TimeStepper:? ? ? ? ? ? ?IterationAdaptiveDT ? Solver Mode:? ? ? ? ? ? ?Preconditioned JFNK I tried modifying the parameters and other preconditioning option, the problem is much the same. So I don't know where I did wrong or there is actually suitable PETSc option to deal with such problem with large mesh.?I would like to hear your response. Sincerely, Yang -- ______________________________________________________ Yangyiwei Yang Wissenschaftliche Hilfskraft TU Darmstadt Fachbereich 11 - Material- und Geowissenschaften Fachgebiet Mechanik funktionaler Materialien L1 | 08 402 Otto Berndt Stra?e 3 D-64287 Darmstadt Tel: +49 (0)6151-16-22923 Email: yangyiwei.yang at mfm.tu-darmstadt.de Homepage: http://www.mawi.tu-darmstadt.de/mfm ORCID: 0000-0001-5505-7117 ______________________________________________________ From knepley at gmail.com Tue Oct 2 10:21:01 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 2 Oct 2018 11:21:01 -0400 Subject: [petsc-users] UCX ERROR KNEM inline copy failed In-Reply-To: <4f35edc3-b2c3-5b93-7b95-cb60bc51fee8@mfm.tu-darmstadt.de> References: <4f35edc3-b2c3-5b93-7b95-cb60bc51fee8@mfm.tu-darmstadt.de> Message-ID: On Tue, Oct 2, 2018 at 11:16 AM Y. Yang wrote: > Dear PETSc team > > Recently I'm using MOOSE (http://www.mooseframework.org/) which is built > with PETSc and, Unfortunately, I encountered some problems with > following PETSc options: > I do not know what problem you are reporting.I don't know what package knem_ep.c is part of, but its not PETSc. Thanks, Matt > petsc_options_iname = '-pc_type -ksp_gmres_restart -sub_ksp_type > -sub_pc_type -pc_asm_overlap -pc_factor_mat_solver_package' > > petsc_options_value = 'asm 1201 preonly ilu > 4 superlu_dist' > > > the error message is: > > Time Step 1, time = 1 > dt = 1 > > |residual|_2 of individual variables: > c: 779.034 > w: 0 > T: 6.57948e+07 > gr0: 211.617 > gr1: 206.973 > gr2: 209.382 > gr3: 191.089 > gr4: 185.242 > gr5: 157.361 > gr6: 128.473 > gr7: 87.6029 > > 0 Nonlinear |R| = [32m6.579482e+07 [39m > [1538482623.976180] [hpb0085:22501:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482605.111342] [hpb0085:22502:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482606.761138] [hpb0085:22502:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482607.107478] [hpb0085:22502:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482605.882817] [hpb0085:22503:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482607.133543] [hpb0085:22503:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482621.905475] [hpb0085:22510:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482626.531234] [hpb0085:22510:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482627.613343] [hpb0085:22515:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482627.830489] [hpb0085:22515:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482629.852351] [hpb0085:22515:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482630.194620] [hpb0085:22515:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482630.280636] [hpb0085:22515:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482600.219314] [hpb0085:22516:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482658.960350] [hpb0085:22516:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482622.949471] [hpb0085:22517:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482612.502017] [hpb0085:22500:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482613.231970] [hpb0085:22500:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482621.417530] [hpb0085:22520:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482622.020998] [hpb0085:22520:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482606.221292] [hpb0085:22521:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482606.676987] [hpb0085:22521:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482606.896865] [hpb0085:22521:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482639.611427] [hpb0085:22522:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482631.435277] [hpb0085:22523:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482658.278343] [hpb0085:22512:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482658.396945] [hpb0085:22512:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482659.917476] [hpb0085:22512:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > [1538482660.162064] [hpb0085:22512:0] knem_ep.c:84 UCX ERROR > KNEM inline copy failed, err = -1 Invalid argument > 2 total processes killed (some possibly by mpirun during cleanup) > > > Here's the status of the simulation > > Parallelism: > Num Processors: 100 > Num Threads: 1 > > Mesh: > Parallel Type: distributed > Mesh Dimension: 3 > Spatial Dimension: 3 > Nodes: > Total: 2065551 > Local: 22774 > Elems: > Total: 2000000 > Local: 20006 > Num Subdomains: 1 > Num Partitions: 100 > Partitioner: parmetis > > Nonlinear System: > Num DOFs: 18589959 > Num Local DOFs: 204966 > Variables: { "c" "w" "T" "gr0" "gr1" "gr2" "gr3" "gr4" > "gr5" } > Finite Element Types: "LAGRANGE" > Approximation Orders: "FIRST" > > Auxiliary System: > Num DOFs: 10065551 > Num Local DOFs: 102798 > Variables: "bnds" { "var_indices" "unique_grains" } { > "M" "dM/dT" } > Finite Element Types: "LAGRANGE" "MONOMIAL" "MONOMIAL" > Approximation Orders: "FIRST" "CONSTANT" "CONSTANT" > > Relationship Managers: > Geometric : GrainTrackerHaloRM (2 layers) > > Execution Information: > Executioner: Transient > TimeStepper: IterationAdaptiveDT > Solver Mode: Preconditioned JFNK > > > I tried modifying the parameters and other preconditioning option, the > problem is much the same. So I don't know where I did wrong or there is > actually suitable PETSc option to deal with such problem with large > mesh. I would like to hear your response. > > Sincerely, > Yang > > -- > ______________________________________________________ > > Yangyiwei Yang > Wissenschaftliche Hilfskraft > > TU Darmstadt > Fachbereich 11 - Material- und Geowissenschaften > Fachgebiet Mechanik funktionaler Materialien > > L1 | 08 402 > Otto Berndt Stra?e 3 > D-64287 Darmstadt > > Tel: +49 (0)6151-16-22923 > Email: yangyiwei.yang at mfm.tu-darmstadt.de > Homepage: http://www.mawi.tu-darmstadt.de/mfm > ORCID: 0000-0001-5505-7117 > > ______________________________________________________ > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From hzhang at mcs.anl.gov Tue Oct 2 10:26:25 2018 From: hzhang at mcs.anl.gov (Zhang, Hong) Date: Tue, 2 Oct 2018 15:26:25 +0000 Subject: [petsc-users] Parallel LU with MPIDENSE In-Reply-To: References: Message-ID: David : Petsc does not support parallel LU. For dense matrix, you can use Elemental. See example petsc/src/ksp/ksp/examples/tests/ex40.c Hong Hello, i was trying to solve a linear system with a MPIDENSE matrix. I did PC pc; KSPGetPC(solver, &pc); PCSetType(pc, PCLU); KSPSetOperators(solver, a_petsc, a_petsc); for some KSP solver and some Mat a_petsc. When i run the code sequentially (mpirun -n 1) it works, but once i start it in parallel it breaks with the error message [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/linearsolvertable.html for possible LU and Cholesky solvers [0]PETSC ERROR: Could not locate a solver package. Perhaps you must ./configure with --download- [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.9.3, unknown [0]PETSC ERROR: Unknown Name on a arch-linux2-c-debug named manjaroDesktop by david Tue Oct 2 16:47:10 2018 [0]PETSC ERROR: Configure options --download-superlu_dist --download-parmetis --download-metis --download-ptscotch [0]PETSC ERROR: #1 MatGetFactor() line 4328 in /home/david/lib/petsc/src/mat/interface/matrix.c I recompiled petsc with the recommended options (and also trying some other options) but the error persists. on the linear solve table there is an X at the required solver package column for dense LU. What does it mean? On https://www.mcs.anl.gov/petsc/petsc-3.2/docs/linearsolvertable.html it says "PLAPACK". Did you deprecate it? What is the replacement? Thanks David Sommer -------------- next part -------------- An HTML attachment was scrubbed... URL: From hzhang at mcs.anl.gov Tue Oct 2 10:26:25 2018 From: hzhang at mcs.anl.gov (Zhang, Hong) Date: Tue, 2 Oct 2018 15:26:25 +0000 Subject: [petsc-users] Parallel LU with MPIDENSE In-Reply-To: References: Message-ID: David : Petsc does not support parallel LU. For dense matrix, you can use Elemental. See example petsc/src/ksp/ksp/examples/tests/ex40.c Hong Hello, i was trying to solve a linear system with a MPIDENSE matrix. I did PC pc; KSPGetPC(solver, &pc); PCSetType(pc, PCLU); KSPSetOperators(solver, a_petsc, a_petsc); for some KSP solver and some Mat a_petsc. When i run the code sequentially (mpirun -n 1) it works, but once i start it in parallel it breaks with the error message [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/linearsolvertable.html for possible LU and Cholesky solvers [0]PETSC ERROR: Could not locate a solver package. Perhaps you must ./configure with --download- [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.9.3, unknown [0]PETSC ERROR: Unknown Name on a arch-linux2-c-debug named manjaroDesktop by david Tue Oct 2 16:47:10 2018 [0]PETSC ERROR: Configure options --download-superlu_dist --download-parmetis --download-metis --download-ptscotch [0]PETSC ERROR: #1 MatGetFactor() line 4328 in /home/david/lib/petsc/src/mat/interface/matrix.c I recompiled petsc with the recommended options (and also trying some other options) but the error persists. on the linear solve table there is an X at the required solver package column for dense LU. What does it mean? On https://www.mcs.anl.gov/petsc/petsc-3.2/docs/linearsolvertable.html it says "PLAPACK". Did you deprecate it? What is the replacement? Thanks David Sommer -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Tue Oct 2 10:31:11 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 2 Oct 2018 11:31:11 -0400 Subject: [petsc-users] Parallel LU with MPIDENSE In-Reply-To: References: Message-ID: On Tue, Oct 2, 2018 at 10:59 AM David Sommer wrote: > Hello, > > i was trying to solve a linear system with a MPIDENSE matrix. I did > PC pc; > KSPGetPC(solver, &pc); > PCSetType(pc, PCLU); > KSPSetOperators(solver, a_petsc, a_petsc); > for some KSP solver and some Mat a_petsc. When i run the code sequentially > (mpirun -n 1) it works, but once i start it in parallel it breaks with the > error message > > > > > > > > *[0]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [0]PETSC ERROR: See > http://www.mcs.anl.gov/petsc/documentation/linearsolvertable.html > for > possible LU and Cholesky > solvers > [0]PETSC ERROR: Could not locate a solver package. Perhaps you must > ./configure with > --download- > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble > shooting. > [0]PETSC ERROR: Petsc Release Version 3.9.3, > unknown > [0]PETSC ERROR: Unknown Name on a arch-linux2-c-debug named manjaroDesktop > by david Tue Oct 2 16:47:10 > 2018 > [0]PETSC ERROR: Configure options --download-superlu_dist > --download-parmetis --download-metis > --download-ptscotch > [0]PETSC ERROR: #1 MatGetFactor() line 4328 in > /home/david/lib/petsc/src/mat/interface/matrix.c * > > I recompiled petsc with the recommended options (and also trying some > other options) but the error persists. on the linear solve table there is > an X at the required solver package column for dense LU. What does it mean? > On > https://www.mcs.anl.gov/petsc/petsc-3.2/docs/linearsolvertable.html > it says "PLAPACK". Did you deprecate it? What is the replacement? > I do not see PLAPACK. You want Elemental. Thanks, Matt > Thanks > > David Sommer > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From fdkong.jd at gmail.com Tue Oct 2 10:52:58 2018 From: fdkong.jd at gmail.com (Fande Kong) Date: Tue, 2 Oct 2018 09:52:58 -0600 Subject: [petsc-users] UCX ERROR KNEM inline copy failed In-Reply-To: References: <4f35edc3-b2c3-5b93-7b95-cb60bc51fee8@mfm.tu-darmstadt.de> Message-ID: The error messages may have nothing to do with PETSc and MOOSE. It might be from a package for MPI communication https://github.com/openucx/ucx. I have no experiences on such things. It may be helpful to contact your HPC administer. Thanks, Fande, On Tue, Oct 2, 2018 at 9:24 AM Matthew Knepley wrote: > On Tue, Oct 2, 2018 at 11:16 AM Y. Yang < > yangyiwei.yang at mfm.tu-darmstadt.de> wrote: > >> Dear PETSc team >> >> Recently I'm using MOOSE (http://www.mooseframework.org/) which is built >> with PETSc and, Unfortunately, I encountered some problems with >> following PETSc options: >> > > I do not know what problem you are reporting.I don't know what package > knem_ep.c is > part of, but its not PETSc. > > Thanks, > > Matt > > >> petsc_options_iname = '-pc_type -ksp_gmres_restart -sub_ksp_type >> -sub_pc_type -pc_asm_overlap -pc_factor_mat_solver_package' >> >> petsc_options_value = 'asm 1201 preonly ilu >> 4 superlu_dist' >> >> >> the error message is: >> >> Time Step 1, time = 1 >> dt = 1 >> >> |residual|_2 of individual variables: >> c: 779.034 >> w: 0 >> T: 6.57948e+07 >> gr0: 211.617 >> gr1: 206.973 >> gr2: 209.382 >> gr3: 191.089 >> gr4: 185.242 >> gr5: 157.361 >> gr6: 128.473 >> gr7: 87.6029 >> >> 0 Nonlinear |R| = [32m6.579482e+07 [39m >> [1538482623.976180] [hpb0085:22501:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482605.111342] [hpb0085:22502:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482606.761138] [hpb0085:22502:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482607.107478] [hpb0085:22502:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482605.882817] [hpb0085:22503:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482607.133543] [hpb0085:22503:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482621.905475] [hpb0085:22510:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482626.531234] [hpb0085:22510:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482627.613343] [hpb0085:22515:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482627.830489] [hpb0085:22515:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482629.852351] [hpb0085:22515:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482630.194620] [hpb0085:22515:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482630.280636] [hpb0085:22515:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482600.219314] [hpb0085:22516:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482658.960350] [hpb0085:22516:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482622.949471] [hpb0085:22517:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482612.502017] [hpb0085:22500:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482613.231970] [hpb0085:22500:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482621.417530] [hpb0085:22520:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482622.020998] [hpb0085:22520:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482606.221292] [hpb0085:22521:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482606.676987] [hpb0085:22521:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482606.896865] [hpb0085:22521:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482639.611427] [hpb0085:22522:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482631.435277] [hpb0085:22523:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482658.278343] [hpb0085:22512:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482658.396945] [hpb0085:22512:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482659.917476] [hpb0085:22512:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> [1538482660.162064] [hpb0085:22512:0] knem_ep.c:84 UCX ERROR >> KNEM inline copy failed, err = -1 Invalid argument >> 2 total processes killed (some possibly by mpirun during cleanup) >> >> >> Here's the status of the simulation >> >> Parallelism: >> Num Processors: 100 >> Num Threads: 1 >> >> Mesh: >> Parallel Type: distributed >> Mesh Dimension: 3 >> Spatial Dimension: 3 >> Nodes: >> Total: 2065551 >> Local: 22774 >> Elems: >> Total: 2000000 >> Local: 20006 >> Num Subdomains: 1 >> Num Partitions: 100 >> Partitioner: parmetis >> >> Nonlinear System: >> Num DOFs: 18589959 >> Num Local DOFs: 204966 >> Variables: { "c" "w" "T" "gr0" "gr1" "gr2" "gr3" "gr4" >> "gr5" } >> Finite Element Types: "LAGRANGE" >> Approximation Orders: "FIRST" >> >> Auxiliary System: >> Num DOFs: 10065551 >> Num Local DOFs: 102798 >> Variables: "bnds" { "var_indices" "unique_grains" } { >> "M" "dM/dT" } >> Finite Element Types: "LAGRANGE" "MONOMIAL" "MONOMIAL" >> Approximation Orders: "FIRST" "CONSTANT" "CONSTANT" >> >> Relationship Managers: >> Geometric : GrainTrackerHaloRM (2 layers) >> >> Execution Information: >> Executioner: Transient >> TimeStepper: IterationAdaptiveDT >> Solver Mode: Preconditioned JFNK >> >> >> I tried modifying the parameters and other preconditioning option, the >> problem is much the same. So I don't know where I did wrong or there is >> actually suitable PETSc option to deal with such problem with large >> mesh. I would like to hear your response. >> >> Sincerely, >> Yang >> >> -- >> ______________________________________________________ >> >> Yangyiwei Yang >> Wissenschaftliche Hilfskraft >> >> TU Darmstadt >> Fachbereich 11 - Material- und Geowissenschaften >> Fachgebiet Mechanik funktionaler Materialien >> >> L1 | 08 402 >> Otto Berndt Stra?e 3 >> D-64287 Darmstadt >> >> Tel: +49 (0)6151-16-22923 >> Email: yangyiwei.yang at mfm.tu-darmstadt.de >> Homepage: http://www.mawi.tu-darmstadt.de/mfm >> ORCID: 0000-0001-5505-7117 >> >> ______________________________________________________ >> >> > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hzhang at mcs.anl.gov Tue Oct 2 11:12:21 2018 From: hzhang at mcs.anl.gov (Zhang, Hong) Date: Tue, 2 Oct 2018 16:12:21 +0000 Subject: [petsc-users] Parallel LU with MPIDENSE In-Reply-To: References: Message-ID: Matt: I recompiled petsc with the recommended options (and also trying some other options) but the error persists. on the linear solve table there is an X at the required solver package column for dense LU. What does it mean? On https://www.mcs.anl.gov/petsc/petsc-3.2/docs/linearsolvertable.html it says "PLAPACK". Did you deprecate it? What is the replacement? I do not see PLAPACK. You want Elemental. petsc-3.2 uses PLAPACK. We replaced PLAPACK with Elemental long time ago. Hong -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From hzhang at mcs.anl.gov Tue Oct 2 11:12:21 2018 From: hzhang at mcs.anl.gov (Zhang, Hong) Date: Tue, 2 Oct 2018 16:12:21 +0000 Subject: [petsc-users] Parallel LU with MPIDENSE In-Reply-To: References: Message-ID: Matt: I recompiled petsc with the recommended options (and also trying some other options) but the error persists. on the linear solve table there is an X at the required solver package column for dense LU. What does it mean? On https://www.mcs.anl.gov/petsc/petsc-3.2/docs/linearsolvertable.html it says "PLAPACK". Did you deprecate it? What is the replacement? I do not see PLAPACK. You want Elemental. petsc-3.2 uses PLAPACK. We replaced PLAPACK with Elemental long time ago. Hong -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From hzhang at mcs.anl.gov Tue Oct 2 11:12:21 2018 From: hzhang at mcs.anl.gov (Zhang, Hong) Date: Tue, 2 Oct 2018 16:12:21 +0000 Subject: [petsc-users] Parallel LU with MPIDENSE In-Reply-To: References: Message-ID: Matt: I recompiled petsc with the recommended options (and also trying some other options) but the error persists. on the linear solve table there is an X at the required solver package column for dense LU. What does it mean? On https://www.mcs.anl.gov/petsc/petsc-3.2/docs/linearsolvertable.html it says "PLAPACK". Did you deprecate it? What is the replacement? I do not see PLAPACK. You want Elemental. petsc-3.2 uses PLAPACK. We replaced PLAPACK with Elemental long time ago. Hong -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From weizhuo2 at illinois.edu Tue Oct 2 13:24:37 2018 From: weizhuo2 at illinois.edu (Weizhuo Wang) Date: Tue, 2 Oct 2018 13:24:37 -0500 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: The example code and makefile are attached below. The whole thing started as I tried to build a Helmholtz solver, and the mean error (calculated by: sum( | numerical_sol - analytical_sol | / analytical_sol ) ) increases as I use finer and finer grids. Then I looked at the example 12 (Laplacian solver) which is similar to what I did to see if I have missed something. The example is using 2_norm. I have made some minor modifications (3 places) on the code, you can search 'Modified' in the code to see them. If this helps: I configured the PETSc to use real and double precision. Changed the name of the example code from ex12.c to ex12c.c Thanks for all your reply! Weizhuo Smith, Barry F. > Please send your version of the example that computes the mean norm of > the grid; I suspect we are talking apples and oranges > > Barry > > > > > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang wrote: > > > > I also tried to divide the norm by m*n , which is the number of grids, > the trend of norm still increases. > > > > Thanks! > > > > Weizhuo > > > > Matthew Knepley > > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang > wrote: > > Hi! > > > > I'm recently trying out the example code provided with the KSP solver > (ex12.c). I noticed that the mean norm of the grid increases as I use finer > meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. However at > m=100, n=100, mean norm increases to 9.55e-6. This seems counter intuitive, > since most of the time error should decreases when using finer grid. Am I > doing this wrong? > > > > The norm is misleading in that it is the l_2 norm, meaning just the sqrt > of the sum of the squares of > > the vector entries. It should be scaled by the volume element to > approximate a scale-independent > > norm (like the L_2 norm). > > > > Thanks, > > > > Matt > > > > Thanks! > > -- > > Wang Weizhuo > > > > > > -- > > 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 > > > > https://www.cse.buffalo.edu/~knepley/ > > > > > > -- > > Wang Weizhuo > > -- Wang Weizhuo -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- static char help[] = "Solves a linear system in parallel with KSP.\n\ Input parameters include:\n\ -m : number of mesh points in x-direction\n\ -n : number of mesh points in y-direction\n\n"; /*T Concepts: KSP^solving a system of linear equations Concepts: KSP^Laplacian, 2d Concepts: PC^registering preconditioners Processors: n T*/ /* Demonstrates registering a new preconditioner (PC) type. To register a PC type whose code is linked into the executable, use PCRegister(). To register a PC type in a dynamic library use PCRegister() Also provide the prototype for your PCCreate_XXX() function. In this example we use the PETSc implementation of the Jacobi method, PCCreate_Jacobi() just as an example. See the file src/ksp/pc/impls/jacobi/jacobi.c for details on how to write a new PC component. See the manual page PCRegister() for details on how to register a method. */ /* Include "petscksp.h" so that we can use KSP solvers. Note that this file automatically includes: petscsys.h - base PETSc routines petscvec.h - vectors petscmat.h - matrices petscis.h - index sets petscksp.h - Krylov subspace methods petscviewer.h - viewers petscpc.h - preconditioners */ #include PETSC_EXTERN PetscErrorCode PCCreate_Jacobi(PC); int main(int argc,char **args) { Vec x,b,u; /* approx solution, RHS, exact solution */ Mat A; /* linear system matrix */ KSP ksp; /* linear solver context */ PetscReal norm; /* norm of solution error */ PetscInt i,j,Ii,J,Istart,Iend,m = 8,n = 7,its; PetscErrorCode ierr; PetscScalar v,one = 1.0; PC pc; /* preconditioner context */ ierr = PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr; ierr = PetscOptionsGetInt(NULL,NULL,"-m",&m,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetInt(NULL,NULL,"-n",&n,NULL);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Compute the matrix and right-hand-side vector that define the linear system, Ax = b. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Create parallel matrix, specifying only its global dimensions. When using MatCreate(), the matrix format can be specified at runtime. Also, the parallel partitioning of the matrix can be determined by PETSc at runtime. */ ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,m*n,m*n);CHKERRQ(ierr); ierr = MatSetFromOptions(A);CHKERRQ(ierr); ierr = MatSetUp(A);CHKERRQ(ierr); /* Currently, all PETSc parallel matrix formats are partitioned by contiguous chunks of rows across the processors. Determine which rows of the matrix are locally owned. */ ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr); /* Set matrix elements for the 2-D, five-point stencil in parallel. - Each processor needs to insert only elements that it owns locally (but any non-local elements will be sent to the appropriate processor during matrix assembly). - Always specify global rows and columns of matrix entries. */ for (Ii=Istart; Ii0) {J = Ii - n; ierr = MatSetValues(A,1,&Ii,1,&J,&v,INSERT_VALUES);CHKERRQ(ierr);} if (i0) {J = Ii - 1; ierr = MatSetValues(A,1,&Ii,1,&J,&v,INSERT_VALUES);CHKERRQ(ierr);} if (j -pc_type -ksp_monitor -ksp_rtol These options will override those specified above as long as KSPSetFromOptions() is called _after_ any other customization routines. */ ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Solve the linear system - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ ierr = KSPSolve(ksp,b,x);CHKERRQ(ierr); /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Check solution and clean up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* Check the error */ ierr = VecAXPY(x,-1.0,u);CHKERRQ(ierr); ierr = VecNorm(x,NORM_2,&norm);CHKERRQ(ierr); ierr = KSPGetIterationNumber(ksp,&its);CHKERRQ(ierr); /* Print convergence information. PetscPrintf() produces a single print statement from all processes that share a communicator. */ // Modified: replaced (double)norm with (double)norm/(m*n) ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g iterations %D\n",(double)norm/(m*n),its);CHKERRQ(ierr); /* Free work space. All PETSc objects should be destroyed when they are no longer needed. */ ierr = KSPDestroy(&ksp);CHKERRQ(ierr); ierr = VecDestroy(&u);CHKERRQ(ierr); ierr = VecDestroy(&x);CHKERRQ(ierr); ierr = VecDestroy(&b);CHKERRQ(ierr); ierr = MatDestroy(&A);CHKERRQ(ierr); /* Always call PetscFinalize() before exiting a program. This routine - finalizes the PETSc libraries as well as MPI - provides summary and diagnostic information if certain runtime options are chosen (e.g., -log_view). */ ierr = PetscFinalize(); return ierr; } /*TEST test: args: -ksp_gmres_cgs_refinement_type refine_always TEST*/ -------------- next part -------------- A non-text attachment was scrubbed... Name: makefile Type: application/octet-stream Size: 959 bytes Desc: not available URL: From mfadams at lbl.gov Tue Oct 2 14:27:12 2018 From: mfadams at lbl.gov (Mark Adams) Date: Tue, 2 Oct 2018 15:27:12 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: On Tue, Oct 2, 2018 at 2:24 PM Weizhuo Wang wrote: > The example code and makefile are attached below. The whole thing started > as I tried to build a Helmholtz solver, and the mean error (calculated by: > sum( | numerical_sol - analytical_sol | / analytical_sol ) ) > This is a one norm. If you use max (instead of sum) then you don't need to scale. You do have to be careful about dividing by (near) zero. > increases as I use finer and finer grids. > What was the rate of increase? > Then I looked at the example 12 (Laplacian solver) which is similar to > what I did to see if I have missed something. The example is using 2_norm. > I have made some minor modifications (3 places) on the code, you can search > 'Modified' in the code to see them. > > If this helps: I configured the PETSc to use real and double precision. > Changed the name of the example code from ex12.c to ex12c.c > > Thanks for all your reply! > > Weizhuo > > > Smith, Barry F. > > >> Please send your version of the example that computes the mean norm of >> the grid; I suspect we are talking apples and oranges >> >> Barry >> >> >> >> > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang wrote: >> > >> > I also tried to divide the norm by m*n , which is the number of grids, >> the trend of norm still increases. >> > >> > Thanks! >> > >> > Weizhuo >> > >> > Matthew Knepley >> > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang >> wrote: >> > Hi! >> > >> > I'm recently trying out the example code provided with the KSP solver >> (ex12.c). I noticed that the mean norm of the grid increases as I use finer >> meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. However at >> m=100, n=100, mean norm increases to 9.55e-6. This seems counter intuitive, >> since most of the time error should decreases when using finer grid. Am I >> doing this wrong? >> > >> > The norm is misleading in that it is the l_2 norm, meaning just the >> sqrt of the sum of the squares of >> > the vector entries. It should be scaled by the volume element to >> approximate a scale-independent >> > norm (like the L_2 norm). >> > >> > Thanks, >> > >> > Matt >> > >> > Thanks! >> > -- >> > Wang Weizhuo >> > >> > >> > -- >> > 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 >> > >> > https://www.cse.buffalo.edu/~knepley/ >> > >> > >> > -- >> > Wang Weizhuo >> >> > > -- > Wang Weizhuo > -------------- next part -------------- An HTML attachment was scrubbed... URL: From weizhuo2 at illinois.edu Tue Oct 2 16:04:27 2018 From: weizhuo2 at illinois.edu (Weizhuo Wang) Date: Tue, 2 Oct 2018 16:04:27 -0500 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: Yes I was using one norm in my Helmholtz code, the example code used 2 norm. But now I am using 2 norm in both code. /* Check the error */ ierr = VecAXPY(x,-1.0,u); CHKERRQ(ierr); ierr = VecNorm(x,NORM_1,&norm); CHKERRQ(ierr); ierr = KSPGetIterationNumber(ksp,&its); CHKERRQ(ierr); ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g iterations %D\n",(double)norm/(m*n),its); CHKERRQ(ierr); I made a plot to show the increase: [image: Norm comparison.png] Mark Adams ?2018?10?2??? ??2:27??? > > > On Tue, Oct 2, 2018 at 2:24 PM Weizhuo Wang wrote: > >> The example code and makefile are attached below. The whole thing started >> as I tried to build a Helmholtz solver, and the mean error (calculated by: >> sum( | numerical_sol - analytical_sol | / analytical_sol ) ) >> > > This is a one norm. If you use max (instead of sum) then you don't need to > scale. You do have to be careful about dividing by (near) zero. > > >> increases as I use finer and finer grids. >> > > What was the rate of increase? > > >> Then I looked at the example 12 (Laplacian solver) which is similar to >> what I did to see if I have missed something. The example is using 2_norm. >> I have made some minor modifications (3 places) on the code, you can search >> 'Modified' in the code to see them. >> >> If this helps: I configured the PETSc to use real and double precision. >> Changed the name of the example code from ex12.c to ex12c.c >> >> Thanks for all your reply! >> >> Weizhuo >> >> >> Smith, Barry F. >> >> >>> Please send your version of the example that computes the mean norm >>> of the grid; I suspect we are talking apples and oranges >>> >>> Barry >>> >>> >>> >>> > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang >>> wrote: >>> > >>> > I also tried to divide the norm by m*n , which is the number of grids, >>> the trend of norm still increases. >>> > >>> > Thanks! >>> > >>> > Weizhuo >>> > >>> > Matthew Knepley >>> > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang >>> wrote: >>> > Hi! >>> > >>> > I'm recently trying out the example code provided with the KSP solver >>> (ex12.c). I noticed that the mean norm of the grid increases as I use finer >>> meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. However at >>> m=100, n=100, mean norm increases to 9.55e-6. This seems counter intuitive, >>> since most of the time error should decreases when using finer grid. Am I >>> doing this wrong? >>> > >>> > The norm is misleading in that it is the l_2 norm, meaning just the >>> sqrt of the sum of the squares of >>> > the vector entries. It should be scaled by the volume element to >>> approximate a scale-independent >>> > norm (like the L_2 norm). >>> > >>> > Thanks, >>> > >>> > Matt >>> > >>> > Thanks! >>> > -- >>> > Wang Weizhuo >>> > >>> > >>> > -- >>> > 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 >>> > >>> > https://www.cse.buffalo.edu/~knepley/ >>> >>> > >>> > >>> > -- >>> > Wang Weizhuo >>> >>> >> >> -- >> Wang Weizhuo >> > -- Wang Weizhuo -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Norm comparison.png Type: image/png Size: 87887 bytes Desc: not available URL: From mfadams at lbl.gov Tue Oct 2 16:10:49 2018 From: mfadams at lbl.gov (Mark Adams) Date: Tue, 2 Oct 2018 17:10:49 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: On Tue, Oct 2, 2018 at 5:04 PM Weizhuo Wang wrote: > Yes I was using one norm in my Helmholtz code, the example code used 2 > norm. But now I am using 2 norm in both code. > > /* > Check the error > */ > ierr = VecAXPY(x,-1.0,u); CHKERRQ(ierr); > ierr = VecNorm(x,NORM_1,&norm); CHKERRQ(ierr); > ierr = KSPGetIterationNumber(ksp,&its); CHKERRQ(ierr); > ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g iterations > %D\n",(double)norm/(m*n),its); CHKERRQ(ierr); > > I made a plot to show the increase: > FYI, this is asymptoting to a constant. What solver tolerance are you using? > > [image: Norm comparison.png] > > Mark Adams ?2018?10?2??? ??2:27??? > >> >> >> On Tue, Oct 2, 2018 at 2:24 PM Weizhuo Wang >> wrote: >> >>> The example code and makefile are attached below. The whole thing >>> started as I tried to build a Helmholtz solver, and the mean error >>> (calculated by: sum( | numerical_sol - analytical_sol | / analytical_sol ) >>> ) >>> >> >> This is a one norm. If you use max (instead of sum) then you don't need >> to scale. You do have to be careful about dividing by (near) zero. >> >> >>> increases as I use finer and finer grids. >>> >> >> What was the rate of increase? >> >> >>> Then I looked at the example 12 (Laplacian solver) which is similar to >>> what I did to see if I have missed something. The example is using 2_norm. >>> I have made some minor modifications (3 places) on the code, you can search >>> 'Modified' in the code to see them. >>> >>> If this helps: I configured the PETSc to use real and double precision. >>> Changed the name of the example code from ex12.c to ex12c.c >>> >>> Thanks for all your reply! >>> >>> Weizhuo >>> >>> >>> Smith, Barry F. >>> >>> >>>> Please send your version of the example that computes the mean norm >>>> of the grid; I suspect we are talking apples and oranges >>>> >>>> Barry >>>> >>>> >>>> >>>> > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang >>>> wrote: >>>> > >>>> > I also tried to divide the norm by m*n , which is the number of >>>> grids, the trend of norm still increases. >>>> > >>>> > Thanks! >>>> > >>>> > Weizhuo >>>> > >>>> > Matthew Knepley >>>> > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang >>>> wrote: >>>> > Hi! >>>> > >>>> > I'm recently trying out the example code provided with the KSP solver >>>> (ex12.c). I noticed that the mean norm of the grid increases as I use finer >>>> meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. However at >>>> m=100, n=100, mean norm increases to 9.55e-6. This seems counter intuitive, >>>> since most of the time error should decreases when using finer grid. Am I >>>> doing this wrong? >>>> > >>>> > The norm is misleading in that it is the l_2 norm, meaning just the >>>> sqrt of the sum of the squares of >>>> > the vector entries. It should be scaled by the volume element to >>>> approximate a scale-independent >>>> > norm (like the L_2 norm). >>>> > >>>> > Thanks, >>>> > >>>> > Matt >>>> > >>>> > Thanks! >>>> > -- >>>> > Wang Weizhuo >>>> > >>>> > >>>> > -- >>>> > 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 >>>> > >>>> > https://www.cse.buffalo.edu/~knepley/ >>>> >>>> > >>>> > >>>> > -- >>>> > Wang Weizhuo >>>> >>>> >>> >>> -- >>> Wang Weizhuo >>> >> > > -- > Wang Weizhuo > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Norm comparison.png Type: image/png Size: 87887 bytes Desc: not available URL: From weizhuo2 at illinois.edu Tue Oct 2 16:26:42 2018 From: weizhuo2 at illinois.edu (Weizhuo Wang) Date: Tue, 2 Oct 2018 16:26:42 -0500 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: I didn't specify a tolerance, it was using the default tolerance. Doesn't the asymptoting norm implies finer grid won't help to get finer solution? Mark Adams ?2018?10?2??? ??4:11??? > > > On Tue, Oct 2, 2018 at 5:04 PM Weizhuo Wang wrote: > >> Yes I was using one norm in my Helmholtz code, the example code used 2 >> norm. But now I am using 2 norm in both code. >> >> /* >> Check the error >> */ >> ierr = VecAXPY(x,-1.0,u); CHKERRQ(ierr); >> ierr = VecNorm(x,NORM_1,&norm); CHKERRQ(ierr); >> ierr = KSPGetIterationNumber(ksp,&its); CHKERRQ(ierr); >> ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g iterations >> %D\n",(double)norm/(m*n),its); CHKERRQ(ierr); >> >> I made a plot to show the increase: >> > > > FYI, this is asymptoting to a constant. What solver tolerance are > you using? > > >> >> [image: Norm comparison.png] >> >> Mark Adams ?2018?10?2??? ??2:27??? >> >>> >>> >>> On Tue, Oct 2, 2018 at 2:24 PM Weizhuo Wang >>> wrote: >>> >>>> The example code and makefile are attached below. The whole thing >>>> started as I tried to build a Helmholtz solver, and the mean error >>>> (calculated by: sum( | numerical_sol - analytical_sol | / analytical_sol ) >>>> ) >>>> >>> >>> This is a one norm. If you use max (instead of sum) then you don't need >>> to scale. You do have to be careful about dividing by (near) zero. >>> >>> >>>> increases as I use finer and finer grids. >>>> >>> >>> What was the rate of increase? >>> >>> >>>> Then I looked at the example 12 (Laplacian solver) which is similar to >>>> what I did to see if I have missed something. The example is using 2_norm. >>>> I have made some minor modifications (3 places) on the code, you can search >>>> 'Modified' in the code to see them. >>>> >>>> If this helps: I configured the PETSc to use real and double precision. >>>> Changed the name of the example code from ex12.c to ex12c.c >>>> >>>> Thanks for all your reply! >>>> >>>> Weizhuo >>>> >>>> >>>> Smith, Barry F. >>>> >>>> >>>>> Please send your version of the example that computes the mean norm >>>>> of the grid; I suspect we are talking apples and oranges >>>>> >>>>> Barry >>>>> >>>>> >>>>> >>>>> > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang >>>>> wrote: >>>>> > >>>>> > I also tried to divide the norm by m*n , which is the number of >>>>> grids, the trend of norm still increases. >>>>> > >>>>> > Thanks! >>>>> > >>>>> > Weizhuo >>>>> > >>>>> > Matthew Knepley >>>>> > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang >>>>> wrote: >>>>> > Hi! >>>>> > >>>>> > I'm recently trying out the example code provided with the KSP >>>>> solver (ex12.c). I noticed that the mean norm of the grid increases as I >>>>> use finer meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. >>>>> However at m=100, n=100, mean norm increases to 9.55e-6. This seems counter >>>>> intuitive, since most of the time error should decreases when using finer >>>>> grid. Am I doing this wrong? >>>>> > >>>>> > The norm is misleading in that it is the l_2 norm, meaning just the >>>>> sqrt of the sum of the squares of >>>>> > the vector entries. It should be scaled by the volume element to >>>>> approximate a scale-independent >>>>> > norm (like the L_2 norm). >>>>> > >>>>> > Thanks, >>>>> > >>>>> > Matt >>>>> > >>>>> > Thanks! >>>>> > -- >>>>> > Wang Weizhuo >>>>> > >>>>> > >>>>> > -- >>>>> > 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 >>>>> > >>>>> > https://www.cse.buffalo.edu/~knepley/ >>>>> >>>>> > >>>>> > >>>>> > -- >>>>> > Wang Weizhuo >>>>> >>>>> >>>> >>>> -- >>>> Wang Weizhuo >>>> >>> >> >> -- >> Wang Weizhuo >> > -- Wang Weizhuo -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Norm comparison.png Type: image/png Size: 87887 bytes Desc: not available URL: From nsime at carnegiescience.edu Tue Oct 2 17:47:11 2018 From: nsime at carnegiescience.edu (Nate Sime) Date: Tue, 2 Oct 2018 18:47:11 -0400 Subject: [petsc-users] MatNest with pc_fieldsplit_type multiplicative yields PetscLayoutSetUp error Message-ID: Initially, I apologise for not being able to provide a minimal working example. I have a system of 4 PDEs defined in 2 spatial dimensions which I have discretised by the FEM. This includes a Taylor-Hood Stokes system, a modified Helmholtz type problem, and a nonlinear advection equation. I assemble each of the blocks of this 4x4 system into Mats and then put those into a MatNest. Additionally I assemble a 4x4 block preconditioner in the same manner, using the standard pressure mass matrix for the continuity equation block. I am using the following simple options: -ksp_type fgmres -pc_type fieldsplit -pc_fieldsplit_type multiplicative -fieldsplit_0_ksp_type preonly -fieldsplit_0_pc_type hypre -fieldsplit_1_ksp_type preonly -fieldsplit_1_pc_type hypre -fieldsplit_2_ksp_type preonly -fieldsplit_2_pc_type hypre -fieldsplit_3_ksp_type preonly -fieldsplit_3_pc_type hypre Solving the system works and scales reasonably well up until the problem extends beyond a size of approximately 50e6 DoF with 192 processes across 4 nodes. Beyond that, I run into the following error with PetscLayoutFindOwner which I have attached the error message at the end of the email. Tracing through the PETSc source, I find that the error arises dealing with -pc_fieldsplit_type multiplicative. Changing to -pc_fieldsplit_type additive, I am able to continue my scaling experiments beyond 50e6 with no problem so far. I was hoping someone may have some basic insight into what I may have done naively and incorrectly to cause this issue. Additionally, please let me know what I have inevitably neglected to provide for elucidation. Nate. [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: Object is in wrong state [0]PETSC ERROR: PetscLayoutSetUp() must be called first [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.10.0, unknown [0]PETSC ERROR: Unknown Name on a? named c456-101.stampede2.tacc.utexas.edu by Tue Oct? 2 17:11:27 2018 [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: #1 PetscLayoutFindOwner() line 246 in petsc/petsc/include/petscis.h [0]PETSC ERROR: #2 PetscSFSetGraphLayout() line 511 in petsc/petsc/src/vec/is/utils/pmap.c [0]PETSC ERROR: #3 MatNestCreateAggregateL2G_Private() line 1188 in petsc/petsc/src/mat/impls/nest/matnest.c [0]PETSC ERROR: #4 MatSetUp_NestIS_Private() line 1336 in petsc/petsc/src/mat/impls/nest/matnest.c [0]PETSC ERROR: #5 MatNestSetSubMats_Nest() line 1073 in petsc/petsc/src/mat/impls/nest/matnest.c [0]PETSC ERROR: #6 MatNestSetSubMats() line 1130 in petsc/petsc/src/mat/impls/nest/matnest.c [0]PETSC ERROR: #7 MatCreateNest() line 1400 in petsc/petsc/src/mat/impls/nest/matnest.c [0]PETSC ERROR: #8 MatNestGetRow() line 360 in petsc/petsc/src/mat/impls/nest/matnest.c [0]PETSC ERROR: #9 MatNestFindSubMat() line 398 in petsc/petsc/src/mat/impls/nest/matnest.c [0]PETSC ERROR: #10 MatCreateSubMatrix_Nest() line 425 in petsc/petsc/src/mat/impls/nest/matnest.c [0]PETSC ERROR: #11 MatCreateSubMatrix() line 8023 in petsc/petsc/src/mat/interface/matrix.c [0]PETSC ERROR: #12 PCSetUp_FieldSplit() line 649 in petsc/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c [0]PETSC ERROR: #13 PCSetUp() line 932 in petsc/petsc/src/ksp/pc/interface/precon.c [0]PETSC ERROR: #14 KSPSetUp() line 391 in petsc/petsc/src/ksp/ksp/interface/itfunc.c [0]PETSC ERROR: #15 KSPSolve() line 723 in petsc/petsc/src/ksp/ksp/interface/itfunc.c From knepley at gmail.com Tue Oct 2 18:52:23 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 2 Oct 2018 19:52:23 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: On Tue, Oct 2, 2018 at 5:26 PM Weizhuo Wang wrote: > I didn't specify a tolerance, it was using the default tolerance. Doesn't > the asymptoting norm implies finer grid won't help to get finer solution? > There are two things going on in your test, discretization error controlled by the grid, and algebraic error controlled by the solver. This makes it difficult to isolate what is happening. However, it seems clear that your plot is looking at algebraic error. You can confirm this by using -pc_type lu for the solve. Then all you have is discretization error. Thanks, Matt > Mark Adams ?2018?10?2??? ??4:11??? > >> >> >> On Tue, Oct 2, 2018 at 5:04 PM Weizhuo Wang >> wrote: >> >>> Yes I was using one norm in my Helmholtz code, the example code used 2 >>> norm. But now I am using 2 norm in both code. >>> >>> /* >>> Check the error >>> */ >>> ierr = VecAXPY(x,-1.0,u); CHKERRQ(ierr); >>> ierr = VecNorm(x,NORM_1,&norm); CHKERRQ(ierr); >>> ierr = KSPGetIterationNumber(ksp,&its); CHKERRQ(ierr); >>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g iterations >>> %D\n",(double)norm/(m*n),its); CHKERRQ(ierr); >>> >>> I made a plot to show the increase: >>> >> >> >> FYI, this is asymptoting to a constant. What solver tolerance are >> you using? >> >> >>> >>> [image: Norm comparison.png] >>> >>> Mark Adams ?2018?10?2??? ??2:27??? >>> >>>> >>>> >>>> On Tue, Oct 2, 2018 at 2:24 PM Weizhuo Wang >>>> wrote: >>>> >>>>> The example code and makefile are attached below. The whole thing >>>>> started as I tried to build a Helmholtz solver, and the mean error >>>>> (calculated by: sum( | numerical_sol - analytical_sol | / analytical_sol ) >>>>> ) >>>>> >>>> >>>> This is a one norm. If you use max (instead of sum) then you don't need >>>> to scale. You do have to be careful about dividing by (near) zero. >>>> >>>> >>>>> increases as I use finer and finer grids. >>>>> >>>> >>>> What was the rate of increase? >>>> >>>> >>>>> Then I looked at the example 12 (Laplacian solver) which is similar to >>>>> what I did to see if I have missed something. The example is using 2_norm. >>>>> I have made some minor modifications (3 places) on the code, you can search >>>>> 'Modified' in the code to see them. >>>>> >>>>> If this helps: I configured the PETSc to use real and double >>>>> precision. Changed the name of the example code from ex12.c to ex12c.c >>>>> >>>>> Thanks for all your reply! >>>>> >>>>> Weizhuo >>>>> >>>>> >>>>> Smith, Barry F. >>>>> >>>>> >>>>>> Please send your version of the example that computes the mean >>>>>> norm of the grid; I suspect we are talking apples and oranges >>>>>> >>>>>> Barry >>>>>> >>>>>> >>>>>> >>>>>> > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang >>>>>> wrote: >>>>>> > >>>>>> > I also tried to divide the norm by m*n , which is the number of >>>>>> grids, the trend of norm still increases. >>>>>> > >>>>>> > Thanks! >>>>>> > >>>>>> > Weizhuo >>>>>> > >>>>>> > Matthew Knepley >>>>>> > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang >>>>>> wrote: >>>>>> > Hi! >>>>>> > >>>>>> > I'm recently trying out the example code provided with the KSP >>>>>> solver (ex12.c). I noticed that the mean norm of the grid increases as I >>>>>> use finer meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. >>>>>> However at m=100, n=100, mean norm increases to 9.55e-6. This seems counter >>>>>> intuitive, since most of the time error should decreases when using finer >>>>>> grid. Am I doing this wrong? >>>>>> > >>>>>> > The norm is misleading in that it is the l_2 norm, meaning just the >>>>>> sqrt of the sum of the squares of >>>>>> > the vector entries. It should be scaled by the volume element to >>>>>> approximate a scale-independent >>>>>> > norm (like the L_2 norm). >>>>>> > >>>>>> > Thanks, >>>>>> > >>>>>> > Matt >>>>>> > >>>>>> > Thanks! >>>>>> > -- >>>>>> > Wang Weizhuo >>>>>> > >>>>>> > >>>>>> > -- >>>>>> > 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 >>>>>> > >>>>>> > https://www.cse.buffalo.edu/~knepley/ >>>>>> >>>>>> > >>>>>> > >>>>>> > -- >>>>>> > Wang Weizhuo >>>>>> >>>>>> >>>>> >>>>> -- >>>>> Wang Weizhuo >>>>> >>>> >>> >>> -- >>> Wang Weizhuo >>> >> > > -- > Wang Weizhuo > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Norm comparison.png Type: image/png Size: 87887 bytes Desc: not available URL: From knepley at gmail.com Tue Oct 2 19:07:55 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 2 Oct 2018 20:07:55 -0400 Subject: [petsc-users] MatNest with pc_fieldsplit_type multiplicative yields PetscLayoutSetUp error In-Reply-To: References: Message-ID: On Tue, Oct 2, 2018 at 6:47 PM Nate Sime wrote: > Initially, I apologise for not being able to provide a minimal working > example. > > I have a system of 4 PDEs defined in 2 spatial dimensions which I have > discretised by the FEM. > > This includes a Taylor-Hood Stokes system, a modified Helmholtz type > problem, and a nonlinear advection equation. > This sounds like magma dynamics, but that should have linear advection. > I assemble each of the blocks of this 4x4 system into Mats and then put > those into a MatNest. > We can track down this error. However, I want to first say that I don't think MatNest should ever be in your user code. MatNest is only an optimization of the storage format, like SBAIJ. It does not contribute anything to functionality. If you want the ability to insert into a submatrix, you can use https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatGetLocalSubMatrix.html or https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateLocalRef.html#MatCreateLocalRef Then you can start off using just AIJ for testing. I doubt the MAtNest optimization would make much of a difference here, but testing it after everything works is much easier. Thanks, Matt > Additionally I assemble a 4x4 block preconditioner in the same manner, > using the standard pressure mass matrix for the continuity equation block. > > I am using the following simple options: > > -ksp_type fgmres > -pc_type fieldsplit > -pc_fieldsplit_type multiplicative > > -fieldsplit_0_ksp_type preonly > -fieldsplit_0_pc_type hypre > > -fieldsplit_1_ksp_type preonly > -fieldsplit_1_pc_type hypre > > -fieldsplit_2_ksp_type preonly > -fieldsplit_2_pc_type hypre > > -fieldsplit_3_ksp_type preonly > -fieldsplit_3_pc_type hypre > > > Solving the system works and scales reasonably well up until the problem > extends beyond a size of approximately 50e6 DoF with 192 processes > across 4 nodes. > > Beyond that, I run into the following error with PetscLayoutFindOwner > which I have attached the error message at the end of the email. > > Tracing through the PETSc source, I find that the error arises dealing > with -pc_fieldsplit_type multiplicative. > > Changing to -pc_fieldsplit_type additive, I am able to continue my > scaling experiments beyond 50e6 with no problem so far. > > I was hoping someone may have some basic insight into what I may have > done naively and incorrectly to cause this issue. > > Additionally, please let me know what I have inevitably neglected to > provide for elucidation. > > Nate. > > > [0]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [0]PETSC ERROR: Object is in wrong state > [0]PETSC ERROR: PetscLayoutSetUp() must be called first > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble shooting. > [0]PETSC ERROR: Petsc Release Version 3.10.0, unknown > [0]PETSC ERROR: Unknown Name on a named > c456-101.stampede2.tacc.utexas.edu by Tue Oct 2 17:11:27 2018 > [0]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [0]PETSC ERROR: #1 PetscLayoutFindOwner() line 246 in > petsc/petsc/include/petscis.h > [0]PETSC ERROR: #2 PetscSFSetGraphLayout() line 511 in > petsc/petsc/src/vec/is/utils/pmap.c > [0]PETSC ERROR: #3 MatNestCreateAggregateL2G_Private() line 1188 in > petsc/petsc/src/mat/impls/nest/matnest.c > [0]PETSC ERROR: #4 MatSetUp_NestIS_Private() line 1336 in > petsc/petsc/src/mat/impls/nest/matnest.c > [0]PETSC ERROR: #5 MatNestSetSubMats_Nest() line 1073 in > petsc/petsc/src/mat/impls/nest/matnest.c > [0]PETSC ERROR: #6 MatNestSetSubMats() line 1130 in > petsc/petsc/src/mat/impls/nest/matnest.c > [0]PETSC ERROR: #7 MatCreateNest() line 1400 in > petsc/petsc/src/mat/impls/nest/matnest.c > [0]PETSC ERROR: #8 MatNestGetRow() line 360 in > petsc/petsc/src/mat/impls/nest/matnest.c > [0]PETSC ERROR: #9 MatNestFindSubMat() line 398 in > petsc/petsc/src/mat/impls/nest/matnest.c > [0]PETSC ERROR: #10 MatCreateSubMatrix_Nest() line 425 in > petsc/petsc/src/mat/impls/nest/matnest.c > [0]PETSC ERROR: #11 MatCreateSubMatrix() line 8023 in > petsc/petsc/src/mat/interface/matrix.c > [0]PETSC ERROR: #12 PCSetUp_FieldSplit() line 649 in > petsc/petsc/src/ksp/pc/impls/fieldsplit/fieldsplit.c > [0]PETSC ERROR: #13 PCSetUp() line 932 in > petsc/petsc/src/ksp/pc/interface/precon.c > [0]PETSC ERROR: #14 KSPSetUp() line 391 in > petsc/petsc/src/ksp/ksp/interface/itfunc.c > [0]PETSC ERROR: #15 KSPSolve() line 723 in > petsc/petsc/src/ksp/ksp/interface/itfunc.c > > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreaceresoli91 at gmail.com Wed Oct 3 08:00:36 2018 From: andreaceresoli91 at gmail.com (Andrea Ceresoli) Date: Wed, 3 Oct 2018 15:00:36 +0200 Subject: [petsc-users] DMNetwork Message-ID: Good morning, I am contacting you for some clarification regarding DMNetwork routines. >From the documentation I found the flow for the creation of an application code is the following: 1. Create a Network and register components 2. Set network size and layout 3. Set components and number of variables for nodes/edges 4. Set up the network 5. Distribute the network Following that flow, from point 1 to point 4 the Network is "owned" only by the 0 rank processor while after point 5 the network is partitioned and "owned" by the n processors involved in the computation (according to the partitioner used). I was trying to let all the n processors involved read a portion of the network in such a way that the flow listed before will be a multiprocessor process and not restricted only to the rank 0 processor (parallel input data). In this way after point 4 I will have a distributed network and I don't need to call DMNetworkDistribute(). Unfortunately the documentation I found doesn't explain how to do that, so I would like to ask you if it is feasible and if you have some examples or documentation that you can share for this purpose. Thank you in advance for your availability, Sincerely, Andrea Ceresoli -------------- next part -------------- An HTML attachment was scrubbed... URL: From hzhang at mcs.anl.gov Wed Oct 3 10:57:54 2018 From: hzhang at mcs.anl.gov (Zhang, Hong) Date: Wed, 3 Oct 2018 15:57:54 +0000 Subject: [petsc-users] DMNetwork In-Reply-To: References: Message-ID: Andrea: From the documentation I found the flow for the creation of an application code is the following: 1. Create a Network and register components 2. Set network size and layout 3. Set components and number of variables for nodes/edges 4. Set up the network 5. Distribute the network Following that flow, from point 1 to point 4 the Network is "owned" only by the 0 rank processor while after point 5 the network is partitioned and "owned" by the n processors involved in the computation (according to the partitioner used). Correct. Currently, DMNetwork only supports sequential setup of network. I just started parallelizing it. I'll let you know when I'm done. I was trying to let all the n processors involved read a portion of the network in such a way that the flow listed before will be a multiprocessor process and not restricted only to the rank 0 processor (parallel input data). In this way after point 4 I will have a distributed network and I don't need to call DMNetworkDistribute(). Unfortunately the documentation I found doesn't explain how to do that, so I would like to ask you if it is feasible and if you have some examples or documentation that you can share for this purpose. It is not supported yet. Internal works are needed. You may follow my development branch https://bitbucket.org/petsc/petsc/branch/hzhang/pdmnetwork-setup If you have idea/suggestions, let us know. Hong -------------- next part -------------- An HTML attachment was scrubbed... URL: From hzhang at mcs.anl.gov Wed Oct 3 10:57:54 2018 From: hzhang at mcs.anl.gov (Zhang, Hong) Date: Wed, 3 Oct 2018 15:57:54 +0000 Subject: [petsc-users] DMNetwork In-Reply-To: References: Message-ID: Andrea: From the documentation I found the flow for the creation of an application code is the following: 1. Create a Network and register components 2. Set network size and layout 3. Set components and number of variables for nodes/edges 4. Set up the network 5. Distribute the network Following that flow, from point 1 to point 4 the Network is "owned" only by the 0 rank processor while after point 5 the network is partitioned and "owned" by the n processors involved in the computation (according to the partitioner used). Correct. Currently, DMNetwork only supports sequential setup of network. I just started parallelizing it. I'll let you know when I'm done. I was trying to let all the n processors involved read a portion of the network in such a way that the flow listed before will be a multiprocessor process and not restricted only to the rank 0 processor (parallel input data). In this way after point 4 I will have a distributed network and I don't need to call DMNetworkDistribute(). Unfortunately the documentation I found doesn't explain how to do that, so I would like to ask you if it is feasible and if you have some examples or documentation that you can share for this purpose. It is not supported yet. Internal works are needed. You may follow my development branch https://bitbucket.org/petsc/petsc/branch/hzhang/pdmnetwork-setup If you have idea/suggestions, let us know. Hong -------------- next part -------------- An HTML attachment was scrubbed... URL: From amfoggia at gmail.com Thu Oct 4 03:42:46 2018 From: amfoggia at gmail.com (Ale Foggia) Date: Thu, 4 Oct 2018 10:42:46 +0200 Subject: [petsc-users] PETSc/SLEPc: Memory consumption, particularly during solver initialization/solve Message-ID: Hello all, I'm using SLEPc 3.9.2 (and PETSc 3.9.3) to get the EPS_SMALLEST_REAL of a matrix with the following characteristics: * type: real, Hermitian, sparse * linear size: 2333606220 * distributed in 2048 processes (64 nodes, 32 procs per node) My code first preallocates the necessary memory with *MatMPIAIJSetPreallocation*, then fills it with the values and finally it calls the following functions to create the solver and diagonalize the matrix: EPSCreate(PETSC_COMM_WORLD, &solver); EPSSetOperators(solver,matrix,NULL); EPSSetProblemType(solver, EPS_HEP); EPSSetType(solver, EPSLANCZOS); EPSSetWhichEigenpairs(solver, EPS_SMALLEST_REAL); EPSSetFromOptions(solver); EPSSolve(solver); I want to make an estimation for larger size problems of the memory used by the program (at every step) because I would like to keep it under 16 GB per node. I've used the "memory usage" functions provided by PETSc, but something happens during the solver stage that I can't explain. This brings up two questions. 1) In each step I put a call to four memory functions and between them I print the value of mem: mem = 0; PetscMallocGetCurrentUsage(&mem); PetscMallocGetMaximumUsage(&mem); PetscMemoryGetCurrentUsage(&mem); PetscMemoryGetMaximumUsage(&mem); I've read some other question in the mailing list regarding the same issue but I can't fully understand this. What is the difference between all of them? What information are they actually giving me? (I know this is only a "per process" output). I copy the output of two steps of the program as an example: ==================== step N ==================== MallocGetCurrent: 314513664.0 B MallocGetMaximum: 332723328.0 B MemoryGetCurrent: 539996160.0 B MemoryGetMaximum: 0.0 B ==================== step N+1 ==================== MallocGetCurrent: 395902912.0 B MallocGetMaximum: 415178624.0 B MemoryGetCurrent: 623783936.0 B MemoryGetMaximum: 623775744.0 B 2) I was using this information to make the calculation of the memory required per node to run my problem. Also, I'm able to login to the computing node while running and I can check the memory consumption (with *top*). The memory used that I see with top is more or less the same as the one reported by PETSc functions at the beginning. But during the inialization of the solver and during the solving, *top* reports a consumption two times bigger than the one the functions report. Is it possible to know from where this extra memory consumption comes from? What things does SLEPc allocate that need that much memory? I've been trying to do the math but I think there are things I'm missing. I thought that part of it comes from the "BV" that the option -eps_view reports: BV Object: 2048 MPI processes type: svec 17 columns of global length 2333606220 vector orthogonalization method: modified Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) block orthogonalization method: GS doing matmult as a single matrix-matrix product But "17 * 2333606220 * 8 Bytes / #nodes" only explains on third or less of the "extra" memory. Ale -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Thu Oct 4 05:49:25 2018 From: knepley at gmail.com (Matthew Knepley) Date: Thu, 4 Oct 2018 06:49:25 -0400 Subject: [petsc-users] PETSc/SLEPc: Memory consumption, particularly during solver initialization/solve In-Reply-To: References: Message-ID: On Thu, Oct 4, 2018 at 4:43 AM Ale Foggia wrote: > Hello all, > > I'm using SLEPc 3.9.2 (and PETSc 3.9.3) to get the EPS_SMALLEST_REAL of a > matrix with the following characteristics: > > * type: real, Hermitian, sparse > * linear size: 2333606220 > * distributed in 2048 processes (64 nodes, 32 procs per node) > > My code first preallocates the necessary memory with > *MatMPIAIJSetPreallocation*, then fills it with the values and finally it > calls the following functions to create the solver and diagonalize the > matrix: > > EPSCreate(PETSC_COMM_WORLD, &solver); > EPSSetOperators(solver,matrix,NULL); > EPSSetProblemType(solver, EPS_HEP); > EPSSetType(solver, EPSLANCZOS); > EPSSetWhichEigenpairs(solver, EPS_SMALLEST_REAL); > EPSSetFromOptions(solver); > EPSSolve(solver); > > I want to make an estimation for larger size problems of the memory used > by the program (at every step) because I would like to keep it under 16 GB > per node. I've used the "memory usage" functions provided by PETSc, but > something happens during the solver stage that I can't explain. This brings > up two questions. > > 1) In each step I put a call to four memory functions and between them I > print the value of mem: > Did you call PetscMemorySetGetMaximumUsage() first? We are computing https://en.wikipedia.org/wiki/Resident_set_size however we can. Usually with getrusage(). >From this (https://www.binarytides.com/linux-command-check-memory-usage/), it looks like top also reports paged out memory. Matt > mem = 0; > PetscMallocGetCurrentUsage(&mem); > PetscMallocGetMaximumUsage(&mem); > PetscMemoryGetCurrentUsage(&mem); > PetscMemoryGetMaximumUsage(&mem); > > I've read some other question in the mailing list regarding the same issue > but I can't fully understand this. What is the difference between all of > them? What information are they actually giving me? (I know this is only a > "per process" output). I copy the output of two steps of the program as an > example: > > ==================== step N ==================== > MallocGetCurrent: 314513664.0 B > MallocGetMaximum: 332723328.0 B > MemoryGetCurrent: 539996160.0 B > MemoryGetMaximum: 0.0 B > ==================== step N+1 ==================== > MallocGetCurrent: 395902912.0 B > MallocGetMaximum: 415178624.0 B > MemoryGetCurrent: 623783936.0 B > MemoryGetMaximum: 623775744.0 B > > 2) I was using this information to make the calculation of the memory > required per node to run my problem. Also, I'm able to login to the > computing node while running and I can check the memory consumption (with > *top*). The memory used that I see with top is more or less the same as the > one reported by PETSc functions at the beginning. But during the > inialization of the solver and during the solving, *top* reports a > consumption two times bigger than the one the functions report. Is it > possible to know from where this extra memory consumption comes from? What > things does SLEPc allocate that need that much memory? I've been trying to > do the math but I think there are things I'm missing. I thought that part > of it comes from the "BV" that the option -eps_view reports: > > BV Object: 2048 MPI processes > type: svec > 17 columns of global length 2333606220 > vector orthogonalization method: modified Gram-Schmidt > orthogonalization refinement: if needed (eta: 0.7071) > block orthogonalization method: GS > doing matmult as a single matrix-matrix product > > But "17 * 2333606220 * 8 Bytes / #nodes" only explains on third or less > of the "extra" memory. > > Ale > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Thu Oct 4 06:12:18 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Thu, 4 Oct 2018 13:12:18 +0200 Subject: [petsc-users] PETSc/SLEPc: Memory consumption, particularly during solver initialization/solve In-Reply-To: References: Message-ID: Regarding the SLEPc part: - What do you mean by "each step"? Are you calling EPSSolve() several times? - Yes, the BV object is generally what takes most of the memory. It is allocated at the beginning of EPSSolve(). Depending on the solver/options, other memory may be allocated as well. - You can also see the memory reported at the end of -log_view - I would suggest using the default solver Krylov-Schur - it will do Lanczos with implicit restart, which will give faster convergence than the EPSLANCZOS solver. Jose > El 4 oct 2018, a las 12:49, Matthew Knepley escribi?: > > On Thu, Oct 4, 2018 at 4:43 AM Ale Foggia wrote: > Hello all, > > I'm using SLEPc 3.9.2 (and PETSc 3.9.3) to get the EPS_SMALLEST_REAL of a matrix with the following characteristics: > > * type: real, Hermitian, sparse > * linear size: 2333606220 > * distributed in 2048 processes (64 nodes, 32 procs per node) > > My code first preallocates the necessary memory with *MatMPIAIJSetPreallocation*, then fills it with the values and finally it calls the following functions to create the solver and diagonalize the matrix: > > EPSCreate(PETSC_COMM_WORLD, &solver); > EPSSetOperators(solver,matrix,NULL); > EPSSetProblemType(solver, EPS_HEP); > EPSSetType(solver, EPSLANCZOS); > EPSSetWhichEigenpairs(solver, EPS_SMALLEST_REAL); > EPSSetFromOptions(solver); > EPSSolve(solver); > > I want to make an estimation for larger size problems of the memory used by the program (at every step) because I would like to keep it under 16 GB per node. I've used the "memory usage" functions provided by PETSc, but something happens during the solver stage that I can't explain. This brings up two questions. > > 1) In each step I put a call to four memory functions and between them I print the value of mem: > > Did you call PetscMemorySetGetMaximumUsage() first? > > We are computing https://en.wikipedia.org/wiki/Resident_set_size however we can. Usually with getrusage(). > From this (https://www.binarytides.com/linux-command-check-memory-usage/), it looks like top also reports > paged out memory. > > Matt > > mem = 0; > PetscMallocGetCurrentUsage(&mem); > PetscMallocGetMaximumUsage(&mem); > PetscMemoryGetCurrentUsage(&mem); > PetscMemoryGetMaximumUsage(&mem); > > I've read some other question in the mailing list regarding the same issue but I can't fully understand this. What is the difference between all of them? What information are they actually giving me? (I know this is only a "per process" output). I copy the output of two steps of the program as an example: > > ==================== step N ==================== > MallocGetCurrent: 314513664.0 B > MallocGetMaximum: 332723328.0 B > MemoryGetCurrent: 539996160.0 B > MemoryGetMaximum: 0.0 B > ==================== step N+1 ==================== > MallocGetCurrent: 395902912.0 B > MallocGetMaximum: 415178624.0 B > MemoryGetCurrent: 623783936.0 B > MemoryGetMaximum: 623775744.0 B > > 2) I was using this information to make the calculation of the memory required per node to run my problem. Also, I'm able to login to the computing node while running and I can check the memory consumption (with *top*). The memory used that I see with top is more or less the same as the one reported by PETSc functions at the beginning. But during the inialization of the solver and during the solving, *top* reports a consumption two times bigger than the one the functions report. Is it possible to know from where this extra memory consumption comes from? What things does SLEPc allocate that need that much memory? I've been trying to do the math but I think there are things I'm missing. I thought that part of it comes from the "BV" that the option -eps_view reports: > > BV Object: 2048 MPI processes > type: svec > 17 columns of global length 2333606220 > vector orthogonalization method: modified Gram-Schmidt > orthogonalization refinement: if needed (eta: 0.7071) > block orthogonalization method: GS > doing matmult as a single matrix-matrix product > > But "17 * 2333606220 * 8 Bytes / #nodes" only explains on third or less of the "extra" memory. > > Ale > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ From phil.tooley at sheffield.ac.uk Thu Oct 4 07:56:09 2018 From: phil.tooley at sheffield.ac.uk (Phil Tooley) Date: Thu, 4 Oct 2018 13:56:09 +0100 Subject: [petsc-users] Better understanding VecScatter Message-ID: <95861ed3-7c9f-820c-8a54-9e84923be54c@sheffield.ac.uk> Hi all, I am trying to understand how to create a custom scatter from petsc ordering in a local vector to natural ordering in a global vector. I have a 3D DMDA and local vector containing field data and am calculating the x y and z gradients into their own local vectors.? I then need to scatter these gradients to different parts of a single vector so they are arranged [x_1 .. x_n y_1 .. y_n z_1 .. z_n] with natural ordering.? (This is for use in a custom numerical scheme that I have been asked to parallelise) I can of course do this using multiple scatters but I need to perform this operation regularly and would like to express it as a single scatter operation if possible. I know I need to get the relevant AO from my DMDA and use it to construct appropriate ISs to build the scatter context but I am unsure how exactly to go about this. Can someone point me in the right direction please? Many Thanks Phil -- Phil Tooley Research Software Engineering University of Sheffield From mfadams at lbl.gov Thu Oct 4 08:59:11 2018 From: mfadams at lbl.gov (Mark Adams) Date: Thu, 4 Oct 2018 09:59:11 -0400 Subject: [petsc-users] Better understanding VecScatter In-Reply-To: <95861ed3-7c9f-820c-8a54-9e84923be54c@sheffield.ac.uk> References: <95861ed3-7c9f-820c-8a54-9e84923be54c@sheffield.ac.uk> Message-ID: So if you have three processors you would want the first processor to have all x gradients, etc.? You could use ISCreateGeneral: https://www.mcs.anl.gov/petsc/petsc-current/src/dm/examples/tutorials/ex6.c.html You need to create an integer array with the global indices that you want to bring to your new vector locally. On Thu, Oct 4, 2018 at 8:56 AM Phil Tooley wrote: > Hi all, > > I am trying to understand how to create a custom scatter from petsc > ordering in a local vector to natural ordering in a global vector. > > I have a 3D DMDA and local vector containing field data and am > calculating the x y and z gradients into their own local vectors. I > then need to scatter these gradients to different parts of a single > vector so they are arranged [x_1 .. x_n y_1 .. y_n z_1 .. z_n] with > natural ordering. (This is for use in a custom numerical scheme that I > have been asked to parallelise) > > I can of course do this using multiple scatters but I need to perform > this operation regularly and would like to express it as a single > scatter operation if possible. > > I know I need to get the relevant AO from my DMDA and use it to > construct appropriate ISs to build the scatter context but I am unsure > how exactly to go about this. > > Can someone point me in the right direction please? > > Many Thanks > > Phil > > -- > Phil Tooley > Research Software Engineering > University of Sheffield > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Thu Oct 4 09:34:48 2018 From: knepley at gmail.com (Matthew Knepley) Date: Thu, 4 Oct 2018 10:34:48 -0400 Subject: [petsc-users] Better understanding VecScatter In-Reply-To: <95861ed3-7c9f-820c-8a54-9e84923be54c@sheffield.ac.uk> References: <95861ed3-7c9f-820c-8a54-9e84923be54c@sheffield.ac.uk> Message-ID: On Thu, Oct 4, 2018 at 8:56 AM Phil Tooley wrote: > Hi all, > > I am trying to understand how to create a custom scatter from petsc > ordering in a local vector to natural ordering in a global vector. > > I have a 3D DMDA and local vector containing field data and am > calculating the x y and z gradients into their own local vectors. I > then need to scatter these gradients to different parts of a single > vector so they are arranged [x_1 .. x_n y_1 .. y_n z_1 .. z_n] with > natural ordering. (This is for use in a custom numerical scheme that I > have been asked to parallelise) > I may not be understanding correctly, but it sounds like this can be done simply using two DMs. The first DM is your original one holding the field values. The second one would set dof = dim in your new DM but everything else the same. You can use https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMDA/DMDACreateCompatibleDMDA.html Then stick the gradients in a global vector for the new DM. Then do GlobalToNatural for that DM. Is this what you want? Thanks, Matt > I can of course do this using multiple scatters but I need to perform > this operation regularly and would like to express it as a single > scatter operation if possible. > > I know I need to get the relevant AO from my DMDA and use it to > construct appropriate ISs to build the scatter context but I am unsure > how exactly to go about this. > > Can someone point me in the right direction please? > > Many Thanks > > Phil > > -- > Phil Tooley > Research Software Engineering > University of Sheffield > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From amfoggia at gmail.com Thu Oct 4 12:54:05 2018 From: amfoggia at gmail.com (Ale Foggia) Date: Thu, 4 Oct 2018 19:54:05 +0200 Subject: [petsc-users] PETSc/SLEPc: Memory consumption, particularly during solver initialization/solve In-Reply-To: References: Message-ID: Thank you both for your answers :) Matt: -Yes, sorry I forgot to tell you that, but I've also called PetscMemorySetGetMaximumUsage() right after initializing SLEPc. Also I've seen a strange behaviour: if I ran the same code in my computer and in the cluster *without* the command line option -malloc_dump, in the cluster the output of PetscMallocGetCurrentUsage and PetscMallocGetMaximumUsage is always zero, but that doesn't happen in my computer. - This is the output of the code for the solving part (after EPSCreate and after EPSSolve), and I've compared it with the output of *top* during those moments of peak memory consumption. *top* provides in one of the columns the resident set size (RES) and the numbers are around 1 GB per process, while, considering the numbers reported by the PETSc functions, the one that is more similar to that is given by MemoryGetCurrentUsage and is only 800 MB in the solving stage. Maybe, we can consider that those numbers are the same plus/minus something? Is it safe to say that MemoryGetCurrentUsage is measuring the "ru_maxss" member of "rusage" (or something similar)? If that's the case, what do the other functions report? ==================== SOLVER INIT ==================== MallocGetCurrent (init): 396096192.0 B MallocGetMaximum (init): 415178624.0 B MemoryGetCurrent (init): 624050176.0 B MemoryGetMaximum (init): 623775744.0 B ==================== SOLVER ==================== MallocGetCurrent (solver): 560320256.0 B MallocGetMaximum (solver): 560333440.0 B MemoryGetCurrent (solver): 820961280.0 B MemoryGetMaximum (solver): 623775744.0 B Jose: - By each step I mean each of the step of the the program in order to diagonalize the matrix. For me, those are: creation of basis, preallocation of matrix, setting values of matrix, initializing solver, solving/diagonalizing and cleaning. I'm only diagonalizing once. - Regarding the information provided by -log_view, it's confusing for me: for example, it reports the creation of Vecs scattered across the various stages that I've set up (with PetscLogStageRegister and PetscLogStagePush/Pop), but almost all the deletions are presented in the "Main Stage". What does that "Main Stage" consider? Why are more deletions in there that creations? It's nor completely for me clear how things are presented there. - Thanks for the suggestion about the solver. Does "faster convergence" for Krylov-Schur mean less memory and less computation, or just less computation? Ale El jue., 4 oct. 2018 a las 13:12, Jose E. Roman () escribi?: > Regarding the SLEPc part: > - What do you mean by "each step"? Are you calling EPSSolve() several > times? > - Yes, the BV object is generally what takes most of the memory. It is > allocated at the beginning of EPSSolve(). Depending on the solver/options, > other memory may be allocated as well. > - You can also see the memory reported at the end of -log_view > - I would suggest using the default solver Krylov-Schur - it will do > Lanczos with implicit restart, which will give faster convergence than the > EPSLANCZOS solver. > > Jose > > > > El 4 oct 2018, a las 12:49, Matthew Knepley > escribi?: > > > > On Thu, Oct 4, 2018 at 4:43 AM Ale Foggia wrote: > > Hello all, > > > > I'm using SLEPc 3.9.2 (and PETSc 3.9.3) to get the EPS_SMALLEST_REAL of > a matrix with the following characteristics: > > > > * type: real, Hermitian, sparse > > * linear size: 2333606220 > > * distributed in 2048 processes (64 nodes, 32 procs per node) > > > > My code first preallocates the necessary memory with > *MatMPIAIJSetPreallocation*, then fills it with the values and finally it > calls the following functions to create the solver and diagonalize the > matrix: > > > > EPSCreate(PETSC_COMM_WORLD, &solver); > > EPSSetOperators(solver,matrix,NULL); > > EPSSetProblemType(solver, EPS_HEP); > > EPSSetType(solver, EPSLANCZOS); > > EPSSetWhichEigenpairs(solver, EPS_SMALLEST_REAL); > > EPSSetFromOptions(solver); > > EPSSolve(solver); > > > > I want to make an estimation for larger size problems of the memory used > by the program (at every step) because I would like to keep it under 16 GB > per node. I've used the "memory usage" functions provided by PETSc, but > something happens during the solver stage that I can't explain. This brings > up two questions. > > > > 1) In each step I put a call to four memory functions and between them I > print the value of mem: > > > > Did you call PetscMemorySetGetMaximumUsage() first? > > > > We are computing https://en.wikipedia.org/wiki/Resident_set_size > however we can. Usually with getrusage(). > > From this (https://www.binarytides.com/linux-command-check-memory-usage/), > it looks like top also reports > > paged out memory. > > > > Matt > > > > mem = 0; > > PetscMallocGetCurrentUsage(&mem); > > PetscMallocGetMaximumUsage(&mem); > > PetscMemoryGetCurrentUsage(&mem); > > PetscMemoryGetMaximumUsage(&mem); > > > > I've read some other question in the mailing list regarding the same > issue but I can't fully understand this. What is the difference between all > of them? What information are they actually giving me? (I know this is only > a "per process" output). I copy the output of two steps of the program as > an example: > > > > ==================== step N ==================== > > MallocGetCurrent: 314513664.0 B > > MallocGetMaximum: 332723328.0 B > > MemoryGetCurrent: 539996160.0 B > > MemoryGetMaximum: 0.0 B > > ==================== step N+1 ==================== > > MallocGetCurrent: 395902912.0 B > > MallocGetMaximum: 415178624.0 B > > MemoryGetCurrent: 623783936.0 B > > MemoryGetMaximum: 623775744.0 B > > > > 2) I was using this information to make the calculation of the memory > required per node to run my problem. Also, I'm able to login to the > computing node while running and I can check the memory consumption (with > *top*). The memory used that I see with top is more or less the same as the > one reported by PETSc functions at the beginning. But during the > inialization of the solver and during the solving, *top* reports a > consumption two times bigger than the one the functions report. Is it > possible to know from where this extra memory consumption comes from? What > things does SLEPc allocate that need that much memory? I've been trying to > do the math but I think there are things I'm missing. I thought that part > of it comes from the "BV" that the option -eps_view reports: > > > > BV Object: 2048 MPI processes > > type: svec > > 17 columns of global length 2333606220 > > vector orthogonalization method: modified Gram-Schmidt > > orthogonalization refinement: if needed (eta: 0.7071) > > block orthogonalization method: GS > > doing matmult as a single matrix-matrix product > > > > But "17 * 2333606220 * 8 Bytes / #nodes" only explains on third or less > of the "extra" memory. > > > > Ale > > > > > > > > -- > > 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 > > > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Thu Oct 4 13:57:52 2018 From: knepley at gmail.com (Matthew Knepley) Date: Thu, 4 Oct 2018 14:57:52 -0400 Subject: [petsc-users] PETSc/SLEPc: Memory consumption, particularly during solver initialization/solve In-Reply-To: References: Message-ID: On Thu, Oct 4, 2018 at 1:54 PM Ale Foggia wrote: > Thank you both for your answers :) > > Matt: > -Yes, sorry I forgot to tell you that, but I've also called > PetscMemorySetGetMaximumUsage() right after initializing SLEPc. Also I've > seen a strange behaviour: if I ran the same code in my computer and in the > cluster *without* the command line option -malloc_dump, in the cluster the > output of PetscMallocGetCurrentUsage and PetscMallocGetMaximumUsage is > always zero, but that doesn't happen in my computer. > > - This is the output of the code for the solving part (after EPSCreate and > after EPSSolve), and I've compared it with the output of *top* during those > moments of peak memory consumption. *top* provides in one of the columns > the resident set size (RES) and the numbers are around 1 GB per process, > while, considering the numbers reported by the PETSc functions, the one > that is more similar to that is given by MemoryGetCurrentUsage and is only > 800 MB in the solving stage. Maybe, we can consider that those numbers are > the same plus/minus something? Is it safe to say that MemoryGetCurrentUsage > is measuring the "ru_maxss" member of "rusage" (or something similar)? If > that's the case, what do the other functions report? > This is a perennial problem, since RSS is no guarantee of stuff that is actually being used, but only was allocated at some point. The best tool I have seen for this is Massif. I really recommend it: http://valgrind.org/docs/manual/ms-manual.html Thanks, Matt > ==================== SOLVER INIT ==================== > MallocGetCurrent (init): 396096192.0 B > MallocGetMaximum (init): 415178624.0 B > MemoryGetCurrent (init): 624050176.0 B > MemoryGetMaximum (init): 623775744.0 B > ==================== SOLVER ==================== > MallocGetCurrent (solver): 560320256.0 B > MallocGetMaximum (solver): 560333440.0 B > MemoryGetCurrent (solver): 820961280.0 B > MemoryGetMaximum (solver): 623775744.0 B > > Jose: > - By each step I mean each of the step of the the program in order to > diagonalize the matrix. For me, those are: creation of basis, preallocation > of matrix, setting values of matrix, initializing solver, > solving/diagonalizing and cleaning. I'm only diagonalizing once. > > - Regarding the information provided by -log_view, it's confusing for me: > for example, it reports the creation of Vecs scattered across the various > stages that I've set up (with PetscLogStageRegister and > PetscLogStagePush/Pop), but almost all the deletions are presented in the > "Main Stage". What does that "Main Stage" consider? Why are more deletions > in there that creations? It's nor completely for me clear how things are > presented there. > > - Thanks for the suggestion about the solver. Does "faster convergence" > for Krylov-Schur mean less memory and less computation, or just less > computation? > > Ale > > > El jue., 4 oct. 2018 a las 13:12, Jose E. Roman () > escribi?: > >> Regarding the SLEPc part: >> - What do you mean by "each step"? Are you calling EPSSolve() several >> times? >> - Yes, the BV object is generally what takes most of the memory. It is >> allocated at the beginning of EPSSolve(). Depending on the solver/options, >> other memory may be allocated as well. >> - You can also see the memory reported at the end of -log_view >> - I would suggest using the default solver Krylov-Schur - it will do >> Lanczos with implicit restart, which will give faster convergence than the >> EPSLANCZOS solver. >> >> Jose >> >> >> > El 4 oct 2018, a las 12:49, Matthew Knepley >> escribi?: >> > >> > On Thu, Oct 4, 2018 at 4:43 AM Ale Foggia wrote: >> > Hello all, >> > >> > I'm using SLEPc 3.9.2 (and PETSc 3.9.3) to get the EPS_SMALLEST_REAL of >> a matrix with the following characteristics: >> > >> > * type: real, Hermitian, sparse >> > * linear size: 2333606220 >> > * distributed in 2048 processes (64 nodes, 32 procs per node) >> > >> > My code first preallocates the necessary memory with >> *MatMPIAIJSetPreallocation*, then fills it with the values and finally it >> calls the following functions to create the solver and diagonalize the >> matrix: >> > >> > EPSCreate(PETSC_COMM_WORLD, &solver); >> > EPSSetOperators(solver,matrix,NULL); >> > EPSSetProblemType(solver, EPS_HEP); >> > EPSSetType(solver, EPSLANCZOS); >> > EPSSetWhichEigenpairs(solver, EPS_SMALLEST_REAL); >> > EPSSetFromOptions(solver); >> > EPSSolve(solver); >> > >> > I want to make an estimation for larger size problems of the memory >> used by the program (at every step) because I would like to keep it under >> 16 GB per node. I've used the "memory usage" functions provided by PETSc, >> but something happens during the solver stage that I can't explain. This >> brings up two questions. >> > >> > 1) In each step I put a call to four memory functions and between them >> I print the value of mem: >> > >> > Did you call PetscMemorySetGetMaximumUsage() first? >> > >> > We are computing https://en.wikipedia.org/wiki/Resident_set_size >> however we can. Usually with getrusage(). >> > From this ( >> https://www.binarytides.com/linux-command-check-memory-usage/), it looks >> like top also reports >> > paged out memory. >> > >> > Matt >> > >> > mem = 0; >> > PetscMallocGetCurrentUsage(&mem); >> > PetscMallocGetMaximumUsage(&mem); >> > PetscMemoryGetCurrentUsage(&mem); >> > PetscMemoryGetMaximumUsage(&mem); >> > >> > I've read some other question in the mailing list regarding the same >> issue but I can't fully understand this. What is the difference between all >> of them? What information are they actually giving me? (I know this is only >> a "per process" output). I copy the output of two steps of the program as >> an example: >> > >> > ==================== step N ==================== >> > MallocGetCurrent: 314513664.0 B >> > MallocGetMaximum: 332723328.0 B >> > MemoryGetCurrent: 539996160.0 B >> > MemoryGetMaximum: 0.0 B >> > ==================== step N+1 ==================== >> > MallocGetCurrent: 395902912.0 B >> > MallocGetMaximum: 415178624.0 B >> > MemoryGetCurrent: 623783936.0 B >> > MemoryGetMaximum: 623775744.0 B >> > >> > 2) I was using this information to make the calculation of the memory >> required per node to run my problem. Also, I'm able to login to the >> computing node while running and I can check the memory consumption (with >> *top*). The memory used that I see with top is more or less the same as the >> one reported by PETSc functions at the beginning. But during the >> inialization of the solver and during the solving, *top* reports a >> consumption two times bigger than the one the functions report. Is it >> possible to know from where this extra memory consumption comes from? What >> things does SLEPc allocate that need that much memory? I've been trying to >> do the math but I think there are things I'm missing. I thought that part >> of it comes from the "BV" that the option -eps_view reports: >> > >> > BV Object: 2048 MPI processes >> > type: svec >> > 17 columns of global length 2333606220 >> > vector orthogonalization method: modified Gram-Schmidt >> > orthogonalization refinement: if needed (eta: 0.7071) >> > block orthogonalization method: GS >> > doing matmult as a single matrix-matrix product >> > >> > But "17 * 2333606220 * 8 Bytes / #nodes" only explains on third or less >> of the "extra" memory. >> > >> > Ale >> > >> > >> > >> > -- >> > 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 >> > >> > https://www.cse.buffalo.edu/~knepley/ >> >> -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jed at jedbrown.org Thu Oct 4 15:59:32 2018 From: jed at jedbrown.org (Jed Brown) Date: Thu, 04 Oct 2018 14:59:32 -0600 Subject: [petsc-users] PETSc/SLEPc: Memory consumption, particularly during solver initialization/solve In-Reply-To: References: Message-ID: <87bm894edn.fsf@jedbrown.org> Matthew Knepley writes: > On Thu, Oct 4, 2018 at 1:54 PM Ale Foggia wrote: > >> Thank you both for your answers :) >> >> Matt: >> -Yes, sorry I forgot to tell you that, but I've also called >> PetscMemorySetGetMaximumUsage() right after initializing SLEPc. Also I've >> seen a strange behaviour: if I ran the same code in my computer and in the >> cluster *without* the command line option -malloc_dump, in the cluster the >> output of PetscMallocGetCurrentUsage and PetscMallocGetMaximumUsage is >> always zero, but that doesn't happen in my computer. >> >> - This is the output of the code for the solving part (after EPSCreate and >> after EPSSolve), and I've compared it with the output of *top* during those >> moments of peak memory consumption. *top* provides in one of the columns >> the resident set size (RES) and the numbers are around 1 GB per process, >> while, considering the numbers reported by the PETSc functions, the one >> that is more similar to that is given by MemoryGetCurrentUsage and is only >> 800 MB in the solving stage. Maybe, we can consider that those numbers are >> the same plus/minus something? Is it safe to say that MemoryGetCurrentUsage >> is measuring the "ru_maxss" member of "rusage" (or something similar)? If >> that's the case, what do the other functions report? >> > > This is a perennial problem, since RSS is no guarantee of stuff that is > actually being used, but only was allocated at some point. No, allocation alone does not make it resident on most operating systems. If you run top, you see a column VIRT (memory that was allocated/mmap'd) and RES (actually resident in physical memory). PetscMemoryGetCurrentUsage tries to get resident memory usage via /proc/{PID}/statm or getrusage() ru_maxrss. PetscMallocGetMaximumUsage just says how much memory has been allocated using PETSc's tracing malloc (off by default with an optimized build, but you can turn on by running with -malloc or related diagnostic options). > The best tool I have seen for this is Massif. I really recommend it: > > http://valgrind.org/docs/manual/ms-manual.html > > Thanks, > > Matt > > >> ==================== SOLVER INIT ==================== >> MallocGetCurrent (init): 396096192.0 B >> MallocGetMaximum (init): 415178624.0 B >> MemoryGetCurrent (init): 624050176.0 B >> MemoryGetMaximum (init): 623775744.0 B >> ==================== SOLVER ==================== >> MallocGetCurrent (solver): 560320256.0 B >> MallocGetMaximum (solver): 560333440.0 B >> MemoryGetCurrent (solver): 820961280.0 B >> MemoryGetMaximum (solver): 623775744.0 B >> >> Jose: >> - By each step I mean each of the step of the the program in order to >> diagonalize the matrix. For me, those are: creation of basis, preallocation >> of matrix, setting values of matrix, initializing solver, >> solving/diagonalizing and cleaning. I'm only diagonalizing once. >> >> - Regarding the information provided by -log_view, it's confusing for me: >> for example, it reports the creation of Vecs scattered across the various >> stages that I've set up (with PetscLogStageRegister and >> PetscLogStagePush/Pop), but almost all the deletions are presented in the >> "Main Stage". What does that "Main Stage" consider? Why are more deletions >> in there that creations? It's nor completely for me clear how things are >> presented there. >> >> - Thanks for the suggestion about the solver. Does "faster convergence" >> for Krylov-Schur mean less memory and less computation, or just less >> computation? >> >> Ale >> >> >> El jue., 4 oct. 2018 a las 13:12, Jose E. Roman () >> escribi?: >> >>> Regarding the SLEPc part: >>> - What do you mean by "each step"? Are you calling EPSSolve() several >>> times? >>> - Yes, the BV object is generally what takes most of the memory. It is >>> allocated at the beginning of EPSSolve(). Depending on the solver/options, >>> other memory may be allocated as well. >>> - You can also see the memory reported at the end of -log_view >>> - I would suggest using the default solver Krylov-Schur - it will do >>> Lanczos with implicit restart, which will give faster convergence than the >>> EPSLANCZOS solver. >>> >>> Jose >>> >>> >>> > El 4 oct 2018, a las 12:49, Matthew Knepley >>> escribi?: >>> > >>> > On Thu, Oct 4, 2018 at 4:43 AM Ale Foggia wrote: >>> > Hello all, >>> > >>> > I'm using SLEPc 3.9.2 (and PETSc 3.9.3) to get the EPS_SMALLEST_REAL of >>> a matrix with the following characteristics: >>> > >>> > * type: real, Hermitian, sparse >>> > * linear size: 2333606220 >>> > * distributed in 2048 processes (64 nodes, 32 procs per node) >>> > >>> > My code first preallocates the necessary memory with >>> *MatMPIAIJSetPreallocation*, then fills it with the values and finally it >>> calls the following functions to create the solver and diagonalize the >>> matrix: >>> > >>> > EPSCreate(PETSC_COMM_WORLD, &solver); >>> > EPSSetOperators(solver,matrix,NULL); >>> > EPSSetProblemType(solver, EPS_HEP); >>> > EPSSetType(solver, EPSLANCZOS); >>> > EPSSetWhichEigenpairs(solver, EPS_SMALLEST_REAL); >>> > EPSSetFromOptions(solver); >>> > EPSSolve(solver); >>> > >>> > I want to make an estimation for larger size problems of the memory >>> used by the program (at every step) because I would like to keep it under >>> 16 GB per node. I've used the "memory usage" functions provided by PETSc, >>> but something happens during the solver stage that I can't explain. This >>> brings up two questions. >>> > >>> > 1) In each step I put a call to four memory functions and between them >>> I print the value of mem: >>> > >>> > Did you call PetscMemorySetGetMaximumUsage() first? >>> > >>> > We are computing https://en.wikipedia.org/wiki/Resident_set_size >>> however we can. Usually with getrusage(). >>> > From this ( >>> https://www.binarytides.com/linux-command-check-memory-usage/), it looks >>> like top also reports >>> > paged out memory. >>> > >>> > Matt >>> > >>> > mem = 0; >>> > PetscMallocGetCurrentUsage(&mem); >>> > PetscMallocGetMaximumUsage(&mem); >>> > PetscMemoryGetCurrentUsage(&mem); >>> > PetscMemoryGetMaximumUsage(&mem); >>> > >>> > I've read some other question in the mailing list regarding the same >>> issue but I can't fully understand this. What is the difference between all >>> of them? What information are they actually giving me? (I know this is only >>> a "per process" output). I copy the output of two steps of the program as >>> an example: >>> > >>> > ==================== step N ==================== >>> > MallocGetCurrent: 314513664.0 B >>> > MallocGetMaximum: 332723328.0 B >>> > MemoryGetCurrent: 539996160.0 B >>> > MemoryGetMaximum: 0.0 B >>> > ==================== step N+1 ==================== >>> > MallocGetCurrent: 395902912.0 B >>> > MallocGetMaximum: 415178624.0 B >>> > MemoryGetCurrent: 623783936.0 B >>> > MemoryGetMaximum: 623775744.0 B >>> > >>> > 2) I was using this information to make the calculation of the memory >>> required per node to run my problem. Also, I'm able to login to the >>> computing node while running and I can check the memory consumption (with >>> *top*). The memory used that I see with top is more or less the same as the >>> one reported by PETSc functions at the beginning. But during the >>> inialization of the solver and during the solving, *top* reports a >>> consumption two times bigger than the one the functions report. Is it >>> possible to know from where this extra memory consumption comes from? What >>> things does SLEPc allocate that need that much memory? I've been trying to >>> do the math but I think there are things I'm missing. I thought that part >>> of it comes from the "BV" that the option -eps_view reports: >>> > >>> > BV Object: 2048 MPI processes >>> > type: svec >>> > 17 columns of global length 2333606220 >>> > vector orthogonalization method: modified Gram-Schmidt >>> > orthogonalization refinement: if needed (eta: 0.7071) >>> > block orthogonalization method: GS >>> > doing matmult as a single matrix-matrix product >>> > >>> > But "17 * 2333606220 * 8 Bytes / #nodes" only explains on third or less >>> of the "extra" memory. >>> > >>> > Ale >>> > >>> > >>> > >>> > -- >>> > 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 >>> > >>> > https://www.cse.buffalo.edu/~knepley/ >>> >>> > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ From heeho.park at gmail.com Thu Oct 4 17:44:21 2018 From: heeho.park at gmail.com (HeeHo Park) Date: Thu, 4 Oct 2018 17:44:21 -0500 Subject: [petsc-users] subprocess (block) tolerance. Message-ID: Hi, I'm running PFLOTRAN and in PFLOTRAN, we have flow_ and flow_sub_ processes. I was wondering what the red underlined values meant (each block tolerance?) and how to change them (would it affect convergence?). Blue marked bold values are changed from the default values for linear solvers. FLOW Linear Solver solver: bcgs preconditioner: asm *atol: 1.000000E-10* * rtol: 1.000000E-10* dtol: 1.000000E+04 maximum iteration: 10000 KSP Object: (flow_) 8 MPI processes type: bcgs maximum iterations=10000, initial guess is zero tolerances: * relative=1e-10, absolute=1e-10*, divergence=10000. left preconditioning using PRECONDITIONED norm type for convergence test PC Object: (flow_) 8 MPI processes type: asm Additive Schwarz: total subdomain blocks = 8, amount of overlap = 1 Additive Schwarz: restriction/interpolation type - RESTRICT [0] number of local blocks = 1 [1] number of local blocks = 1 [2] number of local blocks = 1 [3] number of local blocks = 1 [4] number of local blocks = 1 [5] number of local blocks = 1 [6] number of local blocks = 1 [7] number of local blocks = 1 Local solve info for each block is in the following KSP and PC objects: - - - - - - - - - - - - - - - - - - [0] local block number 0, size = 1389 KSP Object: (flow_sub_) 1 MPI processes type: preonly maximum iterations=10000, initial guess is zero >>> tolerances: *relative=1e-05, absolute=1e-50*, divergence=10000. left preconditioning using DEFAULT norm type for convergence test PC Object: (flow_sub_) 1 MPI processes type: ilu PC has not been set up so information may be incomplete out-of-place factorization 0 levels of fill tolerance for zero pivot 2.22045e-14 using diagonal shift on blocks to prevent zero pivot [INBLOCKS] matrix ordering: natural linear system matrix = precond matrix: Mat Object: (flow_) 1 MPI processes type: seqbaij rows=1389, cols=1389, bs=3 total: nonzeros=20025, allocated nonzeros=20025 total number of mallocs used during MatSetValues calls =0 block size is 3 - - - - - - - - - - - - - - - - - - -- HeeHo Daniel Park -------------- next part -------------- An HTML attachment was scrubbed... URL: From jed at jedbrown.org Thu Oct 4 17:47:19 2018 From: jed at jedbrown.org (Jed Brown) Date: Thu, 04 Oct 2018 16:47:19 -0600 Subject: [petsc-users] subprocess (block) tolerance. In-Reply-To: References: Message-ID: <87r2h52utk.fsf@jedbrown.org> The subdomain KSP (flow_sub_) has type "preonly" so it always does exactly one iteration. If you were to use an iterative subdomain solver (e.g., -flow_sub_ksp_type gmres) then those tolerances would be used. HeeHo Park writes: > Hi, I'm running PFLOTRAN and in PFLOTRAN, we have flow_ and flow_sub_ > processes. I was wondering what the red underlined values meant (each block > tolerance?) and how to change them (would it affect convergence?). Blue > marked bold values are changed from the default values for linear solvers. > > FLOW Linear Solver > solver: bcgs > preconditioner: asm > *atol: 1.000000E-10* > * rtol: 1.000000E-10* > dtol: 1.000000E+04 > maximum iteration: 10000 > KSP Object: (flow_) 8 MPI processes > type: bcgs > maximum iterations=10000, initial guess is zero > tolerances: * relative=1e-10, absolute=1e-10*, divergence=10000. > left preconditioning > using PRECONDITIONED norm type for convergence test > PC Object: (flow_) 8 MPI processes > type: asm > Additive Schwarz: total subdomain blocks = 8, amount of overlap = 1 > Additive Schwarz: restriction/interpolation type - RESTRICT > [0] number of local blocks = 1 > [1] number of local blocks = 1 > [2] number of local blocks = 1 > [3] number of local blocks = 1 > [4] number of local blocks = 1 > [5] number of local blocks = 1 > [6] number of local blocks = 1 > [7] number of local blocks = 1 > Local solve info for each block is in the following KSP and PC objects: > - - - - - - - - - - - - - - - - - - > [0] local block number 0, size = 1389 > KSP Object: (flow_sub_) 1 MPI processes > type: preonly > maximum iterations=10000, initial guess is zero >>>> tolerances: *relative=1e-05, absolute=1e-50*, divergence=10000. > left preconditioning > using DEFAULT norm type for convergence test > PC Object: (flow_sub_) 1 MPI processes > type: ilu > PC has not been set up so information may be incomplete > out-of-place factorization > 0 levels of fill > tolerance for zero pivot 2.22045e-14 > using diagonal shift on blocks to prevent zero pivot [INBLOCKS] > matrix ordering: natural > linear system matrix = precond matrix: > Mat Object: (flow_) 1 MPI processes > type: seqbaij > rows=1389, cols=1389, bs=3 > total: nonzeros=20025, allocated nonzeros=20025 > total number of mallocs used during MatSetValues calls =0 > block size is 3 > - - - - - - - - - - - - - - - - - - > > -- > HeeHo Daniel Park From bsmith at mcs.anl.gov Thu Oct 4 17:53:04 2018 From: bsmith at mcs.anl.gov (Smith, Barry F.) Date: Thu, 4 Oct 2018 22:53:04 +0000 Subject: [petsc-users] subprocess (block) tolerance. In-Reply-To: References: Message-ID: <6F04DAF7-562F-4777-A3E1-70EA4A632929@anl.gov> Since KSP Object: (flow_sub_) 1 MPI processes type: preonly this means only a single iteration of the inner solver is used so the numbers in red are not used. You could do something like -flow_ksp_type fgmres -flow_sub_ksp_type gmres -flow_sub_ksp_rtol 1.e-2 but it wouldn't help maters. Likely the current values are the best. Barry > On Oct 4, 2018, at 5:44 PM, HeeHo Park wrote: > > Hi, I'm running PFLOTRAN and in PFLOTRAN, we have flow_ and flow_sub_ processes. I was wondering what the red underlined values meant (each block tolerance?) and how to change them (would it affect convergence?). Blue marked bold values are changed from the default values for linear solvers. > > FLOW Linear Solver > solver: bcgs > preconditioner: asm > atol: 1.000000E-10 > rtol: 1.000000E-10 > dtol: 1.000000E+04 > maximum iteration: 10000 > KSP Object: (flow_) 8 MPI processes > type: bcgs > maximum iterations=10000, initial guess is zero > tolerances: relative=1e-10, absolute=1e-10, divergence=10000. > left preconditioning > using PRECONDITIONED norm type for convergence test > PC Object: (flow_) 8 MPI processes > type: asm > Additive Schwarz: total subdomain blocks = 8, amount of overlap = 1 > Additive Schwarz: restriction/interpolation type - RESTRICT > [0] number of local blocks = 1 > [1] number of local blocks = 1 > [2] number of local blocks = 1 > [3] number of local blocks = 1 > [4] number of local blocks = 1 > [5] number of local blocks = 1 > [6] number of local blocks = 1 > [7] number of local blocks = 1 > Local solve info for each block is in the following KSP and PC objects: > - - - - - - - - - - - - - - - - - - > [0] local block number 0, size = 1389 > KSP Object: (flow_sub_) 1 MPI processes > type: preonly > maximum iterations=10000, initial guess is zero > >>> tolerances: relative=1e-05, absolute=1e-50, divergence=10000. > left preconditioning > using DEFAULT norm type for convergence test > PC Object: (flow_sub_) 1 MPI processes > type: ilu > PC has not been set up so information may be incomplete > out-of-place factorization > 0 levels of fill > tolerance for zero pivot 2.22045e-14 > using diagonal shift on blocks to prevent zero pivot [INBLOCKS] > matrix ordering: natural > linear system matrix = precond matrix: > Mat Object: (flow_) 1 MPI processes > type: seqbaij > rows=1389, cols=1389, bs=3 > total: nonzeros=20025, allocated nonzeros=20025 > total number of mallocs used during MatSetValues calls =0 > block size is 3 > - - - - - - - - - - - - - - - - - - > > -- > HeeHo Daniel Park From heeho.park at gmail.com Thu Oct 4 18:09:51 2018 From: heeho.park at gmail.com (HeeHo Park) Date: Thu, 4 Oct 2018 18:09:51 -0500 Subject: [petsc-users] subprocess (block) tolerance. In-Reply-To: <6F04DAF7-562F-4777-A3E1-70EA4A632929@anl.gov> References: <6F04DAF7-562F-4777-A3E1-70EA4A632929@anl.gov> Message-ID: Barry and Jed, Thank you for your answers. I think I need to learn more about domain decomposition as I am a bit confused. Is it true that we are using BiCGstab here to solve the system of equations, using Additive Schwartz as a domain decomposition preconditioner, and that precondition matrix for each block is preconditioned by ilu[0]? Thanks, On Thu, Oct 4, 2018 at 5:53 PM Smith, Barry F. wrote: > > Since > > KSP Object: (flow_sub_) 1 MPI processes > type: preonly > > this means only a single iteration of the inner solver is used so the > numbers in red are not used. > > You could do something like -flow_ksp_type fgmres -flow_sub_ksp_type gmres > -flow_sub_ksp_rtol 1.e-2 but it wouldn't help maters. Likely the current > values are the best. > > Barry > > > > On Oct 4, 2018, at 5:44 PM, HeeHo Park wrote: > > > > Hi, I'm running PFLOTRAN and in PFLOTRAN, we have flow_ and flow_sub_ > processes. I was wondering what the red underlined values meant (each block > tolerance?) and how to change them (would it affect convergence?). Blue > marked bold values are changed from the default values for linear solvers. > > > > FLOW Linear Solver > > solver: bcgs > > preconditioner: asm > > atol: 1.000000E-10 > > rtol: 1.000000E-10 > > dtol: 1.000000E+04 > > maximum iteration: 10000 > > KSP Object: (flow_) 8 MPI processes > > type: bcgs > > maximum iterations=10000, initial guess is zero > > tolerances: relative=1e-10, absolute=1e-10, divergence=10000. > > left preconditioning > > using PRECONDITIONED norm type for convergence test > > PC Object: (flow_) 8 MPI processes > > type: asm > > Additive Schwarz: total subdomain blocks = 8, amount of overlap = 1 > > Additive Schwarz: restriction/interpolation type - RESTRICT > > [0] number of local blocks = 1 > > [1] number of local blocks = 1 > > [2] number of local blocks = 1 > > [3] number of local blocks = 1 > > [4] number of local blocks = 1 > > [5] number of local blocks = 1 > > [6] number of local blocks = 1 > > [7] number of local blocks = 1 > > Local solve info for each block is in the following KSP and PC > objects: > > - - - - - - - - - - - - - - - - - - > > [0] local block number 0, size = 1389 > > KSP Object: (flow_sub_) 1 MPI processes > > type: preonly > > maximum iterations=10000, initial guess is zero > > >>> tolerances: relative=1e-05, absolute=1e-50, divergence=10000. > > left preconditioning > > using DEFAULT norm type for convergence test > > PC Object: (flow_sub_) 1 MPI processes > > type: ilu > > PC has not been set up so information may be incomplete > > out-of-place factorization > > 0 levels of fill > > tolerance for zero pivot 2.22045e-14 > > using diagonal shift on blocks to prevent zero pivot [INBLOCKS] > > matrix ordering: natural > > linear system matrix = precond matrix: > > Mat Object: (flow_) 1 MPI processes > > type: seqbaij > > rows=1389, cols=1389, bs=3 > > total: nonzeros=20025, allocated nonzeros=20025 > > total number of mallocs used during MatSetValues calls =0 > > block size is 3 > > - - - - - - - - - - - - - - - - - - > > > > -- > > HeeHo Daniel Park > > -- HeeHo Daniel Park -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Thu Oct 4 18:26:39 2018 From: bsmith at mcs.anl.gov (Smith, Barry F.) Date: Thu, 4 Oct 2018 23:26:39 +0000 Subject: [petsc-users] subprocess (block) tolerance. In-Reply-To: References: <6F04DAF7-562F-4777-A3E1-70EA4A632929@anl.gov> Message-ID: <84FAD7D5-649E-4EFE-ADA6-B58374CE2F0B@anl.gov> > On Oct 4, 2018, at 6:09 PM, HeeHo Park wrote: > > Barry and Jed, > > Thank you for your answers. I think I need to learn more about domain decomposition as I am a bit confused. > Is it true that we are using BiCGstab here to solve the system of equations, using Additive Schwartz as a domain decomposition preconditioner, and that precondition matrix for each block is preconditioned by ilu[0]? You can say it that way. > > Thanks, > > > On Thu, Oct 4, 2018 at 5:53 PM Smith, Barry F. wrote: > > Since > > KSP Object: (flow_sub_) 1 MPI processes > type: preonly > > this means only a single iteration of the inner solver is used so the numbers in red are not used. > > You could do something like -flow_ksp_type fgmres -flow_sub_ksp_type gmres -flow_sub_ksp_rtol 1.e-2 but it wouldn't help maters. Likely the current values are the best. > > Barry > > > > On Oct 4, 2018, at 5:44 PM, HeeHo Park wrote: > > > > Hi, I'm running PFLOTRAN and in PFLOTRAN, we have flow_ and flow_sub_ processes. I was wondering what the red underlined values meant (each block tolerance?) and how to change them (would it affect convergence?). Blue marked bold values are changed from the default values for linear solvers. > > > > FLOW Linear Solver > > solver: bcgs > > preconditioner: asm > > atol: 1.000000E-10 > > rtol: 1.000000E-10 > > dtol: 1.000000E+04 > > maximum iteration: 10000 > > KSP Object: (flow_) 8 MPI processes > > type: bcgs > > maximum iterations=10000, initial guess is zero > > tolerances: relative=1e-10, absolute=1e-10, divergence=10000. > > left preconditioning > > using PRECONDITIONED norm type for convergence test > > PC Object: (flow_) 8 MPI processes > > type: asm > > Additive Schwarz: total subdomain blocks = 8, amount of overlap = 1 > > Additive Schwarz: restriction/interpolation type - RESTRICT > > [0] number of local blocks = 1 > > [1] number of local blocks = 1 > > [2] number of local blocks = 1 > > [3] number of local blocks = 1 > > [4] number of local blocks = 1 > > [5] number of local blocks = 1 > > [6] number of local blocks = 1 > > [7] number of local blocks = 1 > > Local solve info for each block is in the following KSP and PC objects: > > - - - - - - - - - - - - - - - - - - > > [0] local block number 0, size = 1389 > > KSP Object: (flow_sub_) 1 MPI processes > > type: preonly > > maximum iterations=10000, initial guess is zero > > >>> tolerances: relative=1e-05, absolute=1e-50, divergence=10000. > > left preconditioning > > using DEFAULT norm type for convergence test > > PC Object: (flow_sub_) 1 MPI processes > > type: ilu > > PC has not been set up so information may be incomplete > > out-of-place factorization > > 0 levels of fill > > tolerance for zero pivot 2.22045e-14 > > using diagonal shift on blocks to prevent zero pivot [INBLOCKS] > > matrix ordering: natural > > linear system matrix = precond matrix: > > Mat Object: (flow_) 1 MPI processes > > type: seqbaij > > rows=1389, cols=1389, bs=3 > > total: nonzeros=20025, allocated nonzeros=20025 > > total number of mallocs used during MatSetValues calls =0 > > block size is 3 > > - - - - - - - - - - - - - - - - - - > > > > -- > > HeeHo Daniel Park > > > > -- > HeeHo Daniel Park From jroman at dsic.upv.es Fri Oct 5 02:38:28 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Fri, 5 Oct 2018 09:38:28 +0200 Subject: [petsc-users] PETSc/SLEPc: Memory consumption, particularly during solver initialization/solve In-Reply-To: References: Message-ID: > El 4 oct 2018, a las 19:54, Ale Foggia escribi?: > > Jose: > - By each step I mean each of the step of the the program in order to diagonalize the matrix. For me, those are: creation of basis, preallocation of matrix, setting values of matrix, initializing solver, solving/diagonalizing and cleaning. I'm only diagonalizing once. > > - Regarding the information provided by -log_view, it's confusing for me: for example, it reports the creation of Vecs scattered across the various stages that I've set up (with PetscLogStageRegister and PetscLogStagePush/Pop), but almost all the deletions are presented in the "Main Stage". What does that "Main Stage" consider? Why are more deletions in there that creations? It's nor completely for me clear how things are presented there. I guess deletions should match creations. Seems to be related to using stages. Maybe someone from PETSc can give an explanation, but looking at a PETSc example that uses stages (e.g. dm/impls/plex/examples/tests/ex1.c) it seems that some destructions are counted in the main stage while the creation is counted in another stage - I guess it depends on the points where the stages are defined. The sum of creations matches the sum of destroys. > > - Thanks for the suggestion about the solver. Does "faster convergence" for Krylov-Schur mean less memory and less computation, or just less computation? > It should be about the same memory with less iterations. Jose From zakaryah at gmail.com Fri Oct 5 15:14:35 2018 From: zakaryah at gmail.com (zakaryah) Date: Fri, 5 Oct 2018 16:14:35 -0400 Subject: [petsc-users] Fwd: Implementing a homotopy solver In-Reply-To: References: <6377AF62-D548-4276-A2A6-158EE4513593@anl.gov> <00D16613-4B28-4801-96EA-7CE2EF8BF8F7@imperial.ac.uk> <29B68A54-9D29-4881-AD80-98A5E510FD82@anl.gov> Message-ID: Thanks Matt - I was trying to write it in linear algebra notation, but the nature of the problem might produce some confusion. I was also originally a bit confused by a fairly major typo in the paper I was following, but I'm almost sure I have it clear now. I'll try to be concise - the meat is in the last two paragraphs. My system of nonlinear equations, F(x)=0, has dimension m. Traditional methods for solving, like Newton's method, tend to reach points at which the Jacobian becomes singular. I'm trying the homotopy trick, which involves introducing an additional scalar variable, s, and solving the system H(x,s) = sF(x) + (1-s)(x-x_0), starting at s=0 and following the zero curve to, hopefully, a solution at s=1. The homotopy map H only has m components, so its Jacobian J is m x (m+1), and has rank m. I need to find a vector u in its null space: J u = 0. Note that u is size m+1. Rather than solve J u = 0, I make an augmented matrix A, which is (m+1)x(m+1), and consists of J in its first m rows, then a somewhat arbitrary vector in the last row. Then the vector u is the solution to A u = b, where b is zero everywhere except its last element. This solve seems to be working fine. The SNES should then solve for a particular solution y of the Newton update, J y = - H(y). A (unique) particular solution can also be found by solving A y = [-H(y) 0]^T. Finally - and this is the step I can't figure out how to implement properly, I want to find the norm-minimizing solution z for the Newton update: z = y - u(y^T u)/(u^T u). I doubt there is any way to do this elegantly within the existing routines, because u is not in the nullspace of A. Rather, it's in the nullspace of J, which is the submatrix I care about. I think what I need is a way to just apply the orthogonal projection in the preceding paragraph, after the SNES solves the linear system but before the Newton update is applied. I don't know the SNES internals well at all. Is it possible to hook this in somehow, or put it in an existing function? Thanks again for all your help. On Oct 1, 2018 6:49 AM, "Matthew Knepley" wrote: On Sun, Sep 30, 2018 at 6:06 PM zakaryah wrote: > OK, thanks. > > I'm using a composite DM, DM_packer. To make a separate KSP, I did the > following in the FormJacobian() routine, after assembling the Jacobian > matrix A and the RHS for the tangent vector, b: > > - KSPCreate(PETSC_COMM_WORLD,&ksp) > - KSPSetDM(ksp,DM_packer) > - KSPSetDMActive(ksp,PETSC_FALSE) - because I want to set the operators > - KSPSetOperators(ksp,A,P) > - VecSet(n,0) - set initial guess to zero > - KSPSolve(ksp,b,n) - this solve works correctly > - VecNormalize(n,NULL) > - > MatNullSpaceCreate(PetscObjectComm((PetscObject)A),PETSC_FALSE,1,&n,&nullsp) > - MatSetNullSpace(A,nullsp) > > Then, with -snes_type newtonls -pc_type none -ksp_monitor > -ksp_monitor_true_residual -ksp_view, the output for the KSPSolve described > above, i.e. for the tangent vector, looks correct: > > 0 KSP preconditioned resid norm 1.000000000000e+03 true resid norm > 1.000000000000e+03 ||r(i)||/||b|| 1.000000000000e+00 > ... > > 185 KSP preconditioned resid norm 9.900713131874e-03 true resid norm > 9.900713131904e-03 ||r(i)||/||b|| 9.900713131904e-06 > > Linear solve converged due to CONVERGED_RTOL iterations 185 > > KSP Object: 1 MPI processes > > type: gmres > > restart=30, using Classical (unmodified) Gram-Schmidt > Orthogonalization with no iterative refinement > > happy breakdown tolerance 1e-30 > > 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: 1 MPI processes > > type: none > > linear system matrix = precond matrix: > > Mat Object: 1 MPI processes > > type: seqaij > > rows=78247, cols=78247 > > total: nonzeros=6063481, allocated nonzeros=6063481 > > total number of mallocs used during MatSetValues calls =0 > > using I-node routines: found 26083 nodes, limit used is 5 > > > But the next KSP, i.e. the one in the SNES, doesn't converge in the true > residual: > > > 0 KSP preconditioned resid norm 2.045599092896e-04 true resid norm > 2.803828296212e-04 ||r(i)||/||b|| 1.000000000000e+00 > > 191 KSP preconditioned resid norm 2.009941278534e-09 true resid norm > 1.636010142734e-04 ||r(i)||/||b|| 5.834915586465e-01 > > > KSP Object: 1 MPI processes > > type: gmres > > restart=30, using Classical (unmodified) Gram-Schmidt > Orthogonalization with no iterative refinement > > happy breakdown tolerance 1e-30 > > 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: 1 MPI processes > > type: none > > linear system matrix = precond matrix: > > Mat Object: 1 MPI processes > > type: seqaij > > rows=78247, cols=78247 > > total: nonzeros=6063481, allocated nonzeros=6063481 > > total number of mallocs used during MatSetValues calls =0 > > has attached null space > > using I-node routines: found 26083 nodes, limit used is 5 > > > My guess about what's going on is that the tangent vector n isn't really > in the nullspace of A. > I do not understand the rest, but this is the problem. Maybe it would make more sense if you wrote things in linear algebraic notation. Thanks, Matt > Rather, it's in the nullspace of the m x (m+1) submatrix of A. So, An=c > e_{m+1}, where c is an arbitrary constant and e_{m+1} is the m+1 th basis > vector. The nonlinear function also has an added row, F_{m+1}, which is > set to zero in the FormFunction() routine. I don't care about the value of > F_{m+1}, but I suppose that if it's included in the true residual, and NOT > in the "preconditioned" residual, even with pc_type none, then it will be > tricky to diagnose the performance. Should I be using my own routine to > evaluate the residual, so that F_{m+1} is not included? > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Fri Oct 5 15:42:00 2018 From: knepley at gmail.com (Matthew Knepley) Date: Fri, 5 Oct 2018 16:42:00 -0400 Subject: [petsc-users] Fwd: Implementing a homotopy solver In-Reply-To: References: <6377AF62-D548-4276-A2A6-158EE4513593@anl.gov> <00D16613-4B28-4801-96EA-7CE2EF8BF8F7@imperial.ac.uk> <29B68A54-9D29-4881-AD80-98A5E510FD82@anl.gov> Message-ID: On Fri, Oct 5, 2018 at 4:15 PM zakaryah wrote: > Thanks Matt - I was trying to write it in linear algebra notation, but the > nature of the problem might produce some confusion. I was also > originally a bit confused by a fairly major typo in the paper I was > following, but I'm almost sure I have it clear now. I'll try to be > concise - the meat is in the last two paragraphs. > > My system of nonlinear equations, F(x)=0, has dimension m. Traditional > methods for solving, like Newton's method, tend to reach points at which > the Jacobian becomes singular. I'm trying the homotopy trick, which > involves introducing an additional scalar variable, s, and solving the > system H(x,s) = sF(x) + (1-s)(x-x_0), starting at s=0 and following the > zero curve to, hopefully, a solution at s=1. > > The homotopy map H only has m components, so its Jacobian J is m x (m+1), > and has rank m. I need to find a vector u in its null space: J u = 0. > Note that u is size m+1. Rather than solve J u = 0, I make an augmented > matrix A, which is (m+1)x(m+1), and consists of J in its first m rows, then > a somewhat arbitrary vector in the last row. Then the vector u is the > solution to A u = b, where b is zero everywhere except its last element. > This solve seems to be working fine. > > The SNES should then solve for a particular solution y of the Newton > update, J y = - H(y). A (unique) particular solution can also be found by > solving A y = [-H(y) 0]^T. Finally - and this is the step I can't figure > out how to implement properly, I want to find the norm-minimizing solution > z for the Newton update: > z = y - u(y^T u)/(u^T u). > > I doubt there is any way to do this elegantly within the existing > routines, because u is not in the nullspace of A. Rather, it's in the > nullspace of J, which is the submatrix I care about. I think what I need > is a way to just apply the orthogonal projection in the preceding > paragraph, after the SNES solves the linear system but before the Newton > update is applied. I don't know the SNES internals well at all. Is it > possible to hook this in somehow, or put it in an existing function? > I do not claim to fully understand the above (it would be easier for me to write the equations explicitly on their own lines). However, the issue with nullspaces is soluble I think. So you say that J \in R^{m \cross (m+1)} is full rank so that its nullspace has dimension 1 and is spanned by u, J u = 0. Now you augment J to get a square matrix A by adding a row, / J \ u = / J u \ = / 0 \ \ v^T / \ v^T u / \ 0 / if v is orthogonal to u. Thus, just choose v from the m-1 dimensional space orthogonal to u. Thanks, Matt > Thanks again for all your help. > > > On Oct 1, 2018 6:49 AM, "Matthew Knepley" wrote: > > On Sun, Sep 30, 2018 at 6:06 PM zakaryah wrote: > >> OK, thanks. >> >> I'm using a composite DM, DM_packer. To make a separate KSP, I did the >> following in the FormJacobian() routine, after assembling the Jacobian >> matrix A and the RHS for the tangent vector, b: >> >> - KSPCreate(PETSC_COMM_WORLD,&ksp) >> - KSPSetDM(ksp,DM_packer) >> - KSPSetDMActive(ksp,PETSC_FALSE) - because I want to set the >> operators >> - KSPSetOperators(ksp,A,P) >> - VecSet(n,0) - set initial guess to zero >> - KSPSolve(ksp,b,n) - this solve works correctly >> - VecNormalize(n,NULL) >> - >> MatNullSpaceCreate(PetscObjectComm((PetscObject)A),PETSC_FALSE,1,&n,&nullsp) >> - MatSetNullSpace(A,nullsp) >> >> Then, with -snes_type newtonls -pc_type none -ksp_monitor >> -ksp_monitor_true_residual -ksp_view, the output for the KSPSolve described >> above, i.e. for the tangent vector, looks correct: >> >> 0 KSP preconditioned resid norm 1.000000000000e+03 true resid norm >> 1.000000000000e+03 ||r(i)||/||b|| 1.000000000000e+00 >> ... >> >> 185 KSP preconditioned resid norm 9.900713131874e-03 true resid norm >> 9.900713131904e-03 ||r(i)||/||b|| 9.900713131904e-06 >> >> Linear solve converged due to CONVERGED_RTOL iterations 185 >> >> KSP Object: 1 MPI processes >> >> type: gmres >> >> restart=30, using Classical (unmodified) Gram-Schmidt >> Orthogonalization with no iterative refinement >> >> happy breakdown tolerance 1e-30 >> >> 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: 1 MPI processes >> >> type: none >> >> linear system matrix = precond matrix: >> >> Mat Object: 1 MPI processes >> >> type: seqaij >> >> rows=78247, cols=78247 >> >> total: nonzeros=6063481, allocated nonzeros=6063481 >> >> total number of mallocs used during MatSetValues calls =0 >> >> using I-node routines: found 26083 nodes, limit used is 5 >> >> >> But the next KSP, i.e. the one in the SNES, doesn't converge in the true >> residual: >> >> >> 0 KSP preconditioned resid norm 2.045599092896e-04 true resid norm >> 2.803828296212e-04 ||r(i)||/||b|| 1.000000000000e+00 >> >> 191 KSP preconditioned resid norm 2.009941278534e-09 true resid norm >> 1.636010142734e-04 ||r(i)||/||b|| 5.834915586465e-01 >> >> >> KSP Object: 1 MPI processes >> >> type: gmres >> >> restart=30, using Classical (unmodified) Gram-Schmidt >> Orthogonalization with no iterative refinement >> >> happy breakdown tolerance 1e-30 >> >> 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: 1 MPI processes >> >> type: none >> >> linear system matrix = precond matrix: >> >> Mat Object: 1 MPI processes >> >> type: seqaij >> >> rows=78247, cols=78247 >> >> total: nonzeros=6063481, allocated nonzeros=6063481 >> >> total number of mallocs used during MatSetValues calls =0 >> >> has attached null space >> >> using I-node routines: found 26083 nodes, limit used is 5 >> >> >> My guess about what's going on is that the tangent vector n isn't really >> in the nullspace of A. >> > > I do not understand the rest, but this is the problem. Maybe it would make > more sense if you wrote things > in linear algebraic notation. > > Thanks, > > Matt > > >> Rather, it's in the nullspace of the m x (m+1) submatrix of A. So, An=c >> e_{m+1}, where c is an arbitrary constant and e_{m+1} is the m+1 th basis >> vector. The nonlinear function also has an added row, F_{m+1}, which is >> set to zero in the FormFunction() routine. I don't care about the value of >> F_{m+1}, but I suppose that if it's included in the true residual, and NOT >> in the "preconditioned" residual, even with pc_type none, then it will be >> tricky to diagnose the performance. Should I be using my own routine to >> evaluate the residual, so that F_{m+1} is not included? >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From zakaryah at gmail.com Fri Oct 5 15:54:45 2018 From: zakaryah at gmail.com (zakaryah) Date: Fri, 5 Oct 2018 16:54:45 -0400 Subject: [petsc-users] Fwd: Implementing a homotopy solver In-Reply-To: References: <6377AF62-D548-4276-A2A6-158EE4513593@anl.gov> <00D16613-4B28-4801-96EA-7CE2EF8BF8F7@imperial.ac.uk> <29B68A54-9D29-4881-AD80-98A5E510FD82@anl.gov> Message-ID: Sorry again about the formatting - I struggle with notation in email. I think I see what you are saying - my augmented matrix should differ in the last row between the one used to calculate the nullspace, u, and the one the SNES uses as the Jacobian. If I construct the SNES Jacobian A so that u is truly in its nullspace, then I can just add u to the nullspace of A and let PETSc take care of the projection? I will try this - thanks for the excellent suggestion. On Fri, Oct 5, 2018 at 4:42 PM Matthew Knepley wrote: > On Fri, Oct 5, 2018 at 4:15 PM zakaryah wrote: > >> Thanks Matt - I was trying to write it in linear algebra notation, but >> the nature of the problem might produce some confusion. I was also >> originally a bit confused by a fairly major typo in the paper I was >> following, but I'm almost sure I have it clear now. I'll try to be >> concise - the meat is in the last two paragraphs. >> >> My system of nonlinear equations, F(x)=0, has dimension m. Traditional >> methods for solving, like Newton's method, tend to reach points at which >> the Jacobian becomes singular. I'm trying the homotopy trick, which >> involves introducing an additional scalar variable, s, and solving the >> system H(x,s) = sF(x) + (1-s)(x-x_0), starting at s=0 and following the >> zero curve to, hopefully, a solution at s=1. >> >> The homotopy map H only has m components, so its Jacobian J is m x >> (m+1), and has rank m. I need to find a vector u in its null space: J u >> = 0. Note that u is size m+1. Rather than solve J u = 0, I make an >> augmented matrix A, which is (m+1)x(m+1), and consists of J in its first m >> rows, then a somewhat arbitrary vector in the last row. Then the vector >> u is the solution to A u = b, where b is zero everywhere except its last >> element. This solve seems to be working fine. >> >> The SNES should then solve for a particular solution y of the Newton >> update, J y = - H(y). A (unique) particular solution can also be found by >> solving A y = [-H(y) 0]^T. Finally - and this is the step I can't figure >> out how to implement properly, I want to find the norm-minimizing solution >> z for the Newton update: >> z = y - u(y^T u)/(u^T u). >> >> I doubt there is any way to do this elegantly within the existing >> routines, because u is not in the nullspace of A. Rather, it's in the >> nullspace of J, which is the submatrix I care about. I think what I need >> is a way to just apply the orthogonal projection in the preceding >> paragraph, after the SNES solves the linear system but before the Newton >> update is applied. I don't know the SNES internals well at all. Is it >> possible to hook this in somehow, or put it in an existing function? >> > > I do not claim to fully understand the above (it would be easier for me to > write the equations explicitly on their own lines). However, the issue with > nullspaces is soluble I think. So you say that > > J \in R^{m \cross (m+1)} is full rank > > so that its nullspace has dimension 1 and is spanned by u, > > J u = 0. > > Now you augment J to get a square matrix A by adding a row, > > / J \ u = / J u \ = / 0 \ > \ v^T / \ v^T u / \ 0 / > > if v is orthogonal to u. Thus, just choose v from the m-1 dimensional > space orthogonal to u. > > Thanks, > > Matt > > >> Thanks again for all your help. >> >> >> On Oct 1, 2018 6:49 AM, "Matthew Knepley" wrote: >> >> On Sun, Sep 30, 2018 at 6:06 PM zakaryah wrote: >> >>> OK, thanks. >>> >>> I'm using a composite DM, DM_packer. To make a separate KSP, I did the >>> following in the FormJacobian() routine, after assembling the Jacobian >>> matrix A and the RHS for the tangent vector, b: >>> >>> - KSPCreate(PETSC_COMM_WORLD,&ksp) >>> - KSPSetDM(ksp,DM_packer) >>> - KSPSetDMActive(ksp,PETSC_FALSE) - because I want to set the >>> operators >>> - KSPSetOperators(ksp,A,P) >>> - VecSet(n,0) - set initial guess to zero >>> - KSPSolve(ksp,b,n) - this solve works correctly >>> - VecNormalize(n,NULL) >>> - >>> MatNullSpaceCreate(PetscObjectComm((PetscObject)A),PETSC_FALSE,1,&n,&nullsp) >>> - MatSetNullSpace(A,nullsp) >>> >>> Then, with -snes_type newtonls -pc_type none -ksp_monitor >>> -ksp_monitor_true_residual -ksp_view, the output for the KSPSolve described >>> above, i.e. for the tangent vector, looks correct: >>> >>> 0 KSP preconditioned resid norm 1.000000000000e+03 true resid norm >>> 1.000000000000e+03 ||r(i)||/||b|| 1.000000000000e+00 >>> ... >>> >>> 185 KSP preconditioned resid norm 9.900713131874e-03 true resid norm >>> 9.900713131904e-03 ||r(i)||/||b|| 9.900713131904e-06 >>> >>> Linear solve converged due to CONVERGED_RTOL iterations 185 >>> >>> KSP Object: 1 MPI processes >>> >>> type: gmres >>> >>> restart=30, using Classical (unmodified) Gram-Schmidt >>> Orthogonalization with no iterative refinement >>> >>> happy breakdown tolerance 1e-30 >>> >>> 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: 1 MPI processes >>> >>> type: none >>> >>> linear system matrix = precond matrix: >>> >>> Mat Object: 1 MPI processes >>> >>> type: seqaij >>> >>> rows=78247, cols=78247 >>> >>> total: nonzeros=6063481, allocated nonzeros=6063481 >>> >>> total number of mallocs used during MatSetValues calls =0 >>> >>> using I-node routines: found 26083 nodes, limit used is 5 >>> >>> >>> But the next KSP, i.e. the one in the SNES, doesn't converge in the true >>> residual: >>> >>> >>> 0 KSP preconditioned resid norm 2.045599092896e-04 true resid norm >>> 2.803828296212e-04 ||r(i)||/||b|| 1.000000000000e+00 >>> >>> 191 KSP preconditioned resid norm 2.009941278534e-09 true resid norm >>> 1.636010142734e-04 ||r(i)||/||b|| 5.834915586465e-01 >>> >>> >>> KSP Object: 1 MPI processes >>> >>> type: gmres >>> >>> restart=30, using Classical (unmodified) Gram-Schmidt >>> Orthogonalization with no iterative refinement >>> >>> happy breakdown tolerance 1e-30 >>> >>> 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: 1 MPI processes >>> >>> type: none >>> >>> linear system matrix = precond matrix: >>> >>> Mat Object: 1 MPI processes >>> >>> type: seqaij >>> >>> rows=78247, cols=78247 >>> >>> total: nonzeros=6063481, allocated nonzeros=6063481 >>> >>> total number of mallocs used during MatSetValues calls =0 >>> >>> has attached null space >>> >>> using I-node routines: found 26083 nodes, limit used is 5 >>> >>> >>> My guess about what's going on is that the tangent vector n isn't really >>> in the nullspace of A. >>> >> >> I do not understand the rest, but this is the problem. Maybe it would >> make more sense if you wrote things >> in linear algebraic notation. >> >> Thanks, >> >> Matt >> >> >>> Rather, it's in the nullspace of the m x (m+1) submatrix of A. So, An=c >>> e_{m+1}, where c is an arbitrary constant and e_{m+1} is the m+1 th basis >>> vector. The nonlinear function also has an added row, F_{m+1}, which is >>> set to zero in the FormFunction() routine. I don't care about the value of >>> F_{m+1}, but I suppose that if it's included in the true residual, and NOT >>> in the "preconditioned" residual, even with pc_type none, then it will be >>> tricky to diagnose the performance. Should I be using my own routine to >>> evaluate the residual, so that F_{m+1} is not included? >>> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> >> >> > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mvalera-w at sdsu.edu Fri Oct 5 17:49:02 2018 From: mvalera-w at sdsu.edu (Manuel Valera) Date: Fri, 5 Oct 2018 15:49:02 -0700 Subject: [petsc-users] Interpolation in staggered grid Message-ID: Hello, I'm trying to do a simple variable interpolation, from a cell center to a face in a staggered grid, my model data management is done with DMDAs, with two different DMs one for each cell position, I already did this task on a fortran only version of the model using the 4 closest neighbors of the scalars (cell center) to be interpolated at the velocity site (cell face), i did it using a loop over the domain, somehow this easy task is not translating into the DMDA framework, I'm not sure what I'm doing wrong or not aware of a easier way Petsc may have for this task, if you could point out an easier strategy or an example I would be grateful, Thanks, -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.wick.1980 at gmail.com Fri Oct 5 20:08:35 2018 From: michael.wick.1980 at gmail.com (Mike Wick) Date: Fri, 5 Oct 2018 18:08:35 -0700 Subject: [petsc-users] Failure of MUMPS Message-ID: Hello PETSc team: I am trying to solve a PDE problem with high-order finite elements. The matrix is getting denser and my experience is that MUMPS just outperforms iterative solvers. For certain problems, MUMPS just fail in the middle for no clear reason. I just wander if there is any suggestion to improve the robustness of MUMPS? Or in general, any suggestion for interative solver with very high-order finite elements? Thanks! Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: From hzhang at mcs.anl.gov Fri Oct 5 20:12:43 2018 From: hzhang at mcs.anl.gov (Zhang, Hong) Date: Sat, 6 Oct 2018 01:12:43 +0000 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: Mike: Hello PETSc team: I am trying to solve a PDE problem with high-order finite elements. The matrix is getting denser and my experience is that MUMPS just outperforms iterative solvers. For certain problems, MUMPS just fail in the middle for no clear reason. I just wander if there is any suggestion to improve the robustness of MUMPS? Or in general, any suggestion for interative solver with very high-order finite elements? What error message do you get when MUMPS fails? Out of memory, zero pivoting, or something? Hong -------------- next part -------------- An HTML attachment was scrubbed... URL: From hzhang at mcs.anl.gov Fri Oct 5 20:12:43 2018 From: hzhang at mcs.anl.gov (Zhang, Hong) Date: Sat, 6 Oct 2018 01:12:43 +0000 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: Mike: Hello PETSc team: I am trying to solve a PDE problem with high-order finite elements. The matrix is getting denser and my experience is that MUMPS just outperforms iterative solvers. For certain problems, MUMPS just fail in the middle for no clear reason. I just wander if there is any suggestion to improve the robustness of MUMPS? Or in general, any suggestion for interative solver with very high-order finite elements? What error message do you get when MUMPS fails? Out of memory, zero pivoting, or something? Hong -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.wick.1980 at gmail.com Fri Oct 5 20:15:26 2018 From: michael.wick.1980 at gmail.com (Mike Wick) Date: Fri, 5 Oct 2018 18:15:26 -0700 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: Hi Hong: There is no explicit error message actually. The solver converge in 0 iteration and returns an nan number. Looks like a zero pivoting problem. Mike On Fri, Oct 5, 2018 at 6:12 PM Zhang, Hong wrote: > Mike: > >> Hello PETSc team: >> >> I am trying to solve a PDE problem with high-order finite elements. The >> matrix is getting denser and my experience is that MUMPS just outperforms >> iterative solvers. >> >> For certain problems, MUMPS just fail in the middle for no clear reason. >> I just wander if there is any suggestion to improve the robustness of >> MUMPS? Or in general, any suggestion for interative solver with very >> high-order finite elements? >> > > What error message do you get when MUMPS fails? Out of memory, zero > pivoting, or something? > Hong > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.knezevic at akselos.com Fri Oct 5 20:22:17 2018 From: david.knezevic at akselos.com (David Knezevic) Date: Fri, 5 Oct 2018 21:22:17 -0400 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: On Fri, Oct 5, 2018 at 9:16 PM Mike Wick wrote: > Hi Hong: > > There is no explicit error message actually. The solver converge in 0 > iteration and returns an nan number. Looks like a zero pivoting problem. > > Mike > I use MatMumpsGetInfo to get error info returned by MUMPS, e.g. PetscInt info_1; MatMumpsGetInfo(pc_mat, 1, &info_1); Then you can check the value of info_1 to get error diagnostics. One error that I run into sometimes is when info_1 is -9, in which case I increase icntl_14 and try again. Best, David > > On Fri, Oct 5, 2018 at 6:12 PM Zhang, Hong wrote: > >> Mike: >> >>> Hello PETSc team: >>> >>> I am trying to solve a PDE problem with high-order finite elements. The >>> matrix is getting denser and my experience is that MUMPS just outperforms >>> iterative solvers. >>> >>> For certain problems, MUMPS just fail in the middle for no clear reason. >>> I just wander if there is any suggestion to improve the robustness of >>> MUMPS? Or in general, any suggestion for interative solver with very >>> high-order finite elements? >>> >> >> What error message do you get when MUMPS fails? Out of memory, zero >> pivoting, or something? >> Hong >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefano.zampini at gmail.com Sat Oct 6 02:51:18 2018 From: stefano.zampini at gmail.com (Stefano Zampini) Date: Sat, 6 Oct 2018 10:51:18 +0300 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: I also recently noticed that mumps sometimes segfaults (or return NaNs) in parallel on matrices coming from higher order fem (relatively dense blocks). The fault goes away if not using scalapack to solve for the root mode of the nested dissection tree. The same happens with mumps from a package manager instead of --download-mumps. Probably this is a regression on their side . Il Sab 6 Ott 2018, 04:22 David Knezevic ha scritto: > > On Fri, Oct 5, 2018 at 9:16 PM Mike Wick > wrote: > >> Hi Hong: >> >> There is no explicit error message actually. The solver converge in 0 >> iteration and returns an nan number. Looks like a zero pivoting problem. >> >> Mike >> > > I use MatMumpsGetInfo > to > get error info returned by MUMPS, e.g. > > PetscInt info_1; > MatMumpsGetInfo(pc_mat, 1, &info_1); > > Then you can check the value of info_1 to get error diagnostics. One error > that I run into sometimes is when info_1 is -9, in which case I increase > icntl_14 and try again. > > Best, > David > > > >> >> On Fri, Oct 5, 2018 at 6:12 PM Zhang, Hong wrote: >> >>> Mike: >>> >>>> Hello PETSc team: >>>> >>>> I am trying to solve a PDE problem with high-order finite elements. The >>>> matrix is getting denser and my experience is that MUMPS just outperforms >>>> iterative solvers. >>>> >>>> For certain problems, MUMPS just fail in the middle for no clear >>>> reason. I just wander if there is any suggestion to improve the robustness >>>> of MUMPS? Or in general, any suggestion for interative solver with very >>>> high-order finite elements? >>>> >>> >>> What error message do you get when MUMPS fails? Out of memory, zero >>> pivoting, or something? >>> Hong >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Sat Oct 6 06:42:39 2018 From: knepley at gmail.com (Matthew Knepley) Date: Sat, 6 Oct 2018 07:42:39 -0400 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: On Fri, Oct 5, 2018 at 9:08 PM Mike Wick wrote: > Hello PETSc team: > > I am trying to solve a PDE problem with high-order finite elements. The > matrix is getting denser and my experience is that MUMPS just outperforms > iterative solvers. > If the problem is elliptic, there is a lot of evidence that the P1 preconditioner is descent for the system. Some people just project the system to P1, invert that with multigrid, and use that as the PC for Krylov. It should be worth trying. Moreover, as Jed will tell you, forming matrices for higher order is counterproductive. You should apply those matrix-free. Thanks, Matt > For certain problems, MUMPS just fail in the middle for no clear reason. I > just wander if there is any suggestion to improve the robustness of MUMPS? > Or in general, any suggestion for interative solver with very high-order > finite elements? > > Thanks! > > Mike > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Sat Oct 6 06:45:12 2018 From: knepley at gmail.com (Matthew Knepley) Date: Sat, 6 Oct 2018 07:45:12 -0400 Subject: [petsc-users] Interpolation in staggered grid In-Reply-To: References: Message-ID: On Fri, Oct 5, 2018 at 6:49 PM Manuel Valera wrote: > Hello, > > I'm trying to do a simple variable interpolation, from a cell center to a > face in a staggered grid, my model data management is done with DMDAs, with > two different DMs one for each cell position, > > I already did this task on a fortran only version of the model using the 4 > closest neighbors of the scalars (cell center) to be interpolated at the > velocity site (cell face), i did it using a loop over the domain, somehow > this easy task is not translating into the DMDA framework, > Its not clear to me what problem you are having. We have done this before. For example, https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex30.c.html I would note that the development version of PETSc now has DMStag which supports staggered grid discretizations directly. Thanks, Matt > I'm not sure what I'm doing wrong or not aware of a easier way Petsc may > have for this task, if you could point out an easier strategy or an example > I would be grateful, > > Thanks, > > > > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From a.croucher at auckland.ac.nz Sun Oct 7 20:09:06 2018 From: a.croucher at auckland.ac.nz (Adrian Croucher) Date: Mon, 8 Oct 2018 14:09:06 +1300 Subject: [petsc-users] pkg-config Message-ID: <00e0d38f-acaa-cd4b-5e01-91a21eb09235@auckland.ac.nz> hi I am experimenting with using pkg-config to help build my code, and using the PETSc.pc file in $PETSC_DIR/$PETSC_ARCH/lib/pkgconfig. At present it is not working, because the PETSc.pc file sets Libs: -L${libdir} -lpetsc where libdir=${prefix}/lib, and (in my case at least) prefix is equal to $PETSC_DIR. But the PETSc library is not in $PETSC_DIR/lib, it is in $PETSC_DIR/$PETSC_ARCH/lib. Have I messed something up in my PETSc config so that the PETSc.pc file is not quite right? - Adrian -- Dr Adrian Croucher Senior Research Fellow Department of Engineering Science University of Auckland, New Zealand email: a.croucher at auckland.ac.nz tel: +64 (0)9 923 4611 From jed at jedbrown.org Sun Oct 7 20:14:00 2018 From: jed at jedbrown.org (Jed Brown) Date: Sun, 07 Oct 2018 19:14:00 -0600 Subject: [petsc-users] pkg-config In-Reply-To: <00e0d38f-acaa-cd4b-5e01-91a21eb09235@auckland.ac.nz> References: <00e0d38f-acaa-cd4b-5e01-91a21eb09235@auckland.ac.nz> Message-ID: <87efd1z1d3.fsf@jedbrown.org> This was a bug, now fixed in 'maint' and will be in the next patch release. You can repair the PETSc.pc, update to 'maint', or apply this 2-line patch. https://bitbucket.org/petsc/petsc/commits/e1e675de8c3f48a6c27b15412e00ded76072f735 Adrian Croucher writes: > hi > > I am experimenting with using pkg-config to help build my code, and > using the PETSc.pc file in $PETSC_DIR/$PETSC_ARCH/lib/pkgconfig. > > At present it is not working, because the PETSc.pc file sets Libs: > -L${libdir} -lpetsc > > where libdir=${prefix}/lib, and (in my case at least) prefix is equal to > $PETSC_DIR. > > But the PETSc library is not in $PETSC_DIR/lib, it is in > $PETSC_DIR/$PETSC_ARCH/lib. > > Have I messed something up in my PETSc config so that the PETSc.pc file > is not quite right? > > - Adrian > > -- > Dr Adrian Croucher > Senior Research Fellow > Department of Engineering Science > University of Auckland, New Zealand > email: a.croucher at auckland.ac.nz > tel: +64 (0)9 923 4611 From a.croucher at auckland.ac.nz Sun Oct 7 21:18:03 2018 From: a.croucher at auckland.ac.nz (Adrian Croucher) Date: Mon, 8 Oct 2018 15:18:03 +1300 Subject: [petsc-users] pkg-config In-Reply-To: <87efd1z1d3.fsf@jedbrown.org> References: <00e0d38f-acaa-cd4b-5e01-91a21eb09235@auckland.ac.nz> <87efd1z1d3.fsf@jedbrown.org> Message-ID: <076ae03e-0d99-509a-866c-b716b88c1579@auckland.ac.nz> OK thanks Jed, that's fixed it. - Adrian On 8/10/18 2:14 PM, Jed Brown wrote: > This was a bug, now fixed in 'maint' and will be in the next patch > release. You can repair the PETSc.pc, update to 'maint', or apply this > 2-line patch. > > https://bitbucket.org/petsc/petsc/commits/e1e675de8c3f48a6c27b15412e00ded76072f735 > > Adrian Croucher writes: > >> hi >> >> I am experimenting with using pkg-config to help build my code, and >> using the PETSc.pc file in $PETSC_DIR/$PETSC_ARCH/lib/pkgconfig. >> >> At present it is not working, because the PETSc.pc file sets Libs: >> -L${libdir} -lpetsc >> >> where libdir=${prefix}/lib, and (in my case at least) prefix is equal to >> $PETSC_DIR. >> >> But the PETSc library is not in $PETSC_DIR/lib, it is in >> $PETSC_DIR/$PETSC_ARCH/lib. >> >> Have I messed something up in my PETSc config so that the PETSc.pc file >> is not quite right? >> >> - Adrian -- Dr Adrian Croucher Senior Research Fellow Department of Engineering Science University of Auckland, New Zealand email: a.croucher at auckland.ac.nz tel: +64 (0)9 923 4611 From Ling.Zou at inl.gov Mon Oct 8 10:30:22 2018 From: Ling.Zou at inl.gov (Ling Zou) Date: Mon, 8 Oct 2018 15:30:22 +0000 Subject: [petsc-users] Diffusion with unstructured mesh Message-ID: Hi All, It looks like DMPLEX is the built-in unstructured mesh library. Is there an existing example on, for example, a simple diffusion problem using cell-centered finite volume method with the DMPLEX method? Thanks, Ling -------------- next part -------------- An HTML attachment was scrubbed... URL: From ellen.price at cfa.harvard.edu Mon Oct 8 16:49:13 2018 From: ellen.price at cfa.harvard.edu (Ellen M. Price) Date: Mon, 8 Oct 2018 17:49:13 -0400 Subject: [petsc-users] Implementing FEM with PLEX/DS/SNES Message-ID: Can anyone shed some light on SNES example 12? https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex12.c.html I am solving a Poisson problem, but with a source term defined on mesh points, so I don't have an analytic form. The part I am confused about is the role of the functions f0, f1, and g3 that go into the DS. Suppose I have the Poisson problem nabla^2 u = f. Then the weak form is, for test function phi, \int_{\partial \Omega} \phi \nabla u - \int_\Omega \nabla u \cdot \nabla \phi = \int_\Omega \phi f Based on the documentation of PetscDSSetResidual(), I'm a little confused about f0 and f1: \int_\Omega \phi f_0(u, u_t, \nabla u, x, t) + \nabla\phi \cdot {\vec f}_1(u, u_t, \nabla u, x, t) So f0 is, for the Poisson problem, zero, and f1 is just -grad u? Do we need to do anything with the surface term, or is that handled internally? Because neither of these terms are a surface integral term, both are volume integrals. I can't figure out the purpose of g0, g1, g2, g3 in PetscDSSetJacobian(), either. Is g supposed to be the source term? Is psi a second basis function? What even *is* the Jacobian in a FEM problem? I've only seen them formulated as linear problems in tutorials, so I'm not even clear why we need a nonlinear solver or Jacobian... Any help is appreciated. I like the idea of a general framework for FEM, as I think it will reduce human error on my part, but I also want to understand what I'm doing. Ellen Price From weizhuo2 at illinois.edu Mon Oct 8 17:13:29 2018 From: weizhuo2 at illinois.edu (Weizhuo Wang) Date: Mon, 8 Oct 2018 17:13:29 -0500 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: Sorry I was caught up with midterms for the last few days. I tried the lu decomposition today and the 2-norm is pretty stable at ~ 10^-15, which is expected for double precision. Since the discretization error is so small, it would be reasonable to assume the rest is majority the algebraic error. Then looking at the result without the -pc_type lu flag(second graph), the error is asymptoting to a constant several magnitudes larger than the tolerance set for the solver. (atol=1e-12, rtol=1e-9) Is this the expected behavior? Shouldn't it decrease with finer grid? [image: LU.png] [image: Total.png] On Tue, Oct 2, 2018 at 6:52 PM Matthew Knepley wrote: > On Tue, Oct 2, 2018 at 5:26 PM Weizhuo Wang wrote: > >> I didn't specify a tolerance, it was using the default tolerance. Doesn't >> the asymptoting norm implies finer grid won't help to get finer solution? >> > > There are two things going on in your test, discretization error > controlled by the grid, and algebraic error controlled by the solver. This > makes it difficult to isolate what is happening. However, it seems clear > that your plot is looking at algebraic error. You can confirm this by using > > -pc_type lu > > for the solve. Then all you have is discretization error. > > Thanks, > > Matt > > >> Mark Adams ? >> >>> >>> >>> On Tue, Oct 2, 2018 at 5:04 PM Weizhuo Wang >>> wrote: >>> >>>> Yes I was using one norm in my Helmholtz code, the example code used 2 >>>> norm. But now I am using 2 norm in both code. >>>> >>>> /* >>>> Check the error >>>> */ >>>> ierr = VecAXPY(x,-1.0,u); CHKERRQ(ierr); >>>> ierr = VecNorm(x,NORM_1,&norm); CHKERRQ(ierr); >>>> ierr = KSPGetIterationNumber(ksp,&its); CHKERRQ(ierr); >>>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g iterations >>>> %D\n",(double)norm/(m*n),its); CHKERRQ(ierr); >>>> >>>> I made a plot to show the increase: >>>> >>> >>> >>> FYI, this is asymptoting to a constant. What solver tolerance are >>> you using? >>> >>> >>>> >>>> [image: Norm comparison.png] >>>> >>>> Mark Adams ? >>>> >>>>> >>>>> >>>>> On Tue, Oct 2, 2018 at 2:24 PM Weizhuo Wang >>>>> wrote: >>>>> >>>>>> The example code and makefile are attached below. The whole thing >>>>>> started as I tried to build a Helmholtz solver, and the mean error >>>>>> (calculated by: sum( | numerical_sol - analytical_sol | / analytical_sol ) >>>>>> ) >>>>>> >>>>> >>>>> This is a one norm. If you use max (instead of sum) then you don't >>>>> need to scale. You do have to be careful about dividing by (near) zero. >>>>> >>>>> >>>>>> increases as I use finer and finer grids. >>>>>> >>>>> >>>>> What was the rate of increase? >>>>> >>>>> >>>>>> Then I looked at the example 12 (Laplacian solver) which is similar >>>>>> to what I did to see if I have missed something. The example is using >>>>>> 2_norm. I have made some minor modifications (3 places) on the code, you >>>>>> can search 'Modified' in the code to see them. >>>>>> >>>>>> If this helps: I configured the PETSc to use real and double >>>>>> precision. Changed the name of the example code from ex12.c to ex12c.c >>>>>> >>>>>> Thanks for all your reply! >>>>>> >>>>>> Weizhuo >>>>>> >>>>>> >>>>>> Smith, Barry F. >>>>>> >>>>>> >>>>>>> Please send your version of the example that computes the mean >>>>>>> norm of the grid; I suspect we are talking apples and oranges >>>>>>> >>>>>>> Barry >>>>>>> >>>>>>> >>>>>>> >>>>>>> > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang >>>>>>> wrote: >>>>>>> > >>>>>>> > I also tried to divide the norm by m*n , which is the number of >>>>>>> grids, the trend of norm still increases. >>>>>>> > >>>>>>> > Thanks! >>>>>>> > >>>>>>> > Weizhuo >>>>>>> > >>>>>>> > Matthew Knepley >>>>>>> > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang >>>>>>> wrote: >>>>>>> > Hi! >>>>>>> > >>>>>>> > I'm recently trying out the example code provided with the KSP >>>>>>> solver (ex12.c). I noticed that the mean norm of the grid increases as I >>>>>>> use finer meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. >>>>>>> However at m=100, n=100, mean norm increases to 9.55e-6. This seems counter >>>>>>> intuitive, since most of the time error should decreases when using finer >>>>>>> grid. Am I doing this wrong? >>>>>>> > >>>>>>> > The norm is misleading in that it is the l_2 norm, meaning just >>>>>>> the sqrt of the sum of the squares of >>>>>>> > the vector entries. It should be scaled by the volume element to >>>>>>> approximate a scale-independent >>>>>>> > norm (like the L_2 norm). >>>>>>> > >>>>>>> > Thanks, >>>>>>> > >>>>>>> > Matt >>>>>>> > >>>>>>> > Thanks! >>>>>>> > -- >>>>>>> > Wang Weizhuo >>>>>>> > >>>>>>> > >>>>>>> > -- >>>>>>> > 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 >>>>>>> > >>>>>>> > https://www.cse.buffalo.edu/~knepley/ >>>>>>> >>>>>>> > >>>>>>> > >>>>>>> > -- >>>>>>> > Wang Weizhuo >>>>>>> >>>>>>> >>>>>> >>>>>> -- >>>>>> Wang Weizhuo >>>>>> >>>>> >>>> >>>> -- >>>> Wang Weizhuo >>>> >>> >> >> -- >> Wang Weizhuo >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -- Wang Weizhuo -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: LU.png Type: image/png Size: 38656 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Total.png Type: image/png Size: 39046 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Norm comparison.png Type: image/png Size: 87887 bytes Desc: not available URL: From knepley at gmail.com Mon Oct 8 17:28:11 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 8 Oct 2018 18:28:11 -0400 Subject: [petsc-users] Implementing FEM with PLEX/DS/SNES In-Reply-To: References: Message-ID: On Mon, Oct 8, 2018 at 5:50 PM Ellen M. Price wrote: > Can anyone shed some light on SNES example 12? > > > https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex12.c.html > > I am solving a Poisson problem, but with a source term defined on mesh > points, so I don't have an analytic form. Can you explain more about this source term? It sounds like a bunch of delta functions. That would still work in this framework, but the convergence rate for a rhs with these singularities is reduced (this is a generic feature of FEM). > The part I am confused about > is the role of the functions f0, f1, and g3 that go into the DS. > > Suppose I have the Poisson problem nabla^2 u = f. Then the weak form is, > for test function phi, > > \int_{\partial \Omega} \phi \nabla u - \int_\Omega \nabla u \cdot \nabla > \phi = \int_\Omega \phi f > I think you need \int_{\partial \Omega} \phi \nabla u \cdot n instead. > Based on the documentation of PetscDSSetResidual(), I'm a little > confused about f0 and f1: > > \int_\Omega \phi f_0(u, u_t, \nabla u, x, t) + \nabla\phi \cdot {\vec > f}_1(u, u_t, \nabla u, x, t) > > So f0 is, for the Poisson problem, zero, and f1 is just -grad u? No. f1 is indeed -grad u, but f0 is -f. Note that ex12 solves -nabla^2 u = f since that operator is positive definite. > Do we > need to do anything with the surface term, or is that handled > internally? The surface term can be included using https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DT/PetscDSSetBdResidual.html and we use that in ex12 for inhomogeneous Neumann conditions. > Because neither of these terms are a surface integral term, > both are volume integrals. > > I can't figure out the purpose of g0, g1, g2, g3 in > PetscDSSetJacobian(), either. Is g supposed to be the source term? No, it is the coefficient of the different combinations of basis functions and their gradients. For instance, the g3 term (grad phi and grad psi), g3 plays the same role as the elasticity tensor C in mechanics. > Is > psi a second basis function? Yes. If the method is Galerkin, it comes from the same space as phi. > What even *is* the Jacobian in a FEM > problem? The Frechet derivative of the residual. > I've only seen them formulated as linear problems in tutorials, > so I'm not even clear why we need a nonlinear solver or Jacobian... > The Frechet derivative of a linear operator is itself. ex12 also incorporates nonlinear variants of Poisson. > Any help is appreciated. I like the idea of a general framework for FEM, > as I think it will reduce human error on my part, but I also want to > understand what I'm doing. > If you have any more questions, feel free to keep mailing. Thanks, Matt > Ellen Price > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Mon Oct 8 17:46:59 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 8 Oct 2018 18:46:59 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: On Mon, Oct 8, 2018 at 6:13 PM Weizhuo Wang wrote: > Sorry I was caught up with midterms for the last few days. I tried the lu > decomposition today and the 2-norm is pretty stable at ~ 10^-15, which is > expected for double precision. Since the discretization error is so small, > it would be reasonable to assume the rest is majority the algebraic error. > What are you plotting? It looks like only the algebraic error or residual. There is absolutely no way your discretization error is 1e-14. Thanks, Matt > Then looking at the result without the -pc_type lu flag(second graph), the > error is asymptoting to a constant several magnitudes larger than the > tolerance set for the solver. (atol=1e-12, rtol=1e-9) Is this the expected > behavior? Shouldn't it decrease with finer grid? > [image: LU.png] > [image: Total.png] > > On Tue, Oct 2, 2018 at 6:52 PM Matthew Knepley wrote: > >> On Tue, Oct 2, 2018 at 5:26 PM Weizhuo Wang >> wrote: >> >>> I didn't specify a tolerance, it was using the default tolerance. >>> Doesn't the asymptoting norm implies finer grid won't help to get finer >>> solution? >>> >> >> There are two things going on in your test, discretization error >> controlled by the grid, and algebraic error controlled by the solver. This >> makes it difficult to isolate what is happening. However, it seems clear >> that your plot is looking at algebraic error. You can confirm this by using >> >> -pc_type lu >> >> for the solve. Then all you have is discretization error. >> >> Thanks, >> >> Matt >> >> >>> Mark Adams ? >>> >>>> >>>> >>>> On Tue, Oct 2, 2018 at 5:04 PM Weizhuo Wang >>>> wrote: >>>> >>>>> Yes I was using one norm in my Helmholtz code, the example code used 2 >>>>> norm. But now I am using 2 norm in both code. >>>>> >>>>> /* >>>>> Check the error >>>>> */ >>>>> ierr = VecAXPY(x,-1.0,u); CHKERRQ(ierr); >>>>> ierr = VecNorm(x,NORM_1,&norm); CHKERRQ(ierr); >>>>> ierr = KSPGetIterationNumber(ksp,&its); CHKERRQ(ierr); >>>>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g iterations >>>>> %D\n",(double)norm/(m*n),its); CHKERRQ(ierr); >>>>> >>>>> I made a plot to show the increase: >>>>> >>>> >>>> >>>> FYI, this is asymptoting to a constant. What solver tolerance are >>>> you using? >>>> >>>> >>>>> >>>>> [image: Norm comparison.png] >>>>> >>>>> Mark Adams ? >>>>> >>>>>> >>>>>> >>>>>> On Tue, Oct 2, 2018 at 2:24 PM Weizhuo Wang >>>>>> wrote: >>>>>> >>>>>>> The example code and makefile are attached below. The whole thing >>>>>>> started as I tried to build a Helmholtz solver, and the mean error >>>>>>> (calculated by: sum( | numerical_sol - analytical_sol | / analytical_sol ) >>>>>>> ) >>>>>>> >>>>>> >>>>>> This is a one norm. If you use max (instead of sum) then you don't >>>>>> need to scale. You do have to be careful about dividing by (near) zero. >>>>>> >>>>>> >>>>>>> increases as I use finer and finer grids. >>>>>>> >>>>>> >>>>>> What was the rate of increase? >>>>>> >>>>>> >>>>>>> Then I looked at the example 12 (Laplacian solver) which is similar >>>>>>> to what I did to see if I have missed something. The example is using >>>>>>> 2_norm. I have made some minor modifications (3 places) on the code, you >>>>>>> can search 'Modified' in the code to see them. >>>>>>> >>>>>>> If this helps: I configured the PETSc to use real and double >>>>>>> precision. Changed the name of the example code from ex12.c to ex12c.c >>>>>>> >>>>>>> Thanks for all your reply! >>>>>>> >>>>>>> Weizhuo >>>>>>> >>>>>>> >>>>>>> Smith, Barry F. >>>>>>> >>>>>>> >>>>>>>> Please send your version of the example that computes the mean >>>>>>>> norm of the grid; I suspect we are talking apples and oranges >>>>>>>> >>>>>>>> Barry >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang >>>>>>>> wrote: >>>>>>>> > >>>>>>>> > I also tried to divide the norm by m*n , which is the number of >>>>>>>> grids, the trend of norm still increases. >>>>>>>> > >>>>>>>> > Thanks! >>>>>>>> > >>>>>>>> > Weizhuo >>>>>>>> > >>>>>>>> > Matthew Knepley >>>>>>>> > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang < >>>>>>>> weizhuo2 at illinois.edu> wrote: >>>>>>>> > Hi! >>>>>>>> > >>>>>>>> > I'm recently trying out the example code provided with the KSP >>>>>>>> solver (ex12.c). I noticed that the mean norm of the grid increases as I >>>>>>>> use finer meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. >>>>>>>> However at m=100, n=100, mean norm increases to 9.55e-6. This seems counter >>>>>>>> intuitive, since most of the time error should decreases when using finer >>>>>>>> grid. Am I doing this wrong? >>>>>>>> > >>>>>>>> > The norm is misleading in that it is the l_2 norm, meaning just >>>>>>>> the sqrt of the sum of the squares of >>>>>>>> > the vector entries. It should be scaled by the volume element to >>>>>>>> approximate a scale-independent >>>>>>>> > norm (like the L_2 norm). >>>>>>>> > >>>>>>>> > Thanks, >>>>>>>> > >>>>>>>> > Matt >>>>>>>> > >>>>>>>> > Thanks! >>>>>>>> > -- >>>>>>>> > Wang Weizhuo >>>>>>>> > >>>>>>>> > >>>>>>>> > -- >>>>>>>> > 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 >>>>>>>> > >>>>>>>> > https://www.cse.buffalo.edu/~knepley/ >>>>>>>> >>>>>>>> > >>>>>>>> > >>>>>>>> > -- >>>>>>>> > Wang Weizhuo >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Wang Weizhuo >>>>>>> >>>>>> >>>>> >>>>> -- >>>>> Wang Weizhuo >>>>> >>>> >>> >>> -- >>> Wang Weizhuo >>> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > > > -- > Wang Weizhuo > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Norm comparison.png Type: image/png Size: 87887 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Total.png Type: image/png Size: 39046 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: LU.png Type: image/png Size: 38656 bytes Desc: not available URL: From mfadams at lbl.gov Mon Oct 8 17:58:05 2018 From: mfadams at lbl.gov (Mark Adams) Date: Mon, 8 Oct 2018 18:58:05 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: And what is the x-axis? And what solver (preconditioner) are you using w/o LU (2nd graph)? On Mon, Oct 8, 2018 at 6:47 PM Matthew Knepley wrote: > On Mon, Oct 8, 2018 at 6:13 PM Weizhuo Wang wrote: > >> Sorry I was caught up with midterms for the last few days. I tried the lu >> decomposition today and the 2-norm is pretty stable at ~ 10^-15, which is >> expected for double precision. Since the discretization error is so small, >> it would be reasonable to assume the rest is majority the algebraic error. >> > > What are you plotting? It looks like only the algebraic error or residual. > There is absolutely no way your discretization error is 1e-14. > > Thanks, > > Matt > > >> Then looking at the result without the -pc_type lu flag(second graph), >> the error is asymptoting to a constant several magnitudes larger than the >> tolerance set for the solver. (atol=1e-12, rtol=1e-9) Is this the expected >> behavior? Shouldn't it decrease with finer grid? >> [image: LU.png] >> [image: Total.png] >> >> On Tue, Oct 2, 2018 at 6:52 PM Matthew Knepley wrote: >> >>> On Tue, Oct 2, 2018 at 5:26 PM Weizhuo Wang >>> wrote: >>> >>>> I didn't specify a tolerance, it was using the default tolerance. >>>> Doesn't the asymptoting norm implies finer grid won't help to get finer >>>> solution? >>>> >>> >>> There are two things going on in your test, discretization error >>> controlled by the grid, and algebraic error controlled by the solver. This >>> makes it difficult to isolate what is happening. However, it seems clear >>> that your plot is looking at algebraic error. You can confirm this by using >>> >>> -pc_type lu >>> >>> for the solve. Then all you have is discretization error. >>> >>> Thanks, >>> >>> Matt >>> >>> >>>> Mark Adams ? >>>> >>>>> >>>>> >>>>> On Tue, Oct 2, 2018 at 5:04 PM Weizhuo Wang >>>>> wrote: >>>>> >>>>>> Yes I was using one norm in my Helmholtz code, the example code used >>>>>> 2 norm. But now I am using 2 norm in both code. >>>>>> >>>>>> /* >>>>>> Check the error >>>>>> */ >>>>>> ierr = VecAXPY(x,-1.0,u); CHKERRQ(ierr); >>>>>> ierr = VecNorm(x,NORM_1,&norm); CHKERRQ(ierr); >>>>>> ierr = KSPGetIterationNumber(ksp,&its); CHKERRQ(ierr); >>>>>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g iterations >>>>>> %D\n",(double)norm/(m*n),its); CHKERRQ(ierr); >>>>>> >>>>>> I made a plot to show the increase: >>>>>> >>>>> >>>>> >>>>> FYI, this is asymptoting to a constant. What solver tolerance are >>>>> you using? >>>>> >>>>> >>>>>> >>>>>> [image: Norm comparison.png] >>>>>> >>>>>> Mark Adams ? >>>>>> >>>>>>> >>>>>>> >>>>>>> On Tue, Oct 2, 2018 at 2:24 PM Weizhuo Wang >>>>>>> wrote: >>>>>>> >>>>>>>> The example code and makefile are attached below. The whole thing >>>>>>>> started as I tried to build a Helmholtz solver, and the mean error >>>>>>>> (calculated by: sum( | numerical_sol - analytical_sol | / analytical_sol ) >>>>>>>> ) >>>>>>>> >>>>>>> >>>>>>> This is a one norm. If you use max (instead of sum) then you don't >>>>>>> need to scale. You do have to be careful about dividing by (near) zero. >>>>>>> >>>>>>> >>>>>>>> increases as I use finer and finer grids. >>>>>>>> >>>>>>> >>>>>>> What was the rate of increase? >>>>>>> >>>>>>> >>>>>>>> Then I looked at the example 12 (Laplacian solver) which is similar >>>>>>>> to what I did to see if I have missed something. The example is using >>>>>>>> 2_norm. I have made some minor modifications (3 places) on the code, you >>>>>>>> can search 'Modified' in the code to see them. >>>>>>>> >>>>>>>> If this helps: I configured the PETSc to use real and double >>>>>>>> precision. Changed the name of the example code from ex12.c to ex12c.c >>>>>>>> >>>>>>>> Thanks for all your reply! >>>>>>>> >>>>>>>> Weizhuo >>>>>>>> >>>>>>>> >>>>>>>> Smith, Barry F. >>>>>>>> >>>>>>>> >>>>>>>>> Please send your version of the example that computes the mean >>>>>>>>> norm of the grid; I suspect we are talking apples and oranges >>>>>>>>> >>>>>>>>> Barry >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang >>>>>>>>> wrote: >>>>>>>>> > >>>>>>>>> > I also tried to divide the norm by m*n , which is the number of >>>>>>>>> grids, the trend of norm still increases. >>>>>>>>> > >>>>>>>>> > Thanks! >>>>>>>>> > >>>>>>>>> > Weizhuo >>>>>>>>> > >>>>>>>>> > Matthew Knepley >>>>>>>>> > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang < >>>>>>>>> weizhuo2 at illinois.edu> wrote: >>>>>>>>> > Hi! >>>>>>>>> > >>>>>>>>> > I'm recently trying out the example code provided with the KSP >>>>>>>>> solver (ex12.c). I noticed that the mean norm of the grid increases as I >>>>>>>>> use finer meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. >>>>>>>>> However at m=100, n=100, mean norm increases to 9.55e-6. This seems counter >>>>>>>>> intuitive, since most of the time error should decreases when using finer >>>>>>>>> grid. Am I doing this wrong? >>>>>>>>> > >>>>>>>>> > The norm is misleading in that it is the l_2 norm, meaning just >>>>>>>>> the sqrt of the sum of the squares of >>>>>>>>> > the vector entries. It should be scaled by the volume element to >>>>>>>>> approximate a scale-independent >>>>>>>>> > norm (like the L_2 norm). >>>>>>>>> > >>>>>>>>> > Thanks, >>>>>>>>> > >>>>>>>>> > Matt >>>>>>>>> > >>>>>>>>> > Thanks! >>>>>>>>> > -- >>>>>>>>> > Wang Weizhuo >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > -- >>>>>>>>> > 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 >>>>>>>>> > >>>>>>>>> > https://www.cse.buffalo.edu/~knepley/ >>>>>>>>> >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > -- >>>>>>>>> > Wang Weizhuo >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Wang Weizhuo >>>>>>>> >>>>>>> >>>>>> >>>>>> -- >>>>>> Wang Weizhuo >>>>>> >>>>> >>>> >>>> -- >>>> Wang Weizhuo >>>> >>> >>> >>> -- >>> 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 >>> >>> https://www.cse.buffalo.edu/~knepley/ >>> >>> >> >> >> -- >> Wang Weizhuo >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Total.png Type: image/png Size: 39046 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: LU.png Type: image/png Size: 38656 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Norm comparison.png Type: image/png Size: 87887 bytes Desc: not available URL: From weizhuo2 at illinois.edu Mon Oct 8 17:57:55 2018 From: weizhuo2 at illinois.edu (Weizhuo Wang) Date: Mon, 8 Oct 2018 17:57:55 -0500 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: The first plot is the norm with the flag -pc_type lu with respect to number of grids in one axis (n), and the second plot is the norm without the flag -pc_type lu. Specifically, the norm is calculated by norm = norm_2(numerical - analytic)/(n*n) On Mon, Oct 8, 2018 at 5:47 PM Matthew Knepley wrote: > On Mon, Oct 8, 2018 at 6:13 PM Weizhuo Wang wrote: > >> Sorry I was caught up with midterms for the last few days. I tried the lu >> decomposition today and the 2-norm is pretty stable at ~ 10^-15, which is >> expected for double precision. Since the discretization error is so small, >> it would be reasonable to assume the rest is majority the algebraic error. >> > > What are you plotting? It looks like only the algebraic error or residual. > There is absolutely no way your discretization error is 1e-14. > > Thanks, > > Matt > > >> Then looking at the result without the -pc_type lu flag(second graph), >> the error is asymptoting to a constant several magnitudes larger than the >> tolerance set for the solver. (atol=1e-12, rtol=1e-9) Is this the expected >> behavior? Shouldn't it decrease with finer grid? >> [image: LU.png] >> [image: Total.png] >> >> On Tue, Oct 2, 2018 at 6:52 PM Matthew Knepley wrote: >> >>> On Tue, Oct 2, 2018 at 5:26 PM Weizhuo Wang >>> wrote: >>> >>>> I didn't specify a tolerance, it was using the default tolerance. >>>> Doesn't the asymptoting norm implies finer grid won't help to get finer >>>> solution? >>>> >>> >>> There are two things going on in your test, discretization error >>> controlled by the grid, and algebraic error controlled by the solver. This >>> makes it difficult to isolate what is happening. However, it seems clear >>> that your plot is looking at algebraic error. You can confirm this by using >>> >>> -pc_type lu >>> >>> for the solve. Then all you have is discretization error. >>> >>> Thanks, >>> >>> Matt >>> >>> >>>> Mark Adams ? >>>> >>>>> >>>>> >>>>> On Tue, Oct 2, 2018 at 5:04 PM Weizhuo Wang >>>>> wrote: >>>>> >>>>>> Yes I was using one norm in my Helmholtz code, the example code used >>>>>> 2 norm. But now I am using 2 norm in both code. >>>>>> >>>>>> /* >>>>>> Check the error >>>>>> */ >>>>>> ierr = VecAXPY(x,-1.0,u); CHKERRQ(ierr); >>>>>> ierr = VecNorm(x,NORM_1,&norm); CHKERRQ(ierr); >>>>>> ierr = KSPGetIterationNumber(ksp,&its); CHKERRQ(ierr); >>>>>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g iterations >>>>>> %D\n",(double)norm/(m*n),its); CHKERRQ(ierr); >>>>>> >>>>>> I made a plot to show the increase: >>>>>> >>>>> >>>>> >>>>> FYI, this is asymptoting to a constant. What solver tolerance are >>>>> you using? >>>>> >>>>> >>>>>> >>>>>> [image: Norm comparison.png] >>>>>> >>>>>> Mark Adams ? >>>>>> >>>>>>> >>>>>>> >>>>>>> On Tue, Oct 2, 2018 at 2:24 PM Weizhuo Wang >>>>>>> wrote: >>>>>>> >>>>>>>> The example code and makefile are attached below. The whole thing >>>>>>>> started as I tried to build a Helmholtz solver, and the mean error >>>>>>>> (calculated by: sum( | numerical_sol - analytical_sol | / analytical_sol ) >>>>>>>> ) >>>>>>>> >>>>>>> >>>>>>> This is a one norm. If you use max (instead of sum) then you don't >>>>>>> need to scale. You do have to be careful about dividing by (near) zero. >>>>>>> >>>>>>> >>>>>>>> increases as I use finer and finer grids. >>>>>>>> >>>>>>> >>>>>>> What was the rate of increase? >>>>>>> >>>>>>> >>>>>>>> Then I looked at the example 12 (Laplacian solver) which is similar >>>>>>>> to what I did to see if I have missed something. The example is using >>>>>>>> 2_norm. I have made some minor modifications (3 places) on the code, you >>>>>>>> can search 'Modified' in the code to see them. >>>>>>>> >>>>>>>> If this helps: I configured the PETSc to use real and double >>>>>>>> precision. Changed the name of the example code from ex12.c to ex12c.c >>>>>>>> >>>>>>>> Thanks for all your reply! >>>>>>>> >>>>>>>> Weizhuo >>>>>>>> >>>>>>>> >>>>>>>> Smith, Barry F. >>>>>>>> >>>>>>>> >>>>>>>>> Please send your version of the example that computes the mean >>>>>>>>> norm of the grid; I suspect we are talking apples and oranges >>>>>>>>> >>>>>>>>> Barry >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang >>>>>>>>> wrote: >>>>>>>>> > >>>>>>>>> > I also tried to divide the norm by m*n , which is the number of >>>>>>>>> grids, the trend of norm still increases. >>>>>>>>> > >>>>>>>>> > Thanks! >>>>>>>>> > >>>>>>>>> > Weizhuo >>>>>>>>> > >>>>>>>>> > Matthew Knepley >>>>>>>>> > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang < >>>>>>>>> weizhuo2 at illinois.edu> wrote: >>>>>>>>> > Hi! >>>>>>>>> > >>>>>>>>> > I'm recently trying out the example code provided with the KSP >>>>>>>>> solver (ex12.c). I noticed that the mean norm of the grid increases as I >>>>>>>>> use finer meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. >>>>>>>>> However at m=100, n=100, mean norm increases to 9.55e-6. This seems counter >>>>>>>>> intuitive, since most of the time error should decreases when using finer >>>>>>>>> grid. Am I doing this wrong? >>>>>>>>> > >>>>>>>>> > The norm is misleading in that it is the l_2 norm, meaning just >>>>>>>>> the sqrt of the sum of the squares of >>>>>>>>> > the vector entries. It should be scaled by the volume element to >>>>>>>>> approximate a scale-independent >>>>>>>>> > norm (like the L_2 norm). >>>>>>>>> > >>>>>>>>> > Thanks, >>>>>>>>> > >>>>>>>>> > Matt >>>>>>>>> > >>>>>>>>> > Thanks! >>>>>>>>> > -- >>>>>>>>> > Wang Weizhuo >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > -- >>>>>>>>> > 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 >>>>>>>>> > >>>>>>>>> > https://www.cse.buffalo.edu/~knepley/ >>>>>>>>> >>>>>>>>> > >>>>>>>>> > >>>>>>>>> > -- >>>>>>>>> > Wang Weizhuo >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> Wang Weizhuo >>>>>>>> >>>>>>> >>>>>> >>>>>> -- >>>>>> Wang Weizhuo >>>>>> >>>>> >>>> >>>> -- >>>> Wang Weizhuo >>>> >>> >>> >>> -- >>> 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 >>> >>> https://www.cse.buffalo.edu/~knepley/ >>> >>> >> >> >> -- >> Wang Weizhuo >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -- Wang Weizhuo -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: LU.png Type: image/png Size: 38656 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Total.png Type: image/png Size: 39046 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Norm comparison.png Type: image/png Size: 87887 bytes Desc: not available URL: From weizhuo2 at illinois.edu Mon Oct 8 18:10:57 2018 From: weizhuo2 at illinois.edu (Weizhuo Wang) Date: Mon, 8 Oct 2018 18:10:57 -0500 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: x-axis is n - the number of grids in one axis, for example if the grid is 100*100, then n=100. I believe the preconditioner is ksp, since it is set from options of a default KSP solver. I can send you the code if you want to take a glimpse at it. On Mon, Oct 8, 2018 at 5:58 PM Mark Adams wrote: > And what is the x-axis? And what solver (preconditioner) are you using w/o > LU (2nd graph)? > > On Mon, Oct 8, 2018 at 6:47 PM Matthew Knepley wrote: > >> On Mon, Oct 8, 2018 at 6:13 PM Weizhuo Wang >> wrote: >> >>> Sorry I was caught up with midterms for the last few days. I tried the >>> lu decomposition today and the 2-norm is pretty stable at ~ 10^-15, which >>> is expected for double precision. Since the discretization error is so >>> small, it would be reasonable to assume the rest is majority the algebraic >>> error. >>> >> >> What are you plotting? It looks like only the algebraic error or >> residual. There is absolutely no way your discretization error is 1e-14. >> >> Thanks, >> >> Matt >> >> >>> Then looking at the result without the -pc_type lu flag(second graph), >>> the error is asymptoting to a constant several magnitudes larger than the >>> tolerance set for the solver. (atol=1e-12, rtol=1e-9) Is this the expected >>> behavior? Shouldn't it decrease with finer grid? >>> [image: LU.png] >>> [image: Total.png] >>> >>> On Tue, Oct 2, 2018 at 6:52 PM Matthew Knepley >>> wrote: >>> >>>> On Tue, Oct 2, 2018 at 5:26 PM Weizhuo Wang >>>> wrote: >>>> >>>>> I didn't specify a tolerance, it was using the default tolerance. >>>>> Doesn't the asymptoting norm implies finer grid won't help to get finer >>>>> solution? >>>>> >>>> >>>> There are two things going on in your test, discretization error >>>> controlled by the grid, and algebraic error controlled by the solver. This >>>> makes it difficult to isolate what is happening. However, it seems clear >>>> that your plot is looking at algebraic error. You can confirm this by using >>>> >>>> -pc_type lu >>>> >>>> for the solve. Then all you have is discretization error. >>>> >>>> Thanks, >>>> >>>> Matt >>>> >>>> >>>>> Mark Adams ? >>>>> >>>>>> >>>>>> >>>>>> On Tue, Oct 2, 2018 at 5:04 PM Weizhuo Wang >>>>>> wrote: >>>>>> >>>>>>> Yes I was using one norm in my Helmholtz code, the example code used >>>>>>> 2 norm. But now I am using 2 norm in both code. >>>>>>> >>>>>>> /* >>>>>>> Check the error >>>>>>> */ >>>>>>> ierr = VecAXPY(x,-1.0,u); CHKERRQ(ierr); >>>>>>> ierr = VecNorm(x,NORM_1,&norm); CHKERRQ(ierr); >>>>>>> ierr = KSPGetIterationNumber(ksp,&its); CHKERRQ(ierr); >>>>>>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g iterations >>>>>>> %D\n",(double)norm/(m*n),its); CHKERRQ(ierr); >>>>>>> >>>>>>> I made a plot to show the increase: >>>>>>> >>>>>> >>>>>> >>>>>> FYI, this is asymptoting to a constant. What solver tolerance are >>>>>> you using? >>>>>> >>>>>> >>>>>>> >>>>>>> [image: Norm comparison.png] >>>>>>> >>>>>>> Mark Adams ? >>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Tue, Oct 2, 2018 at 2:24 PM Weizhuo Wang >>>>>>>> wrote: >>>>>>>> >>>>>>>>> The example code and makefile are attached below. The whole thing >>>>>>>>> started as I tried to build a Helmholtz solver, and the mean error >>>>>>>>> (calculated by: sum( | numerical_sol - analytical_sol | / analytical_sol ) >>>>>>>>> ) >>>>>>>>> >>>>>>>> >>>>>>>> This is a one norm. If you use max (instead of sum) then you don't >>>>>>>> need to scale. You do have to be careful about dividing by (near) zero. >>>>>>>> >>>>>>>> >>>>>>>>> increases as I use finer and finer grids. >>>>>>>>> >>>>>>>> >>>>>>>> What was the rate of increase? >>>>>>>> >>>>>>>> >>>>>>>>> Then I looked at the example 12 (Laplacian solver) which is >>>>>>>>> similar to what I did to see if I have missed something. The example is >>>>>>>>> using 2_norm. I have made some minor modifications (3 places) on the code, >>>>>>>>> you can search 'Modified' in the code to see them. >>>>>>>>> >>>>>>>>> If this helps: I configured the PETSc to use real and double >>>>>>>>> precision. Changed the name of the example code from ex12.c to ex12c.c >>>>>>>>> >>>>>>>>> Thanks for all your reply! >>>>>>>>> >>>>>>>>> Weizhuo >>>>>>>>> >>>>>>>>> >>>>>>>>> Smith, Barry F. >>>>>>>>> >>>>>>>>> >>>>>>>>>> Please send your version of the example that computes the mean >>>>>>>>>> norm of the grid; I suspect we are talking apples and oranges >>>>>>>>>> >>>>>>>>>> Barry >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang >>>>>>>>>> wrote: >>>>>>>>>> > >>>>>>>>>> > I also tried to divide the norm by m*n , which is the number of >>>>>>>>>> grids, the trend of norm still increases. >>>>>>>>>> > >>>>>>>>>> > Thanks! >>>>>>>>>> > >>>>>>>>>> > Weizhuo >>>>>>>>>> > >>>>>>>>>> > Matthew Knepley >>>>>>>>>> > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang < >>>>>>>>>> weizhuo2 at illinois.edu> wrote: >>>>>>>>>> > Hi! >>>>>>>>>> > >>>>>>>>>> > I'm recently trying out the example code provided with the KSP >>>>>>>>>> solver (ex12.c). I noticed that the mean norm of the grid increases as I >>>>>>>>>> use finer meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. >>>>>>>>>> However at m=100, n=100, mean norm increases to 9.55e-6. This seems counter >>>>>>>>>> intuitive, since most of the time error should decreases when using finer >>>>>>>>>> grid. Am I doing this wrong? >>>>>>>>>> > >>>>>>>>>> > The norm is misleading in that it is the l_2 norm, meaning just >>>>>>>>>> the sqrt of the sum of the squares of >>>>>>>>>> > the vector entries. It should be scaled by the volume element >>>>>>>>>> to approximate a scale-independent >>>>>>>>>> > norm (like the L_2 norm). >>>>>>>>>> > >>>>>>>>>> > Thanks, >>>>>>>>>> > >>>>>>>>>> > Matt >>>>>>>>>> > >>>>>>>>>> > Thanks! >>>>>>>>>> > -- >>>>>>>>>> > Wang Weizhuo >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > -- >>>>>>>>>> > 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 >>>>>>>>>> > >>>>>>>>>> > https://www.cse.buffalo.edu/~knepley/ >>>>>>>>>> >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > -- >>>>>>>>>> > Wang Weizhuo >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Wang Weizhuo >>>>>>>>> >>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Wang Weizhuo >>>>>>> >>>>>> >>>>> >>>>> -- >>>>> Wang Weizhuo >>>>> >>>> >>>> >>>> -- >>>> 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 >>>> >>>> https://www.cse.buffalo.edu/~knepley/ >>>> >>>> >>> >>> >>> -- >>> Wang Weizhuo >>> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > -- Wang Weizhuo -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Total.png Type: image/png Size: 39046 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Norm comparison.png Type: image/png Size: 87887 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: LU.png Type: image/png Size: 38656 bytes Desc: not available URL: From knepley at gmail.com Mon Oct 8 19:25:35 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 8 Oct 2018 20:25:35 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang wrote: > The first plot is the norm with the flag -pc_type lu with respect to > number of grids in one axis (n), and the second plot is the norm without > the flag -pc_type lu. > > Specifically, the norm is calculated by > > norm = norm_2(numerical - analytic)/(n*n) > I do not believe you are calculating this correctly. There is no way your discretisation error is that low. Matt > On Mon, Oct 8, 2018 at 5:47 PM Matthew Knepley wrote: > >> On Mon, Oct 8, 2018 at 6:13 PM Weizhuo Wang >> wrote: >> >>> Sorry I was caught up with midterms for the last few days. I tried the >>> lu decomposition today and the 2-norm is pretty stable at ~ 10^-15, which >>> is expected for double precision. Since the discretization error is so >>> small, it would be reasonable to assume the rest is majority the algebraic >>> error. >>> >> >> What are you plotting? It looks like only the algebraic error or >> residual. There is absolutely no way your discretization error is 1e-14. >> >> Thanks, >> >> Matt >> >> >>> Then looking at the result without the -pc_type lu flag(second graph), >>> the error is asymptoting to a constant several magnitudes larger than the >>> tolerance set for the solver. (atol=1e-12, rtol=1e-9) Is this the expected >>> behavior? Shouldn't it decrease with finer grid? >>> [image: LU.png] >>> [image: Total.png] >>> >>> On Tue, Oct 2, 2018 at 6:52 PM Matthew Knepley >>> wrote: >>> >>>> On Tue, Oct 2, 2018 at 5:26 PM Weizhuo Wang >>>> wrote: >>>> >>>>> I didn't specify a tolerance, it was using the default tolerance. >>>>> Doesn't the asymptoting norm implies finer grid won't help to get finer >>>>> solution? >>>>> >>>> >>>> There are two things going on in your test, discretization error >>>> controlled by the grid, and algebraic error controlled by the solver. This >>>> makes it difficult to isolate what is happening. However, it seems clear >>>> that your plot is looking at algebraic error. You can confirm this by using >>>> >>>> -pc_type lu >>>> >>>> for the solve. Then all you have is discretization error. >>>> >>>> Thanks, >>>> >>>> Matt >>>> >>>> >>>>> Mark Adams ? >>>>> >>>>>> >>>>>> >>>>>> On Tue, Oct 2, 2018 at 5:04 PM Weizhuo Wang >>>>>> wrote: >>>>>> >>>>>>> Yes I was using one norm in my Helmholtz code, the example code used >>>>>>> 2 norm. But now I am using 2 norm in both code. >>>>>>> >>>>>>> /* >>>>>>> Check the error >>>>>>> */ >>>>>>> ierr = VecAXPY(x,-1.0,u); CHKERRQ(ierr); >>>>>>> ierr = VecNorm(x,NORM_1,&norm); CHKERRQ(ierr); >>>>>>> ierr = KSPGetIterationNumber(ksp,&its); CHKERRQ(ierr); >>>>>>> ierr = PetscPrintf(PETSC_COMM_WORLD,"Norm of error %g iterations >>>>>>> %D\n",(double)norm/(m*n),its); CHKERRQ(ierr); >>>>>>> >>>>>>> I made a plot to show the increase: >>>>>>> >>>>>> >>>>>> >>>>>> FYI, this is asymptoting to a constant. What solver tolerance are >>>>>> you using? >>>>>> >>>>>> >>>>>>> >>>>>>> [image: Norm comparison.png] >>>>>>> >>>>>>> Mark Adams ? >>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Tue, Oct 2, 2018 at 2:24 PM Weizhuo Wang >>>>>>>> wrote: >>>>>>>> >>>>>>>>> The example code and makefile are attached below. The whole thing >>>>>>>>> started as I tried to build a Helmholtz solver, and the mean error >>>>>>>>> (calculated by: sum( | numerical_sol - analytical_sol | / analytical_sol ) >>>>>>>>> ) >>>>>>>>> >>>>>>>> >>>>>>>> This is a one norm. If you use max (instead of sum) then you don't >>>>>>>> need to scale. You do have to be careful about dividing by (near) zero. >>>>>>>> >>>>>>>> >>>>>>>>> increases as I use finer and finer grids. >>>>>>>>> >>>>>>>> >>>>>>>> What was the rate of increase? >>>>>>>> >>>>>>>> >>>>>>>>> Then I looked at the example 12 (Laplacian solver) which is >>>>>>>>> similar to what I did to see if I have missed something. The example is >>>>>>>>> using 2_norm. I have made some minor modifications (3 places) on the code, >>>>>>>>> you can search 'Modified' in the code to see them. >>>>>>>>> >>>>>>>>> If this helps: I configured the PETSc to use real and double >>>>>>>>> precision. Changed the name of the example code from ex12.c to ex12c.c >>>>>>>>> >>>>>>>>> Thanks for all your reply! >>>>>>>>> >>>>>>>>> Weizhuo >>>>>>>>> >>>>>>>>> >>>>>>>>> Smith, Barry F. >>>>>>>>> >>>>>>>>> >>>>>>>>>> Please send your version of the example that computes the mean >>>>>>>>>> norm of the grid; I suspect we are talking apples and oranges >>>>>>>>>> >>>>>>>>>> Barry >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> > On Oct 1, 2018, at 7:51 PM, Weizhuo Wang >>>>>>>>>> wrote: >>>>>>>>>> > >>>>>>>>>> > I also tried to divide the norm by m*n , which is the number of >>>>>>>>>> grids, the trend of norm still increases. >>>>>>>>>> > >>>>>>>>>> > Thanks! >>>>>>>>>> > >>>>>>>>>> > Weizhuo >>>>>>>>>> > >>>>>>>>>> > Matthew Knepley >>>>>>>>>> > On Mon, Oct 1, 2018 at 6:31 PM Weizhuo Wang < >>>>>>>>>> weizhuo2 at illinois.edu> wrote: >>>>>>>>>> > Hi! >>>>>>>>>> > >>>>>>>>>> > I'm recently trying out the example code provided with the KSP >>>>>>>>>> solver (ex12.c). I noticed that the mean norm of the grid increases as I >>>>>>>>>> use finer meshes. For example, the mean norm is 5.72e-8 at m=10 n=10. >>>>>>>>>> However at m=100, n=100, mean norm increases to 9.55e-6. This seems counter >>>>>>>>>> intuitive, since most of the time error should decreases when using finer >>>>>>>>>> grid. Am I doing this wrong? >>>>>>>>>> > >>>>>>>>>> > The norm is misleading in that it is the l_2 norm, meaning just >>>>>>>>>> the sqrt of the sum of the squares of >>>>>>>>>> > the vector entries. It should be scaled by the volume element >>>>>>>>>> to approximate a scale-independent >>>>>>>>>> > norm (like the L_2 norm). >>>>>>>>>> > >>>>>>>>>> > Thanks, >>>>>>>>>> > >>>>>>>>>> > Matt >>>>>>>>>> > >>>>>>>>>> > Thanks! >>>>>>>>>> > -- >>>>>>>>>> > Wang Weizhuo >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > -- >>>>>>>>>> > 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 >>>>>>>>>> > >>>>>>>>>> > https://www.cse.buffalo.edu/~knepley/ >>>>>>>>>> >>>>>>>>>> > >>>>>>>>>> > >>>>>>>>>> > -- >>>>>>>>>> > Wang Weizhuo >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Wang Weizhuo >>>>>>>>> >>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Wang Weizhuo >>>>>>> >>>>>> >>>>> >>>>> -- >>>>> Wang Weizhuo >>>>> >>>> >>>> >>>> -- >>>> 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 >>>> >>>> https://www.cse.buffalo.edu/~knepley/ >>>> >>>> >>> >>> >>> -- >>> Wang Weizhuo >>> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > > > -- > Wang Weizhuo > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Norm comparison.png Type: image/png Size: 87887 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: LU.png Type: image/png Size: 38656 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Total.png Type: image/png Size: 39046 bytes Desc: not available URL: From ellen.price at cfa.harvard.edu Mon Oct 8 19:41:15 2018 From: ellen.price at cfa.harvard.edu (Ellen M. Price) Date: Mon, 8 Oct 2018 20:41:15 -0400 Subject: [petsc-users] Implementing FEM with PLEX/DS/SNES In-Reply-To: References: Message-ID: Hi Matt, Thanks for the speedy reply. I do have a few more questions/elaborations on my previous correspondence. As for the source term (and the boundary condition, actually), both are only *known* at mesh points, but are assumed continuous everywhere. How does this change things? Basically, I want to assume a linear interpolation (I'm using linear elements) of the source term over each tetrahedral cell and then the integral should be some linear combination of mesh point values, with coefficients given by the inner product of basis functions? The boundary term is actually given by a very nasty integral equation, which is probably the most expensive part of the simulation. So I only want to evaluate it at mesh points if possible. You are correct, I forgot the \cdot n in that equation. Oops! I need to think more about the Jacobian and residual before I can really ask an intelligent question about them. I suppose that in practice, I need to figure out exactly which Jacobian terms I need to include, and which can be NULL. Some guidance on that would be immensely helpful. If it helps, the equation I'm solving is just the Newtonian gravitational potential equation (on a nontrivial mesh and with a nontrivial, non-analytic mass density function). Ellen On 10/08/2018 06:28 PM, Matthew Knepley wrote: > On Mon, Oct 8, 2018 at 5:50 PM Ellen M. Price > > wrote: > > Can anyone shed some light on SNES example 12? > > https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex12.c.html > > I am solving a Poisson problem, but with a source term defined on mesh > points, so I don't have an analytic form. > > > Can you explain more about this source term? It sounds like a bunch of > delta functions. That > would still work in this framework, but the convergence rate for a rhs > with these singularities > is reduced (this is a generic feature of FEM). > ? > > The part I am confused about > is the role of the functions f0, f1, and g3 that go into the DS. > > Suppose I have the Poisson problem nabla^2 u = f. Then the weak form is, > for test function phi, > > \int_{\partial \Omega} \phi \nabla u - \int_\Omega \nabla u \cdot \nabla > \phi = \int_\Omega \phi f > > > I think you need \int_{\partial \Omega} \phi \nabla u \cdot n instead. > ? > > Based on the documentation of PetscDSSetResidual(), I'm a little > confused about f0 and f1: > > \int_\Omega \phi f_0(u, u_t, \nabla u, x, t) + \nabla\phi \cdot {\vec > f}_1(u, u_t, \nabla u, x, t) > > So f0 is, for the Poisson problem, zero, and f1 is just -grad u? > > > No. f1 is indeed -grad u, but f0 is -f. > > Note that ex12 solves -nabla^2 u = f since that operator is positive > definite. > ? > > Do we > need to do anything with the surface term, or is that handled > internally? > > > The surface term can be included using > > ??https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DT/PetscDSSetBdResidual.html > > and we use that in ex12 for inhomogeneous Neumann conditions. > ? > > Because neither of these terms are a surface integral term, > both are volume integrals. > > I can't figure out the purpose of g0, g1, g2, g3 in > PetscDSSetJacobian(), either. Is g supposed to be the source term? > > > No, it is the coefficient of the different combinations of basis > functions and their gradients. > For instance, the g3 term (grad phi and grad psi), g3 plays the same > role as the elasticity > tensor C in mechanics. > ? > > Is > psi a second basis function? > > > Yes. If the method is Galerkin, it comes from the same space as phi. > ? > > What even *is* the Jacobian in a FEM > problem? > > > The Frechet derivative of the residual. > ? > > I've only seen them formulated as linear problems in tutorials, > so I'm not even clear why we need a nonlinear solver or Jacobian... > > > The Frechet derivative of a linear operator is itself. ex12 also > incorporates > nonlinear variants of Poisson. > ? > > Any help is appreciated. I like the idea of a general framework for FEM, > as I think it will reduce human error on my part, but I also want to > understand what I'm doing. > > > If you have any more questions, feel free to keep mailing. > > ? Thanks, > > ? ? ?Matt > ? > > Ellen Price > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > From mfadams at lbl.gov Mon Oct 8 19:58:09 2018 From: mfadams at lbl.gov (Mark Adams) Date: Mon, 8 Oct 2018 20:58:09 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang wrote: > The first plot is the norm with the flag -pc_type lu with respect to > number of grids in one axis (n), and the second plot is the norm without > the flag -pc_type lu. > So you are using the default PC w/o LU. The default is ILU. This will reduce high frequency effectively but is not effective on the low frequency error. Don't expect your algebraic error reduction to be at the same scale as the residual reduction (what KSP measures). > -------------- next part -------------- An HTML attachment was scrubbed... URL: From weizhuo2 at illinois.edu Mon Oct 8 20:28:44 2018 From: weizhuo2 at illinois.edu (Weizhuo Wang) Date: Mon, 8 Oct 2018 20:28:44 -0500 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: The code is attached in case anyone wants to take a look, I will try the high frequency scenario later. On Mon, Oct 8, 2018 at 7:58 PM Mark Adams wrote: > > > On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang wrote: > >> The first plot is the norm with the flag -pc_type lu with respect to >> number of grids in one axis (n), and the second plot is the norm without >> the flag -pc_type lu. >> > > So you are using the default PC w/o LU. The default is ILU. This will > reduce high frequency effectively but is not effective on the low frequency > error. Don't expect your algebraic error reduction to be at the same scale > as the residual reduction (what KSP measures). > > >> -- Wang Weizhuo -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: makefile Type: application/octet-stream Size: 959 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Helmholtz_demoV2C.cpp Type: application/octet-stream Size: 8084 bytes Desc: not available URL: From knepley at gmail.com Mon Oct 8 20:30:28 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 8 Oct 2018 21:30:28 -0400 Subject: [petsc-users] Implementing FEM with PLEX/DS/SNES In-Reply-To: References: Message-ID: On Mon, Oct 8, 2018 at 8:41 PM Ellen M. Price wrote: > Hi Matt, > > Thanks for the speedy reply. I do have a few more questions/elaborations > on my previous correspondence. > > As for the source term (and the boundary condition, actually), both are > only *known* at mesh points, but are assumed continuous everywhere. How > does this change things? Basically, I want to assume a linear > interpolation (I'm using linear elements) of the source term over each > tetrahedral cell and then the integral should be some linear combination > of mesh point values, with coefficients given by the inner product of > basis functions? Its a little bit strange to give a forcing term this way. It means that you do not know your problem independent of your discretization. For example, ex12 can use quadratic elements, or cubic, or DG, so it does not assume any discretization when specifying the problem. You can do what you want, namely just pass in a rhs vector. However, that also means you need to understand the mesh ordering, dof ordering, etc. Its not a great way to proceed. How do you create these "mesh point" values in the first place? > The boundary term is actually given by a very nasty > integral equation, which is probably the most expensive part of the > simulation. So I only want to evaluate it at mesh points if possible. > In order to maintain accuracy, you should really evaluate it at quadrature points (you can always choose a low-order quadrature if you don't care). You can look at the Neumann term I use https://bitbucket.org/petsc/petsc/src/760cff7d6b13b58cab0db4b57ca0fc45c2034c72/src/snes/examples/tutorials/ex12.c#lines-159 > You are correct, I forgot the \cdot n in that equation. Oops! > > I need to think more about the Jacobian and residual before I can really > ask an intelligent question about them. I suppose that in practice, I > need to figure out exactly which Jacobian terms I need to include, and > which can be NULL. Some guidance on that would be immensely helpful. > Put them all in. Always check the full physics and then use approximations as preconditioners. > If it helps, the equation I'm solving is just the Newtonian > gravitational potential equation (on a nontrivial mesh and with a > nontrivial, non-analytic mass density function). > Hmm, FEM is not great for such rough source terms. At least not without some kind of nice adaptivity. Also, I assume you are doing a boundary integral for boundary conditions. This is quickly going to dominate the computational cost. I would figure out my strategy for that pretty early. Thanks, Matt > Ellen > > > On 10/08/2018 06:28 PM, Matthew Knepley wrote: > > On Mon, Oct 8, 2018 at 5:50 PM Ellen M. Price > > > > wrote: > > > > Can anyone shed some light on SNES example 12? > > > > > https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex12.c.html > > > > I am solving a Poisson problem, but with a source term defined on > mesh > > points, so I don't have an analytic form. > > > > > > Can you explain more about this source term? It sounds like a bunch of > > delta functions. That > > would still work in this framework, but the convergence rate for a rhs > > with these singularities > > is reduced (this is a generic feature of FEM). > > > > > > The part I am confused about > > is the role of the functions f0, f1, and g3 that go into the DS. > > > > Suppose I have the Poisson problem nabla^2 u = f. Then the weak form > is, > > for test function phi, > > > > \int_{\partial \Omega} \phi \nabla u - \int_\Omega \nabla u \cdot > \nabla > > \phi = \int_\Omega \phi f > > > > > > I think you need \int_{\partial \Omega} \phi \nabla u \cdot n instead. > > > > > > Based on the documentation of PetscDSSetResidual(), I'm a little > > confused about f0 and f1: > > > > \int_\Omega \phi f_0(u, u_t, \nabla u, x, t) + \nabla\phi \cdot {\vec > > f}_1(u, u_t, \nabla u, x, t) > > > > So f0 is, for the Poisson problem, zero, and f1 is just -grad u? > > > > > > No. f1 is indeed -grad u, but f0 is -f. > > > > Note that ex12 solves -nabla^2 u = f since that operator is positive > > definite. > > > > > > Do we > > need to do anything with the surface term, or is that handled > > internally? > > > > > > The surface term can be included using > > > > > https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DT/PetscDSSetBdResidual.html > > > > and we use that in ex12 for inhomogeneous Neumann conditions. > > > > > > Because neither of these terms are a surface integral term, > > both are volume integrals. > > > > I can't figure out the purpose of g0, g1, g2, g3 in > > PetscDSSetJacobian(), either. Is g supposed to be the source term? > > > > > > No, it is the coefficient of the different combinations of basis > > functions and their gradients. > > For instance, the g3 term (grad phi and grad psi), g3 plays the same > > role as the elasticity > > tensor C in mechanics. > > > > > > Is > > psi a second basis function? > > > > > > Yes. If the method is Galerkin, it comes from the same space as phi. > > > > > > What even *is* the Jacobian in a FEM > > problem? > > > > > > The Frechet derivative of the residual. > > > > > > I've only seen them formulated as linear problems in tutorials, > > so I'm not even clear why we need a nonlinear solver or Jacobian... > > > > > > The Frechet derivative of a linear operator is itself. ex12 also > > incorporates > > nonlinear variants of Poisson. > > > > > > Any help is appreciated. I like the idea of a general framework for > FEM, > > as I think it will reduce human error on my part, but I also want to > > understand what I'm doing. > > > > > > If you have any more questions, feel free to keep mailing. > > > > Thanks, > > > > Matt > > > > > > Ellen Price > > > > > > > > -- > > 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 > > > > https://www.cse.buffalo.edu/~knepley/ > > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Mon Oct 8 20:33:33 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 8 Oct 2018 21:33:33 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: On Mon, Oct 8, 2018 at 9:28 PM Weizhuo Wang wrote: > The code is attached in case anyone wants to take a look, I will try the > high frequency scenario later. > That is not the error. It is superconvergence at the vertices. The real solution is trigonometric, so your linear interpolants or whatever you use is not going to get the right value in between mesh points. You need to do a real integral over the whole interval to get the L_2 error. Thanks, Matt > On Mon, Oct 8, 2018 at 7:58 PM Mark Adams wrote: > >> >> >> On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang >> wrote: >> >>> The first plot is the norm with the flag -pc_type lu with respect to >>> number of grids in one axis (n), and the second plot is the norm without >>> the flag -pc_type lu. >>> >> >> So you are using the default PC w/o LU. The default is ILU. This will >> reduce high frequency effectively but is not effective on the low frequency >> error. Don't expect your algebraic error reduction to be at the same scale >> as the residual reduction (what KSP measures). >> >> >>> > > -- > Wang Weizhuo > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From yjwu16 at gmail.com Mon Oct 8 22:32:37 2018 From: yjwu16 at gmail.com (Yingjie Wu) Date: Tue, 9 Oct 2018 11:32:37 +0800 Subject: [petsc-users] Problems about Block Jocabi and Matrix-Free Method in SNES Message-ID: Dear Petsc developer: Hi, I've been studying Petsc recently about Precontioner and Metrix-Free, and I have some questions that puzzle me. 1. I want to test block Jacobi preconditioner, so I chose /snes/example/tutorial/ex3.c as an example. According to the reference in the example, the input parameters are: mpiexec -n 8./ex3 -nox -n 10000 -ksp_type fgmres -pc_type bjacobi -pc_bjacobi_blocks 4 -sub_ksp_type gmres -sub_ksp_max_it 3 -post_setsubksp -sub_ksp_rtol 1.e-16 I want to export each block of KSP and PC information : -snes_view -ksp_view However, the procedure is wrong and the wrong information is as follows: [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: Arguments must have same communicators [0]PETSC ERROR: Different communicators in the two objects: Argument # 1 and 2 flag 3 [0]PETSC ERROR: [1]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [2]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [2]PETSC ERROR: [3]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [3]PETSC ERROR: Arguments must have same communicators [3]PETSC ERROR: [6]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [6]PETSC ERROR: Arguments must have same communicators [6]PETSC ERROR: Different communicators in the two objects: Argument # 1 and 2 flag 3 [6]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [7]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [7]PETSC ERROR: Arguments must have same communicators [7]PETSC ERROR: Different communicators in the two objects: Argument # 1 and 2 flag 3 [7]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [7]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 [0]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by yjwu Mon Oct 8 22:35:34 2018 [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-mpich --download-fblaslapack [0]PETSC ERROR: #1 KSPView() line 118 in /home/yjwu/petsc-3.10.1/src/ksp/ksp/interface/itcreate.c [0]PETSC ERROR: #2 PCView_BJacobi() line 232 in /home/yjwu/petsc-3.10.1/src/ksp/pc/impls/bjacobi/bjacobi.c [0]PETSC ERROR: #3 PCView() line 1651 in /home/yjwu/petsc-3.10.1/src/ksp/pc/interface/precon.c [1]PETSC ERROR: Arguments must have same communicators [1]PETSC ERROR: Different communicators in the two objects: Argument # 1 and 2 flag 3 [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [1]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 [1]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by yjwu Mon Oct 8 22:35:34 2018 [1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-mpich --download-fblaslapack [1]PETSC ERROR: #1 KSPView() line 118 in /home/yjwu/petsc-3.10.1/src/ksp/ksp/interface/itcreate.c Arguments must have same communicators [2]PETSC ERROR: Different communicators in the two objects: Argument # 1 and 2 flag 3 [2]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. If I want to get the information of KSP and PC in each block, what should I do? 2. There is a requirement in my program to use Matrix-Free method to approximate Jacobian matrix by finite difference of residual function in solving nonlinear equations. But I'll also provide an analytic( incomplete, some terms are missing or approximate) for preconditioning. Because my problem is about a large set of equations composed of several physical fields, I want to use block Jacobian precondition for each subfield(block), and ILU sub_pc for each subfield. After reading the Users'Guide, I found that using - snex_mf_operator can do the above, so I added: - snes_mf_operator after the example above. However, the procedure is wrong and does not seem to support this. The wrong information is: [1]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [2]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [2]PETSC ERROR: No support for this operation for this object type [2]PETSC ERROR: Mat type mffd [2]PETSC ERROR: [3]PETSC ERROR: [4]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [4]PETSC ERROR: No support for this operation for this object type [4]PETSC ERROR: Mat type mffd [4]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [4]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 [6]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [6]PETSC ERROR: No support for this operation for this object type [6]PETSC ERROR: Mat type mffd [6]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [6]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 [6]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by yjwu Mon Oct 8 23:01:57 2018 [6]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-mpich --download-fblaslapack [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: No support for this operation for this object type [0]PETSC ERROR: Mat type mffd [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 [0]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by yjwu Mon Oct 8 23:01:57 2018 [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-mpich --download-fblaslapack [0]PETSC ERROR: #1 MatSetValues() line 1330 in /home/yjwu/petsc-3.10.1/src/mat/interface/matrix.c [1]PETSC ERROR: No support for this operation for this object type [1]PETSC ERROR: Mat type mffd [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. If I want to implement matrix-free and block jacobi precondition in my program, what do I need to pay attention or add ? The second question is very important for my research and I hope to get your answer. Thanks, Yingjie -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfadams at lbl.gov Tue Oct 9 02:50:01 2018 From: mfadams at lbl.gov (Mark Adams) Date: Tue, 9 Oct 2018 03:50:01 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: To reiterate what Matt is saying, you seem to have the exact solution on a 10x10 grid. That makes no sense unless the solution can be represented exactly by your FE space (eg, u(x,y) = x + y). On Mon, Oct 8, 2018 at 9:33 PM Matthew Knepley wrote: > On Mon, Oct 8, 2018 at 9:28 PM Weizhuo Wang wrote: > >> The code is attached in case anyone wants to take a look, I will try the >> high frequency scenario later. >> > > That is not the error. It is superconvergence at the vertices. The real > solution is trigonometric, so your > linear interpolants or whatever you use is not going to get the right > value in between mesh points. You > need to do a real integral over the whole interval to get the L_2 error. > > Thanks, > > Matt > > >> On Mon, Oct 8, 2018 at 7:58 PM Mark Adams wrote: >> >>> >>> >>> On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang >>> wrote: >>> >>>> The first plot is the norm with the flag -pc_type lu with respect to >>>> number of grids in one axis (n), and the second plot is the norm without >>>> the flag -pc_type lu. >>>> >>> >>> So you are using the default PC w/o LU. The default is ILU. This will >>> reduce high frequency effectively but is not effective on the low frequency >>> error. Don't expect your algebraic error reduction to be at the same scale >>> as the residual reduction (what KSP measures). >>> >>> >>>> >> >> -- >> Wang Weizhuo >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Tue Oct 9 10:34:19 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 9 Oct 2018 11:34:19 -0400 Subject: [petsc-users] Problems about Block Jocabi and Matrix-Free Method in SNES In-Reply-To: References: Message-ID: On Mon, Oct 8, 2018 at 11:33 PM Yingjie Wu wrote: > Dear Petsc developer: > Hi, > > I've been studying Petsc recently about Precontioner and Metrix-Free, and > I have some questions that puzzle me. > > 1. I want to test block Jacobi preconditioner, so I chose > /snes/example/tutorial/ex3.c as an example. According to the reference in > the example, the input parameters are: > mpiexec -n 8./ex3 -nox -n 10000 -ksp_type fgmres -pc_type bjacobi > -pc_bjacobi_blocks 4 -sub_ksp_type gmres -sub_ksp_max_it 3 -post_setsubksp > -sub_ksp_rtol 1.e-16 > You do not care about recursive blocks, so just use $MPIEXEC -n 8 ./ex3 -nox -n 10000 -ksp_type fgmres -pc_type bjacobi -pc_bjacobi_blocks 4 -sub_ksp_type gmres -sub_ksp_max_it 3 -snes_view -ksp_view and I get the attached output. > I want to export each block of KSP and PC information : > -snes_view -ksp_view > However, the procedure is wrong and the wrong information is as follows: > > [0]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [0]PETSC ERROR: Arguments must have same communicators > [0]PETSC ERROR: Different communicators in the two objects: Argument # 1 > and 2 flag 3 > [0]PETSC ERROR: [1]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [2]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [2]PETSC ERROR: [3]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [3]PETSC ERROR: Arguments must have same communicators > [3]PETSC ERROR: [6]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [6]PETSC ERROR: Arguments must have same communicators > [6]PETSC ERROR: Different communicators in the two objects: Argument # 1 > and 2 flag 3 > [6]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble shooting. > [7]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [7]PETSC ERROR: Arguments must have same communicators > [7]PETSC ERROR: Different communicators in the two objects: Argument # 1 > and 2 flag 3 > [7]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble shooting. > [7]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 > See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble > shooting. > [0]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 > [0]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by yjwu > Mon Oct 8 22:35:34 2018 > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ > --with-fc=gfortran --download-mpich --download-fblaslapack > [0]PETSC ERROR: #1 KSPView() line 118 in > /home/yjwu/petsc-3.10.1/src/ksp/ksp/interface/itcreate.c > [0]PETSC ERROR: #2 PCView_BJacobi() line 232 in > /home/yjwu/petsc-3.10.1/src/ksp/pc/impls/bjacobi/bjacobi.c > [0]PETSC ERROR: #3 PCView() line 1651 in > /home/yjwu/petsc-3.10.1/src/ksp/pc/interface/precon.c > [1]PETSC ERROR: Arguments must have same communicators > [1]PETSC ERROR: Different communicators in the two objects: Argument # 1 > and 2 flag 3 > [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble shooting. > [1]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 > [1]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by yjwu > Mon Oct 8 22:35:34 2018 > [1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ > --with-fc=gfortran --download-mpich --download-fblaslapack > [1]PETSC ERROR: #1 KSPView() line 118 in > /home/yjwu/petsc-3.10.1/src/ksp/ksp/interface/itcreate.c > Arguments must have same communicators > [2]PETSC ERROR: Different communicators in the two objects: Argument # 1 > and 2 flag 3 > [2]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble shooting. > > If I want to get the information of KSP and PC in each block, what should > I do? > > 2. There is a requirement in my program to use Matrix-Free method to > approximate Jacobian matrix by finite difference of residual function in > solving nonlinear equations. But I'll also provide an analytic( incomplete, > some terms are missing or approximate) for preconditioning. Because my > problem is about a large set of equations composed of several physical > fields, I want to use block Jacobian precondition for each subfield(block), > and ILU sub_pc for each subfield. After reading the Users'Guide, I found > that using - snex_mf_operator can do the above, so I added: > - snes_mf_operator > You need to be careful what matrix you are adding values to in your FormJacobian() routine. The primal matrix J is of type MFFD (finite difference) and thus cannot accept values. You put your approximate values in the preconditioner M. Thanks, Matt > after the example above. However, the procedure is wrong and does not seem > to support this. > The wrong information is: > > [1]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [2]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [2]PETSC ERROR: No support for this operation for this object type > [2]PETSC ERROR: Mat type mffd > [2]PETSC ERROR: [3]PETSC ERROR: [4]PETSC ERROR: --------------------- > Error Message -------------------------------------------------------------- > [4]PETSC ERROR: No support for this operation for this object type > [4]PETSC ERROR: Mat type mffd > [4]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble shooting. > [4]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 > [6]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [6]PETSC ERROR: No support for this operation for this object type > [6]PETSC ERROR: Mat type mffd > [6]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble shooting. > [6]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 > [6]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by yjwu > Mon Oct 8 23:01:57 2018 > [6]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ > --with-fc=gfortran --download-mpich --download-fblaslapack > [0]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [0]PETSC ERROR: No support for this operation for this object type > [0]PETSC ERROR: Mat type mffd > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble shooting. > [0]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 > [0]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by yjwu > Mon Oct 8 23:01:57 2018 > [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ > --with-fc=gfortran --download-mpich --download-fblaslapack > [0]PETSC ERROR: #1 MatSetValues() line 1330 in > /home/yjwu/petsc-3.10.1/src/mat/interface/matrix.c > [1]PETSC ERROR: No support for this operation for this object type > [1]PETSC ERROR: Mat type mffd > [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble shooting. > > If I want to implement matrix-free and block jacobi precondition in my > program, what do I need to pay attention or add ? > > The second question is very important for my research and I hope to get > your answer. > > Thanks, > Yingjie > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: out Type: application/octet-stream Size: 12478 bytes Desc: not available URL: From jczhang at mcs.anl.gov Tue Oct 9 15:39:07 2018 From: jczhang at mcs.anl.gov (Zhang, Junchao) Date: Tue, 9 Oct 2018 20:39:07 +0000 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: I met a case where MUMPS returned an out-of-memory code but PETSc continued to run. When PETSc calls MUMPS, it checks if (A->erroriffailure). I added -mat_error_if_failure, but it did not work since it was overwritten by MatSetErrorIfFailure(pc->pmat,pc->erroriffailure) Does it suggest we should add a new option -pc_factor_error_if_failure and check it in PCSetFromOptions_Factor()? --Junchao Zhang On Fri, Oct 5, 2018 at 8:12 PM Zhang, Hong > wrote: Mike: Hello PETSc team: I am trying to solve a PDE problem with high-order finite elements. The matrix is getting denser and my experience is that MUMPS just outperforms iterative solvers. For certain problems, MUMPS just fail in the middle for no clear reason. I just wander if there is any suggestion to improve the robustness of MUMPS? Or in general, any suggestion for interative solver with very high-order finite elements? What error message do you get when MUMPS fails? Out of memory, zero pivoting, or something? Hong -------------- next part -------------- An HTML attachment was scrubbed... URL: From jczhang at mcs.anl.gov Tue Oct 9 15:39:07 2018 From: jczhang at mcs.anl.gov (Zhang, Junchao) Date: Tue, 9 Oct 2018 20:39:07 +0000 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: I met a case where MUMPS returned an out-of-memory code but PETSc continued to run. When PETSc calls MUMPS, it checks if (A->erroriffailure). I added -mat_error_if_failure, but it did not work since it was overwritten by MatSetErrorIfFailure(pc->pmat,pc->erroriffailure) Does it suggest we should add a new option -pc_factor_error_if_failure and check it in PCSetFromOptions_Factor()? --Junchao Zhang On Fri, Oct 5, 2018 at 8:12 PM Zhang, Hong > wrote: Mike: Hello PETSc team: I am trying to solve a PDE problem with high-order finite elements. The matrix is getting denser and my experience is that MUMPS just outperforms iterative solvers. For certain problems, MUMPS just fail in the middle for no clear reason. I just wander if there is any suggestion to improve the robustness of MUMPS? Or in general, any suggestion for interative solver with very high-order finite elements? What error message do you get when MUMPS fails? Out of memory, zero pivoting, or something? Hong -------------- next part -------------- An HTML attachment was scrubbed... URL: From jczhang at mcs.anl.gov Tue Oct 9 16:05:41 2018 From: jczhang at mcs.anl.gov (Zhang, Junchao) Date: Tue, 9 Oct 2018 21:05:41 +0000 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: OK, I found -ksp_error_if_not_converged will trigger PETSc to fail in this case. --Junchao Zhang On Tue, Oct 9, 2018 at 3:38 PM Junchao Zhang > wrote: I met a case where MUMPS returned an out-of-memory code but PETSc continued to run. When PETSc calls MUMPS, it checks if (A->erroriffailure). I added -mat_error_if_failure, but it did not work since it was overwritten by MatSetErrorIfFailure(pc->pmat,pc->erroriffailure) Does it suggest we should add a new option -pc_factor_error_if_failure and check it in PCSetFromOptions_Factor()? --Junchao Zhang On Fri, Oct 5, 2018 at 8:12 PM Zhang, Hong > wrote: Mike: Hello PETSc team: I am trying to solve a PDE problem with high-order finite elements. The matrix is getting denser and my experience is that MUMPS just outperforms iterative solvers. For certain problems, MUMPS just fail in the middle for no clear reason. I just wander if there is any suggestion to improve the robustness of MUMPS? Or in general, any suggestion for interative solver with very high-order finite elements? What error message do you get when MUMPS fails? Out of memory, zero pivoting, or something? Hong -------------- next part -------------- An HTML attachment was scrubbed... URL: From amfoggia at gmail.com Wed Oct 10 02:38:23 2018 From: amfoggia at gmail.com (Ale Foggia) Date: Wed, 10 Oct 2018 09:38:23 +0200 Subject: [petsc-users] PETSc/SLEPc: Memory consumption, particularly during solver initialization/solve In-Reply-To: References: Message-ID: Jed, Jose and Matthew, I've finally managed to make massif (it gives pretty detailed information, I like it) work in the correct way in the cluster and I'm able to track down the memory consumption, and what's more important (for me), I think now I'm able to make a more accurate prediction of the memory I need for a particular size of the problem. Thank you very much for all your answers and suggestions. El vie., 5 oct. 2018 a las 9:38, Jose E. Roman () escribi?: > > > > El 4 oct 2018, a las 19:54, Ale Foggia escribi?: > > > > Jose: > > - By each step I mean each of the step of the the program in order to > diagonalize the matrix. For me, those are: creation of basis, preallocation > of matrix, setting values of matrix, initializing solver, > solving/diagonalizing and cleaning. I'm only diagonalizing once. > > > > - Regarding the information provided by -log_view, it's confusing for > me: for example, it reports the creation of Vecs scattered across the > various stages that I've set up (with PetscLogStageRegister and > PetscLogStagePush/Pop), but almost all the deletions are presented in the > "Main Stage". What does that "Main Stage" consider? Why are more deletions > in there that creations? It's nor completely for me clear how things are > presented there. > > I guess deletions should match creations. Seems to be related to using > stages. Maybe someone from PETSc can give an explanation, but looking at a > PETSc example that uses stages (e.g. dm/impls/plex/examples/tests/ex1.c) it > seems that some destructions are counted in the main stage while the > creation is counted in another stage - I guess it depends on the points > where the stages are defined. The sum of creations matches the sum of > destroys. > > > > > - Thanks for the suggestion about the solver. Does "faster convergence" > for Krylov-Schur mean less memory and less computation, or just less > computation? > > > > It should be about the same memory with less iterations. > > Jose > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Wed Oct 10 06:51:23 2018 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 10 Oct 2018 07:51:23 -0400 Subject: [petsc-users] PETSc/SLEPc: Memory consumption, particularly during solver initialization/solve In-Reply-To: References: Message-ID: On Wed, Oct 10, 2018 at 3:38 AM Ale Foggia wrote: > Jed, Jose and Matthew, > I've finally managed to make massif (it gives pretty detailed information, > I like it) work in the correct way in the cluster and I'm able to track > down the memory consumption, and what's more important (for me), I think > now I'm able to make a more accurate prediction of the memory I need for a > particular size of the problem. Thank you very much for all your answers > and suggestions. > Great! Could you tell me in one line what was taking up memory? It always good to hear about real applications. Thanks, Matt > El vie., 5 oct. 2018 a las 9:38, Jose E. Roman () > escribi?: > >> >> >> > El 4 oct 2018, a las 19:54, Ale Foggia escribi?: >> > >> > Jose: >> > - By each step I mean each of the step of the the program in order to >> diagonalize the matrix. For me, those are: creation of basis, preallocation >> of matrix, setting values of matrix, initializing solver, >> solving/diagonalizing and cleaning. I'm only diagonalizing once. >> > >> > - Regarding the information provided by -log_view, it's confusing for >> me: for example, it reports the creation of Vecs scattered across the >> various stages that I've set up (with PetscLogStageRegister and >> PetscLogStagePush/Pop), but almost all the deletions are presented in the >> "Main Stage". What does that "Main Stage" consider? Why are more deletions >> in there that creations? It's nor completely for me clear how things are >> presented there. >> >> I guess deletions should match creations. Seems to be related to using >> stages. Maybe someone from PETSc can give an explanation, but looking at a >> PETSc example that uses stages (e.g. dm/impls/plex/examples/tests/ex1.c) it >> seems that some destructions are counted in the main stage while the >> creation is counted in another stage - I guess it depends on the points >> where the stages are defined. The sum of creations matches the sum of >> destroys. >> >> > >> > - Thanks for the suggestion about the solver. Does "faster convergence" >> for Krylov-Schur mean less memory and less computation, or just less >> computation? >> > >> >> It should be about the same memory with less iterations. >> >> Jose >> >> -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From yjwu16 at gmail.com Wed Oct 10 07:50:20 2018 From: yjwu16 at gmail.com (Yingjie Wu) Date: Wed, 10 Oct 2018 20:50:20 +0800 Subject: [petsc-users] Problems about Block Jocabi and Matrix-Free Method in SNES In-Reply-To: References: Message-ID: Thank you very much, Matt. I followed your advice and learned some MATMFFD related functions. Since I really wanted to use the Matrix-Free method, I learned the few examples of this method. I would like to enhance my understanding of the Matrix-Free method in PETSc according to my questions about these examples and hope to get your answer. 1. In the example src/snes/example/tutorials/ex22.c ...... 107: packer->ops->creatematrix = DMCreateMatrix_MF; 110: SNESCreate(PETSC_COMM_WORLD,&snes); 111: SNESSetDM(snes,packer); 112: SNESSetFunction(snes,NULL,ComputeFunction,NULL); 113: SNESSetJacobian(snes,NULL, NULL,ComputeJacobian_MF,NULL); 115: SNESSetFromOptions(snes); ...... 285: PetscErrorCode DMCreateMatrix_MF(DM packer,Mat *A) 286: { 288: Vec t; 289: PetscInt m; 292: DMGetGlobalVector(packer,&t); 293: VecGetLocalSize(t,&m); 294: DMRestoreGlobalVector(packer,&t); 295: MatCreateMFFD(PETSC_COMM_WORLD,m,m,PETSC_DETERMINE,PETSC_DETERMINE,A); 296: MatSetUp(*A); 297: return(0); 298: } 300: PetscErrorCode ComputeJacobian_MF(SNES snes,Vec x,Mat A,Mat B,void *ctx) 301: { 305: MatMFFDSetFunction(A,(PetscErrorCode (*)(void*,Vec,Vec))SNESComputeFunction,snes); 306: MatMFFDSetBase(A,x,NULL); 307: return(0); 308: } Why are the solution vector, Jacobian matrix, and precondition matrix set to NULL in SNESSetJacobian? Is it because they are automatically generated in SNESSetDM? There is no precondition matrix B in ComputeJacobian_MF (Jacobian evaluate program). If I want to add my own precondition matrix, then the Assembly matrix B in this function, is that right? What is the function of MatMFFDSetBase? I read the documentation but didn't understand it. What would happen if I removed it? 2. In the example /src/snes/examples/tutorials/ex14.c 114: SNESSetFunction(snes,r,FormFunction,(void*)&user); 131: PetscOptionsGetBool(NULL,NULL,"-snes_mf",&matrix_free,NULL); 132: PetscOptionsGetBool(NULL,NULL,"-fdcoloring",&coloring,NULL); 133: PetscOptionsGetBool(NULL,NULL,"-fdcoloring_ds",&coloring_ds,NULL); 134: PetscOptionsGetBool(NULL,NULL,"-fdcoloring_local",&local_coloring,NULL); 135: if (!matrix_free) { 136: DMSetMatType(user.da,MATAIJ); 137: DMCreateMatrix(user.da,&J); 138: if (coloring) { 139: ISColoring iscoloring; 140: if (!local_coloring) { 141: DMCreateColoring(user.da,IS_COLORING_GLOBAL,&iscoloring); 142: MatFDColoringCreate(J,iscoloring,&matfdcoloring); 143: MatFDColoringSetFunction(matfdcoloring,(PetscErrorCode (*)(void))FormFunction,&user); 144: } else { 145: DMCreateColoring(user.da,IS_COLORING_LOCAL,&iscoloring); 146: MatFDColoringCreate(J,iscoloring,&matfdcoloring); 147: MatFDColoringUseDM(J,matfdcoloring); 148: MatFDColoringSetFunction(matfdcoloring,(PetscErrorCode (*)(void))FormFunctionLocal,&user); 149: } 150: if (coloring_ds) { 151: MatFDColoringSetType(matfdcoloring,MATMFFD_DS); 152: } 153: MatFDColoringSetFromOptions(matfdcoloring); 154: MatFDColoringSetUp(J,iscoloring,matfdcoloring); 155: SNESSetJacobian(snes,J,J,SNESComputeJacobianDefaultColor,matfdcoloring); 156: ISColoringDestroy(&iscoloring); 157: } else { 158: SNESSetJacobian(snes,J,J,FormJacobian,&user); 159: } 160: } If the command "- snes_mf" is used, the function SNESSetJacobian is not called, and the Jacobian matrix type is initialized as MATMFFD. The function in SNESSetFunction is used to approximate the matrix vector product. Do I understand this correctly? The description of my question may be complicated, but as a beginner, I really want to learn something about matrix-free method from the examples, and I hope to get your reply. Thanks, Yingjie Matthew Knepley ?2018?10?9??? ??11:34??? > On Mon, Oct 8, 2018 at 11:33 PM Yingjie Wu wrote: > >> Dear Petsc developer: >> Hi, >> >> I've been studying Petsc recently about Precontioner and Metrix-Free, and >> I have some questions that puzzle me. >> >> 1. I want to test block Jacobi preconditioner, so I chose >> /snes/example/tutorial/ex3.c as an example. According to the reference in >> the example, the input parameters are: >> mpiexec -n 8./ex3 -nox -n 10000 -ksp_type fgmres -pc_type bjacobi >> -pc_bjacobi_blocks 4 -sub_ksp_type gmres -sub_ksp_max_it 3 -post_setsubksp >> -sub_ksp_rtol 1.e-16 >> > > You do not care about recursive blocks, so just use > > $MPIEXEC -n 8 ./ex3 -nox -n 10000 -ksp_type fgmres -pc_type bjacobi > -pc_bjacobi_blocks 4 -sub_ksp_type gmres -sub_ksp_max_it 3 -snes_view > -ksp_view > > and I get the attached output. > > >> I want to export each block of KSP and PC information : >> -snes_view -ksp_view >> However, the procedure is wrong and the wrong information is as follows: >> >> [0]PETSC ERROR: --------------------- Error Message >> -------------------------------------------------------------- >> [0]PETSC ERROR: Arguments must have same communicators >> [0]PETSC ERROR: Different communicators in the two objects: Argument # 1 >> and 2 flag 3 >> [0]PETSC ERROR: [1]PETSC ERROR: --------------------- Error Message >> -------------------------------------------------------------- >> [2]PETSC ERROR: --------------------- Error Message >> -------------------------------------------------------------- >> [2]PETSC ERROR: [3]PETSC ERROR: --------------------- Error Message >> -------------------------------------------------------------- >> [3]PETSC ERROR: Arguments must have same communicators >> [3]PETSC ERROR: [6]PETSC ERROR: --------------------- Error Message >> -------------------------------------------------------------- >> [6]PETSC ERROR: Arguments must have same communicators >> [6]PETSC ERROR: Different communicators in the two objects: Argument # 1 >> and 2 flag 3 >> [6]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >> for trouble shooting. >> [7]PETSC ERROR: --------------------- Error Message >> -------------------------------------------------------------- >> [7]PETSC ERROR: Arguments must have same communicators >> [7]PETSC ERROR: Different communicators in the two objects: Argument # 1 >> and 2 flag 3 >> [7]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >> for trouble shooting. >> [7]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 >> See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble >> shooting. >> [0]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 >> [0]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by >> yjwu Mon Oct 8 22:35:34 2018 >> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >> --with-fc=gfortran --download-mpich --download-fblaslapack >> [0]PETSC ERROR: #1 KSPView() line 118 in >> /home/yjwu/petsc-3.10.1/src/ksp/ksp/interface/itcreate.c >> [0]PETSC ERROR: #2 PCView_BJacobi() line 232 in >> /home/yjwu/petsc-3.10.1/src/ksp/pc/impls/bjacobi/bjacobi.c >> [0]PETSC ERROR: #3 PCView() line 1651 in >> /home/yjwu/petsc-3.10.1/src/ksp/pc/interface/precon.c >> [1]PETSC ERROR: Arguments must have same communicators >> [1]PETSC ERROR: Different communicators in the two objects: Argument # 1 >> and 2 flag 3 >> [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >> for trouble shooting. >> [1]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 >> [1]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by >> yjwu Mon Oct 8 22:35:34 2018 >> [1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >> --with-fc=gfortran --download-mpich --download-fblaslapack >> [1]PETSC ERROR: #1 KSPView() line 118 in >> /home/yjwu/petsc-3.10.1/src/ksp/ksp/interface/itcreate.c >> Arguments must have same communicators >> [2]PETSC ERROR: Different communicators in the two objects: Argument # 1 >> and 2 flag 3 >> [2]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >> for trouble shooting. >> >> If I want to get the information of KSP and PC in each block, what should >> I do? >> >> 2. There is a requirement in my program to use Matrix-Free method to >> approximate Jacobian matrix by finite difference of residual function in >> solving nonlinear equations. But I'll also provide an analytic( incomplete, >> some terms are missing or approximate) for preconditioning. Because my >> problem is about a large set of equations composed of several physical >> fields, I want to use block Jacobian precondition for each subfield(block), >> and ILU sub_pc for each subfield. After reading the Users'Guide, I found >> that using - snex_mf_operator can do the above, so I added: >> - snes_mf_operator >> > > You need to be careful what matrix you are adding values to in your > FormJacobian() routine. The primal matrix J is of type MFFD (finite > difference) > and thus cannot accept values. You put your approximate values in the > preconditioner M. > > Thanks, > > Matt > > >> after the example above. However, the procedure is wrong and does not >> seem to support this. >> The wrong information is: >> >> [1]PETSC ERROR: --------------------- Error Message >> -------------------------------------------------------------- >> [2]PETSC ERROR: --------------------- Error Message >> -------------------------------------------------------------- >> [2]PETSC ERROR: No support for this operation for this object type >> [2]PETSC ERROR: Mat type mffd >> [2]PETSC ERROR: [3]PETSC ERROR: [4]PETSC ERROR: --------------------- >> Error Message -------------------------------------------------------------- >> [4]PETSC ERROR: No support for this operation for this object type >> [4]PETSC ERROR: Mat type mffd >> [4]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >> for trouble shooting. >> [4]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 >> [6]PETSC ERROR: --------------------- Error Message >> -------------------------------------------------------------- >> [6]PETSC ERROR: No support for this operation for this object type >> [6]PETSC ERROR: Mat type mffd >> [6]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >> for trouble shooting. >> [6]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 >> [6]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by >> yjwu Mon Oct 8 23:01:57 2018 >> [6]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >> --with-fc=gfortran --download-mpich --download-fblaslapack >> [0]PETSC ERROR: --------------------- Error Message >> -------------------------------------------------------------- >> [0]PETSC ERROR: No support for this operation for this object type >> [0]PETSC ERROR: Mat type mffd >> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >> for trouble shooting. >> [0]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 >> [0]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by >> yjwu Mon Oct 8 23:01:57 2018 >> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >> --with-fc=gfortran --download-mpich --download-fblaslapack >> [0]PETSC ERROR: #1 MatSetValues() line 1330 in >> /home/yjwu/petsc-3.10.1/src/mat/interface/matrix.c >> [1]PETSC ERROR: No support for this operation for this object type >> [1]PETSC ERROR: Mat type mffd >> [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >> for trouble shooting. >> >> If I want to implement matrix-free and block jacobi precondition in my >> program, what do I need to pay attention or add ? >> >> The second question is very important for my research and I hope to get >> your answer. >> >> Thanks, >> Yingjie >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Wed Oct 10 08:09:29 2018 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 10 Oct 2018 09:09:29 -0400 Subject: [petsc-users] Problems about Block Jocabi and Matrix-Free Method in SNES In-Reply-To: References: Message-ID: On Wed, Oct 10, 2018 at 8:50 AM Yingjie Wu wrote: > Thank you very much, Matt. > I followed your advice and learned some MATMFFD related functions. Since > I really wanted to use the Matrix-Free method, I learned the few examples > of this method. I would like to enhance my understanding of the Matrix-Free > method in PETSc according to my questions about these examples and hope to > get your answer. > 1. In the example src/snes/example/tutorials/ex22.c > > ...... > 107: packer->ops->creatematrix = DMCreateMatrix_MF; > > 110: SNESCreate(PETSC_COMM_WORLD,&snes); > 111: SNESSetDM(snes,packer); > 112: SNESSetFunction(snes,NULL,ComputeFunction,NULL); > 113: SNESSetJacobian(snes,NULL, NULL,ComputeJacobian_MF,NULL); > > 115: SNESSetFromOptions(snes); > ...... > 285: PetscErrorCode DMCreateMatrix_MF(DM packer,Mat *A) > 286: { > 288: Vec t; > 289: PetscInt m; > > 292: DMGetGlobalVector(packer,&t); > 293: VecGetLocalSize(t,&m); > 294: DMRestoreGlobalVector(packer,&t); > 295: > MatCreateMFFD(PETSC_COMM_WORLD,m,m,PETSC_DETERMINE,PETSC_DETERMINE,A); > 296: MatSetUp(*A); > 297: return(0); > 298: } > > 300: PetscErrorCode ComputeJacobian_MF(SNES snes,Vec x,Mat A,Mat B,void > *ctx) > 301: { > > 305: MatMFFDSetFunction(A,(PetscErrorCode > (*)(void*,Vec,Vec))SNESComputeFunction,snes); > 306: MatMFFDSetBase(A,x,NULL); > 307: return(0); > 308: } > > Why are the solution vector, Jacobian matrix, and precondition matrix set > to NULL in SNESSetJacobian? Is it because they are automatically generated > in SNESSetDM? > Yes. This example show how to do it by hand. If you give NULL for your FormJacobian function, we do it automatically. If you give _mf_operator, then we do it, but pass through the matrices to your FormJacobian() function. > There is no precondition matrix B in ComputeJacobian_MF (Jacobian evaluate > program). If I want to add my own precondition matrix, then the Assembly > matrix B in this function, is that right? > What is the function of MatMFFDSetBase? I read the documentation but > didn't understand it. What would happen if I removed it? > SetBase() provides the initial vector for differencing. This is necessary. > 2. In the example /src/snes/examples/tutorials/ex14.c > > 114: SNESSetFunction(snes,r,FormFunction,(void*)&user); > > 131: PetscOptionsGetBool(NULL,NULL,"-snes_mf",&matrix_free,NULL); > 132: PetscOptionsGetBool(NULL,NULL,"-fdcoloring",&coloring,NULL); > 133: PetscOptionsGetBool(NULL,NULL,"-fdcoloring_ds",&coloring_ds,NULL); > 134: > PetscOptionsGetBool(NULL,NULL,"-fdcoloring_local",&local_coloring,NULL); > 135: if (!matrix_free) { > 136: DMSetMatType(user.da,MATAIJ); > 137: DMCreateMatrix(user.da,&J); > 138: if (coloring) { > 139: ISColoring iscoloring; > 140: if (!local_coloring) { > 141: DMCreateColoring(user.da,IS_COLORING_GLOBAL,&iscoloring); > 142: MatFDColoringCreate(J,iscoloring,&matfdcoloring); > 143: MatFDColoringSetFunction(matfdcoloring,(PetscErrorCode > (*)(void))FormFunction,&user); > 144: } else { > 145: DMCreateColoring(user.da,IS_COLORING_LOCAL,&iscoloring); > 146: MatFDColoringCreate(J,iscoloring,&matfdcoloring); > 147: MatFDColoringUseDM(J,matfdcoloring); > 148: MatFDColoringSetFunction(matfdcoloring,(PetscErrorCode > (*)(void))FormFunctionLocal,&user); > 149: } > 150: if (coloring_ds) { > 151: MatFDColoringSetType(matfdcoloring,MATMFFD_DS); > 152: } > 153: MatFDColoringSetFromOptions(matfdcoloring); > 154: MatFDColoringSetUp(J,iscoloring,matfdcoloring); > 155: > SNESSetJacobian(snes,J,J,SNESComputeJacobianDefaultColor,matfdcoloring); > 156: ISColoringDestroy(&iscoloring); > 157: } else { > 158: SNESSetJacobian(snes,J,J,FormJacobian,&user); > 159: } > 160: } > > If the command "- snes_mf" is used, the function SNESSetJacobian is not > called, and the Jacobian matrix type is initialized as MATMFFD. The > function in SNESSetFunction is used to approximate the matrix vector > product. Do I understand this correctly? > Yes . Thanks, Matt > The description of my question may be complicated, but as a beginner, I > really want to learn something about matrix-free method from the examples, > and I hope to get your reply. > > Thanks, > Yingjie > > Matthew Knepley ?2018?10?9??? ??11:34??? > >> On Mon, Oct 8, 2018 at 11:33 PM Yingjie Wu wrote: >> >>> Dear Petsc developer: >>> Hi, >>> >>> I've been studying Petsc recently about Precontioner and Metrix-Free, >>> and I have some questions that puzzle me. >>> >>> 1. I want to test block Jacobi preconditioner, so I chose >>> /snes/example/tutorial/ex3.c as an example. According to the reference in >>> the example, the input parameters are: >>> mpiexec -n 8./ex3 -nox -n 10000 -ksp_type fgmres -pc_type bjacobi >>> -pc_bjacobi_blocks 4 -sub_ksp_type gmres -sub_ksp_max_it 3 -post_setsubksp >>> -sub_ksp_rtol 1.e-16 >>> >> >> You do not care about recursive blocks, so just use >> >> $MPIEXEC -n 8 ./ex3 -nox -n 10000 -ksp_type fgmres -pc_type bjacobi >> -pc_bjacobi_blocks 4 -sub_ksp_type gmres -sub_ksp_max_it 3 -snes_view >> -ksp_view >> >> and I get the attached output. >> >> >>> I want to export each block of KSP and PC information : >>> -snes_view -ksp_view >>> However, the procedure is wrong and the wrong information is as >>> follows: >>> >>> [0]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> [0]PETSC ERROR: Arguments must have same communicators >>> [0]PETSC ERROR: Different communicators in the two objects: Argument # 1 >>> and 2 flag 3 >>> [0]PETSC ERROR: [1]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> [2]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> [2]PETSC ERROR: [3]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> [3]PETSC ERROR: Arguments must have same communicators >>> [3]PETSC ERROR: [6]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> [6]PETSC ERROR: Arguments must have same communicators >>> [6]PETSC ERROR: Different communicators in the two objects: Argument # 1 >>> and 2 flag 3 >>> [6]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >>> for trouble shooting. >>> [7]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> [7]PETSC ERROR: Arguments must have same communicators >>> [7]PETSC ERROR: Different communicators in the two objects: Argument # 1 >>> and 2 flag 3 >>> [7]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >>> for trouble shooting. >>> [7]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 >>> See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble >>> shooting. >>> [0]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 >>> [0]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by >>> yjwu Mon Oct 8 22:35:34 2018 >>> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >>> --with-fc=gfortran --download-mpich --download-fblaslapack >>> [0]PETSC ERROR: #1 KSPView() line 118 in >>> /home/yjwu/petsc-3.10.1/src/ksp/ksp/interface/itcreate.c >>> [0]PETSC ERROR: #2 PCView_BJacobi() line 232 in >>> /home/yjwu/petsc-3.10.1/src/ksp/pc/impls/bjacobi/bjacobi.c >>> [0]PETSC ERROR: #3 PCView() line 1651 in >>> /home/yjwu/petsc-3.10.1/src/ksp/pc/interface/precon.c >>> [1]PETSC ERROR: Arguments must have same communicators >>> [1]PETSC ERROR: Different communicators in the two objects: Argument # 1 >>> and 2 flag 3 >>> [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >>> for trouble shooting. >>> [1]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 >>> [1]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by >>> yjwu Mon Oct 8 22:35:34 2018 >>> [1]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >>> --with-fc=gfortran --download-mpich --download-fblaslapack >>> [1]PETSC ERROR: #1 KSPView() line 118 in >>> /home/yjwu/petsc-3.10.1/src/ksp/ksp/interface/itcreate.c >>> Arguments must have same communicators >>> [2]PETSC ERROR: Different communicators in the two objects: Argument # 1 >>> and 2 flag 3 >>> [2]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >>> for trouble shooting. >>> >>> If I want to get the information of KSP and PC in each block, what >>> should I do? >>> >>> 2. There is a requirement in my program to use Matrix-Free method to >>> approximate Jacobian matrix by finite difference of residual function in >>> solving nonlinear equations. But I'll also provide an analytic( incomplete, >>> some terms are missing or approximate) for preconditioning. Because my >>> problem is about a large set of equations composed of several physical >>> fields, I want to use block Jacobian precondition for each subfield(block), >>> and ILU sub_pc for each subfield. After reading the Users'Guide, I found >>> that using - snex_mf_operator can do the above, so I added: >>> - snes_mf_operator >>> >> >> You need to be careful what matrix you are adding values to in your >> FormJacobian() routine. The primal matrix J is of type MFFD (finite >> difference) >> and thus cannot accept values. You put your approximate values in the >> preconditioner M. >> >> Thanks, >> >> Matt >> >> >>> after the example above. However, the procedure is wrong and does not >>> seem to support this. >>> The wrong information is: >>> >>> [1]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> [2]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> [2]PETSC ERROR: No support for this operation for this object type >>> [2]PETSC ERROR: Mat type mffd >>> [2]PETSC ERROR: [3]PETSC ERROR: [4]PETSC ERROR: --------------------- >>> Error Message -------------------------------------------------------------- >>> [4]PETSC ERROR: No support for this operation for this object type >>> [4]PETSC ERROR: Mat type mffd >>> [4]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >>> for trouble shooting. >>> [4]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 >>> [6]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> [6]PETSC ERROR: No support for this operation for this object type >>> [6]PETSC ERROR: Mat type mffd >>> [6]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >>> for trouble shooting. >>> [6]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 >>> [6]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by >>> yjwu Mon Oct 8 23:01:57 2018 >>> [6]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >>> --with-fc=gfortran --download-mpich --download-fblaslapack >>> [0]PETSC ERROR: --------------------- Error Message >>> -------------------------------------------------------------- >>> [0]PETSC ERROR: No support for this operation for this object type >>> [0]PETSC ERROR: Mat type mffd >>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >>> for trouble shooting. >>> [0]PETSC ERROR: Petsc Release Version 3.10.1, Sep, 26, 2018 >>> [0]PETSC ERROR: ./ex3 on a arch-linux2-c-debug named yjwu-XPS-8910 by >>> yjwu Mon Oct 8 23:01:57 2018 >>> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ >>> --with-fc=gfortran --download-mpich --download-fblaslapack >>> [0]PETSC ERROR: #1 MatSetValues() line 1330 in >>> /home/yjwu/petsc-3.10.1/src/mat/interface/matrix.c >>> [1]PETSC ERROR: No support for this operation for this object type >>> [1]PETSC ERROR: Mat type mffd >>> [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >>> for trouble shooting. >>> >>> If I want to implement matrix-free and block jacobi precondition in my >>> program, what do I need to pay attention or add ? >>> >>> The second question is very important for my research and I hope to get >>> your answer. >>> >>> Thanks, >>> Yingjie >>> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ling.Zou at inl.gov Wed Oct 10 11:35:37 2018 From: Ling.Zou at inl.gov (Ling Zou) Date: Wed, 10 Oct 2018 16:35:37 +0000 Subject: [petsc-users] =?windows-1252?q?error=3A_=91DMSetSection=92_was_n?= =?windows-1252?q?ot_declared_in_this_scope?= Message-ID: Hi All, I am starting playing with DMPlex, but get this error: error: ?DMSetSection? was not declared in this scope However, other DMPlex basic functions work just fine, e.g., DMPlexCreateFluentFromFile DMPlexCheckSymmetry DMPlexCheckSkeleton DMPlexCheckFaces DMPlexGetChart DMPlexGetHeightStratum Is this function somewhat special? PS: I am using cmake, and followed Jed's FindPETSc.cmake at https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake Ling [https://avatars1.githubusercontent.com/u/3303?s=400&v=4] jedbrown/cmake-modules - GitHub github.com CMake modules for some scientific libraries. Contribute to jedbrown/cmake-modules development by creating an account on GitHub. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Ling.Zou at inl.gov Wed Oct 10 11:41:51 2018 From: Ling.Zou at inl.gov (Ling Zou) Date: Wed, 10 Oct 2018 16:41:51 +0000 Subject: [petsc-users] =?windows-1252?q?error=3A_=91DMSetSection=92_was_n?= =?windows-1252?q?ot_declared_in_this_scope?= In-Reply-To: References: Message-ID: BTW, if I move the source file to: petsc-3.10.2/src/dm/impls/plex/examples/tutorials Using the makefile there, it compiles just fine. Ling ________________________________ From: petsc-users on behalf of Ling Zou Sent: Wednesday, October 10, 2018 10:35:37 AM To: PETSc users list Subject: [petsc-users] error: ?DMSetSection? was not declared in this scope Hi All, I am starting playing with DMPlex, but get this error: error: ?DMSetSection? was not declared in this scope However, other DMPlex basic functions work just fine, e.g., DMPlexCreateFluentFromFile DMPlexCheckSymmetry DMPlexCheckSkeleton DMPlexCheckFaces DMPlexGetChart DMPlexGetHeightStratum Is this function somewhat special? PS: I am using cmake, and followed Jed's FindPETSc.cmake at https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake Ling [https://avatars1.githubusercontent.com/u/3303?s=400&v=4] jedbrown/cmake-modules - GitHub github.com CMake modules for some scientific libraries. Contribute to jedbrown/cmake-modules development by creating an account on GitHub. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mcygorek at uottawa.ca Wed Oct 10 12:54:04 2018 From: mcygorek at uottawa.ca (Moritz Cygorek) Date: Wed, 10 Oct 2018 17:54:04 +0000 Subject: [petsc-users] STFILTER in slepc Message-ID: Hi, in the list of changes to SLEPc version 3.8, it is stated that there is a preliminary implementation of polynomial filtering using STFILTER. Because I am struggling to obtain interior eigenvalues and harmonic extraction seems not to be stable enough in my case, I wanted to give it a try, but I could not find any documentation yet. Does anybody have an example of how to use STFILTER or any documentation about it? Thanks in advance, Moritz -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Wed Oct 10 13:30:43 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Wed, 10 Oct 2018 20:30:43 +0200 Subject: [petsc-users] STFILTER in slepc In-Reply-To: References: Message-ID: <278D7A53-FA81-4980-8392-9227C3437889@dsic.upv.es> > El 10 oct 2018, a las 19:54, Moritz Cygorek escribi?: > > Hi, > > in the list of changes to SLEPc version 3.8, it is stated that there is a preliminary implementation of polynomial filtering using STFILTER. > > Because I am struggling to obtain interior eigenvalues and harmonic extraction seems not to be stable enough in my case, I wanted to give it a try, but I could not find any documentation yet. > > Does anybody have an example of how to use STFILTER or any documentation about it? > > Thanks in advance, > Moritz There are no examples. You just set the type to STFILTER and set some parameters such as the interval of interest or the polynomial degree. See functions starting with STFilter here: http://slepc.upv.es/documentation/current/docs/manualpages/ST/index.html In some problems it works well, but don't expect too much. It is still in our to-do list to make it more usable. It will be good to have your feedback. If you want, send results to slepc-maint, maybe we can help tuning the parameters. Jose From mcygorek at uottawa.ca Wed Oct 10 14:10:34 2018 From: mcygorek at uottawa.ca (Moritz Cygorek) Date: Wed, 10 Oct 2018 19:10:34 +0000 Subject: [petsc-users] STFILTER in slepc In-Reply-To: <278D7A53-FA81-4980-8392-9227C3437889@dsic.upv.es> References: , <278D7A53-FA81-4980-8392-9227C3437889@dsic.upv.es> Message-ID: <867180c290734d1da494a13d49fcbc7e@uottawa.ca> Thank you for the fast reply. I've tried running my program (using the defaul Krylov-Schur method for sparse MPI matrices) with the additional options: -st_type filter -st_filter_degree 2 -st_filter_interval 2.,2.7 -st_filter_range -2000,2000 and I get the following error message: [0]PETSC ERROR: STFILTER cannot get the filter specified; please adjust your filter parameters (e.g. increasing the polynomial degree) .... [0]PETSC ERROR: #1 FILTLAN_GetIntervals() line 451 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c [0]PETSC ERROR: #2 STFilter_FILTLAN_setFilter() line 1016 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c [0]PETSC ERROR: #3 STSetUp_Filter() line 42 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filter.c [0]PETSC ERROR: #4 STSetUp() line 271 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/interface/stsolve.c [0]PETSC ERROR: #5 EPSSetUp() line 263 in /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssetup.c [0]PETSC ERROR: #6 EPSSolve() line 135 in /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssolve.c Do you have a clue what I've missed? Moritz ________________________________ From: Jose E. Roman Sent: Wednesday, October 10, 2018 2:30 PM To: Moritz Cygorek Cc: petsc-users at mcs.anl.gov Subject: Re: [petsc-users] STFILTER in slepc > El 10 oct 2018, a las 19:54, Moritz Cygorek escribi?: > > Hi, > > in the list of changes to SLEPc version 3.8, it is stated that there is a preliminary implementation of polynomial filtering using STFILTER. > > Because I am struggling to obtain interior eigenvalues and harmonic extraction seems not to be stable enough in my case, I wanted to give it a try, but I could not find any documentation yet. > > Does anybody have an example of how to use STFILTER or any documentation about it? > > Thanks in advance, > Moritz There are no examples. You just set the type to STFILTER and set some parameters such as the interval of interest or the polynomial degree. See functions starting with STFilter here: http://slepc.upv.es/documentation/current/docs/manualpages/ST/index.html In some problems it works well, but don't expect too much. It is still in our to-do list to make it more usable. It will be good to have your feedback. If you want, send results to slepc-maint, maybe we can help tuning the parameters. Jose -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Wed Oct 10 14:48:36 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Wed, 10 Oct 2018 21:48:36 +0200 Subject: [petsc-users] STFILTER in slepc In-Reply-To: <867180c290734d1da494a13d49fcbc7e@uottawa.ca> References: <278D7A53-FA81-4980-8392-9227C3437889@dsic.upv.es> <867180c290734d1da494a13d49fcbc7e@uottawa.ca> Message-ID: <61D97868-F6C6-4C4D-8DF5-38F2BB3E283F@dsic.upv.es> This type of method requires a very high degree polynomial; suggest using degree=100 at least (this is the default value), but larger values may be necessary. Also, for this particular filter the "range" must be approximately equal to the numerical range; if you have no clue where your first and last eigenvalues are, you may use EPSSolve() calls with EPS_LARGEST_REAL and EPS_SMALLEST_REAL. Jose > El 10 oct 2018, a las 21:10, Moritz Cygorek escribi?: > > Thank you for the fast reply. > > I've tried running my program (using the defaul Krylov-Schur method for sparse MPI matrices) with the additional options: > > -st_type filter -st_filter_degree 2 -st_filter_interval 2.,2.7 -st_filter_range -2000,2000 > > and I get the following error message: > > [0]PETSC ERROR: STFILTER cannot get the filter specified; please adjust your filter parameters (e.g. increasing the polynomial degree) > .... > [0]PETSC ERROR: #1 FILTLAN_GetIntervals() line 451 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c > [0]PETSC ERROR: #2 STFilter_FILTLAN_setFilter() line 1016 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c > [0]PETSC ERROR: #3 STSetUp_Filter() line 42 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filter.c > [0]PETSC ERROR: #4 STSetUp() line 271 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/interface/stsolve.c > [0]PETSC ERROR: #5 EPSSetUp() line 263 in /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssetup.c > [0]PETSC ERROR: #6 EPSSolve() line 135 in /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssolve.c > > > > Do you have a clue what I've missed? > > > Moritz > > > From: Jose E. Roman > Sent: Wednesday, October 10, 2018 2:30 PM > To: Moritz Cygorek > Cc: petsc-users at mcs.anl.gov > Subject: Re: [petsc-users] STFILTER in slepc > > > > El 10 oct 2018, a las 19:54, Moritz Cygorek escribi?: > > > > Hi, > > > > in the list of changes to SLEPc version 3.8, it is stated that there is a preliminary implementation of polynomial filtering using STFILTER. > > > > Because I am struggling to obtain interior eigenvalues and harmonic extraction seems not to be stable enough in my case, I wanted to give it a try, but I could not find any documentation yet. > > > > Does anybody have an example of how to use STFILTER or any documentation about it? > > > > Thanks in advance, > > Moritz > > There are no examples. You just set the type to STFILTER and set some parameters such as the interval of interest or the polynomial degree. See functions starting with STFilter here:http://slepc.upv.es/documentation/current/docs/manualpages/ST/index.html > > In some problems it works well, but don't expect too much. It is still in our to-do list to make it more usable. It will be good to have your feedback. If you want, send results to slepc-maint, maybe we can help tuning the parameters. > > Jose From mcygorek at uottawa.ca Wed Oct 10 19:41:09 2018 From: mcygorek at uottawa.ca (Moritz Cygorek) Date: Thu, 11 Oct 2018 00:41:09 +0000 Subject: [petsc-users] STFILTER in slepc In-Reply-To: <61D97868-F6C6-4C4D-8DF5-38F2BB3E283F@dsic.upv.es> References: <278D7A53-FA81-4980-8392-9227C3437889@dsic.upv.es> <867180c290734d1da494a13d49fcbc7e@uottawa.ca>, <61D97868-F6C6-4C4D-8DF5-38F2BB3E283F@dsic.upv.es> Message-ID: <0c920e55c6f946ea96359db9b0adb78a@uottawa.ca> Thank you very much. Apparently, I've misunderstood what the filter actually does. I thought about the much simpler process, where you diagonalize -(A- tau*I)^2 +offset*I where tau is my target an offset is large enough so that the global maximum is reached for eigenvalues around tau. Then you look for the largest eigenvalue of the modified problem and either calculate the Ritz value of the original matrix or calculate back from the eigenvalues of the modified problem. Now, it looks to me like -st_type filter activates something like the package FILTLAN. I guess I can define a MatShell to do the thing I intended in the first place. But, I guess, this is a common thing, so I am wondering whether it is already implemented somewhere and I just didn't find it in the documentation. Can you say something about this? Regards, Moritz ________________________________ From: Jose E. Roman Sent: Wednesday, October 10, 2018 3:48 PM To: Moritz Cygorek Cc: petsc-users at mcs.anl.gov Subject: Re: [petsc-users] STFILTER in slepc This type of method requires a very high degree polynomial; suggest using degree=100 at least (this is the default value), but larger values may be necessary. Also, for this particular filter the "range" must be approximately equal to the numerical range; if you have no clue where your first and last eigenvalues are, you may use EPSSolve() calls with EPS_LARGEST_REAL and EPS_SMALLEST_REAL. Jose > El 10 oct 2018, a las 21:10, Moritz Cygorek escribi?: > > Thank you for the fast reply. > > I've tried running my program (using the defaul Krylov-Schur method for sparse MPI matrices) with the additional options: > > -st_type filter -st_filter_degree 2 -st_filter_interval 2.,2.7 -st_filter_range -2000,2000 > > and I get the following error message: > > [0]PETSC ERROR: STFILTER cannot get the filter specified; please adjust your filter parameters (e.g. increasing the polynomial degree) > .... > [0]PETSC ERROR: #1 FILTLAN_GetIntervals() line 451 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c > [0]PETSC ERROR: #2 STFilter_FILTLAN_setFilter() line 1016 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c > [0]PETSC ERROR: #3 STSetUp_Filter() line 42 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filter.c > [0]PETSC ERROR: #4 STSetUp() line 271 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/interface/stsolve.c > [0]PETSC ERROR: #5 EPSSetUp() line 263 in /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssetup.c > [0]PETSC ERROR: #6 EPSSolve() line 135 in /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssolve.c > > > > Do you have a clue what I've missed? > > > Moritz > > > From: Jose E. Roman > Sent: Wednesday, October 10, 2018 2:30 PM > To: Moritz Cygorek > Cc: petsc-users at mcs.anl.gov > Subject: Re: [petsc-users] STFILTER in slepc > > > > El 10 oct 2018, a las 19:54, Moritz Cygorek escribi?: > > > > Hi, > > > > in the list of changes to SLEPc version 3.8, it is stated that there is a preliminary implementation of polynomial filtering using STFILTER. > > > > Because I am struggling to obtain interior eigenvalues and harmonic extraction seems not to be stable enough in my case, I wanted to give it a try, but I could not find any documentation yet. > > > > Does anybody have an example of how to use STFILTER or any documentation about it? > > > > Thanks in advance, > > Moritz > > There are no examples. You just set the type to STFILTER and set some parameters such as the interval of interest or the polynomial degree. See functions starting with STFilter here:http://slepc.upv.es/documentation/current/docs/manualpages/ST/index.html > > In some problems it works well, but don't expect too much. It is still in our to-do list to make it more usable. It will be good to have your feedback. If you want, send results to slepc-maint, maybe we can help tuning the parameters. > > Jose -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Wed Oct 10 19:43:44 2018 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 10 Oct 2018 20:43:44 -0400 Subject: [petsc-users] STFILTER in slepc In-Reply-To: <0c920e55c6f946ea96359db9b0adb78a@uottawa.ca> References: <278D7A53-FA81-4980-8392-9227C3437889@dsic.upv.es> <867180c290734d1da494a13d49fcbc7e@uottawa.ca> <61D97868-F6C6-4C4D-8DF5-38F2BB3E283F@dsic.upv.es> <0c920e55c6f946ea96359db9b0adb78a@uottawa.ca> Message-ID: On Wed, Oct 10, 2018 at 8:41 PM Moritz Cygorek wrote: > Thank you very much. Apparently, I've misunderstood what the filter > actually does. I thought about the much simpler process, where you > diagonalize > > > -(A- tau*I)^2 +offset*I > > > where tau is my target an offset is large enough so that the global > maximum is reached for eigenvalues around tau. > Is this different from -eps_target_magnitude? Thanks, Matt > Then you look for the largest eigenvalue of the modified problem and > either calculate the Ritz value of the original matrix or calculate back > from the eigenvalues of the modified problem. > > > Now, it looks to me like -st_type filter activates something like the > package FILTLAN. > > > I guess I can define a MatShell to do the thing I intended in the first > place. > > But, I guess, this is a common thing, so I am wondering whether it is > already implemented somewhere and I just didn't find it in the > documentation. Can you say something about this? > > > Regards, > > Moritz > > > > > ------------------------------ > *From:* Jose E. Roman > *Sent:* Wednesday, October 10, 2018 3:48 PM > *To:* Moritz Cygorek > *Cc:* petsc-users at mcs.anl.gov > *Subject:* Re: [petsc-users] STFILTER in slepc > > This type of method requires a very high degree polynomial; suggest using > degree=100 at least (this is the default value), but larger values may be > necessary. Also, for this particular filter the "range" must be > approximately equal to the numerical range; if you have no clue where your > first and last eigenvalues are, you may use EPSSolve() calls with > EPS_LARGEST_REAL and EPS_SMALLEST_REAL. > > Jose > > > El 10 oct 2018, a las 21:10, Moritz Cygorek > escribi?: > > > > Thank you for the fast reply. > > > > I've tried running my program (using the defaul Krylov-Schur method for > sparse MPI matrices) with the additional options: > > > > -st_type filter -st_filter_degree 2 -st_filter_interval 2.,2.7 > -st_filter_range -2000,2000 > > > > and I get the following error message: > > > > [0]PETSC ERROR: STFILTER cannot get the filter specified; please adjust > your filter parameters (e.g. increasing the polynomial degree) > > .... > > [0]PETSC ERROR: #1 FILTLAN_GetIntervals() line 451 in > /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c > > [0]PETSC ERROR: #2 STFilter_FILTLAN_setFilter() line 1016 in > /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c > > [0]PETSC ERROR: #3 STSetUp_Filter() line 42 in > /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filter.c > > [0]PETSC ERROR: #4 STSetUp() line 271 in > /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/interface/stsolve.c > > [0]PETSC ERROR: #5 EPSSetUp() line 263 in > /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssetup.c > > [0]PETSC ERROR: #6 EPSSolve() line 135 in > /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssolve.c > > > > > > > > Do you have a clue what I've missed? > > > > > > Moritz > > > > > > From: Jose E. Roman > > Sent: Wednesday, October 10, 2018 2:30 PM > > To: Moritz Cygorek > > Cc: petsc-users at mcs.anl.gov > > Subject: Re: [petsc-users] STFILTER in slepc > > > > > > > El 10 oct 2018, a las 19:54, Moritz Cygorek > escribi?: > > > > > > Hi, > > > > > > in the list of changes to SLEPc version 3.8, it is stated that there > is a preliminary implementation of polynomial filtering using STFILTER. > > > > > > Because I am struggling to obtain interior eigenvalues and harmonic > extraction seems not to be stable enough in my case, I wanted to give it a > try, but I could not find any documentation yet. > > > > > > Does anybody have an example of how to use STFILTER or any > documentation about it? > > > > > > Thanks in advance, > > > Moritz > > > > There are no examples. You just set the type to STFILTER and set some > parameters such as the interval of interest or the polynomial degree. See > functions starting with STFilter here: > http://slepc.upv.es/documentation/current/docs/manualpages/ST/index.html > > > > In some problems it works well, but don't expect too much. It is still > in our to-do list to make it more usable. It will be good to have your > feedback. If you want, send results to slepc-maint, maybe we can help > tuning the parameters. > > > > Jose > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.mayhem23 at gmail.com Thu Oct 11 03:50:44 2018 From: dave.mayhem23 at gmail.com (Dave May) Date: Thu, 11 Oct 2018 09:50:44 +0100 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: On Sat, 6 Oct 2018 at 12:42, Matthew Knepley wrote: > On Fri, Oct 5, 2018 at 9:08 PM Mike Wick > wrote: > >> Hello PETSc team: >> >> I am trying to solve a PDE problem with high-order finite elements. The >> matrix is getting denser and my experience is that MUMPS just outperforms >> iterative solvers. >> > > If the problem is elliptic, there is a lot of evidence that the P1 > preconditioner is descent for the system. Some people > just project the system to P1, invert that with multigrid, and use that as > the PC for Krylov. It should be worth trying. > Matt means project to P1 directly from your high order function space in one step. It is definitely worth trying. For those interested, this approach is first described and discussed (to my knowledge) in this paper: Persson, Per-Olof, and Jaime Peraire. "An efficient low memory implicit DG algorithm for time dependent problems." *44th AIAA Aerospace Sciences Meeting and Exhibit*. 2006. > Moreover, as Jed will tell you, forming matrices for higher order is > counterproductive. You should apply those matrix-free. > I definitely agree with that. Cheers, Dave > > Thanks, > > Matt > > >> For certain problems, MUMPS just fail in the middle for no clear reason. >> I just wander if there is any suggestion to improve the robustness of >> MUMPS? Or in general, any suggestion for interative solver with very >> high-order finite elements? >> >> Thanks! >> >> Mike >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Thu Oct 11 04:55:30 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Thu, 11 Oct 2018 11:55:30 +0200 Subject: [petsc-users] STFILTER in slepc In-Reply-To: References: <278D7A53-FA81-4980-8392-9227C3437889@dsic.upv.es> <867180c290734d1da494a13d49fcbc7e@uottawa.ca> <61D97868-F6C6-4C4D-8DF5-38F2BB3E283F@dsic.upv.es> <0c920e55c6f946ea96359db9b0adb78a@uottawa.ca> Message-ID: <61835618-52E0-42BC-BDAF-52FDF1662905@dsic.upv.es> The filter technique must be used with an interval in EPS, e.g. -eps_interval 2.,2.7 (This interval will be passed to STFILTER, so no need to specify -st_filter_interval). Therefore, it does not require -eps_target_magnitude or similar. Regarding the simpler (A-tau*I)^2, we call it "spectrum folding" (see section 3.4.6 of SLEPc's manual) and it is implemented in ex24.c http://slepc.upv.es/documentation/current/src/eps/examples/tutorials/ex24.c.html My experience is that spectrum folding will not give good convergence except for easy problems. For more difficult problems with clustered eigenvalues you need a polynomial filter. The technique of polynomial filter trades iterations of the Krylov subspace for matrix-vector products required by a high-degree polynomial. If you want, send us the matrix to slepc-maint and we will have a try. Jose > El 11 oct 2018, a las 2:43, Matthew Knepley escribi?: > > On Wed, Oct 10, 2018 at 8:41 PM Moritz Cygorek wrote: > Thank you very much. Apparently, I've misunderstood what the filter actually does. I thought about the much simpler process, where you diagonalize > > > > -(A- tau*I)^2 +offset*I > > > > where tau is my target an offset is large enough so that the global maximum is reached for eigenvalues around tau. > > > Is this different from -eps_target_magnitude? > > Thanks, > > Matt > > Then you look for the largest eigenvalue of the modified problem and either calculate the Ritz value of the original matrix or calculate back from the eigenvalues of the modified problem. > > > > Now, it looks to me like -st_type filter activates something like the package FILTLAN. > > > > I guess I can define a MatShell to do the thing I intended in the first place. > > But, I guess, this is a common thing, so I am wondering whether it is already implemented somewhere and I just didn't find it in the documentation. Can you say something about this? > > > > Regards, > > Moritz > > > > > > From: Jose E. Roman > Sent: Wednesday, October 10, 2018 3:48 PM > To: Moritz Cygorek > Cc: petsc-users at mcs.anl.gov > Subject: Re: [petsc-users] STFILTER in slepc > > This type of method requires a very high degree polynomial; suggest using degree=100 at least (this is the default value), but larger values may be necessary. Also, for this particular filter the "range" must be approximately equal to the numerical range; if you have no clue where your first and last eigenvalues are, you may use EPSSolve() calls with EPS_LARGEST_REAL and EPS_SMALLEST_REAL. > > Jose > > > El 10 oct 2018, a las 21:10, Moritz Cygorek escribi?: > > > > Thank you for the fast reply. > > > > I've tried running my program (using the defaul Krylov-Schur method for sparse MPI matrices) with the additional options: > > > > -st_type filter -st_filter_degree 2 -st_filter_interval 2.,2.7 -st_filter_range -2000,2000 > > > > and I get the following error message: > > > > [0]PETSC ERROR: STFILTER cannot get the filter specified; please adjust your filter parameters (e.g. increasing the polynomial degree) > > .... > > [0]PETSC ERROR: #1 FILTLAN_GetIntervals() line 451 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c > > [0]PETSC ERROR: #2 STFilter_FILTLAN_setFilter() line 1016 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c > > [0]PETSC ERROR: #3 STSetUp_Filter() line 42 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filter.c > > [0]PETSC ERROR: #4 STSetUp() line 271 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/interface/stsolve.c > > [0]PETSC ERROR: #5 EPSSetUp() line 263 in /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssetup.c > > [0]PETSC ERROR: #6 EPSSolve() line 135 in /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssolve.c > > > > > > > > Do you have a clue what I've missed? > > > > > > Moritz > > > > > > From: Jose E. Roman > > Sent: Wednesday, October 10, 2018 2:30 PM > > To: Moritz Cygorek > > Cc: petsc-users at mcs.anl.gov > > Subject: Re: [petsc-users] STFILTER in slepc > > > > > > > El 10 oct 2018, a las 19:54, Moritz Cygorek escribi?: > > > > > > Hi, > > > > > > in the list of changes to SLEPc version 3.8, it is stated that there is a preliminary implementation of polynomial filtering using STFILTER. > > > > > > Because I am struggling to obtain interior eigenvalues and harmonic extraction seems not to be stable enough in my case, I wanted to give it a try, but I could not find any documentation yet. > > > > > > Does anybody have an example of how to use STFILTER or any documentation about it? > > > > > > Thanks in advance, > > > Moritz > > > > There are no examples. You just set the type to STFILTER and set some parameters such as the interval of interest or the polynomial degree. See functions starting with STFilter here:http://slepc.upv.es/documentation/current/docs/manualpages/ST/index.html > > > > In some problems it works well, but don't expect too much. It is still in our to-do list to make it more usable. It will be good to have your feedback. If you want, send results to slepc-maint, maybe we can help tuning the parameters. > > > > Jose > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ From yjwu16 at gmail.com Thu Oct 11 10:37:41 2018 From: yjwu16 at gmail.com (Yingjie Wu) Date: Thu, 11 Oct 2018 23:37:41 +0800 Subject: [petsc-users] Problems about Matrix-Free and DM object Message-ID: Dear Petsc developer: Hi, Thank you very much for your previous reply. I feel that I have learned a lot about the matrix-free method. I was studying the example /src/snes/example/tutorials/ex28.c recently. One of its tests is as follows: -u_da_grid_x 20 -snes_converged_reason -snes_monitor_short -ksp_monitor_short -problem_type 2 -snes_mf_operator -pack_dm_mat_type {{aij nest}} -pc_type fieldsplit -pc_fieldsplit_dm_splits -pc_fieldsplit_type additive -fieldsplit_u_ksp_type gmres -fieldsplit_k_pc_type jacobi The example is calculated by the Matrix-free method, and the precondition matrix is divided by FieldSplit. There are several questions in the procedure that make me feel uncertain. 1. The program uses the Matrixfree method by the command "-snes_mf_operator", but the form of Jacobian matrix is not defined as MATMFFD in the program. Does the program automatically set the Jacobian matrix to the form of MATMFFD after opening the command? Both Jacobian matrix and precondition matrix are defined as B in the program, and matrix elements are provided by Jacobian evaluation program. But the Jacobian matrix in the Matrixfree method is in the form of MATMFFD. You mentioned earlier that adding elements to the matrix with type MATMFFD can cause program errors, but why does the program work in this example? The procedures are as follows: ierr = SNESSetFunction(snes,F,FormFunction_All,user);CHKERRQ(ierr); ierr = SNESSetJacobian(snes,B,B,FormJacobian_All,user);CHKERRQ(ierr); 2.Can we use DMCompositeScatter to scatter ghost value into local vectors? I didn't seem to mention the documentation. The program only uses the following functions, but can use ghost value. ierr = DMCompositeScatter(user->pack,X,Uloc,Kloc);CHKERRQ(ierr); ierr = DMDAVecGetArray(dau,Uloc,&u);CHKERRQ(ierr); ierr = DMDAVecGetArray(dak,Kloc,&k);CHKERRQ(ierr); Greatly appreciated your reply and attention. Thanks, Yingjie -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Thu Oct 11 10:54:33 2018 From: knepley at gmail.com (Matthew Knepley) Date: Thu, 11 Oct 2018 11:54:33 -0400 Subject: [petsc-users] Problems about Matrix-Free and DM object In-Reply-To: References: Message-ID: On Thu, Oct 11, 2018 at 11:38 AM Yingjie Wu wrote: > Dear Petsc developer: > Hi, > Thank you very much for your previous reply. I feel that I have learned a > lot about the matrix-free method. > I was studying the example /src/snes/example/tutorials/ex28.c recently. > One of its tests is as follows: > > -u_da_grid_x 20 -snes_converged_reason -snes_monitor_short > -ksp_monitor_short -problem_type 2 -snes_mf_operator -pack_dm_mat_type > {{aij nest}} -pc_type fieldsplit -pc_fieldsplit_dm_splits > -pc_fieldsplit_type additive -fieldsplit_u_ksp_type gmres > -fieldsplit_k_pc_type jacobi > > The example is calculated by the Matrix-free method, and the precondition > matrix is divided by FieldSplit. There are several questions in the > procedure that make me feel uncertain. > 1. The program uses the Matrixfree method by the command > "-snes_mf_operator", but the form of Jacobian matrix is not defined as > MATMFFD in the program. Does the program automatically set the Jacobian > matrix to the form of MATMFFD after opening the command? > If you give that option, PETSc will automatically create a MFFD Mat object and stick your nonlinear residual evaluation in it. > Both Jacobian matrix and precondition matrix are defined as B in the > program, and matrix elements are provided by Jacobian evaluation program. > But the Jacobian matrix in the Matrixfree method is in the form of MATMFFD. > You mentioned earlier that adding elements to the matrix with type MATMFFD > can cause program errors, but why does the program work in this example? > The procedures are as follows: > > ierr = SNESSetFunction(snes,F,FormFunction_All,user);CHKERRQ(ierr); > ierr = SNESSetJacobian(snes,B,B,FormJacobian_All,user);CHKERRQ(ierr); > > Because the FoirmJacobian() function in ex28 only ever puts values into the preconditioning matrix. This is generally the right way to proceed. > 2.Can we use DMCompositeScatter to scatter ghost value into local vectors? > I didn't seem to mention the documentation. The program only uses the > following functions, but can use ghost value. > ierr = DMCompositeScatter(user->pack,X,Uloc,Kloc);CHKERRQ(ierr); > ierr = DMDAVecGetArray(dau,Uloc,&u);CHKERRQ(ierr); > ierr = DMDAVecGetArray(dak,Kloc,&k);CHKERRQ(ierr); > DMCompositeScatter splits a vector up into the smaller vectors for each system. DMComposite is very specialized, and we do not recommend using it except in special cases. DMGlobalToLocal() and DMLocalToGlobal() communicate ghost values. Thanks, Matt > Greatly appreciated your reply and attention. > Thanks, > Yingjie > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mcygorek at uottawa.ca Thu Oct 11 13:13:48 2018 From: mcygorek at uottawa.ca (Moritz Cygorek) Date: Thu, 11 Oct 2018 18:13:48 +0000 Subject: [petsc-users] STFILTER in slepc In-Reply-To: <61835618-52E0-42BC-BDAF-52FDF1662905@dsic.upv.es> References: <278D7A53-FA81-4980-8392-9227C3437889@dsic.upv.es> <867180c290734d1da494a13d49fcbc7e@uottawa.ca> <61D97868-F6C6-4C4D-8DF5-38F2BB3E283F@dsic.upv.es> <0c920e55c6f946ea96359db9b0adb78a@uottawa.ca> , <61835618-52E0-42BC-BDAF-52FDF1662905@dsic.upv.es> Message-ID: <63a8350e7e5941d9951ee18f9a87442c@uottawa.ca> Thank you for the response. This example is exactly the kind of thing I thought about. But, as you say, convergence is indeed not better. What's the best format to send the matrix to slepc-maint? My small test case is a sparse matrix of dimension 30720. I currently read it from three files (containing IA, JA, and the values in CSR format). Because everything is contained in a larger framework, it's not very easy to extract the reader. Is there a generic way to read in sparse matrices from files for PETSc? Maybe you can already give me a hint about the best method if I tell you the properties of the spectrum: The problem is the calculation of electronic states in a quantum dot. There is a band gap from around 0 to 2 and I am interested in the first 20 or 40 eigenvectors above and below the gap. The first few states are separated by about 0.1 but for higher states the energies come closer and closer together. Additionally, there are a number of states with energies around 1000, which are artificial and originate from the way we treat the boundary conditions. Also, I know that all states come in pairs with the same energy (Kramers degeneracy). For the small test case, the conduction band states, i.e. eigenvectors with energies close to 2, converge very fast (about 5 min on a laptop computer). However, the states with energies around 0 converge much more slowly and that's one of my major problems. For those states harmonic extraction seems to be better suited, but I have the impression that it is not extremely stable. For example, applied to the states close to 2 I see that some states are skipped, which can be seen by the fact that the degeneracies are sometimes wrong. Also, with harmonic extraction, the program sometimes stops claiming the number of requested eigenpairs are reached, but the calculated relative error of most states is way larger than the tolerance. Maybe you know from experience which method is better suited to tackle these kinds of problems? Eventually, I intend to do calculates with dimensions of ~ 10 million distributed of a few 100 CPUs. Regards, Moritz ________________________________ From: Jose E. Roman Sent: Thursday, October 11, 2018 5:55 AM To: Matthew Knepley; Moritz Cygorek Cc: PETSc; Carmen Campos Subject: Re: [petsc-users] STFILTER in slepc The filter technique must be used with an interval in EPS, e.g. -eps_interval 2.,2.7 (This interval will be passed to STFILTER, so no need to specify -st_filter_interval). Therefore, it does not require -eps_target_magnitude or similar. Regarding the simpler (A-tau*I)^2, we call it "spectrum folding" (see section 3.4.6 of SLEPc's manual) and it is implemented in ex24.c http://slepc.upv.es/documentation/current/src/eps/examples/tutorials/ex24.c.html My experience is that spectrum folding will not give good convergence except for easy problems. For more difficult problems with clustered eigenvalues you need a polynomial filter. The technique of polynomial filter trades iterations of the Krylov subspace for matrix-vector products required by a high-degree polynomial. If you want, send us the matrix to slepc-maint and we will have a try. Jose > El 11 oct 2018, a las 2:43, Matthew Knepley escribi?: > > On Wed, Oct 10, 2018 at 8:41 PM Moritz Cygorek wrote: > Thank you very much. Apparently, I've misunderstood what the filter actually does. I thought about the much simpler process, where you diagonalize > > > > -(A- tau*I)^2 +offset*I > > > > where tau is my target an offset is large enough so that the global maximum is reached for eigenvalues around tau. > > > Is this different from -eps_target_magnitude? > > Thanks, > > Matt > > Then you look for the largest eigenvalue of the modified problem and either calculate the Ritz value of the original matrix or calculate back from the eigenvalues of the modified problem. > > > > Now, it looks to me like -st_type filter activates something like the package FILTLAN. > > > > I guess I can define a MatShell to do the thing I intended in the first place. > > But, I guess, this is a common thing, so I am wondering whether it is already implemented somewhere and I just didn't find it in the documentation. Can you say something about this? > > > > Regards, > > Moritz > > > > > > From: Jose E. Roman > Sent: Wednesday, October 10, 2018 3:48 PM > To: Moritz Cygorek > Cc: petsc-users at mcs.anl.gov > Subject: Re: [petsc-users] STFILTER in slepc > > This type of method requires a very high degree polynomial; suggest using degree=100 at least (this is the default value), but larger values may be necessary. Also, for this particular filter the "range" must be approximately equal to the numerical range; if you have no clue where your first and last eigenvalues are, you may use EPSSolve() calls with EPS_LARGEST_REAL and EPS_SMALLEST_REAL. > > Jose > > > El 10 oct 2018, a las 21:10, Moritz Cygorek escribi?: > > > > Thank you for the fast reply. > > > > I've tried running my program (using the defaul Krylov-Schur method for sparse MPI matrices) with the additional options: > > > > -st_type filter -st_filter_degree 2 -st_filter_interval 2.,2.7 -st_filter_range -2000,2000 > > > > and I get the following error message: > > > > [0]PETSC ERROR: STFILTER cannot get the filter specified; please adjust your filter parameters (e.g. increasing the polynomial degree) > > .... > > [0]PETSC ERROR: #1 FILTLAN_GetIntervals() line 451 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c > > [0]PETSC ERROR: #2 STFilter_FILTLAN_setFilter() line 1016 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c > > [0]PETSC ERROR: #3 STSetUp_Filter() line 42 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filter.c > > [0]PETSC ERROR: #4 STSetUp() line 271 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/interface/stsolve.c > > [0]PETSC ERROR: #5 EPSSetUp() line 263 in /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssetup.c > > [0]PETSC ERROR: #6 EPSSolve() line 135 in /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssolve.c > > > > > > > > Do you have a clue what I've missed? > > > > > > Moritz > > > > > > From: Jose E. Roman > > Sent: Wednesday, October 10, 2018 2:30 PM > > To: Moritz Cygorek > > Cc: petsc-users at mcs.anl.gov > > Subject: Re: [petsc-users] STFILTER in slepc > > > > > > > El 10 oct 2018, a las 19:54, Moritz Cygorek escribi?: > > > > > > Hi, > > > > > > in the list of changes to SLEPc version 3.8, it is stated that there is a preliminary implementation of polynomial filtering using STFILTER. > > > > > > Because I am struggling to obtain interior eigenvalues and harmonic extraction seems not to be stable enough in my case, I wanted to give it a try, but I could not find any documentation yet. > > > > > > Does anybody have an example of how to use STFILTER or any documentation about it? > > > > > > Thanks in advance, > > > Moritz > > > > There are no examples. You just set the type to STFILTER and set some parameters such as the interval of interest or the polynomial degree. See functions starting with STFilter here:http://slepc.upv.es/documentation/current/docs/manualpages/ST/index.html > > > > In some problems it works well, but don't expect too much. It is still in our to-do list to make it more usable. It will be good to have your feedback. If you want, send results to slepc-maint, maybe we can help tuning the parameters. > > > > Jose > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Thu Oct 11 14:15:46 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Thu, 11 Oct 2018 21:15:46 +0200 Subject: [petsc-users] STFILTER in slepc In-Reply-To: <63a8350e7e5941d9951ee18f9a87442c@uottawa.ca> References: <278D7A53-FA81-4980-8392-9227C3437889@dsic.upv.es> <867180c290734d1da494a13d49fcbc7e@uottawa.ca> <61D97868-F6C6-4C4D-8DF5-38F2BB3E283F@dsic.upv.es> <0c920e55c6f946ea96359db9b0adb78a@uottawa.ca> <61835618-52E0-42BC-BDAF-52FDF1662905@dsic.upv.es> <63a8350e7e5941d9951ee18f9a87442c@uottawa.ca> Message-ID: Run your code with -eps_view_mat0 binary:amatrix.bin This will save the A matrix of the EPS solver in file "amatrix.bin" at the end of EPSSolve(). I cannot say which is the best method, it depends on the distribution of the spectrum. Let's see how it goes. Jose > El 11 oct 2018, a las 20:13, Moritz Cygorek escribi?: > > Thank you for the response. This example is exactly the kind of thing I thought about. > But, as you say, convergence is indeed not better. > > > What's the best format to send the matrix to slepc-maint? > My small test case is a sparse matrix of dimension 30720. I currently read it from three files (containing IA, JA, and the values in CSR format). Because everything is contained in a larger framework, it's not very easy to extract the reader. Is there a generic way to read in sparse matrices from files for PETSc? > > > > Maybe you can already give me a hint about the best method if I tell you the properties of the spectrum: > The problem is the calculation of electronic states in a quantum dot. There is a band gap from around 0 to 2 and I am interested in the first 20 or 40 eigenvectors above and below the gap. > The first few states are separated by about 0.1 but for higher states the energies come closer and closer together. > Additionally, there are a number of states with energies around 1000, which are artificial and originate from the way we treat the boundary conditions. Also, I know that all states come in pairs with the same energy (Kramers degeneracy). > > For the small test case, the conduction band states, i.e. eigenvectors with energies close to 2, converge very fast (about 5 min on a laptop computer). However, the states with energies around 0 converge much more slowly and that's one of my major problems. > For those states harmonic extraction seems to be better suited, but I have the impression that it is not extremely stable. For example, applied to the states close to 2 I see that some states are skipped, which can be seen by the fact that the degeneracies are sometimes wrong. > Also, with harmonic extraction, the program sometimes stops claiming the number of requested eigenpairs are reached, but the calculated relative error of most states is way larger than the tolerance. > > Maybe you know from experience which method is better suited to tackle these kinds of problems? > > > Eventually, I intend to do calculates with dimensions of ~ 10 million distributed of a few 100 CPUs. > > Regards, > Moritz > > > > > From: Jose E. Roman > Sent: Thursday, October 11, 2018 5:55 AM > To: Matthew Knepley; Moritz Cygorek > Cc: PETSc; Carmen Campos > Subject: Re: [petsc-users] STFILTER in slepc > > The filter technique must be used with an interval in EPS, e.g. > -eps_interval 2.,2.7 > (This interval will be passed to STFILTER, so no need to specify -st_filter_interval). > Therefore, it does not require -eps_target_magnitude or similar. > > Regarding the simpler (A-tau*I)^2, we call it "spectrum folding" (see section 3.4.6 of SLEPc's manual) and it is implemented in ex24.c > http://slepc.upv.es/documentation/current/src/eps/examples/tutorials/ex24.c.html > > My experience is that spectrum folding will not give good convergence except for easy problems. For more difficult problems with clustered eigenvalues you need a polynomial filter. The technique of polynomial filter trades iterations of the Krylov subspace for matrix-vector products required by a high-degree polynomial. > > If you want, send us the matrix to slepc-maint and we will have a try. > > Jose > > > > El 11 oct 2018, a las 2:43, Matthew Knepley escribi?: > > > > On Wed, Oct 10, 2018 at 8:41 PM Moritz Cygorek wrote: > > Thank you very much. Apparently, I've misunderstood what the filter actually does. I thought about the much simpler process, where you diagonalize > > > > > > > > -(A- tau*I)^2 +offset*I > > > > > > > > where tau is my target an offset is large enough so that the global maximum is reached for eigenvalues around tau. > > > > > > Is this different from -eps_target_magnitude? > > > > Thanks, > > > > Matt > > > > Then you look for the largest eigenvalue of the modified problem and either calculate the Ritz value of the original matrix or calculate back from the eigenvalues of the modified problem. > > > > > > > > Now, it looks to me like -st_type filter activates something like the package FILTLAN. > > > > > > > > I guess I can define a MatShell to do the thing I intended in the first place. > > > > But, I guess, this is a common thing, so I am wondering whether it is already implemented somewhere and I just didn't find it in the documentation. Can you say something about this? > > > > > > > > Regards, > > > > Moritz > > > > > > > > > > > > From: Jose E. Roman > > Sent: Wednesday, October 10, 2018 3:48 PM > > To: Moritz Cygorek > > Cc: petsc-users at mcs.anl.gov > > Subject: Re: [petsc-users] STFILTER in slepc > > > > This type of method requires a very high degree polynomial; suggest using degree=100 at least (this is the default value), but larger values may be necessary. Also, for this particular filter the "range" must be approximately equal to the numerical range; if you have no clue where your first and last eigenvalues are, you may use EPSSolve() calls with EPS_LARGEST_REAL and EPS_SMALLEST_REAL. > > > > Jose > > > > > El 10 oct 2018, a las 21:10, Moritz Cygorek escribi?: > > > > > > Thank you for the fast reply. > > > > > > I've tried running my program (using the defaul Krylov-Schur method for sparse MPI matrices) with the additional options: > > > > > > -st_type filter -st_filter_degree 2 -st_filter_interval 2.,2.7 -st_filter_range -2000,2000 > > > > > > and I get the following error message: > > > > > > [0]PETSC ERROR: STFILTER cannot get the filter specified; please adjust your filter parameters (e.g. increasing the polynomial degree) > > > .... > > > [0]PETSC ERROR: #1 FILTLAN_GetIntervals() line 451 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c > > > [0]PETSC ERROR: #2 STFilter_FILTLAN_setFilter() line 1016 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filtlan.c > > > [0]PETSC ERROR: #3 STSetUp_Filter() line 42 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/impls/filter/filter.c > > > [0]PETSC ERROR: #4 STSetUp() line 271 in /home/applications/sources/libraries/slepc-3.9.2/src/sys/classes/st/interface/stsolve.c > > > [0]PETSC ERROR: #5 EPSSetUp() line 263 in /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssetup.c > > > [0]PETSC ERROR: #6 EPSSolve() line 135 in /home/applications/sources/libraries/slepc-3.9.2/src/eps/interface/epssolve.c > > > > > > > > > > > > Do you have a clue what I've missed? > > > > > > > > > Moritz > > > > > > > > > From: Jose E. Roman > > > Sent: Wednesday, October 10, 2018 2:30 PM > > > To: Moritz Cygorek > > > Cc: petsc-users at mcs.anl.gov > > > Subject: Re: [petsc-users] STFILTER in slepc > > > > > > > > > > El 10 oct 2018, a las 19:54, Moritz Cygorek escribi?: > > > > > > > > Hi, > > > > > > > > in the list of changes to SLEPc version 3.8, it is stated that there is a preliminary implementation of polynomial filtering using STFILTER. > > > > > > > > Because I am struggling to obtain interior eigenvalues and harmonic extraction seems not to be stable enough in my case, I wanted to give it a try, but I could not find any documentation yet. > > > > > > > > Does anybody have an example of how to use STFILTER or any documentation about it? > > > > > > > > Thanks in advance, > > > > Moritz > > > > > > There are no examples. You just set the type to STFILTER and set some parameters such as the interval of interest or the polynomial degree. See functions starting with STFilter here:http://slepc.upv.es/documentation/current/docs/manualpages/ST/index.html > > > > > > In some problems it works well, but don't expect too much. It is still in our to-do list to make it more usable. It will be good to have your feedback. If you want, send results to slepc-maint, maybe we can help tuning the parameters. > > > > > > Jose > > > > > > > > -- > > 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 > > > > https://www.cse.buffalo.edu/~knepley/ From michael.wick.1980 at gmail.com Thu Oct 11 14:26:35 2018 From: michael.wick.1980 at gmail.com (Michael Wick) Date: Thu, 11 Oct 2018 12:26:35 -0700 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: Thanks for all the suggestions! Increasing the value of icntl_14 in MUMPS helps a lot for my case. Do you have any suggestions for higher-order methods in saddle-point problems? Mike Dave May ?2018?10?11??? ??1:50??? > > > On Sat, 6 Oct 2018 at 12:42, Matthew Knepley wrote: > >> On Fri, Oct 5, 2018 at 9:08 PM Mike Wick >> wrote: >> >>> Hello PETSc team: >>> >>> I am trying to solve a PDE problem with high-order finite elements. The >>> matrix is getting denser and my experience is that MUMPS just outperforms >>> iterative solvers. >>> >> >> If the problem is elliptic, there is a lot of evidence that the P1 >> preconditioner is descent for the system. Some people >> just project the system to P1, invert that with multigrid, and use that >> as the PC for Krylov. It should be worth trying. >> > > Matt means project to P1 directly from your high order function space in > one step. It is definitely worth trying. > For those interested, this approach is first described and discussed (to > my knowledge) in this paper: > > Persson, Per-Olof, and Jaime Peraire. "An efficient low memory implicit DG > algorithm for time dependent problems." *44th AIAA Aerospace Sciences > Meeting and Exhibit*. 2006. > > >> Moreover, as Jed will tell you, forming matrices for higher order is >> counterproductive. You should apply those matrix-free. >> > > I definitely agree with that. > > Cheers, > Dave > > > >> >> Thanks, >> >> Matt >> >> >>> For certain problems, MUMPS just fail in the middle for no clear reason. >>> I just wander if there is any suggestion to improve the robustness of >>> MUMPS? Or in general, any suggestion for interative solver with very >>> high-order finite elements? >>> >>> Thanks! >>> >>> Mike >>> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ellen.price at cfa.harvard.edu Thu Oct 11 15:38:50 2018 From: ellen.price at cfa.harvard.edu (Ellen M. Price) Date: Thu, 11 Oct 2018 16:38:50 -0400 Subject: [petsc-users] DMPLEX project function error Message-ID: I was working with a DMPLEX and FEM, following SNES example 12. I get the following error when I call DMProjectFunction, but I don't know what it means. Can anyone explain where I might have gone wrong, or at least what this error is telling me? I think the point closure size is correct, since my mesh is 3d simplex, but what is the dual space dimension, and where might I have set it incorrectly? [0]PETSC ERROR: Nonconforming object sizes [0]PETSC ERROR: The section point closure size 4 != dual space dimension 1 [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.9.2, May, 20, 2018 ... [0]PETSC ERROR: Configure options --prefix=/home/eprice/software/petsc-opt --with-hdf5=1 --with-hdf5-dir=/home/eprice/software/hdf5-parallel --with-mpe=1 --with-mpe-dir=/home/eprice/software/mpe --with-debugging=0 LDFLAGS="-pthread -lz" COPTFLAGS="-O3 -march=native -mtune=native" CXXOPTFLAGS="-O3 -march=native -mtune=native" FOPTFLAGS="-O3 -march=native -mtune=native" --with-mpi=1 --with-mpi-dir=/home/eprice/software/mpich --with-mumps=1 --with-mumps-dir=/home/eprice/software/mumps --with-parmetis=1 --with-parmetis-dir=/home/eprice/software/parmetis --with-metis=1 --with-metis-dir=/home/eprice/software/parmetis --with-ptscotch=1 --with-ptscotch-dir=/home/eprice/software/scotch --with-scalapack=1 --with-scalapack-dir=/home/eprice/software/scalapack [0]PETSC ERROR: #1 DMProjectLocal_Generic_Plex() line 347 in /h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c [0]PETSC ERROR: #2 DMProjectFunctionLocal_Plex() line 428 in /h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c [0]PETSC ERROR: #3 DMProjectFunctionLocal() line 6265 in /h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c [0]PETSC ERROR: #4 DMProjectFunction() line 6250 in /h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c ... (I know this is an optimized PETSc build, but I get the same error from my debug build, it's just much slower.) Ellen From knepley at gmail.com Thu Oct 11 16:16:45 2018 From: knepley at gmail.com (Matthew Knepley) Date: Thu, 11 Oct 2018 17:16:45 -0400 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: On Thu, Oct 11, 2018 at 3:26 PM Michael Wick wrote: > Thanks for all the suggestions! > > Increasing the value of icntl_14 in MUMPS helps a lot for my case. > > Do you have any suggestions for higher-order methods in saddle-point > problems? > It depends on what the Schur complement looks like. Matt > Mike > > Dave May ?2018?10?11??? ??1:50??? > >> >> >> On Sat, 6 Oct 2018 at 12:42, Matthew Knepley wrote: >> >>> On Fri, Oct 5, 2018 at 9:08 PM Mike Wick >>> wrote: >>> >>>> Hello PETSc team: >>>> >>>> I am trying to solve a PDE problem with high-order finite elements. The >>>> matrix is getting denser and my experience is that MUMPS just outperforms >>>> iterative solvers. >>>> >>> >>> If the problem is elliptic, there is a lot of evidence that the P1 >>> preconditioner is descent for the system. Some people >>> just project the system to P1, invert that with multigrid, and use that >>> as the PC for Krylov. It should be worth trying. >>> >> >> Matt means project to P1 directly from your high order function space in >> one step. It is definitely worth trying. >> For those interested, this approach is first described and discussed (to >> my knowledge) in this paper: >> >> Persson, Per-Olof, and Jaime Peraire. "An efficient low memory implicit >> DG algorithm for time dependent problems." *44th AIAA Aerospace Sciences >> Meeting and Exhibit*. 2006. >> >> >>> Moreover, as Jed will tell you, forming matrices for higher order is >>> counterproductive. You should apply those matrix-free. >>> >> >> I definitely agree with that. >> >> Cheers, >> Dave >> >> >> >>> >>> Thanks, >>> >>> Matt >>> >>> >>>> For certain problems, MUMPS just fail in the middle for no clear >>>> reason. I just wander if there is any suggestion to improve the robustness >>>> of MUMPS? Or in general, any suggestion for interative solver with very >>>> high-order finite elements? >>>> >>>> Thanks! >>>> >>>> Mike >>>> >>> >>> >>> -- >>> 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 >>> >>> https://www.cse.buffalo.edu/~knepley/ >>> >>> >> -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Thu Oct 11 16:41:51 2018 From: knepley at gmail.com (Matthew Knepley) Date: Thu, 11 Oct 2018 17:41:51 -0400 Subject: [petsc-users] DMPLEX project function error In-Reply-To: References: Message-ID: On Thu, Oct 11, 2018 at 4:39 PM Ellen M. Price wrote: > I was working with a DMPLEX and FEM, following SNES example 12. I get > the following error when I call DMProjectFunction, but I don't know what > it means. Can anyone explain where I might have gone wrong, or at least > what this error is telling me? I think the point closure size is > correct, since my mesh is 3d simplex, Yes, if you have 3D SIMPLEX mesh and are using P1 elements, then you would have 4 dofs in the closure of a cell. The dual space dimension is the number of dual space basis vectors assigned to points in the closure. Since it is 1, it looks like you have a P0 dual space. I assume you changed something in ex12? Thanks, Matt > but what is the dual space > dimension, and where might I have set it incorrectly? > > [0]PETSC ERROR: Nonconforming object sizes > [0]PETSC ERROR: The section point closure size 4 != dual space dimension 1 > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble shooting. > [0]PETSC ERROR: Petsc Release Version 3.9.2, May, 20, 2018 > ... > [0]PETSC ERROR: Configure options > --prefix=/home/eprice/software/petsc-opt --with-hdf5=1 > --with-hdf5-dir=/home/eprice/software/hdf5-parallel --with-mpe=1 > --with-mpe-dir=/home/eprice/software/mpe --with-debugging=0 > LDFLAGS="-pthread -lz" COPTFLAGS="-O3 -march=native -mtune=native" > CXXOPTFLAGS="-O3 -march=native -mtune=native" FOPTFLAGS="-O3 > -march=native -mtune=native" --with-mpi=1 > --with-mpi-dir=/home/eprice/software/mpich --with-mumps=1 > --with-mumps-dir=/home/eprice/software/mumps --with-parmetis=1 > --with-parmetis-dir=/home/eprice/software/parmetis --with-metis=1 > --with-metis-dir=/home/eprice/software/parmetis --with-ptscotch=1 > --with-ptscotch-dir=/home/eprice/software/scotch --with-scalapack=1 > --with-scalapack-dir=/home/eprice/software/scalapack > [0]PETSC ERROR: #1 DMProjectLocal_Generic_Plex() line 347 in > /h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c > [0]PETSC ERROR: #2 DMProjectFunctionLocal_Plex() line 428 in > /h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c > [0]PETSC ERROR: #3 DMProjectFunctionLocal() line 6265 in > /h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c > [0]PETSC ERROR: #4 DMProjectFunction() line 6250 in > /h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c > ... > > (I know this is an optimized PETSc build, but I get the same error from > my debug build, it's just much slower.) > > Ellen > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.mayhem23 at gmail.com Fri Oct 12 02:33:44 2018 From: dave.mayhem23 at gmail.com (Dave May) Date: Fri, 12 Oct 2018 08:33:44 +0100 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: On Thu, 11 Oct 2018 at 20:26, Michael Wick wrote: > Thanks for all the suggestions! > > Increasing the value of icntl_14 in MUMPS helps a lot for my case. > > Do you have any suggestions for higher-order methods in saddle-point > problems? > If the saddle point system arises from Stokes or an incompressible elasticity formulation, then the standard block factorizations of Silvester, Elman, Wathan will work very well for high-order - assuming of course you use inf-sup stable basis for u/p. For Stokes/elasticity, the pressure mass matrix is a decent spectrally equivalent operator for the Schur complement. These preconditioners are discussed here: * Michele Benzi, Gene H. Golub, and J?rg Liesen, Numerical solution of saddle point problems, Acta Numerica, 14 (2005), pp. 1?137. * Howard C. Elman, David J. Silvester, and Andrew J. Wathen, Finite elements and fast iterative solvers: with applications in incompressible fluid dynamics, Oxford University Press, 2014. High order examples can be found here: * https://arxiv.org/abs/1607.03936 * Rudi, Johann, Georg Stadler, and Omar Ghattas. "Weighted BFBT Preconditioner for Stokes Flow Problems with Highly Heterogeneous Viscosity." SIAM Journal on Scientific Computing 39.5 (2017): S272-S297. Note that in the Rudi et al papers, due the highly variable nature of the viscosity, the authors advocate using a more complex definition of the preconditioner for the Schur complement. Whether you need to use their approach is dependent on the nature of the problem you are solving. Thanks, Dave > > Mike > > Dave May ?2018?10?11??? ??1:50??? > >> >> >> On Sat, 6 Oct 2018 at 12:42, Matthew Knepley wrote: >> >>> On Fri, Oct 5, 2018 at 9:08 PM Mike Wick >>> wrote: >>> >>>> Hello PETSc team: >>>> >>>> I am trying to solve a PDE problem with high-order finite elements. The >>>> matrix is getting denser and my experience is that MUMPS just outperforms >>>> iterative solvers. >>>> >>> >>> If the problem is elliptic, there is a lot of evidence that the P1 >>> preconditioner is descent for the system. Some people >>> just project the system to P1, invert that with multigrid, and use that >>> as the PC for Krylov. It should be worth trying. >>> >> >> Matt means project to P1 directly from your high order function space in >> one step. It is definitely worth trying. >> For those interested, this approach is first described and discussed (to >> my knowledge) in this paper: >> >> Persson, Per-Olof, and Jaime Peraire. "An efficient low memory implicit >> DG algorithm for time dependent problems." *44th AIAA Aerospace Sciences >> Meeting and Exhibit*. 2006. >> >> >>> Moreover, as Jed will tell you, forming matrices for higher order is >>> counterproductive. You should apply those matrix-free. >>> >> >> I definitely agree with that. >> >> Cheers, >> Dave >> >> >> >>> >>> Thanks, >>> >>> Matt >>> >>> >>>> For certain problems, MUMPS just fail in the middle for no clear >>>> reason. I just wander if there is any suggestion to improve the robustness >>>> of MUMPS? Or in general, any suggestion for interative solver with very >>>> high-order finite elements? >>>> >>>> Thanks! >>>> >>>> Mike >>>> >>> >>> >>> -- >>> 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 >>> >>> https://www.cse.buffalo.edu/~knepley/ >>> >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From barrydog505 at gmail.com Fri Oct 12 03:56:51 2018 From: barrydog505 at gmail.com (=?UTF-8?B?6Zmz5a6X6IiI?=) Date: Fri, 12 Oct 2018 16:56:51 +0800 Subject: [petsc-users] How to get nodes list refer to unstructure mesh element Message-ID: Hi all, I have import a .msh file from DMPlexCreateFromFile. I have found DMDAGetElements in DMDA's ex5 having this function, how can i do this from DMPlex or unstructure grid. Are there any methods that can get nodes list refer to unstructure mesh element? ------------------------------------ for example : 4 / \ / 1 \ 2 - - - - - 3 element [1] >> nodes list [2 3 4] Thanks a lot. Best regards, Barry -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfadams at lbl.gov Fri Oct 12 04:21:50 2018 From: mfadams at lbl.gov (Mark Adams) Date: Fri, 12 Oct 2018 05:21:50 -0400 Subject: [petsc-users] How to get nodes list refer to unstructure mesh element In-Reply-To: References: Message-ID: You want to use DMPlexVecGetClosure: https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexVecGetClosure.html The examples shown here don't close cells. What you want. src/dm/impls/plex/examples/tutorials/ex6.c does iterate over cells, and get the closure (vertices), which is what you want. Mark On Fri, Oct 12, 2018 at 4:58 AM ??? wrote: > Hi all, > > I have import a .msh file from DMPlexCreateFromFile. > I have found DMDAGetElements in DMDA's ex5 having this function, > how can i do this from DMPlex or unstructure grid. > Are there any methods that can get nodes list refer to unstructure mesh > element? > ------------------------------------ > for example : > 4 > / \ > / 1 \ > 2 - - - - - 3 element [1] >> nodes list [2 3 4] > > Thanks a lot. > > Best regards, > Barry > -------------- next part -------------- An HTML attachment was scrubbed... URL: From barrydog505 at gmail.com Fri Oct 12 04:55:15 2018 From: barrydog505 at gmail.com (=?UTF-8?B?6Zmz5a6X6IiI?=) Date: Fri, 12 Oct 2018 17:55:15 +0800 Subject: [petsc-users] How to get nodes list refer to unstructure mesh element In-Reply-To: References: Message-ID: Thanks, I'll check them out. Mark Adams ? 2018?10?12? ?? ??5:22??? > You want to use DMPlexVecGetClosure: > > > https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexVecGetClosure.html > > The examples shown here don't close cells. What you > want. src/dm/impls/plex/examples/tutorials/ex6.c does iterate over cells, > and get the closure (vertices), which is what you want. > > Mark > > > > On Fri, Oct 12, 2018 at 4:58 AM ??? wrote: > >> Hi all, >> >> I have import a .msh file from DMPlexCreateFromFile. >> I have found DMDAGetElements in DMDA's ex5 having this function, >> how can i do this from DMPlex or unstructure grid. >> Are there any methods that can get nodes list refer to unstructure mesh >> element? >> ------------------------------------ >> for example : >> 4 >> / \ >> / 1 \ >> 2 - - - - - 3 element [1] >> nodes list [2 3 4] >> >> Thanks a lot. >> >> Best regards, >> Barry >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Fri Oct 12 06:04:54 2018 From: knepley at gmail.com (Matthew Knepley) Date: Fri, 12 Oct 2018 07:04:54 -0400 Subject: [petsc-users] How to get nodes list refer to unstructure mesh element In-Reply-To: References: Message-ID: If you only have cell-vertex meshes, then using the single-layer version DMPlexGetCone() is faster. Thanks, Matt On Fri, Oct 12, 2018 at 5:56 AM ??? wrote: > Thanks, I'll check them out. > > Mark Adams ? 2018?10?12? ?? ??5:22??? > >> You want to use DMPlexVecGetClosure: >> >> >> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexVecGetClosure.html >> >> The examples shown here don't close cells. What you >> want. src/dm/impls/plex/examples/tutorials/ex6.c does iterate over cells, >> and get the closure (vertices), which is what you want. >> >> Mark >> >> >> >> On Fri, Oct 12, 2018 at 4:58 AM ??? wrote: >> >>> Hi all, >>> >>> I have import a .msh file from DMPlexCreateFromFile. >>> I have found DMDAGetElements in DMDA's ex5 having this function, >>> how can i do this from DMPlex or unstructure grid. >>> Are there any methods that can get nodes list refer to unstructure mesh >>> element? >>> ------------------------------------ >>> for example : >>> 4 >>> / \ >>> / 1 \ >>> 2 - - - - - 3 element [1] >> nodes list [2 3 4] >>> >>> Thanks a lot. >>> >>> Best regards, >>> Barry >>> >> -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From barrydog505 at gmail.com Fri Oct 12 06:09:41 2018 From: barrydog505 at gmail.com (=?UTF-8?B?6Zmz5a6X6IiI?=) Date: Fri, 12 Oct 2018 19:09:41 +0800 Subject: [petsc-users] How to get nodes list refer to unstructure mesh element In-Reply-To: References: Message-ID: Thanks for the tip! Matthew Knepley ? 2018?10?12? ?? ??7:05??? > If you only have cell-vertex meshes, then using the single-layer version > DMPlexGetCone() is faster. > > Thanks, > > Matt > > On Fri, Oct 12, 2018 at 5:56 AM ??? wrote: > >> Thanks, I'll check them out. >> >> Mark Adams ? 2018?10?12? ?? ??5:22??? >> >>> You want to use DMPlexVecGetClosure: >>> >>> >>> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexVecGetClosure.html >>> >>> The examples shown here don't close cells. What you >>> want. src/dm/impls/plex/examples/tutorials/ex6.c does iterate over cells, >>> and get the closure (vertices), which is what you want. >>> >>> Mark >>> >>> >>> >>> On Fri, Oct 12, 2018 at 4:58 AM ??? wrote: >>> >>>> Hi all, >>>> >>>> I have import a .msh file from DMPlexCreateFromFile. >>>> I have found DMDAGetElements in DMDA's ex5 having this function, >>>> how can i do this from DMPlex or unstructure grid. >>>> Are there any methods that can get nodes list refer to unstructure mesh >>>> element? >>>> ------------------------------------ >>>> for example : >>>> 4 >>>> / \ >>>> / 1 \ >>>> 2 - - - - - 3 element [1] >> nodes list [2 3 4] >>>> >>>> Thanks a lot. >>>> >>>> Best regards, >>>> Barry >>>> >>> > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Moritz.Huck at isea.rwth-aachen.de Fri Oct 12 07:38:23 2018 From: Moritz.Huck at isea.rwth-aachen.de (Moritz.Huck at isea.rwth-aachen.de) Date: Fri, 12 Oct 2018 12:38:23 +0000 Subject: [petsc-users] Order Adapting BDF timestepping Message-ID: Hi, does the BDF alogrithm adapt the order? If not are there method to get error estimates for orders higher and lower than the current one? (or adaption strategies which dont need these estimates)? Thanks, Moritz -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 7669 bytes Desc: not available URL: From emconsta at anl.gov Fri Oct 12 09:14:28 2018 From: emconsta at anl.gov (Constantinescu, Emil M.) Date: Fri, 12 Oct 2018 14:14:28 +0000 Subject: [petsc-users] Order Adapting BDF timestepping In-Reply-To: References: Message-ID: No, the current implementation does not seem to adapt the order, only the time step. With increasing order, you typically get less and less stability. There is no method of order 7 or higher. Order 6 is barely stable. So it's not a lot of wiggle room to adapt the order in there. Emil On 10/12/18 7:38 AM, Moritz.Huck at isea.rwth-aachen.de wrote: > Hi, > > does the BDF alogrithm adapt the order? > > If not are there method to get? error estimates for orders higher and > lower than the current one? > > (or adaption strategies which dont need these estimates)? > > Thanks, > > Moritz > From jed at jedbrown.org Fri Oct 12 10:03:20 2018 From: jed at jedbrown.org (Jed Brown) Date: Fri, 12 Oct 2018 09:03:20 -0600 Subject: [petsc-users] Failure of MUMPS In-Reply-To: References: Message-ID: <871s8vgqbr.fsf@jedbrown.org> Dave May writes: > * Rudi, Johann, Georg Stadler, and Omar Ghattas. "Weighted BFBT > Preconditioner for Stokes Flow Problems with Highly Heterogeneous > Viscosity." SIAM Journal on Scientific Computing 39.5 (2017): S272-S297. Somehow the SIAM version of the abstract says this is Q_k \times Q_{k-1}^{disc} (an unstable element) despite both arXiv versions saying Q_k \times P_{k-1}^{disc} (the stable element that they actually use). https://epubs.siam.org/doi/pdf/10.1137/16M108450X This weighting scheme (using a lumped velocity mass matrix scaled by viscosity) would be good work to add to PCLSC. > Note that in the Rudi et al papers, due the highly variable nature of the > viscosity, the authors advocate using a more complex definition of the > preconditioner for the Schur complement. Whether you need to use their > approach is dependent on the nature of the problem you are solving. From ellen.price at cfa.harvard.edu Fri Oct 12 10:12:39 2018 From: ellen.price at cfa.harvard.edu (Ellen M. Price) Date: Fri, 12 Oct 2018 11:12:39 -0400 Subject: [petsc-users] DMPLEX project function error In-Reply-To: References: Message-ID: <6db4ff08-a00d-7223-c533-d9c7729a96d4@cfa.harvard.edu> So I found *that* problem -- turns out that using DMPlexCreateSection was messing things up, and it seems PETSc is handling that part internally? However, I've run into a related problem now. I need to project some field data onto the mesh; it's a static array of integration weights, and each one corresponds to a single point in the mesh. Based on this answer: https://lists.mcs.anl.gov/pipermail/petsc-users/2015-December/027964.html I think I need DMPlexDistributeField. However, *that* function takes a section as an argument, and I had to take out the part where I create a section to get things working! Calling DMGetDefaultSection or DMGetDefaultGlobalSection doesn't seem to help matters, either, because then I seem to get a null section? So I either need to figure out how to set the section properly or how to get the section properly. As always, any help is appreciated. Ellen On 10/11/2018 05:41 PM, Matthew Knepley wrote: > On Thu, Oct 11, 2018 at 4:39 PM Ellen M. Price > > wrote: > > I was working with a DMPLEX and FEM, following SNES example 12. I get > the following error when I call DMProjectFunction, but I don't know what > it means. Can anyone explain where I might have gone wrong, or at least > what this error is telling me? I think the point closure size is > correct, since my mesh is 3d simplex, > > > Yes, if you have 3D SIMPLEX mesh and are using P1 elements, then you > would have > 4 dofs in the closure of a cell. The dual space dimension is the number > of dual space > basis vectors assigned to points in the closure. Since it is 1, it looks > like you have a P0 > dual space. I assume you changed something in ex12? > > ? Thanks, > > ? ? ?Matt > ? > > but what is the dual space > dimension, and where might I have set it incorrectly? > > [0]PETSC ERROR: Nonconforming object sizes > [0]PETSC ERROR: The section point closure size 4 != dual space > dimension 1 > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble shooting. > [0]PETSC ERROR: Petsc Release Version 3.9.2, May, 20, 2018 > ... > [0]PETSC ERROR: Configure options > --prefix=/home/eprice/software/petsc-opt --with-hdf5=1 > --with-hdf5-dir=/home/eprice/software/hdf5-parallel --with-mpe=1 > --with-mpe-dir=/home/eprice/software/mpe --with-debugging=0 > LDFLAGS="-pthread -lz" COPTFLAGS="-O3 -march=native -mtune=native" > CXXOPTFLAGS="-O3 -march=native -mtune=native" FOPTFLAGS="-O3 > -march=native -mtune=native" --with-mpi=1 > --with-mpi-dir=/home/eprice/software/mpich --with-mumps=1 > --with-mumps-dir=/home/eprice/software/mumps --with-parmetis=1 > --with-parmetis-dir=/home/eprice/software/parmetis --with-metis=1 > --with-metis-dir=/home/eprice/software/parmetis --with-ptscotch=1 > --with-ptscotch-dir=/home/eprice/software/scotch --with-scalapack=1 > --with-scalapack-dir=/home/eprice/software/scalapack > [0]PETSC ERROR: #1 DMProjectLocal_Generic_Plex() line 347 in > /h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c > [0]PETSC ERROR: #2 DMProjectFunctionLocal_Plex() line 428 in > /h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c > [0]PETSC ERROR: #3 DMProjectFunctionLocal() line 6265 in > /h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c > [0]PETSC ERROR: #4 DMProjectFunction() line 6250 in > /h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c > ... > > (I know this is an optimized PETSc build, but I get the same error from > my debug build, it's just much slower.) > > Ellen > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > From knepley at gmail.com Fri Oct 12 10:31:18 2018 From: knepley at gmail.com (Matthew Knepley) Date: Fri, 12 Oct 2018 11:31:18 -0400 Subject: [petsc-users] DMPLEX project function error In-Reply-To: <6db4ff08-a00d-7223-c533-d9c7729a96d4@cfa.harvard.edu> References: <6db4ff08-a00d-7223-c533-d9c7729a96d4@cfa.harvard.edu> Message-ID: On Fri, Oct 12, 2018 at 11:12 AM Ellen M. Price wrote: > So I found *that* problem -- turns out that using DMPlexCreateSection > was messing things up, and it seems PETSc is handling that part > internally? DMPlexSection creates the Section based on the discretization information in the DM (stored in a PetscDS). If no discretization info is available, then it defaults to P0 I think, which is what you got. After discretization info is put into the DM, if I ask for the Section, the DM will create it automatically if it is missing. > However, I've run into a related problem now. I need to > project some field data onto the mesh; it's a static array of > integration weights, and each one corresponds to a single point in the > mesh. Based on this answer: > > https://lists.mcs.anl.gov/pipermail/petsc-users/2015-December/027964.html > > I think I need DMPlexDistributeField. I don't think that is what you want. That is just sending data around. You want to define an FEM field. We use DMProject*() for this. These take as input either a function of the coordinates (regular function) or another FEM field. Can you tell me how your function is defined? I mean apart from the particular data you have at points. Thanks, Matt > However, *that* function takes a > section as an argument, and I had to take out the part where I create a > section to get things working! Calling DMGetDefaultSection or > DMGetDefaultGlobalSection doesn't seem to help matters, either, because > then I seem to get a null section? > > So I either need to figure out how to set the section properly or how to > get the section properly. As always, any help is appreciated. > > Ellen > > > On 10/11/2018 05:41 PM, Matthew Knepley wrote: > > On Thu, Oct 11, 2018 at 4:39 PM Ellen M. Price > > > > wrote: > > > > I was working with a DMPLEX and FEM, following SNES example 12. I get > > the following error when I call DMProjectFunction, but I don't know > what > > it means. Can anyone explain where I might have gone wrong, or at > least > > what this error is telling me? I think the point closure size is > > correct, since my mesh is 3d simplex, > > > > > > Yes, if you have 3D SIMPLEX mesh and are using P1 elements, then you > > would have > > 4 dofs in the closure of a cell. The dual space dimension is the number > > of dual space > > basis vectors assigned to points in the closure. Since it is 1, it looks > > like you have a P0 > > dual space. I assume you changed something in ex12? > > > > Thanks, > > > > Matt > > > > > > but what is the dual space > > dimension, and where might I have set it incorrectly? > > > > [0]PETSC ERROR: Nonconforming object sizes > > [0]PETSC ERROR: The section point closure size 4 != dual space > > dimension 1 > > [0]PETSC ERROR: See > http://www.mcs.anl.gov/petsc/documentation/faq.html > > for trouble shooting. > > [0]PETSC ERROR: Petsc Release Version 3.9.2, May, 20, 2018 > > ... > > [0]PETSC ERROR: Configure options > > --prefix=/home/eprice/software/petsc-opt --with-hdf5=1 > > --with-hdf5-dir=/home/eprice/software/hdf5-parallel --with-mpe=1 > > --with-mpe-dir=/home/eprice/software/mpe --with-debugging=0 > > LDFLAGS="-pthread -lz" COPTFLAGS="-O3 -march=native -mtune=native" > > CXXOPTFLAGS="-O3 -march=native -mtune=native" FOPTFLAGS="-O3 > > -march=native -mtune=native" --with-mpi=1 > > --with-mpi-dir=/home/eprice/software/mpich --with-mumps=1 > > --with-mumps-dir=/home/eprice/software/mumps --with-parmetis=1 > > --with-parmetis-dir=/home/eprice/software/parmetis --with-metis=1 > > --with-metis-dir=/home/eprice/software/parmetis --with-ptscotch=1 > > --with-ptscotch-dir=/home/eprice/software/scotch --with-scalapack=1 > > --with-scalapack-dir=/home/eprice/software/scalapack > > [0]PETSC ERROR: #1 DMProjectLocal_Generic_Plex() line 347 in > > /h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c > > [0]PETSC ERROR: #2 DMProjectFunctionLocal_Plex() line 428 in > > /h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c > > [0]PETSC ERROR: #3 DMProjectFunctionLocal() line 6265 in > > /h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c > > [0]PETSC ERROR: #4 DMProjectFunction() line 6250 in > > /h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c > > ... > > > > (I know this is an optimized PETSc build, but I get the same error > from > > my debug build, it's just much slower.) > > > > Ellen > > > > > > > > -- > > 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 > > > > https://www.cse.buffalo.edu/~knepley/ > > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From ellen.price at cfa.harvard.edu Fri Oct 12 14:51:18 2018 From: ellen.price at cfa.harvard.edu (Ellen M. Price) Date: Fri, 12 Oct 2018 15:51:18 -0400 Subject: [petsc-users] DMPLEX project function error In-Reply-To: References: <6db4ff08-a00d-7223-c533-d9c7729a96d4@cfa.harvard.edu> Message-ID: <4665f197-89a8-ae7f-3a54-a9f87200fe51@cfa.harvard.edu> Hi Matt, Basically, I have a simple meshing script that generates a set of points for my FEM mesh and outputs a C file that compiles into my program. Along with those points is a static data field that I need to be associated with the correct data point. I don't have a function that evaluates at each point, it's just pre-generated data. Since I called DMPlexDistribute() early on, I think my mesh points get re-ordered, right? So I need a way to re-order my data field to match that ordering. Is there a good way to do this? I tried using DMPlexDistributeField as a first attempt, but I get some kind of error no matter what I do (presumably I'm not giving the right input), and there aren't any examples in the docs. Ellen On 10/12/2018 11:31 AM, Matthew Knepley wrote: > On Fri, Oct 12, 2018 at 11:12 AM Ellen M. Price > > wrote: > > So I found *that* problem -- turns out that using DMPlexCreateSection > was messing things up, and it seems PETSc is handling that part > internally? > > > DMPlexSection creates the Section based on the discretization > information in the DM (stored in a PetscDS). > If no discretization info is available, then it defaults to P0 I think, > which is what you got. > > After discretization info is put into the DM, if I ask for the Section, > the DM will create it automatically if it is missing. > ? > > However, I've run into a related problem now. I need to > project some field data onto the mesh; it's a static array of > integration weights, and each one corresponds to a single point in the > mesh. Based on this answer: > > https://lists.mcs.anl.gov/pipermail/petsc-users/2015-December/027964.html > > I think I need DMPlexDistributeField. > > > I don't think that is what you want.? That is just sending data around. > > You want to define an FEM field. We use DMProject*() for this. These > take as input either > a function of the coordinates (regular function) or another FEM field. > > Can you tell me how your function is defined? I mean apart from the > particular data you > have at points. > > ? Thanks, > > ? ? ?Matt > ? > > However, *that* function takes a > section as an argument, and I had to take out the part where I create a > section to get things working!? Calling DMGetDefaultSection or > DMGetDefaultGlobalSection doesn't seem to help matters, either, because > then I seem to get a null section? > > So I either need to figure out how to set the section properly or how to > get the section properly. As always, any help is appreciated. > > Ellen > > > On 10/11/2018 05:41 PM, Matthew Knepley wrote: > > On Thu, Oct 11, 2018 at 4:39 PM Ellen M. Price > > > >> wrote: > > > >? ? ?I was working with a DMPLEX and FEM, following SNES example > 12. I get > >? ? ?the following error when I call DMProjectFunction, but I don't > know what > >? ? ?it means. Can anyone explain where I might have gone wrong, or > at least > >? ? ?what this error is telling me? I think the point closure size is > >? ? ?correct, since my mesh is 3d simplex, > > > > > > Yes, if you have 3D SIMPLEX mesh and are using P1 elements, then you > > would have > > 4 dofs in the closure of a cell. The dual space dimension is the > number > > of dual space > > basis vectors assigned to points in the closure. Since it is 1, it > looks > > like you have a P0 > > dual space. I assume you changed something in ex12? > > > > ? Thanks, > > > > ? ? ?Matt > > ? > > > >? ? ?but what is the dual space > >? ? ?dimension, and where might I have set it incorrectly? > > > >? ? ?[0]PETSC ERROR: Nonconforming object sizes > >? ? ?[0]PETSC ERROR: The section point closure size 4 != dual space > >? ? ?dimension 1 > >? ? ?[0]PETSC ERROR: See > http://www.mcs.anl.gov/petsc/documentation/faq.html > >? ? ?for trouble shooting. > >? ? ?[0]PETSC ERROR: Petsc Release Version 3.9.2, May, 20, 2018 > >? ? ?... > >? ? ?[0]PETSC ERROR: Configure options > >? ? ?--prefix=/home/eprice/software/petsc-opt --with-hdf5=1 > >? ? ?--with-hdf5-dir=/home/eprice/software/hdf5-parallel --with-mpe=1 > >? ? ?--with-mpe-dir=/home/eprice/software/mpe --with-debugging=0 > >? ? ?LDFLAGS="-pthread -lz" COPTFLAGS="-O3 -march=native -mtune=native" > >? ? ?CXXOPTFLAGS="-O3 -march=native -mtune=native" FOPTFLAGS="-O3 > >? ? ?-march=native -mtune=native" --with-mpi=1 > >? ? ?--with-mpi-dir=/home/eprice/software/mpich --with-mumps=1 > >? ? ?--with-mumps-dir=/home/eprice/software/mumps --with-parmetis=1 > >? ? ?--with-parmetis-dir=/home/eprice/software/parmetis --with-metis=1 > >? ? ?--with-metis-dir=/home/eprice/software/parmetis --with-ptscotch=1 > >? ? ?--with-ptscotch-dir=/home/eprice/software/scotch > --with-scalapack=1 > >? ? ?--with-scalapack-dir=/home/eprice/software/scalapack > >? ? ?[0]PETSC ERROR: #1 DMProjectLocal_Generic_Plex() line 347 in > >? ? ?/h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c > >? ? ?[0]PETSC ERROR: #2 DMProjectFunctionLocal_Plex() line 428 in > >? ? ?/h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c > >? ? ?[0]PETSC ERROR: #3 DMProjectFunctionLocal() line 6265 in > >? ? ?/h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c > >? ? ?[0]PETSC ERROR: #4 DMProjectFunction() line 6250 in > >? ? ?/h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c > >? ? ?... > > > >? ? ?(I know this is an optimized PETSc build, but I get the same > error from > >? ? ?my debug build, it's just much slower.) > > > >? ? ?Ellen > > > > > > > > -- > > 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 > > > > https://www.cse.buffalo.edu/~knepley/ > > > > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > From knepley at gmail.com Fri Oct 12 15:36:27 2018 From: knepley at gmail.com (Matthew Knepley) Date: Fri, 12 Oct 2018 16:36:27 -0400 Subject: [petsc-users] DMPLEX project function error In-Reply-To: <4665f197-89a8-ae7f-3a54-a9f87200fe51@cfa.harvard.edu> References: <6db4ff08-a00d-7223-c533-d9c7729a96d4@cfa.harvard.edu> <4665f197-89a8-ae7f-3a54-a9f87200fe51@cfa.harvard.edu> Message-ID: On Fri, Oct 12, 2018 at 3:51 PM Ellen M. Price wrote: > Hi Matt, > > Basically, I have a simple meshing script that generates a set of points > for my FEM mesh and outputs a C file that compiles into my program. > Along with those points is a static data field that I need to be > associated with the correct data point. I don't have a function that > evaluates at each point, it's just pre-generated data. > I cannot help but make editorial comments. Do not do this. It is incredibly fragile, since it depends on both a mesh and a discretization. > Since I called DMPlexDistribute() early on, I think my mesh points get > re-ordered, right? So I need a way to re-order my data field to match > that ordering. Is there a good way to do this? > However, if you want to do this, it is not hard. You do use DMPlexDistributeField ( https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexDistributeField.html), but you need to be careful about the arguments. You want DMPlexDistribute(dmOriginal, 0, &migrationSF, &dmNew); DMPlexDistributeField(dmOriginal, migrationSF, originalSection, originalVec, newSection, newVec); Your Sections are easy to make, just put 1 dof on every vertex. The originalVec is just a Vec of your values (you can use VecCreateSeqWithArray() to wrap one around it), and the newVec you can get with DMCreateLocalVector(dmNew, &newVec) if you do DMSetSection(dmNew, newSection). Does this make sense? Thanks, Matt > I tried using DMPlexDistributeField as a first attempt, but I get some > kind of error no matter what I do (presumably I'm not giving the right > input), and there aren't any examples in the docs. > > Ellen > > > On 10/12/2018 11:31 AM, Matthew Knepley wrote: > > On Fri, Oct 12, 2018 at 11:12 AM Ellen M. Price > > > > wrote: > > > > So I found *that* problem -- turns out that using DMPlexCreateSection > > was messing things up, and it seems PETSc is handling that part > > internally? > > > > > > DMPlexSection creates the Section based on the discretization > > information in the DM (stored in a PetscDS). > > If no discretization info is available, then it defaults to P0 I think, > > which is what you got. > > > > After discretization info is put into the DM, if I ask for the Section, > > the DM will create it automatically if it is missing. > > > > > > However, I've run into a related problem now. I need to > > project some field data onto the mesh; it's a static array of > > integration weights, and each one corresponds to a single point in > the > > mesh. Based on this answer: > > > > > https://lists.mcs.anl.gov/pipermail/petsc-users/2015-December/027964.html > > > > I think I need DMPlexDistributeField. > > > > > > I don't think that is what you want. That is just sending data around. > > > > You want to define an FEM field. We use DMProject*() for this. These > > take as input either > > a function of the coordinates (regular function) or another FEM field. > > > > Can you tell me how your function is defined? I mean apart from the > > particular data you > > have at points. > > > > Thanks, > > > > Matt > > > > > > However, *that* function takes a > > section as an argument, and I had to take out the part where I > create a > > section to get things working! Calling DMGetDefaultSection or > > DMGetDefaultGlobalSection doesn't seem to help matters, either, > because > > then I seem to get a null section? > > > > So I either need to figure out how to set the section properly or > how to > > get the section properly. As always, any help is appreciated. > > > > Ellen > > > > > > On 10/11/2018 05:41 PM, Matthew Knepley wrote: > > > On Thu, Oct 11, 2018 at 4:39 PM Ellen M. Price > > > > > > >> wrote: > > > > > > I was working with a DMPLEX and FEM, following SNES example > > 12. I get > > > the following error when I call DMProjectFunction, but I don't > > know what > > > it means. Can anyone explain where I might have gone wrong, or > > at least > > > what this error is telling me? I think the point closure size > is > > > correct, since my mesh is 3d simplex, > > > > > > > > > Yes, if you have 3D SIMPLEX mesh and are using P1 elements, then > you > > > would have > > > 4 dofs in the closure of a cell. The dual space dimension is the > > number > > > of dual space > > > basis vectors assigned to points in the closure. Since it is 1, it > > looks > > > like you have a P0 > > > dual space. I assume you changed something in ex12? > > > > > > Thanks, > > > > > > Matt > > > > > > > > > but what is the dual space > > > dimension, and where might I have set it incorrectly? > > > > > > [0]PETSC ERROR: Nonconforming object sizes > > > [0]PETSC ERROR: The section point closure size 4 != dual space > > > dimension 1 > > > [0]PETSC ERROR: See > > http://www.mcs.anl.gov/petsc/documentation/faq.html > > > for trouble shooting. > > > [0]PETSC ERROR: Petsc Release Version 3.9.2, May, 20, 2018 > > > ... > > > [0]PETSC ERROR: Configure options > > > --prefix=/home/eprice/software/petsc-opt --with-hdf5=1 > > > --with-hdf5-dir=/home/eprice/software/hdf5-parallel > --with-mpe=1 > > > --with-mpe-dir=/home/eprice/software/mpe --with-debugging=0 > > > LDFLAGS="-pthread -lz" COPTFLAGS="-O3 -march=native > -mtune=native" > > > CXXOPTFLAGS="-O3 -march=native -mtune=native" FOPTFLAGS="-O3 > > > -march=native -mtune=native" --with-mpi=1 > > > --with-mpi-dir=/home/eprice/software/mpich --with-mumps=1 > > > --with-mumps-dir=/home/eprice/software/mumps --with-parmetis=1 > > > --with-parmetis-dir=/home/eprice/software/parmetis > --with-metis=1 > > > --with-metis-dir=/home/eprice/software/parmetis > --with-ptscotch=1 > > > --with-ptscotch-dir=/home/eprice/software/scotch > > --with-scalapack=1 > > > --with-scalapack-dir=/home/eprice/software/scalapack > > > [0]PETSC ERROR: #1 DMProjectLocal_Generic_Plex() line 347 in > > > /h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c > > > [0]PETSC ERROR: #2 DMProjectFunctionLocal_Plex() line 428 in > > > /h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c > > > [0]PETSC ERROR: #3 DMProjectFunctionLocal() line 6265 in > > > /h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c > > > [0]PETSC ERROR: #4 DMProjectFunction() line 6250 in > > > /h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c > > > ... > > > > > > (I know this is an optimized PETSc build, but I get the same > > error from > > > my debug build, it's just much slower.) > > > > > > Ellen > > > > > > > > > > > > -- > > > 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 > > > > > > https://www.cse.buffalo.edu/~knepley/ > > > > > > > > > > > > > -- > > 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 > > > > https://www.cse.buffalo.edu/~knepley/ > > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From ellen.price at cfa.harvard.edu Sat Oct 13 23:36:19 2018 From: ellen.price at cfa.harvard.edu (Ellen M. Price) Date: Sun, 14 Oct 2018 00:36:19 -0400 Subject: [petsc-users] DMPLEX project function error In-Reply-To: References: <6db4ff08-a00d-7223-c533-d9c7729a96d4@cfa.harvard.edu> <4665f197-89a8-ae7f-3a54-a9f87200fe51@cfa.harvard.edu> Message-ID: <0a4e98b9-4b34-570d-f375-8a6a1884c73e@cfa.harvard.edu> Hi Matt, I ran into a problem implementing this. My integration code relies on knowing the points of each tetrahedron in the domain so I can turn an integral over all space into a sum of integrals over cells. I can't find an example of getting vertices for a given cell (I think TS ex11 comes closest, looks like it gets faces?). Is there an elegant way to do this, or an example I can follow? Ellen On 10/13/2018 04:26 AM, Matthew Knepley wrote: > On Fri, Oct 12, 2018 at 6:00 PM Ellen M. Price > > wrote: > > Hi Matt, > > Thanks for the feedback! I'm always open to editorial comments. Do you > have a suggestion for a better way? I'm basically just trying to do an > integral over all space to get my boundary values for the FEM solve. I > don't know if PETSc has a way to do something like this? > > > So you are defining your BC by a boundary integral. I would just stick > that integration code > into a function and let that be called as your BC function. It will not > be called "extra" times, > just once for each dual vector, which in the case of P1 is every vertex. > This way it will work > for any element. > > ? Thanks, > > ? ? ?Matt > ? > > Ellen > > > On 10/12/2018 04:36 PM, Matthew Knepley wrote: > > On Fri, Oct 12, 2018 at 3:51 PM Ellen M. Price > > > >> wrote: > > > >? ? ?Hi Matt, > > > >? ? ?Basically, I have a simple meshing script that generates a set > of points > >? ? ?for my FEM mesh and outputs a C file that compiles into my > program. > >? ? ?Along with those points is a static data field that I need to be > >? ? ?associated with the correct data point. I don't have a > function that > >? ? ?evaluates at each point, it's just pre-generated data. > > > > > > I cannot help but make editorial comments. Do not do this. It is > > incredibly fragile, since > > it depends on both a mesh and a discretization. > > ? > > > >? ? ?Since I called DMPlexDistribute() early on, I think my mesh > points get > >? ? ?re-ordered, right? So I need a way to re-order my data field > to match > >? ? ?that ordering. Is there a good way to do this? > > > > > > However, if you want to do this, it is not hard. You do use > > DMPlexDistributeField > > > (https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexDistributeField.html), > > but you need > > to be careful about the arguments. You want > > > > ? ?DMPlexDistribute(dmOriginal, 0, &migrationSF, &dmNew); > > ???DMPlexDistributeField(dmOriginal, migrationSF, originalSection, > > originalVec, newSection, newVec); > > > > Your Sections are easy to make, just put 1 dof on every vertex. The > > originalVec is just a Vec of your values > > (you can use VecCreateSeqWithArray() to wrap one around it), and the > > newVec you can get with > > DMCreateLocalVector(dmNew, &newVec) if you do DMSetSection(dmNew, > > newSection). > > > > Does this make sense? > > > > ? Thanks, > > > > ? ? ?Matt > > ? > > > >? ? ?I tried using DMPlexDistributeField as a first attempt, but I > get some > >? ? ?kind of error no matter what I do (presumably I'm not giving > the right > >? ? ?input), and there aren't any examples in the docs. > > > >? ? ?Ellen > > > > > >? ? ?On 10/12/2018 11:31 AM, Matthew Knepley wrote: > >? ? ?> On Fri, Oct 12, 2018 at 11:12 AM Ellen M. Price > >? ? ?> > > > >? ? ? > >? ? ? >>> wrote: > >? ? ?> > >? ? ?>? ? ?So I found *that* problem -- turns out that using > >? ? ?DMPlexCreateSection > >? ? ?>? ? ?was messing things up, and it seems PETSc is handling > that part > >? ? ?>? ? ?internally? > >? ? ?> > >? ? ?> > >? ? ?> DMPlexSection creates the Section based on the discretization > >? ? ?> information in the DM (stored in a PetscDS). > >? ? ?> If no discretization info is available, then it defaults to P0 I > >? ? ?think, > >? ? ?> which is what you got. > >? ? ?> > >? ? ?> After discretization info is put into the DM, if I ask for the > >? ? ?Section, > >? ? ?> the DM will create it automatically if it is missing. > >? ? ?> ? > >? ? ?> > >? ? ?>? ? ?However, I've run into a related problem now. I need to > >? ? ?>? ? ?project some field data onto the mesh; it's a static > array of > >? ? ?>? ? ?integration weights, and each one corresponds to a single > >? ? ?point in the > >? ? ?>? ? ?mesh. Based on this answer: > >? ? ?> > >? ? ?>? ? > >? ? > ??https://lists.mcs.anl.gov/pipermail/petsc-users/2015-December/027964.html > >? ? ?> > >? ? ?>? ? ?I think I need DMPlexDistributeField. > >? ? ?> > >? ? ?> > >? ? ?> I don't think that is what you want.? That is just sending data > >? ? ?around. > >? ? ?> > >? ? ?> You want to define an FEM field. We use DMProject*() for > this. These > >? ? ?> take as input either > >? ? ?> a function of the coordinates (regular function) or another > FEM field. > >? ? ?> > >? ? ?> Can you tell me how your function is defined? I mean apart > from the > >? ? ?> particular data you > >? ? ?> have at points. > >? ? ?> > >? ? ?> ? Thanks, > >? ? ?> > >? ? ?> ? ? ?Matt > >? ? ?> ? > >? ? ?> > >? ? ?>? ? ?However, *that* function takes a > >? ? ?>? ? ?section as an argument, and I had to take out the part > where I > >? ? ?create a > >? ? ?>? ? ?section to get things working!? Calling > DMGetDefaultSection or > >? ? ?>? ? ?DMGetDefaultGlobalSection doesn't seem to help matters, > >? ? ?either, because > >? ? ?>? ? ?then I seem to get a null section? > >? ? ?> > >? ? ?>? ? ?So I either need to figure out how to set the section > properly > >? ? ?or how to > >? ? ?>? ? ?get the section properly. As always, any help is > appreciated. > >? ? ?> > >? ? ?>? ? ?Ellen > >? ? ?> > >? ? ?> > >? ? ?>? ? ?On 10/11/2018 05:41 PM, Matthew Knepley wrote: > >? ? ?>? ? ?> On Thu, Oct 11, 2018 at 4:39 PM Ellen M. Price > >? ? ?>? ? ?> > >? ? ? > > >? ? ? > >? ? ? >> > >? ? ?>? ? ? > >? ? ? > > >? ? ?>? ? ? > >? ? ? >>>> wrote: > >? ? ?>? ? ?> > >? ? ?>? ? ?>? ? ?I was working with a DMPLEX and FEM, following > SNES example > >? ? ?>? ? ?12. I get > >? ? ?>? ? ?>? ? ?the following error when I call DMProjectFunction, > but I > >? ? ?don't > >? ? ?>? ? ?know what > >? ? ?>? ? ?>? ? ?it means. Can anyone explain where I might have gone > >? ? ?wrong, or > >? ? ?>? ? ?at least > >? ? ?>? ? ?>? ? ?what this error is telling me? I think the point > closure > >? ? ?size is > >? ? ?>? ? ?>? ? ?correct, since my mesh is 3d simplex, > >? ? ?>? ? ?> > >? ? ?>? ? ?> > >? ? ?>? ? ?> Yes, if you have 3D SIMPLEX mesh and are using P1 > elements, > >? ? ?then you > >? ? ?>? ? ?> would have > >? ? ?>? ? ?> 4 dofs in the closure of a cell. The dual space > dimension is the > >? ? ?>? ? ?number > >? ? ?>? ? ?> of dual space > >? ? ?>? ? ?> basis vectors assigned to points in the closure. Since > it is > >? ? ?1, it > >? ? ?>? ? ?looks > >? ? ?>? ? ?> like you have a P0 > >? ? ?>? ? ?> dual space. I assume you changed something in ex12? > >? ? ?>? ? ?> > >? ? ?>? ? ?> ? Thanks, > >? ? ?>? ? ?> > >? ? ?>? ? ?> ? ? ?Matt > >? ? ?>? ? ?> ? > >? ? ?>? ? ?> > >? ? ?>? ? ?>? ? ?but what is the dual space > >? ? ?>? ? ?>? ? ?dimension, and where might I have set it incorrectly? > >? ? ?>? ? ?> > >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: Nonconforming object sizes > >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: The section point closure size 4 > != dual > >? ? ?space > >? ? ?>? ? ?>? ? ?dimension 1 > >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: See > >? ? ?>? ? ?http://www.mcs.anl.gov/petsc/documentation/faq.html > >? ? ?>? ? ?>? ? ?for trouble shooting. > >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: Petsc Release Version 3.9.2, May, > 20, 2018 > >? ? ?>? ? ?>? ? ?... > >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: Configure options > >? ? ?>? ? ?>? ? ?--prefix=/home/eprice/software/petsc-opt --with-hdf5=1 > >? ? ?>? ? ?>? ? ?--with-hdf5-dir=/home/eprice/software/hdf5-parallel > >? ? ?--with-mpe=1 > >? ? ?>? ? ?>? ? ?--with-mpe-dir=/home/eprice/software/mpe > --with-debugging=0 > >? ? ?>? ? ?>? ? ?LDFLAGS="-pthread -lz" COPTFLAGS="-O3 -march=native > >? ? ?-mtune=native" > >? ? ?>? ? ?>? ? ?CXXOPTFLAGS="-O3 -march=native -mtune=native" > FOPTFLAGS="-O3 > >? ? ?>? ? ?>? ? ?-march=native -mtune=native" --with-mpi=1 > >? ? ?>? ? ?>? ? ?--with-mpi-dir=/home/eprice/software/mpich > --with-mumps=1 > >? ? ?>? ? ?>? ? ?--with-mumps-dir=/home/eprice/software/mumps > >? ? ?--with-parmetis=1 > >? ? ?>? ? ?>? ? ?--with-parmetis-dir=/home/eprice/software/parmetis > >? ? ?--with-metis=1 > >? ? ?>? ? ?>? ? ?--with-metis-dir=/home/eprice/software/parmetis > >? ? ?--with-ptscotch=1 > >? ? ?>? ? ?>? ? ?--with-ptscotch-dir=/home/eprice/software/scotch > >? ? ?>? ? ?--with-scalapack=1 > >? ? ?>? ? ?>? ? ?--with-scalapack-dir=/home/eprice/software/scalapack > >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: #1 DMProjectLocal_Generic_Plex() > line 347 in > >? ? ?>? ? ?>? ? > ?/h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c > >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: #2 DMProjectFunctionLocal_Plex() > line 428 in > >? ? ?>? ? ?>? ? > ?/h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c > >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: #3 DMProjectFunctionLocal() line > 6265 in > >? ? ?>? ? ?>? ? ?/h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c > >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: #4 DMProjectFunction() line 6250 in > >? ? ?>? ? ?>? ? ?/h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c > >? ? ?>? ? ?>? ? ?... > >? ? ?>? ? ?> > >? ? ?>? ? ?>? ? ?(I know this is an optimized PETSc build, but I > get the same > >? ? ?>? ? ?error from > >? ? ?>? ? ?>? ? ?my debug build, it's just much slower.) > >? ? ?>? ? ?> > >? ? ?>? ? ?>? ? ?Ellen > >? ? ?>? ? ?> > >? ? ?>? ? ?> > >? ? ?>? ? ?> > >? ? ?>? ? ?> -- > >? ? ?>? ? ?> 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 > >? ? ?>? ? ?> > >? ? ?>? ? ?> https://www.cse.buffalo.edu/~knepley/ > > >? ? ? > >? ? ?>? ? ? > >? ? ?>? ? ?> > >? ? ?> > >? ? ?> > >? ? ?> > >? ? ?> -- > >? ? ?> 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 > >? ? ?> > >? ? ?> https://www.cse.buffalo.edu/~knepley/ > > >? ? ? > >? ? ?> > > > > > > > > -- > > 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 > > > > https://www.cse.buffalo.edu/~knepley/ > > > > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > From yann.jobic at univ-amu.fr Sun Oct 14 02:07:51 2018 From: yann.jobic at univ-amu.fr (yann JOBIC) Date: Sun, 14 Oct 2018 09:07:51 +0200 Subject: [petsc-users] DMPLEX project function error In-Reply-To: <0a4e98b9-4b34-570d-f375-8a6a1884c73e@cfa.harvard.edu> References: <6db4ff08-a00d-7223-c533-d9c7729a96d4@cfa.harvard.edu> <4665f197-89a8-ae7f-3a54-a9f87200fe51@cfa.harvard.edu> <0a4e98b9-4b34-570d-f375-8a6a1884c73e@cfa.harvard.edu> Message-ID: Hi Ellen, I've made an old code (i forgot in which version it's working) that gives local coordinates and connectivity of a distributed DM. I didn't check that it's working again. I'll also work on that on the future. If it can help, i send you my ugly code (i didn't clean it). Yann On 14/10/2018 06:36, Ellen M. Price wrote: > Hi Matt, > > I ran into a problem implementing this. My integration code relies on > knowing the points of each tetrahedron in the domain so I can turn an > integral over all space into a sum of integrals over cells. I can't find > an example of getting vertices for a given cell (I think TS ex11 comes > closest, looks like it gets faces?). Is there an elegant way to do this, > or an example I can follow? > > Ellen > > > On 10/13/2018 04:26 AM, Matthew Knepley wrote: >> On Fri, Oct 12, 2018 at 6:00 PM Ellen M. Price >> > wrote: >> >> Hi Matt, >> >> Thanks for the feedback! I'm always open to editorial comments. Do you >> have a suggestion for a better way? I'm basically just trying to do an >> integral over all space to get my boundary values for the FEM solve. I >> don't know if PETSc has a way to do something like this? >> >> >> So you are defining your BC by a boundary integral. I would just stick >> that integration code >> into a function and let that be called as your BC function. It will not >> be called "extra" times, >> just once for each dual vector, which in the case of P1 is every vertex. >> This way it will work >> for any element. >> >> ? Thanks, >> >> ? ? ?Matt >> >> >> Ellen >> >> >> On 10/12/2018 04:36 PM, Matthew Knepley wrote: >> > On Fri, Oct 12, 2018 at 3:51 PM Ellen M. Price >> > >> > >> wrote: >> > >> >? ? ?Hi Matt, >> > >> >? ? ?Basically, I have a simple meshing script that generates a set >> of points >> >? ? ?for my FEM mesh and outputs a C file that compiles into my >> program. >> >? ? ?Along with those points is a static data field that I need to be >> >? ? ?associated with the correct data point. I don't have a >> function that >> >? ? ?evaluates at each point, it's just pre-generated data. >> > >> > >> > I cannot help but make editorial comments. Do not do this. It is >> > incredibly fragile, since >> > it depends on both a mesh and a discretization. >> > >> > >> >? ? ?Since I called DMPlexDistribute() early on, I think my mesh >> points get >> >? ? ?re-ordered, right? So I need a way to re-order my data field >> to match >> >? ? ?that ordering. Is there a good way to do this? >> > >> > >> > However, if you want to do this, it is not hard. You do use >> > DMPlexDistributeField >> > >> (https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexDistributeField.html), >> > but you need >> > to be careful about the arguments. You want >> > >> > ? ?DMPlexDistribute(dmOriginal, 0, &migrationSF, &dmNew); >> > ???DMPlexDistributeField(dmOriginal, migrationSF, originalSection, >> > originalVec, newSection, newVec); >> > >> > Your Sections are easy to make, just put 1 dof on every vertex. The >> > originalVec is just a Vec of your values >> > (you can use VecCreateSeqWithArray() to wrap one around it), and the >> > newVec you can get with >> > DMCreateLocalVector(dmNew, &newVec) if you do DMSetSection(dmNew, >> > newSection). >> > >> > Does this make sense? >> > >> > ? Thanks, >> > >> > ? ? ?Matt >> > >> > >> >? ? ?I tried using DMPlexDistributeField as a first attempt, but I >> get some >> >? ? ?kind of error no matter what I do (presumably I'm not giving >> the right >> >? ? ?input), and there aren't any examples in the docs. >> > >> >? ? ?Ellen >> > >> > >> >? ? ?On 10/12/2018 11:31 AM, Matthew Knepley wrote: >> >? ? ?> On Fri, Oct 12, 2018 at 11:12 AM Ellen M. Price >> >? ? ?> > >> > > >> >? ? ?> >> >? ? ?> >>> wrote: >> >? ? ?> >> >? ? ?>? ? ?So I found *that* problem -- turns out that using >> >? ? ?DMPlexCreateSection >> >? ? ?>? ? ?was messing things up, and it seems PETSc is handling >> that part >> >? ? ?>? ? ?internally? >> >? ? ?> >> >? ? ?> >> >? ? ?> DMPlexSection creates the Section based on the discretization >> >? ? ?> information in the DM (stored in a PetscDS). >> >? ? ?> If no discretization info is available, then it defaults to P0 I >> >? ? ?think, >> >? ? ?> which is what you got. >> >? ? ?> >> >? ? ?> After discretization info is put into the DM, if I ask for the >> >? ? ?Section, >> >? ? ?> the DM will create it automatically if it is missing. >> >? ? ?> >> >? ? ?> >> >? ? ?>? ? ?However, I've run into a related problem now. I need to >> >? ? ?>? ? ?project some field data onto the mesh; it's a static >> array of >> >? ? ?>? ? ?integration weights, and each one corresponds to a single >> >? ? ?point in the >> >? ? ?>? ? ?mesh. Based on this answer: >> >? ? ?> >> >? ? ?> >> > >> ??https://lists.mcs.anl.gov/pipermail/petsc-users/2015-December/027964.html >> >? ? ?> >> >? ? ?>? ? ?I think I need DMPlexDistributeField. >> >? ? ?> >> >? ? ?> >> >? ? ?> I don't think that is what you want.? That is just sending data >> >? ? ?around. >> >? ? ?> >> >? ? ?> You want to define an FEM field. We use DMProject*() for >> this. These >> >? ? ?> take as input either >> >? ? ?> a function of the coordinates (regular function) or another >> FEM field. >> >? ? ?> >> >? ? ?> Can you tell me how your function is defined? I mean apart >> from the >> >? ? ?> particular data you >> >? ? ?> have at points. >> >? ? ?> >> >? ? ?> ? Thanks, >> >? ? ?> >> >? ? ?> ? ? ?Matt >> >? ? ?> >> >? ? ?> >> >? ? ?>? ? ?However, *that* function takes a >> >? ? ?>? ? ?section as an argument, and I had to take out the part >> where I >> >? ? ?create a >> >? ? ?>? ? ?section to get things working!? Calling >> DMGetDefaultSection or >> >? ? ?>? ? ?DMGetDefaultGlobalSection doesn't seem to help matters, >> >? ? ?either, because >> >? ? ?>? ? ?then I seem to get a null section? >> >? ? ?> >> >? ? ?>? ? ?So I either need to figure out how to set the section >> properly >> >? ? ?or how to >> >? ? ?>? ? ?get the section properly. As always, any help is >> appreciated. >> >? ? ?> >> >? ? ?>? ? ?Ellen >> >? ? ?> >> >? ? ?> >> >? ? ?>? ? ?On 10/11/2018 05:41 PM, Matthew Knepley wrote: >> >? ? ?>? ? ?> On Thu, Oct 11, 2018 at 4:39 PM Ellen M. Price >> >? ? ?>? ? ?> > >> >? ? ?> > >> >? ? ?> >> >? ? ?> >> >> >? ? ?>? ? ?> >> >? ? ?> > >> >? ? ?>? ? ?> >> >? ? ?> >>>> wrote: >> >? ? ?>? ? ?> >> >? ? ?>? ? ?>? ? ?I was working with a DMPLEX and FEM, following >> SNES example >> >? ? ?>? ? ?12. I get >> >? ? ?>? ? ?>? ? ?the following error when I call DMProjectFunction, >> but I >> >? ? ?don't >> >? ? ?>? ? ?know what >> >? ? ?>? ? ?>? ? ?it means. Can anyone explain where I might have gone >> >? ? ?wrong, or >> >? ? ?>? ? ?at least >> >? ? ?>? ? ?>? ? ?what this error is telling me? I think the point >> closure >> >? ? ?size is >> >? ? ?>? ? ?>? ? ?correct, since my mesh is 3d simplex, >> >? ? ?>? ? ?> >> >? ? ?>? ? ?> >> >? ? ?>? ? ?> Yes, if you have 3D SIMPLEX mesh and are using P1 >> elements, >> >? ? ?then you >> >? ? ?>? ? ?> would have >> >? ? ?>? ? ?> 4 dofs in the closure of a cell. The dual space >> dimension is the >> >? ? ?>? ? ?number >> >? ? ?>? ? ?> of dual space >> >? ? ?>? ? ?> basis vectors assigned to points in the closure. Since >> it is >> >? ? ?1, it >> >? ? ?>? ? ?looks >> >? ? ?>? ? ?> like you have a P0 >> >? ? ?>? ? ?> dual space. I assume you changed something in ex12? >> >? ? ?>? ? ?> >> >? ? ?>? ? ?> ? Thanks, >> >? ? ?>? ? ?> >> >? ? ?>? ? ?> ? ? ?Matt >> >? ? ?>? ? ?> >> >? ? ?>? ? ?> >> >? ? ?>? ? ?>? ? ?but what is the dual space >> >? ? ?>? ? ?>? ? ?dimension, and where might I have set it incorrectly? >> >? ? ?>? ? ?> >> >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: Nonconforming object sizes >> >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: The section point closure size 4 >> != dual >> >? ? ?space >> >? ? ?>? ? ?>? ? ?dimension 1 >> >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: See >> >? ? ?>? ? ?http://www.mcs.anl.gov/petsc/documentation/faq.html >> >? ? ?>? ? ?>? ? ?for trouble shooting. >> >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: Petsc Release Version 3.9.2, May, >> 20, 2018 >> >? ? ?>? ? ?>? ? ?... >> >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: Configure options >> >? ? ?>? ? ?>? ? ?--prefix=/home/eprice/software/petsc-opt --with-hdf5=1 >> >? ? ?>? ? ?>? ? ?--with-hdf5-dir=/home/eprice/software/hdf5-parallel >> >? ? ?--with-mpe=1 >> >? ? ?>? ? ?>? ? ?--with-mpe-dir=/home/eprice/software/mpe >> --with-debugging=0 >> >? ? ?>? ? ?>? ? ?LDFLAGS="-pthread -lz" COPTFLAGS="-O3 -march=native >> >? ? ?-mtune=native" >> >? ? ?>? ? ?>? ? ?CXXOPTFLAGS="-O3 -march=native -mtune=native" >> FOPTFLAGS="-O3 >> >? ? ?>? ? ?>? ? ?-march=native -mtune=native" --with-mpi=1 >> >? ? ?>? ? ?>? ? ?--with-mpi-dir=/home/eprice/software/mpich >> --with-mumps=1 >> >? ? ?>? ? ?>? ? ?--with-mumps-dir=/home/eprice/software/mumps >> >? ? ?--with-parmetis=1 >> >? ? ?>? ? ?>? ? ?--with-parmetis-dir=/home/eprice/software/parmetis >> >? ? ?--with-metis=1 >> >? ? ?>? ? ?>? ? ?--with-metis-dir=/home/eprice/software/parmetis >> >? ? ?--with-ptscotch=1 >> >? ? ?>? ? ?>? ? ?--with-ptscotch-dir=/home/eprice/software/scotch >> >? ? ?>? ? ?--with-scalapack=1 >> >? ? ?>? ? ?>? ? ?--with-scalapack-dir=/home/eprice/software/scalapack >> >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: #1 DMProjectLocal_Generic_Plex() >> line 347 in >> >? ? ?>? ? ?> >> ?/h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c >> >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: #2 DMProjectFunctionLocal_Plex() >> line 428 in >> >? ? ?>? ? ?> >> ?/h/sabriel0/src/petsc-3.9.2/src/dm/impls/plex/plexproject.c >> >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: #3 DMProjectFunctionLocal() line >> 6265 in >> >? ? ?>? ? ?>? ? ?/h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c >> >? ? ?>? ? ?>? ? ?[0]PETSC ERROR: #4 DMProjectFunction() line 6250 in >> >? ? ?>? ? ?>? ? ?/h/sabriel0/src/petsc-3.9.2/src/dm/interface/dm.c >> >? ? ?>? ? ?>? ? ?... >> >? ? ?>? ? ?> >> >? ? ?>? ? ?>? ? ?(I know this is an optimized PETSc build, but I >> get the same >> >? ? ?>? ? ?error from >> >? ? ?>? ? ?>? ? ?my debug build, it's just much slower.) >> >? ? ?>? ? ?> >> >? ? ?>? ? ?>? ? ?Ellen >> >? ? ?>? ? ?> >> >? ? ?>? ? ?> >> >? ? ?>? ? ?> >> >? ? ?>? ? ?> -- >> >? ? ?>? ? ?> 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 >> >? ? ?>? ? ?> >> >? ? ?>? ? ?> https://www.cse.buffalo.edu/~knepley/ >> >> >? ? ? >> >? ? ?>? ? ? >> >? ? ?>? ? ?> >> >? ? ?> >> >? ? ?> >> >? ? ?> >> >? ? ?> -- >> >? ? ?> 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 >> >? ? ?> >> >? ? ?> https://www.cse.buffalo.edu/~knepley/ >> >> >? ? ? >> >? ? ?> >> > >> > >> > >> > -- >> > 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 >> > >> > https://www.cse.buffalo.edu/~knepley/ >> >> > >> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> -------------- next part -------------- A non-text attachment was scrubbed... Name: dmload.c Type: text/x-csrc Size: 15415 bytes Desc: not available URL: From zakaryah at gmail.com Sun Oct 14 14:55:19 2018 From: zakaryah at gmail.com (zakaryah) Date: Sun, 14 Oct 2018 15:55:19 -0400 Subject: [petsc-users] Implementing FEM with PLEX/DS/SNES In-Reply-To: References: Message-ID: Hi Matt, > Can you explain more about this source term? It sounds like a bunch of >> > delta functions. That >> > would still work in this framework, but the convergence rate for a rhs >> > with these singularities >> > is reduced (this is a generic feature of FEM). >> > Can you elaborate on this, or suggest references? In the context of elasticity, does this mean that convergence for problems using node forces us generally worse than with the equivalent body forces? Thanks! > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Sun Oct 14 18:13:22 2018 From: knepley at gmail.com (Matthew Knepley) Date: Sun, 14 Oct 2018 19:13:22 -0400 Subject: [petsc-users] Implementing FEM with PLEX/DS/SNES In-Reply-To: References: Message-ID: On Sun, Oct 14, 2018 at 3:56 PM zakaryah wrote: > Hi Matt, > > > Can you explain more about this source term? It sounds like a bunch of >>> > delta functions. That >>> > would still work in this framework, but the convergence rate for a rhs >>> > with these singularities >>> > is reduced (this is a generic feature of FEM). >>> >> > Can you elaborate on this, or suggest references? In the context of > elasticity, does this mean that convergence for problems using node forces > us generally worse than with the equivalent body forces? Thanks! > >> Think of the simplest example, which is a Laplacian with a delta function source. The solution is the Green's function 1/r. This is singular at the origin (and not in the FEM space), and the standard FEM bases are bad at approximating 1/r near the origin. Babuska has a bunch of papers on this. Now what does "worse" mean in the context of node forces vs tractions? It means that the convergence of your computed solution, as you refine the mesh, is slower to the true solution of the node forces problem then it is to the true solution of the tractions problem. 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From zakaryah at gmail.com Sun Oct 14 20:04:47 2018 From: zakaryah at gmail.com (zakaryah) Date: Sun, 14 Oct 2018 21:04:47 -0400 Subject: [petsc-users] Implementing FEM with PLEX/DS/SNES In-Reply-To: References: Message-ID: Thanks Matt - this is very helpful. On Sun, Oct 14, 2018, 7:13 PM Matthew Knepley wrote: > On Sun, Oct 14, 2018 at 3:56 PM zakaryah wrote: > >> Hi Matt, >> >> > Can you explain more about this source term? It sounds like a bunch of >>>> > delta functions. That >>>> > would still work in this framework, but the convergence rate for a rhs >>>> > with these singularities >>>> > is reduced (this is a generic feature of FEM). >>>> >>> >> Can you elaborate on this, or suggest references? In the context of >> elasticity, does this mean that convergence for problems using node forces >> us generally worse than with the equivalent body forces? Thanks! >> >>> > Think of the simplest example, which is a Laplacian with a delta function > source. The solution is the Green's function 1/r. > This is singular at the origin (and not in the FEM space), and the > standard FEM bases are bad at approximating 1/r near the origin. > Babuska has a bunch of papers on this. Now what does "worse" mean in the > context of node forces vs tractions? It means that the > convergence of your computed solution, as you refine the mesh, is slower > to the true solution of the node forces problem then it is > to the true solution of the tractions problem. > > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yjwu16 at gmail.com Mon Oct 15 09:41:27 2018 From: yjwu16 at gmail.com (Yingjie Wu) Date: Mon, 15 Oct 2018 22:41:27 +0800 Subject: [petsc-users] Some Problems in Modifying Parallel Programs Message-ID: Dear Petsc developer: Hi, Thank you very much for your previous reply. I recently wanted to modify my program to parallel version, and encountered some problems in modifying it. 1. There are functions (read matrix) in the program that reads files,will they affect my parallelism? The codes are as follows: ierr = PetscViewerBinaryOpen (PETSC_COMM_WORLD, file, FILE_MODE_READ, &viewer); CHKERRQ (ierr); ierr = MatCreate (PETSC_COMM_WORLD, &A1); CHKERRQ (ierr); ierr = MatSetFromOptions (A1); CHKERRQ (ierr); ierr = MatCreate (PETSC_COMM_WORLD, &A2); CHKERRQ (ierr); ierr = MatSetFromOptions (A2); CHKERRQ (ierr); ierr = MatLoad (A1, viewer); CHKERRQ (ierr); ierr = MatLoad (A2, viewer); CHKERRQ (ierr); ierr = PetscViewerDestroy (&viewer); CHKERRQ (ierr); I read two matrix information from a binary file and wanted to use it on each processor (in fact, my goal was to use these two matrices to give initial values to the two field variables). The program can run in serial time. Now I want to change it to parallel program. What do I need to modify? 2. Following the last question, I used the following code in giving initial value procedure FormInitialGuess(): ierr = MatSeqAIJGetArray (A1, &initial_phi1); CHKERRQ (ierr); ierr = MatSeqAIJGetArray (A2, &initial_phi2); CHKERRQ (ierr); I found this function on manualpages, and I felt that it could fulfill my need to represent the elements of the matrix in arrays to give field variables an initial value in each grid. The matrix A1 and A2 above are actually the matrix information that was read from the file before. Now I want to modify it as a parallel program. How do I use matrix information to give initial values in parallel? (In program, field variables are implemented through DM because parallel computing and Ghost Value are supported) Thanks, Yingjie -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Mon Oct 15 09:52:39 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 15 Oct 2018 10:52:39 -0400 Subject: [petsc-users] Some Problems in Modifying Parallel Programs In-Reply-To: References: Message-ID: On Mon, Oct 15, 2018 at 10:42 AM Yingjie Wu wrote: > Dear Petsc developer: > Hi, > Thank you very much for your previous reply. > I recently wanted to modify my program to parallel version, and > encountered some problems in modifying it. > 1. There are functions (read matrix) in the program that reads files,will > they affect my parallelism? > No, MatLoad works in parallel. This will work unchanged if you want the default layout. If you want a special partition, you must call MatSetSizes() after MatCreate(). > The codes are as follows: > > ierr = PetscViewerBinaryOpen (PETSC_COMM_WORLD, file, FILE_MODE_READ, > &viewer); CHKERRQ (ierr); > ierr = MatCreate (PETSC_COMM_WORLD, &A1); CHKERRQ (ierr); > ierr = MatSetFromOptions (A1); CHKERRQ (ierr); > ierr = MatCreate (PETSC_COMM_WORLD, &A2); CHKERRQ (ierr); > ierr = MatSetFromOptions (A2); CHKERRQ (ierr); > ierr = MatLoad (A1, viewer); CHKERRQ (ierr); > ierr = MatLoad (A2, viewer); CHKERRQ (ierr); > ierr = PetscViewerDestroy (&viewer); CHKERRQ (ierr); > > I read two matrix information from a binary file and wanted to use it on > each processor (in fact, my goal was to use these two matrices to give > initial values to the two field variables). The program can run in serial > time. Now I want to change it to parallel program. What do I need to > modify? > 2. Following the last question, I used the following code in giving > initial value procedure FormInitialGuess(): > > ierr = MatSeqAIJGetArray (A1, &initial_phi1); CHKERRQ (ierr); > ierr = MatSeqAIJGetArray (A2, &initial_phi2); CHKERRQ (ierr); > > I found this function on manualpages, and I felt that it could fulfill my > need to represent the elements of the matrix in arrays to give field > variables an initial value in each grid. The matrix A1 and A2 above are > actually the matrix information that was read from the file before. Now I > want to modify it as a parallel program. How do I use matrix information to > give initial values in parallel? (In program, field variables are > implemented through DM because parallel computing and Ghost Value are > supported) > I do not understand the use of matrices to initialize field values. Usually field values are stored on Vec objects, and this is the philosophy of DM objects. Thanks, Matt > Thanks, > Yingjie > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From yjwu16 at gmail.com Mon Oct 15 10:12:54 2018 From: yjwu16 at gmail.com (Yingjie Wu) Date: Mon, 15 Oct 2018 23:12:54 +0800 Subject: [petsc-users] Some Problems in Modifying Parallel Programs In-Reply-To: References: Message-ID: Thank you very much, Matt. My problem is actually a two-dimensional problem, and the matrix in my binary file is actually a two-dimensional array, each point corresponding to a value on the two-dimensional grid. Your suggestion is very useful to me. I can try to convert the matrix binary file into a vector binary file to give program an initial value. So what I should do is: 1. establish parallel vectors. 2. reads data from binary files to vectors. (VecLoad()) 3. use VecGetArray() in FormInitialGuess() to use vector elements to give the initial values of the field variables. I know DM can support parallel computing (domain decomposition). How can I ensure that the part of the vector built on each processor corresponds to the index of DM object? (Cause my field variables are established by DMDACreate2d, and I want to assign initial values to field variables using read vectors ) Thanks, Yingjie Matthew Knepley ?2018?10?15??? ??10:52??? > On Mon, Oct 15, 2018 at 10:42 AM Yingjie Wu wrote: > >> Dear Petsc developer: >> Hi, >> Thank you very much for your previous reply. >> I recently wanted to modify my program to parallel version, and >> encountered some problems in modifying it. >> 1. There are functions (read matrix) in the program that reads files,will >> they affect my parallelism? >> > > No, MatLoad works in parallel. This will work unchanged if you want the > default layout. If you want a special partition, > you must call MatSetSizes() after MatCreate(). > > >> The codes are as follows: >> >> ierr = PetscViewerBinaryOpen (PETSC_COMM_WORLD, file, FILE_MODE_READ, >> &viewer); CHKERRQ (ierr); >> ierr = MatCreate (PETSC_COMM_WORLD, &A1); CHKERRQ (ierr); >> ierr = MatSetFromOptions (A1); CHKERRQ (ierr); >> ierr = MatCreate (PETSC_COMM_WORLD, &A2); CHKERRQ (ierr); >> ierr = MatSetFromOptions (A2); CHKERRQ (ierr); >> ierr = MatLoad (A1, viewer); CHKERRQ (ierr); >> ierr = MatLoad (A2, viewer); CHKERRQ (ierr); >> ierr = PetscViewerDestroy (&viewer); CHKERRQ (ierr); >> >> I read two matrix information from a binary file and wanted to use it on >> each processor (in fact, my goal was to use these two matrices to give >> initial values to the two field variables). The program can run in serial >> time. Now I want to change it to parallel program. What do I need to >> modify? >> 2. Following the last question, I used the following code in giving >> initial value procedure FormInitialGuess(): >> >> ierr = MatSeqAIJGetArray (A1, &initial_phi1); CHKERRQ (ierr); >> ierr = MatSeqAIJGetArray (A2, &initial_phi2); CHKERRQ (ierr); >> >> I found this function on manualpages, and I felt that it could fulfill my >> need to represent the elements of the matrix in arrays to give field >> variables an initial value in each grid. The matrix A1 and A2 above are >> actually the matrix information that was read from the file before. Now I >> want to modify it as a parallel program. How do I use matrix information to >> give initial values in parallel? (In program, field variables are >> implemented through DM because parallel computing and Ghost Value are >> supported) >> > > I do not understand the use of matrices to initialize field values. > Usually field values are stored on Vec objects, and this is > the philosophy of DM objects. > > Thanks, > > Matt > > >> Thanks, >> Yingjie >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Mon Oct 15 10:32:09 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 15 Oct 2018 11:32:09 -0400 Subject: [petsc-users] Some Problems in Modifying Parallel Programs In-Reply-To: References: Message-ID: On Mon, Oct 15, 2018 at 11:13 AM Yingjie Wu wrote: > Thank you very much, Matt. > > My problem is actually a two-dimensional problem, and the matrix in my > binary file is actually a two-dimensional array, each point corresponding > to a value on the two-dimensional grid. > These are still vectors. Vec store fields, which gives values to points on your grid. Matrices map between states, so between vectors. > Your suggestion is very useful to me. I can try to convert the matrix > binary file into a vector binary file to give program an initial value. So > what I should do is: > 1. establish parallel vectors. > 2. reads data from binary files to vectors. (VecLoad()) > 3. use VecGetArray() in FormInitialGuess() to use vector elements to give > the initial values of the field variables. > I know DM can support parallel computing (domain decomposition). How can I > ensure that the part of the vector built on each processor corresponds to > the index of DM object? (Cause my field variables are established by > DMDACreate2d, and I want to assign initial values to field variables using > read vectors ) > Yes. Many times you will want to VecLoad, then DMGlobalToLocal() to get ghosted vectors, then DMVecGetArray() to get ghosted arrays. Matt > > Thanks, > Yingjie > > Matthew Knepley ?2018?10?15??? ??10:52??? > >> On Mon, Oct 15, 2018 at 10:42 AM Yingjie Wu wrote: >> >>> Dear Petsc developer: >>> Hi, >>> Thank you very much for your previous reply. >>> I recently wanted to modify my program to parallel version, and >>> encountered some problems in modifying it. >>> 1. There are functions (read matrix) in the program that reads >>> files,will they affect my parallelism? >>> >> >> No, MatLoad works in parallel. This will work unchanged if you want the >> default layout. If you want a special partition, >> you must call MatSetSizes() after MatCreate(). >> >> >>> The codes are as follows: >>> >>> ierr = PetscViewerBinaryOpen (PETSC_COMM_WORLD, file, FILE_MODE_READ, >>> &viewer); CHKERRQ (ierr); >>> ierr = MatCreate (PETSC_COMM_WORLD, &A1); CHKERRQ (ierr); >>> ierr = MatSetFromOptions (A1); CHKERRQ (ierr); >>> ierr = MatCreate (PETSC_COMM_WORLD, &A2); CHKERRQ (ierr); >>> ierr = MatSetFromOptions (A2); CHKERRQ (ierr); >>> ierr = MatLoad (A1, viewer); CHKERRQ (ierr); >>> ierr = MatLoad (A2, viewer); CHKERRQ (ierr); >>> ierr = PetscViewerDestroy (&viewer); CHKERRQ (ierr); >>> >>> I read two matrix information from a binary file and wanted to use it on >>> each processor (in fact, my goal was to use these two matrices to give >>> initial values to the two field variables). The program can run in serial >>> time. Now I want to change it to parallel program. What do I need to >>> modify? >>> 2. Following the last question, I used the following code in giving >>> initial value procedure FormInitialGuess(): >>> >>> ierr = MatSeqAIJGetArray (A1, &initial_phi1); CHKERRQ (ierr); >>> ierr = MatSeqAIJGetArray (A2, &initial_phi2); CHKERRQ (ierr); >>> >>> >>> I found this function on manualpages, and I felt that it could fulfill >>> my need to represent the elements of the matrix in arrays to give field >>> variables an initial value in each grid. The matrix A1 and A2 above are >>> actually the matrix information that was read from the file before. Now I >>> want to modify it as a parallel program. How do I use matrix information to >>> give initial values in parallel? (In program, field variables are >>> implemented through DM because parallel computing and Ghost Value are >>> supported) >>> >> >> I do not understand the use of matrices to initialize field values. >> Usually field values are stored on Vec objects, and this is >> the philosophy of DM objects. >> >> Thanks, >> >> Matt >> >> >>> Thanks, >>> Yingjie >>> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.mayhem23 at gmail.com Mon Oct 15 10:38:45 2018 From: dave.mayhem23 at gmail.com (Dave May) Date: Mon, 15 Oct 2018 17:38:45 +0200 Subject: [petsc-users] Some Problems in Modifying Parallel Programs In-Reply-To: References: Message-ID: On Mon, 15 Oct 2018 at 16:54, Matthew Knepley wrote: > On Mon, Oct 15, 2018 at 10:42 AM Yingjie Wu wrote: > >> Dear Petsc developer: >> Hi, >> Thank you very much for your previous reply. >> I recently wanted to modify my program to parallel version, and >> encountered some problems in modifying it. >> 1. There are functions (read matrix) in the program that reads files,will >> they affect my parallelism? >> > > No, MatLoad works in parallel. This will work unchanged if you want the > default layout. If you want a special partition, > you must call MatSetSizes() after MatCreate(). > > >> The codes are as follows: >> >> ierr = PetscViewerBinaryOpen (PETSC_COMM_WORLD, file, FILE_MODE_READ, >> &viewer); CHKERRQ (ierr); >> ierr = MatCreate (PETSC_COMM_WORLD, &A1); CHKERRQ (ierr); >> ierr = MatSetFromOptions (A1); CHKERRQ (ierr); >> ierr = MatCreate (PETSC_COMM_WORLD, &A2); CHKERRQ (ierr); >> ierr = MatSetFromOptions (A2); CHKERRQ (ierr); >> ierr = MatLoad (A1, viewer); CHKERRQ (ierr); >> ierr = MatLoad (A2, viewer); CHKERRQ (ierr); >> ierr = PetscViewerDestroy (&viewer); CHKERRQ (ierr); >> >> I read two matrix information from a binary file and wanted to use it on >> each processor (in fact, my goal was to use these two matrices to give >> initial values to the two field variables). The program can run in serial >> time. Now I want to change it to parallel program. What do I need to >> modify? >> 2. Following the last question, I used the following code in giving >> initial value procedure FormInitialGuess(): >> >> ierr = MatSeqAIJGetArray (A1, &initial_phi1); CHKERRQ (ierr); >> ierr = MatSeqAIJGetArray (A2, &initial_phi2); CHKERRQ (ierr); >> >> I found this function on manualpages, and I felt that it could fulfill my >> need to represent the elements of the matrix in arrays to give field >> variables an initial value in each grid. The matrix A1 and A2 above are >> actually the matrix information that was read from the file before. Now I >> want to modify it as a parallel program. How do I use matrix information to >> give initial values in parallel? (In program, field variables are >> implemented through DM because parallel computing and Ghost Value are >> supported) >> > > I do not understand the use of matrices to initialize field values. > Usually field values are stored on Vec objects, and this is > the philosophy of DM objects. > Maybe this is a "matlab style" idea / way of thinking, e.g. representing 2d meshes and fields as matrices because they "look kinda the same....". If that is the case - don't do it! Use vectors to represent fields > Thanks, > > Matt > > >> Thanks, >> Yingjie >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yjwu16 at gmail.com Mon Oct 15 11:03:03 2018 From: yjwu16 at gmail.com (Yingjie Wu) Date: Tue, 16 Oct 2018 00:03:03 +0800 Subject: [petsc-users] Some Problems in Modifying Parallel Programs In-Reply-To: References: Message-ID: Thanks,Matt I'm sorry I didn't describe the problem clearly. I'm still wondering how, although VecLoad supports parallel vector reading, how can I guarantee that the local vector on the processor corresponds to the DM's IS? For example, when in FormInitialGuess, I want to make sure that the array VecGetArray() obtained by the local vector(Vectors read from binary files) and the array DMGlobalToLocal () DMVecGetArray () obtained by the DM belong to the same processor, so that some errors in the mpi can be avoided. Thanks, Yingjie Matthew Knepley ?2018?10?15??? ??11:32??? > On Mon, Oct 15, 2018 at 11:13 AM Yingjie Wu wrote: > >> Thank you very much, Matt. >> >> My problem is actually a two-dimensional problem, and the matrix in my >> binary file is actually a two-dimensional array, each point corresponding >> to a value on the two-dimensional grid. >> > > These are still vectors. Vec store fields, which gives values to points on > your grid. Matrices map between states, so between vectors. > > >> Your suggestion is very useful to me. I can try to convert the matrix >> binary file into a vector binary file to give program an initial value. So >> what I should do is: >> 1. establish parallel vectors. >> 2. reads data from binary files to vectors. (VecLoad()) >> 3. use VecGetArray() in FormInitialGuess() to use vector elements to give >> the initial values of the field variables. >> I know DM can support parallel computing (domain decomposition). How can >> I ensure that the part of the vector built on each processor corresponds to >> the index of DM object? (Cause my field variables are established by >> DMDACreate2d, and I want to assign initial values to field variables using >> read vectors ) >> > > Yes. Many times you will want to VecLoad, then DMGlobalToLocal() to get > ghosted vectors, then DMVecGetArray() to get ghosted arrays. > > Matt > > >> >> Thanks, >> Yingjie >> >> Matthew Knepley ?2018?10?15??? ??10:52??? >> >>> On Mon, Oct 15, 2018 at 10:42 AM Yingjie Wu wrote: >>> >>>> Dear Petsc developer: >>>> Hi, >>>> Thank you very much for your previous reply. >>>> I recently wanted to modify my program to parallel version, and >>>> encountered some problems in modifying it. >>>> 1. There are functions (read matrix) in the program that reads >>>> files,will they affect my parallelism? >>>> >>> >>> No, MatLoad works in parallel. This will work unchanged if you want the >>> default layout. If you want a special partition, >>> you must call MatSetSizes() after MatCreate(). >>> >>> >>>> The codes are as follows: >>>> >>>> ierr = PetscViewerBinaryOpen (PETSC_COMM_WORLD, file, FILE_MODE_READ, >>>> &viewer); CHKERRQ (ierr); >>>> ierr = MatCreate (PETSC_COMM_WORLD, &A1); CHKERRQ (ierr); >>>> ierr = MatSetFromOptions (A1); CHKERRQ (ierr); >>>> ierr = MatCreate (PETSC_COMM_WORLD, &A2); CHKERRQ (ierr); >>>> ierr = MatSetFromOptions (A2); CHKERRQ (ierr); >>>> ierr = MatLoad (A1, viewer); CHKERRQ (ierr); >>>> ierr = MatLoad (A2, viewer); CHKERRQ (ierr); >>>> ierr = PetscViewerDestroy (&viewer); CHKERRQ (ierr); >>>> >>>> I read two matrix information from a binary file and wanted to use it >>>> on each processor (in fact, my goal was to use these two matrices to give >>>> initial values to the two field variables). The program can run in serial >>>> time. Now I want to change it to parallel program. What do I need to >>>> modify? >>>> 2. Following the last question, I used the following code in giving >>>> initial value procedure FormInitialGuess(): >>>> >>>> ierr = MatSeqAIJGetArray (A1, &initial_phi1); CHKERRQ (ierr); >>>> >>>> ierr = MatSeqAIJGetArray (A2, &initial_phi2); CHKERRQ (ierr); >>>> >>>> >>>> I found this function on manualpages, and I felt that it could fulfill >>>> my need to represent the elements of the matrix in arrays to give field >>>> variables an initial value in each grid. The matrix A1 and A2 above are >>>> actually the matrix information that was read from the file before. Now I >>>> want to modify it as a parallel program. How do I use matrix information to >>>> give initial values in parallel? (In program, field variables are >>>> implemented through DM because parallel computing and Ghost Value are >>>> supported) >>>> >>> >>> I do not understand the use of matrices to initialize field values. >>> Usually field values are stored on Vec objects, and this is >>> the philosophy of DM objects. >>> >>> Thanks, >>> >>> Matt >>> >>> >>>> Thanks, >>>> Yingjie >>>> >>> >>> >>> -- >>> 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 >>> >>> https://www.cse.buffalo.edu/~knepley/ >>> >>> >> > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Mon Oct 15 11:47:53 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 15 Oct 2018 12:47:53 -0400 Subject: [petsc-users] Some Problems in Modifying Parallel Programs In-Reply-To: References: Message-ID: On Mon, Oct 15, 2018 at 12:03 PM Yingjie Wu wrote: > Thanks,Matt > > I'm sorry I didn't describe the problem clearly. > I'm still wondering how, although VecLoad supports parallel vector > reading, how can I guarantee that the local vector on the processor > corresponds to the DM's IS? > For example, when in FormInitialGuess, I want to make sure that the array > VecGetArray() obtained by the local vector(Vectors read from binary files) > and the array DMGlobalToLocal () DMVecGetArray () obtained by the DM > belong to the same processor, so that some errors in the mpi can be avoided. > I think I understand your question. If you give in a Vec in natural ordering, you can use VecLoad with a Vec you get from DMCreateGlobalVector(), and it will automatically reorder it into the right parallel ordering. Thanks, Matt > Thanks, > Yingjie > > Matthew Knepley ?2018?10?15??? ??11:32??? > >> On Mon, Oct 15, 2018 at 11:13 AM Yingjie Wu wrote: >> >>> Thank you very much, Matt. >>> >>> My problem is actually a two-dimensional problem, and the matrix in my >>> binary file is actually a two-dimensional array, each point corresponding >>> to a value on the two-dimensional grid. >>> >> >> These are still vectors. Vec store fields, which gives values to points >> on your grid. Matrices map between states, so between vectors. >> >> >>> Your suggestion is very useful to me. I can try to convert the matrix >>> binary file into a vector binary file to give program an initial value. So >>> what I should do is: >>> 1. establish parallel vectors. >>> 2. reads data from binary files to vectors. (VecLoad()) >>> 3. use VecGetArray() in FormInitialGuess() to use vector elements to >>> give the initial values of the field variables. >>> I know DM can support parallel computing (domain decomposition). How can >>> I ensure that the part of the vector built on each processor corresponds to >>> the index of DM object? (Cause my field variables are established by >>> DMDACreate2d, and I want to assign initial values to field variables using >>> read vectors ) >>> >> >> Yes. Many times you will want to VecLoad, then DMGlobalToLocal() to get >> ghosted vectors, then DMVecGetArray() to get ghosted arrays. >> >> Matt >> >> >>> >>> Thanks, >>> Yingjie >>> >>> Matthew Knepley ?2018?10?15??? ??10:52??? >>> >>>> On Mon, Oct 15, 2018 at 10:42 AM Yingjie Wu wrote: >>>> >>>>> Dear Petsc developer: >>>>> Hi, >>>>> Thank you very much for your previous reply. >>>>> I recently wanted to modify my program to parallel version, and >>>>> encountered some problems in modifying it. >>>>> 1. There are functions (read matrix) in the program that reads >>>>> files,will they affect my parallelism? >>>>> >>>> >>>> No, MatLoad works in parallel. This will work unchanged if you want the >>>> default layout. If you want a special partition, >>>> you must call MatSetSizes() after MatCreate(). >>>> >>>> >>>>> The codes are as follows: >>>>> >>>>> ierr = PetscViewerBinaryOpen (PETSC_COMM_WORLD, file, FILE_MODE_READ, >>>>> &viewer); CHKERRQ (ierr); >>>>> ierr = MatCreate (PETSC_COMM_WORLD, &A1); CHKERRQ (ierr); >>>>> ierr = MatSetFromOptions (A1); CHKERRQ (ierr); >>>>> ierr = MatCreate (PETSC_COMM_WORLD, &A2); CHKERRQ (ierr); >>>>> ierr = MatSetFromOptions (A2); CHKERRQ (ierr); >>>>> ierr = MatLoad (A1, viewer); CHKERRQ (ierr); >>>>> ierr = MatLoad (A2, viewer); CHKERRQ (ierr); >>>>> ierr = PetscViewerDestroy (&viewer); CHKERRQ (ierr); >>>>> >>>>> I read two matrix information from a binary file and wanted to use it >>>>> on each processor (in fact, my goal was to use these two matrices to give >>>>> initial values to the two field variables). The program can run in serial >>>>> time. Now I want to change it to parallel program. What do I need to >>>>> modify? >>>>> 2. Following the last question, I used the following code in giving >>>>> initial value procedure FormInitialGuess(): >>>>> >>>>> ierr = MatSeqAIJGetArray (A1, &initial_phi1); CHKERRQ (ierr); >>>>> >>>>> ierr = MatSeqAIJGetArray (A2, &initial_phi2); CHKERRQ (ierr); >>>>> >>>>> >>>>> I found this function on manualpages, and I felt that it could fulfill >>>>> my need to represent the elements of the matrix in arrays to give field >>>>> variables an initial value in each grid. The matrix A1 and A2 above are >>>>> actually the matrix information that was read from the file before. Now I >>>>> want to modify it as a parallel program. How do I use matrix information to >>>>> give initial values in parallel? (In program, field variables are >>>>> implemented through DM because parallel computing and Ghost Value are >>>>> supported) >>>>> >>>> >>>> I do not understand the use of matrices to initialize field values. >>>> Usually field values are stored on Vec objects, and this is >>>> the philosophy of DM objects. >>>> >>>> Thanks, >>>> >>>> Matt >>>> >>>> >>>>> Thanks, >>>>> Yingjie >>>>> >>>> >>>> >>>> -- >>>> 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 >>>> >>>> https://www.cse.buffalo.edu/~knepley/ >>>> >>>> >>> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mvalera-w at sdsu.edu Mon Oct 15 16:22:02 2018 From: mvalera-w at sdsu.edu (Manuel Valera) Date: Mon, 15 Oct 2018 14:22:02 -0700 Subject: [petsc-users] Fwd: Interpolation in staggered grid In-Reply-To: References: Message-ID: Thanks Matthew, i have made some progress but i am still unsure on how to proceed to make the DMDAs work as intended, i will try to lay out what i am trying now: I was able to port the interpolation into the DMDA model but it works only in serial runs, and it becomes unstable for more than one processor running, What i do is roughly this: - Calculate density at a cell-centered DMDA object, using a local vector so i can access the ghost rows (indices -1 and max+1) - Interpolate into a face-centered DMDA object for velocities, using also a local vector. Doing this i get the right results using the same interpolation i used for my non-petsc implementation of the model, as long as i use only one processor but the doubts i have are: - How to use the local vectors properly: Is operating on them the recommended course in this case? - How can i access the ghost indices in the global vector so i can then communicate GlobalToLocal? would this be a better strategy? - I feel is wrong to interpolate a cell-centered based vector into a face-centered based vector, using the indices of the latter, what strategy would work best in this case? I also tried opening a global vector with a different DA layout than the one created (opening global density on the velocities DMDA layout) and this introduced an error in the GlobalToLocal, LocalToLocal, LocalToGlobal communication, something didn't happen if i used the local versions of these vectors instead, Thanks for your help, Manuel On Sat, Oct 6, 2018 at 4:45 AM Matthew Knepley wrote: > On Fri, Oct 5, 2018 at 6:49 PM Manuel Valera wrote: > >> Hello, >> >> I'm trying to do a simple variable interpolation, from a cell center to a >> face in a staggered grid, my model data management is done with DMDAs, with >> two different DMs one for each cell position, >> >> I already did this task on a fortran only version of the model using the >> 4 closest neighbors of the scalars (cell center) to be interpolated at the >> velocity site (cell face), i did it using a loop over the domain, somehow >> this easy task is not translating into the DMDA framework, >> > > Its not clear to me what problem you are having. We have done this before. > For example, > > > https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex30.c.html > > I would note that the development version of PETSc now has DMStag which > supports staggered grid discretizations directly. > > Thanks, > > Matt > > >> I'm not sure what I'm doing wrong or not aware of a easier way Petsc may >> have for this task, if you could point out an easier strategy or an example >> I would be grateful, >> >> Thanks, >> >> >> >> >> > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From popov at uni-mainz.de Tue Oct 16 02:56:47 2018 From: popov at uni-mainz.de (Anton Popov) Date: Tue, 16 Oct 2018 09:56:47 +0200 Subject: [petsc-users] Fwd: Interpolation in staggered grid In-Reply-To: References: Message-ID: <63a76b79-e51b-74df-6282-72477e11ec0e@uni-mainz.de> Hi Manuel, you might consider useful taking a look at this code https://bitbucket.org/bkaus/lamem, which is a multi-DMDA staggered grid implementation. Also, as Matt pointed out, there is a direct PETSc support for staggered grids (DMSTAG), recently contributed by Patrick Sanan. Thanks, Anton On 15.10.2018 23:22, Manuel Valera wrote: > > Thanks Matthew, i have made some progress but i am still unsure on how > to proceed to make the DMDAs work as intended, i will try to lay out > what i am trying now: > > I was able to port the interpolation into the DMDA model but it works > only in serial runs, and it becomes unstable for more than one > processor running, > > What i do is roughly this: > > * Calculate density at a cell-centered DMDA object, using a local > vector so i can access the ghost rows (indices -1 and max+1) > * Interpolate into a face-centered DMDA object for velocities, using > also a local vector. > > Doing this i get the right results using the same interpolation i used > for my non-petsc implementation of the model, as long as i use only > one processor but the doubts i have are: > > * How to use the local vectors properly: Is operating on them the > recommended course in this case? > * How can i access the ghost indices in the global vector so i can > then communicate GlobalToLocal? would this be a better strategy? > * I feel is wrong to interpolate a cell-centered based vector into a > face-centered based vector, using the indices of the latter, what > strategy would work best in this case? > > I also tried opening a global vector with a different DA layout than > the one created (opening global density on the velocities DMDA layout) > and this introduced an error in the GlobalToLocal, LocalToLocal, > LocalToGlobal communication, something didn't happen if i used the > local versions of these vectors instead, > > Thanks for your help, > > Manuel > > > > > > On Sat, Oct 6, 2018 at 4:45 AM Matthew Knepley > wrote: > > On Fri, Oct 5, 2018 at 6:49 PM Manuel Valera > wrote: > > Hello, > > I'm trying to do a simple variable interpolation, from a cell > center to a face in a staggered grid, my model data management > is done with DMDAs, with two different DMs one for each cell > position, > > I already did this task on a fortran only version of the model > using the 4 closest neighbors of the scalars (cell center) to > be interpolated at the velocity site (cell face), i did it > using a loop over the domain, somehow this easy task is not > translating into the DMDA framework, > > > Its not clear to me what problem you are having. We have done this > before. For example, > > https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex30.c.html > > I would note that the development version of PETSc now has DMStag > which supports staggered grid discretizations directly. > > ? Thanks, > > ? ? Matt > > I'm not sure what I'm doing wrong or not aware of a easier way > Petsc may have for this task, if you could point out an easier > strategy or an example I would be grateful, > > Thanks, > > > > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Tue Oct 16 05:06:27 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 16 Oct 2018 06:06:27 -0400 Subject: [petsc-users] Fwd: Interpolation in staggered grid In-Reply-To: <63a76b79-e51b-74df-6282-72477e11ec0e@uni-mainz.de> References: <63a76b79-e51b-74df-6282-72477e11ec0e@uni-mainz.de> Message-ID: On Tue, Oct 16, 2018 at 3:57 AM Anton Popov wrote: > Hi Manuel, > > you might consider useful taking a look at this code > https://bitbucket.org/bkaus/lamem, which is a multi-DMDA staggered grid > implementation. > > Also, as Matt pointed out, there is a direct PETSc support for staggered > grids (DMSTAG), recently contributed by Patrick Sanan. > > Anton is right, LaMeM is a great example. Did you also have a look at SNES ex30? It is staggered grid FV and works in parallel. Thanks, Matt > Thanks, > > Anton > > On 15.10.2018 23:22, Manuel Valera wrote: > > > Thanks Matthew, i have made some progress but i am still unsure on how to > proceed to make the DMDAs work as intended, i will try to lay out what i am > trying now: > > I was able to port the interpolation into the DMDA model but it works only > in serial runs, and it becomes unstable for more than one processor running, > > What i do is roughly this: > > - Calculate density at a cell-centered DMDA object, using a local > vector so i can access the ghost rows (indices -1 and max+1) > - Interpolate into a face-centered DMDA object for velocities, using > also a local vector. > > Doing this i get the right results using the same interpolation i used for > my non-petsc implementation of the model, as long as i use only one > processor but the doubts i have are: > > - How to use the local vectors properly: Is operating on them the > recommended course in this case? > - How can i access the ghost indices in the global vector so i can > then communicate GlobalToLocal? would this be a better strategy? > - I feel is wrong to interpolate a cell-centered based vector into a > face-centered based vector, using the indices of the latter, what strategy > would work best in this case? > > I also tried opening a global vector with a different DA layout than the > one created (opening global density on the velocities DMDA layout) and this > introduced an error in the GlobalToLocal, LocalToLocal, LocalToGlobal > communication, something didn't happen if i used the local versions of > these vectors instead, > > Thanks for your help, > > Manuel > > > > > > On Sat, Oct 6, 2018 at 4:45 AM Matthew Knepley wrote: > >> On Fri, Oct 5, 2018 at 6:49 PM Manuel Valera wrote: >> >>> Hello, >>> >>> I'm trying to do a simple variable interpolation, from a cell center to >>> a face in a staggered grid, my model data management is done with DMDAs, >>> with two different DMs one for each cell position, >>> >>> I already did this task on a fortran only version of the model using the >>> 4 closest neighbors of the scalars (cell center) to be interpolated at the >>> velocity site (cell face), i did it using a loop over the domain, somehow >>> this easy task is not translating into the DMDA framework, >>> >> >> Its not clear to me what problem you are having. We have done this >> before. For example, >> >> >> https://www.mcs.anl.gov/petsc/petsc-current/src/snes/examples/tutorials/ex30.c.html >> >> I would note that the development version of PETSc now has DMStag which >> supports staggered grid discretizations directly. >> >> Thanks, >> >> Matt >> >> >>> I'm not sure what I'm doing wrong or not aware of a easier way Petsc may >>> have for this task, if you could point out an easier strategy or an example >>> I would be grateful, >>> >>> Thanks, >>> >>> >>> >>> >>> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From ysjosh.lo at gmail.com Tue Oct 16 11:30:15 2018 From: ysjosh.lo at gmail.com (Josh L) Date: Tue, 16 Oct 2018 11:30:15 -0500 Subject: [petsc-users] Gauss quadrature for triangle or tetrahedral element and Nature ordering Message-ID: Hi, Does anyone use PETSc to calculate the value determinant, basis function and the derivative of basis function at Gauss integration point? For quadrilateral element, I use PetscDTGaussQuadrature to get the location of integration point, and then use DMPlexComputeCellGeometryFEM to get the value of determinant. But I don't know how to do it for triangle element, and don't know how to use PETSc to calculate basis function and it's derivative? Is there anyway to get the mapping between nature ordering and global ordering for vertex number? Thanks, Josh -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Tue Oct 16 13:55:51 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 16 Oct 2018 14:55:51 -0400 Subject: [petsc-users] Gauss quadrature for triangle or tetrahedral element and Nature ordering In-Reply-To: References: Message-ID: On Tue, Oct 16, 2018 at 12:31 PM Josh L wrote: > Hi, > > Does anyone use PETSc to calculate the value determinant, basis function > and the derivative of basis function at Gauss integration point? > > For quadrilateral element, I use PetscDTGaussQuadrature to get the > location of integration point, and then use DMPlexComputeCellGeometryFEM to > get the value of determinant. > > But I don't know how to do it for triangle element, and don't know how to > use PETSc to calculate basis function and it's derivative? > > Is there anyway to get the mapping between nature ordering and global > ordering for vertex number? > The reason that it is a little disjointed is that we are in the process of converting from what I had previously done: https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DMPLEX/DMPlexComputeCellGeometryFEM.html to something which is much more flexible and nice https://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/DM/DMFieldCreateFEGeom.html You get the DMField object from PetscErrorCode DMGetCoordinateField(DM dm, DMField *field) which is sadly not documented yet, but just gives back the right thing. If the DMField stuff looks too new, you can just use the old code until the documentation catches up. Otherwise, feel free to mail DMField questions. The reason for DMField is that you can have very general things that can evaluate themselves (particles, Fourier bases, etc.) instead of just FEM. Thanks, Matt > Thanks, > Josh > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From weizhuo2 at illinois.edu Tue Oct 16 18:26:14 2018 From: weizhuo2 at illinois.edu (Weizhuo Wang) Date: Tue, 16 Oct 2018 18:26:14 -0500 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: Hello again! After some tweaking the code is giving right answers now. However it start to disagree with MATLAB results ('traditional' way using matrix inverse) when the grid is larger than 100*100. My PhD advisor and I suspects that the default dimension of the Krylov subspace is 100 in the test case we are running. If so, is there a way to increase the size of the subspace? [image: Disagrees.png] Thanks! Wang Weizhuo On Tue, Oct 9, 2018 at 2:50 AM Mark Adams wrote: > To reiterate what Matt is saying, you seem to have the exact solution on a > 10x10 grid. That makes no sense unless the solution can be represented > exactly by your FE space (eg, u(x,y) = x + y). > > On Mon, Oct 8, 2018 at 9:33 PM Matthew Knepley wrote: > >> On Mon, Oct 8, 2018 at 9:28 PM Weizhuo Wang >> wrote: >> >>> The code is attached in case anyone wants to take a look, I will try the >>> high frequency scenario later. >>> >> >> That is not the error. It is superconvergence at the vertices. The real >> solution is trigonometric, so your >> linear interpolants or whatever you use is not going to get the right >> value in between mesh points. You >> need to do a real integral over the whole interval to get the L_2 error. >> >> Thanks, >> >> Matt >> >> >>> On Mon, Oct 8, 2018 at 7:58 PM Mark Adams wrote: >>> >>>> >>>> >>>> On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang >>>> wrote: >>>> >>>>> The first plot is the norm with the flag -pc_type lu with respect to >>>>> number of grids in one axis (n), and the second plot is the norm without >>>>> the flag -pc_type lu. >>>>> >>>> >>>> So you are using the default PC w/o LU. The default is ILU. This will >>>> reduce high frequency effectively but is not effective on the low frequency >>>> error. Don't expect your algebraic error reduction to be at the same scale >>>> as the residual reduction (what KSP measures). >>>> >>>> >>>>> >>> >>> -- >>> Wang Weizhuo >>> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > -- Wang Weizhuo -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Disagrees.png Type: image/png Size: 81967 bytes Desc: not available URL: From knepley at gmail.com Tue Oct 16 20:05:47 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 16 Oct 2018 21:05:47 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: On Tue, Oct 16, 2018 at 7:26 PM Weizhuo Wang wrote: > Hello again! > > After some tweaking the code is giving right answers now. However it start > to disagree with MATLAB results ('traditional' way using matrix inverse) > when the grid is larger than 100*100. My PhD advisor and I suspects that > the default dimension of the Krylov subspace is 100 in the test case we are > running. If so, is there a way to increase the size of the subspace? > 1) The default subspace size is 30, not 100. You can increase the subspace size using -ksp_gmres_restart n 2) The problem is likely your tolerance. The default solver tolerance is 1e-5. You can change it using -ksp_rtol 1e-9 Thanks, Matt > > [image: Disagrees.png] > > Thanks! > > Wang Weizhuo > > On Tue, Oct 9, 2018 at 2:50 AM Mark Adams wrote: > >> To reiterate what Matt is saying, you seem to have the exact solution on >> a 10x10 grid. That makes no sense unless the solution can be represented >> exactly by your FE space (eg, u(x,y) = x + y). >> >> On Mon, Oct 8, 2018 at 9:33 PM Matthew Knepley wrote: >> >>> On Mon, Oct 8, 2018 at 9:28 PM Weizhuo Wang >>> wrote: >>> >>>> The code is attached in case anyone wants to take a look, I will try >>>> the high frequency scenario later. >>>> >>> >>> That is not the error. It is superconvergence at the vertices. The real >>> solution is trigonometric, so your >>> linear interpolants or whatever you use is not going to get the right >>> value in between mesh points. You >>> need to do a real integral over the whole interval to get the L_2 error. >>> >>> Thanks, >>> >>> Matt >>> >>> >>>> On Mon, Oct 8, 2018 at 7:58 PM Mark Adams wrote: >>>> >>>>> >>>>> >>>>> On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang >>>>> wrote: >>>>> >>>>>> The first plot is the norm with the flag -pc_type lu with respect to >>>>>> number of grids in one axis (n), and the second plot is the norm without >>>>>> the flag -pc_type lu. >>>>>> >>>>> >>>>> So you are using the default PC w/o LU. The default is ILU. This will >>>>> reduce high frequency effectively but is not effective on the low frequency >>>>> error. Don't expect your algebraic error reduction to be at the same scale >>>>> as the residual reduction (what KSP measures). >>>>> >>>>> >>>>>> >>>> >>>> -- >>>> Wang Weizhuo >>>> >>> >>> >>> -- >>> 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 >>> >>> https://www.cse.buffalo.edu/~knepley/ >>> >>> >> > > -- > Wang Weizhuo > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Disagrees.png Type: image/png Size: 81967 bytes Desc: not available URL: From weizhuo2 at illinois.edu Tue Oct 16 20:14:15 2018 From: weizhuo2 at illinois.edu (Weizhuo Wang) Date: Tue, 16 Oct 2018 20:14:15 -0500 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: I just tried both, neither of them make a difference. I got exactly the same curve with either combination. Thanks! Wang weizhuo On Tue, Oct 16, 2018 at 8:06 PM Matthew Knepley wrote: > On Tue, Oct 16, 2018 at 7:26 PM Weizhuo Wang > wrote: > >> Hello again! >> >> After some tweaking the code is giving right answers now. However it >> start to disagree with MATLAB results ('traditional' way using matrix >> inverse) when the grid is larger than 100*100. My PhD advisor and I >> suspects that the default dimension of the Krylov subspace is 100 in the >> test case we are running. If so, is there a way to increase the size of the >> subspace? >> > > 1) The default subspace size is 30, not 100. You can increase the subspace > size using > > -ksp_gmres_restart n > > 2) The problem is likely your tolerance. The default solver tolerance is > 1e-5. You can change it using > > -ksp_rtol 1e-9 > > Thanks, > > Matt > > >> >> [image: Disagrees.png] >> >> Thanks! >> >> Wang Weizhuo >> >> On Tue, Oct 9, 2018 at 2:50 AM Mark Adams wrote: >> >>> To reiterate what Matt is saying, you seem to have the exact solution on >>> a 10x10 grid. That makes no sense unless the solution can be represented >>> exactly by your FE space (eg, u(x,y) = x + y). >>> >>> On Mon, Oct 8, 2018 at 9:33 PM Matthew Knepley >>> wrote: >>> >>>> On Mon, Oct 8, 2018 at 9:28 PM Weizhuo Wang >>>> wrote: >>>> >>>>> The code is attached in case anyone wants to take a look, I will try >>>>> the high frequency scenario later. >>>>> >>>> >>>> That is not the error. It is superconvergence at the vertices. The real >>>> solution is trigonometric, so your >>>> linear interpolants or whatever you use is not going to get the right >>>> value in between mesh points. You >>>> need to do a real integral over the whole interval to get the L_2 error. >>>> >>>> Thanks, >>>> >>>> Matt >>>> >>>> >>>>> On Mon, Oct 8, 2018 at 7:58 PM Mark Adams wrote: >>>>> >>>>>> >>>>>> >>>>>> On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang >>>>>> wrote: >>>>>> >>>>>>> The first plot is the norm with the flag -pc_type lu with respect to >>>>>>> number of grids in one axis (n), and the second plot is the norm without >>>>>>> the flag -pc_type lu. >>>>>>> >>>>>> >>>>>> So you are using the default PC w/o LU. The default is ILU. This will >>>>>> reduce high frequency effectively but is not effective on the low frequency >>>>>> error. Don't expect your algebraic error reduction to be at the same scale >>>>>> as the residual reduction (what KSP measures). >>>>>> >>>>>> >>>>>>> >>>>> >>>>> -- >>>>> Wang Weizhuo >>>>> >>>> >>>> >>>> -- >>>> 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 >>>> >>>> https://www.cse.buffalo.edu/~knepley/ >>>> >>>> >>> >> >> -- >> Wang Weizhuo >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -- Wang Weizhuo -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Disagrees.png Type: image/png Size: 81967 bytes Desc: not available URL: From dave.mayhem23 at gmail.com Tue Oct 16 20:31:11 2018 From: dave.mayhem23 at gmail.com (Dave May) Date: Wed, 17 Oct 2018 03:31:11 +0200 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: On Wed, 17 Oct 2018 at 03:15, Weizhuo Wang wrote: > I just tried both, neither of them make a difference. I got exactly the > same curve with either combination. > Try using right preconditioning. https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPSetPCSide.html Use the options: -ksp_type gmres -ksp_pc_side right -ksp_rtol 1e-12 Or; -ksp_type fgmres -ksp_rtol 1e-12 Fgmres does right preconditioning my default > Thanks! > > Wang weizhuo > > On Tue, Oct 16, 2018 at 8:06 PM Matthew Knepley wrote: > >> On Tue, Oct 16, 2018 at 7:26 PM Weizhuo Wang >> wrote: >> >>> Hello again! >>> >>> After some tweaking the code is giving right answers now. However it >>> start to disagree with MATLAB results ('traditional' way using matrix >>> inverse) when the grid is larger than 100*100. My PhD advisor and I >>> suspects that the default dimension of the Krylov subspace is 100 in the >>> test case we are running. If so, is there a way to increase the size of the >>> subspace? >>> >> >> 1) The default subspace size is 30, not 100. You can increase the >> subspace size using >> >> -ksp_gmres_restart n >> >> 2) The problem is likely your tolerance. The default solver tolerance is >> 1e-5. You can change it using >> >> -ksp_rtol 1e-9 >> >> Thanks, >> >> Matt >> >> >>> >>> [image: Disagrees.png] >>> >>> Thanks! >>> >>> Wang Weizhuo >>> >>> On Tue, Oct 9, 2018 at 2:50 AM Mark Adams wrote: >>> >>>> To reiterate what Matt is saying, you seem to have the exact solution >>>> on a 10x10 grid. That makes no sense unless the solution can be represented >>>> exactly by your FE space (eg, u(x,y) = x + y). >>>> >>>> On Mon, Oct 8, 2018 at 9:33 PM Matthew Knepley >>>> wrote: >>>> >>>>> On Mon, Oct 8, 2018 at 9:28 PM Weizhuo Wang >>>>> wrote: >>>>> >>>>>> The code is attached in case anyone wants to take a look, I will try >>>>>> the high frequency scenario later. >>>>>> >>>>> >>>>> That is not the error. It is superconvergence at the vertices. The >>>>> real solution is trigonometric, so your >>>>> linear interpolants or whatever you use is not going to get the right >>>>> value in between mesh points. You >>>>> need to do a real integral over the whole interval to get the L_2 >>>>> error. >>>>> >>>>> Thanks, >>>>> >>>>> Matt >>>>> >>>>> >>>>>> On Mon, Oct 8, 2018 at 7:58 PM Mark Adams wrote: >>>>>> >>>>>>> >>>>>>> >>>>>>> On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang >>>>>>> wrote: >>>>>>> >>>>>>>> The first plot is the norm with the flag -pc_type lu with respect >>>>>>>> to number of grids in one axis (n), and the second plot is the norm without >>>>>>>> the flag -pc_type lu. >>>>>>>> >>>>>>> >>>>>>> So you are using the default PC w/o LU. The default is ILU. This >>>>>>> will reduce high frequency effectively but is not effective on the low >>>>>>> frequency error. Don't expect your algebraic error reduction to be at the >>>>>>> same scale as the residual reduction (what KSP measures). >>>>>>> >>>>>>> >>>>>>>> >>>>>> >>>>>> -- >>>>>> Wang Weizhuo >>>>>> >>>>> >>>>> >>>>> -- >>>>> 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 >>>>> >>>>> https://www.cse.buffalo.edu/~knepley/ >>>>> >>>>> >>>> >>> >>> -- >>> Wang Weizhuo >>> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > > > -- > Wang Weizhuo > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Disagrees.png Type: image/png Size: 81967 bytes Desc: not available URL: From knepley at gmail.com Tue Oct 16 20:36:43 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 16 Oct 2018 21:36:43 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: On Tue, Oct 16, 2018 at 9:14 PM Weizhuo Wang wrote: > I just tried both, neither of them make a difference. I got exactly the > same curve with either combination. > I have a hard time believing you. If you make the residual tolerance much finer, your error will definitely change. I run tests every day that do exactly this. You can run them too, since they are just examples. Thanks, Matt > Thanks! > > Wang weizhuo > > On Tue, Oct 16, 2018 at 8:06 PM Matthew Knepley wrote: > >> On Tue, Oct 16, 2018 at 7:26 PM Weizhuo Wang >> wrote: >> >>> Hello again! >>> >>> After some tweaking the code is giving right answers now. However it >>> start to disagree with MATLAB results ('traditional' way using matrix >>> inverse) when the grid is larger than 100*100. My PhD advisor and I >>> suspects that the default dimension of the Krylov subspace is 100 in the >>> test case we are running. If so, is there a way to increase the size of the >>> subspace? >>> >> >> 1) The default subspace size is 30, not 100. You can increase the >> subspace size using >> >> -ksp_gmres_restart n >> >> 2) The problem is likely your tolerance. The default solver tolerance is >> 1e-5. You can change it using >> >> -ksp_rtol 1e-9 >> >> Thanks, >> >> Matt >> >> >>> >>> [image: Disagrees.png] >>> >>> Thanks! >>> >>> Wang Weizhuo >>> >>> On Tue, Oct 9, 2018 at 2:50 AM Mark Adams wrote: >>> >>>> To reiterate what Matt is saying, you seem to have the exact solution >>>> on a 10x10 grid. That makes no sense unless the solution can be represented >>>> exactly by your FE space (eg, u(x,y) = x + y). >>>> >>>> On Mon, Oct 8, 2018 at 9:33 PM Matthew Knepley >>>> wrote: >>>> >>>>> On Mon, Oct 8, 2018 at 9:28 PM Weizhuo Wang >>>>> wrote: >>>>> >>>>>> The code is attached in case anyone wants to take a look, I will try >>>>>> the high frequency scenario later. >>>>>> >>>>> >>>>> That is not the error. It is superconvergence at the vertices. The >>>>> real solution is trigonometric, so your >>>>> linear interpolants or whatever you use is not going to get the right >>>>> value in between mesh points. You >>>>> need to do a real integral over the whole interval to get the L_2 >>>>> error. >>>>> >>>>> Thanks, >>>>> >>>>> Matt >>>>> >>>>> >>>>>> On Mon, Oct 8, 2018 at 7:58 PM Mark Adams wrote: >>>>>> >>>>>>> >>>>>>> >>>>>>> On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang >>>>>>> wrote: >>>>>>> >>>>>>>> The first plot is the norm with the flag -pc_type lu with respect >>>>>>>> to number of grids in one axis (n), and the second plot is the norm without >>>>>>>> the flag -pc_type lu. >>>>>>>> >>>>>>> >>>>>>> So you are using the default PC w/o LU. The default is ILU. This >>>>>>> will reduce high frequency effectively but is not effective on the low >>>>>>> frequency error. Don't expect your algebraic error reduction to be at the >>>>>>> same scale as the residual reduction (what KSP measures). >>>>>>> >>>>>>> >>>>>>>> >>>>>> >>>>>> -- >>>>>> Wang Weizhuo >>>>>> >>>>> >>>>> >>>>> -- >>>>> 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 >>>>> >>>>> https://www.cse.buffalo.edu/~knepley/ >>>>> >>>>> >>>> >>> >>> -- >>> Wang Weizhuo >>> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > > > -- > Wang Weizhuo > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Disagrees.png Type: image/png Size: 81967 bytes Desc: not available URL: From ellen.price at cfa.harvard.edu Tue Oct 16 20:40:07 2018 From: ellen.price at cfa.harvard.edu (Ellen M. Price) Date: Tue, 16 Oct 2018 21:40:07 -0400 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: Maybe a stupid suggestion, but sometimes I forget to call the *SetFromOptions function on my object, and then get confused when changing the options has no effect. Just a thought from a fellow grad student. Ellen On 10/16/2018 09:36 PM, Matthew Knepley wrote: > On Tue, Oct 16, 2018 at 9:14 PM Weizhuo Wang > wrote: > > I just tried both, neither of them make a difference. I got exactly > the same curve with either combination. > > > I have a hard time believing you. If you make the residual tolerance > much finer, your error will definitely change. > I run tests every day that do exactly this. You can run them too, since > they are just examples. > > ? Thanks, > > ? ? ?Matt > ? > > Thanks! > > Wang weizhuo > > On Tue, Oct 16, 2018 at 8:06 PM Matthew Knepley > wrote: > > On Tue, Oct 16, 2018 at 7:26 PM Weizhuo Wang > > wrote: > > Hello again! > > After some tweaking the code is giving right answers now. > However it start to disagree with MATLAB results > ('traditional' way using matrix inverse) when the grid is > larger than 100*100. My PhD advisor and I suspects that the > default dimension of the Krylov subspace is 100 in the test > case we are running. If so, is there a way to increase the > size of the subspace? > > > 1) The default subspace size is 30, not 100. You can increase > the subspace size using > > ? ? ? ?-ksp_gmres_restart n > > 2) The problem is likely your tolerance. The default solver > tolerance is 1e-5. You can change it using > > ? ? ? ?-ksp_rtol 1e-9 > > ? Thanks, > > ? ? ?Matt > ? > > > Disagrees.png > > Thanks! > > Wang Weizhuo > > On Tue, Oct 9, 2018 at 2:50 AM Mark Adams > wrote: > > To reiterate what Matt is saying, you seem to have the > exact solution on a 10x10 grid. That makes no sense > unless the solution can be represented exactly by your > FE space (eg, u(x,y) = x + y). > > On Mon, Oct 8, 2018 at 9:33 PM Matthew Knepley > > wrote: > > On Mon, Oct 8, 2018 at 9:28 PM Weizhuo Wang > > wrote: > > The code is attached in case anyone wants to > take a look, I will try the high frequency > scenario later. > > > That is not the error. It is superconvergence at the > vertices. The real solution is trigonometric, so your > linear interpolants or whatever you use is not going > to get the right value in between mesh points. You > need to do a real integral over the whole interval > to get the L_2 error. > > ? Thanks, > > ? ? ?Matt > ? > > On Mon, Oct 8, 2018 at 7:58 PM Mark Adams > > wrote: > > > > On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang > > wrote: > > The first plot is the norm with the flag > -pc_type lu with respect to number of > grids in one axis (n), and the second > plot is the norm without the flag > -pc_type lu.? > > > So you are using the default PC w/o LU. The > default is ILU. This will reduce high > frequency effectively but is not effective > on the low frequency error. Don't expect > your algebraic error reduction to be at the > same scale as the residual reduction (what > KSP measures).? > ? > > > > -- > Wang Weizhuo > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > > > > -- > Wang Weizhuo > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > > > > -- > Wang Weizhuo > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > From fdkong.jd at gmail.com Tue Oct 16 20:54:52 2018 From: fdkong.jd at gmail.com (Fande Kong) Date: Tue, 16 Oct 2018 19:54:52 -0600 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: Use -ksp_view to confirm the options are actually set. Fande Sent from my iPhone > On Oct 16, 2018, at 7:40 PM, Ellen M. Price wrote: > > Maybe a stupid suggestion, but sometimes I forget to call the > *SetFromOptions function on my object, and then get confused when > changing the options has no effect. Just a thought from a fellow grad > student. > > Ellen > > >> On 10/16/2018 09:36 PM, Matthew Knepley wrote: >> On Tue, Oct 16, 2018 at 9:14 PM Weizhuo Wang > > wrote: >> >> I just tried both, neither of them make a difference. I got exactly >> the same curve with either combination. >> >> >> I have a hard time believing you. If you make the residual tolerance >> much finer, your error will definitely change. >> I run tests every day that do exactly this. You can run them too, since >> they are just examples. >> >> Thanks, >> >> Matt >> >> >> Thanks! >> >> Wang weizhuo >> >> On Tue, Oct 16, 2018 at 8:06 PM Matthew Knepley > > wrote: >> >> On Tue, Oct 16, 2018 at 7:26 PM Weizhuo Wang >> > wrote: >> >> Hello again! >> >> After some tweaking the code is giving right answers now. >> However it start to disagree with MATLAB results >> ('traditional' way using matrix inverse) when the grid is >> larger than 100*100. My PhD advisor and I suspects that the >> default dimension of the Krylov subspace is 100 in the test >> case we are running. If so, is there a way to increase the >> size of the subspace? >> >> >> 1) The default subspace size is 30, not 100. You can increase >> the subspace size using >> >> -ksp_gmres_restart n >> >> 2) The problem is likely your tolerance. The default solver >> tolerance is 1e-5. You can change it using >> >> -ksp_rtol 1e-9 >> >> Thanks, >> >> Matt >> >> >> >> Disagrees.png >> >> Thanks! >> >> Wang Weizhuo >> >> On Tue, Oct 9, 2018 at 2:50 AM Mark Adams > > wrote: >> >> To reiterate what Matt is saying, you seem to have the >> exact solution on a 10x10 grid. That makes no sense >> unless the solution can be represented exactly by your >> FE space (eg, u(x,y) = x + y). >> >> On Mon, Oct 8, 2018 at 9:33 PM Matthew Knepley >> > wrote: >> >> On Mon, Oct 8, 2018 at 9:28 PM Weizhuo Wang >> > > wrote: >> >> The code is attached in case anyone wants to >> take a look, I will try the high frequency >> scenario later. >> >> >> That is not the error. It is superconvergence at the >> vertices. The real solution is trigonometric, so your >> linear interpolants or whatever you use is not going >> to get the right value in between mesh points. You >> need to do a real integral over the whole interval >> to get the L_2 error. >> >> Thanks, >> >> Matt >> >> >> On Mon, Oct 8, 2018 at 7:58 PM Mark Adams >> > wrote: >> >> >> >> On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang >> > > wrote: >> >> The first plot is the norm with the flag >> -pc_type lu with respect to number of >> grids in one axis (n), and the second >> plot is the norm without the flag >> -pc_type lu. >> >> >> So you are using the default PC w/o LU. The >> default is ILU. This will reduce high >> frequency effectively but is not effective >> on the low frequency error. Don't expect >> your algebraic error reduction to be at the >> same scale as the residual reduction (what >> KSP measures). >> >> >> >> >> -- >> Wang Weizhuo >> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> >> >> >> -- >> Wang Weizhuo >> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> >> >> >> -- >> Wang Weizhuo >> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> From ysjosh.lo at gmail.com Tue Oct 16 23:27:56 2018 From: ysjosh.lo at gmail.com (Josh L) Date: Tue, 16 Oct 2018 23:27:56 -0500 Subject: [petsc-users] DMPlex. Apply Dirichlet boundary condition Message-ID: Hi, My problem has an irregular domain and for the nodes I have to apply boundary condition, I only know their node number in nature ordering. How do I apply BC(zero out the corresponding entries in global Vec and Mat) after DMPlexDistribute when it is all in global ordering? If using DMLabel, how do I add those nodes to the label If I only have their number in nature ordering? Thanks, Josh -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Wed Oct 17 08:48:41 2018 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 17 Oct 2018 09:48:41 -0400 Subject: [petsc-users] DMPlex. Apply Dirichlet boundary condition In-Reply-To: References: Message-ID: On Wed, Oct 17, 2018 at 12:29 AM Josh L wrote: > Hi, > > My problem has an irregular domain and for the nodes I have to apply > boundary condition, I only know their node number in nature ordering. > How do I apply BC(zero out the corresponding entries in global Vec and > Mat) after DMPlexDistribute when it is all in global ordering? > > If using DMLabel, how do I add those nodes to the label If I only have > their number in nature ordering? > I will help you do whatever you want to do. However, first I would like to encourage you not to do what you are doing. It looks like you want to add a boundary condition to your continuum model? First, you need a way to describe the boundary that is invariant to mesh transformations, such as redistribution, adaptation, and coordinate remapping.. For this you can use DMLabel. Those transformations update the label so that the same topological piece of the mesh is marked after the transformation. Second, you should also specify your boundary condition in a way that is invariant to these transformations. This function https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMAddBoundary.html encourages you to write boundary conditions as pointwise functions, which can easily be projected into a finite element space along a given DMLabel using DMProjectFunctionLabelLocal(). You can also use a finite element function instead using DMProjectFieldLabelLocal(). These functions are used internally by DMPlexInsertBoundaryValues(). Could you use that kind of a scheme? Thanks, Matt > Thanks, > Josh > > > > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From griesser.jan at googlemail.com Wed Oct 17 10:53:15 2018 From: griesser.jan at googlemail.com (=?UTF-8?B?SmFuIEdyaWXDn2Vy?=) Date: Wed, 17 Oct 2018 17:53:15 +0200 Subject: [petsc-users] PetscInt overflow Message-ID: Hi all, i am using slepc4py and petsc4py to solve for the smallest real eigenvalues and eigenvectors. For my test cases with a matrix A of the size 30k x 30k solving for the smallest soutions works quite well, but when i increase the dimension of my system to around A = 768000 x 768000 or 3 million x 3 million and ask for the smallest real 3000 (the number is increasing with increasing system size) eigenvalues and eigenvectors i get the output (for the 768000): The product 4001 times 768000 overflows the size of PetscInt; consider reducing the number of columns, or use BVVECS instead i understand that the requested number of eigenvectors and eigenvalues is causing an overflow but i do not understand the solution of the problem which is stated in the error message. Can someone tell me what exactly BVVECS is and how i can use it? Or is there any other solution to my problem ? Thank you very much in advance, Jan -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Wed Oct 17 10:58:26 2018 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 17 Oct 2018 11:58:26 -0400 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: Message-ID: On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er wrote: > Hi all, > i am using slepc4py and petsc4py to solve for the smallest real > eigenvalues and eigenvectors. For my test cases with a matrix A of the size > 30k x 30k solving for the smallest soutions works quite well, but when i > increase the dimension of my system to around A = 768000 x 768000 or 3 > million x 3 million and ask for the smallest real 3000 (the number is > increasing with increasing system size) eigenvalues and eigenvectors i get > the output (for the 768000): > The product 4001 times 768000 overflows the size of PetscInt; consider > reducing the number of columns, or use BVVECS instead > i understand that the requested number of eigenvectors and eigenvalues is > causing an overflow but i do not understand the solution of the problem > which is stated in the error message. Can someone tell me what exactly > BVVECS is and how i can use it? Or is there any other solution to my > problem ? > You can also reconfigure with 64-bit integers: --with-64-bit-indices Thanks, Matt > Thank you very much in advance, > Jan > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From iancclin at umich.edu Wed Oct 17 11:05:28 2018 From: iancclin at umich.edu (Ian Lin) Date: Wed, 17 Oct 2018 12:05:28 -0400 Subject: [petsc-users] Mac OSX 10.14 related MPI compilation issue Message-ID: <39FFEB45-C2FD-4CEE-9F2F-F6E19218A68F@umich.edu> Hi PETSc team, I am using Mac computer as my local machine for testing my code linked with PETSc. Recently I just updated to OSX 10.14 (Mojave), and I found some compilation issue regarding the path of mpi.h. In my system, I used home-brew to install openmpi 3.1.2 with gcc 8.2. In the meantime, I had openmpi 1.10.7 installed and linked with gcc 8.2 and used it to compile PETSc. However it send me an error saying that "PETSc was configured with one OpenMPI mpi.h version but now appears to be compiling using a different OpenMPI mpi.h version? My configure command was ./configure --with-blaslapack-dir=/usr/local/opt/openblas --with-mpi-dir=/Users/iancclin/softwares/openmpi/1.10.7/gcc8 --prefix=/Users/iancclin/softwares/petsc/3.10.2/openmpi1.10.7_gcc8.2.0 I guess this should be simple enough to avoid any mistake. However the problem still persists. Besides, when I tried to compile PETSc with home-brew installed openmpi 3.1.2, it compile without any problem. In make.log, somehow it was searching mpi.h in /usr/local/include instead of the include directory of my self installed openmpi 1.10.7. I attached my configure.log and make.log for your reference. Did I make any mistake on compiling? Or do you have any suggestion to workaround this? Thanks a lot, Ian -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: configure.log Type: application/octet-stream Size: 4195141 bytes Desc: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: make.log Type: application/octet-stream Size: 16563 bytes Desc: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Wed Oct 17 11:23:35 2018 From: bsmith at mcs.anl.gov (Smith, Barry F.) Date: Wed, 17 Oct 2018 16:23:35 +0000 Subject: [petsc-users] Mac OSX 10.14 related MPI compilation issue In-Reply-To: <39FFEB45-C2FD-4CEE-9F2F-F6E19218A68F@umich.edu> References: <39FFEB45-C2FD-4CEE-9F2F-F6E19218A68F@umich.edu> Message-ID: <7D2E0DF8-D842-43B5-ACD7-E9360D42FD34@anl.gov> Ian, You need to use brew to uninstall the MPI in /usr/local before you use the other install of MPI. There is no easy systematic way to force the compiler and linker to find the "other" mpi.h first. Barry Having multiple MPI's installed on the system is often problematic. > On Oct 17, 2018, at 11:05 AM, Ian Lin wrote: > > Hi PETSc team, > > I am using Mac computer as my local machine for testing my code linked with PETSc. Recently I just updated to OSX 10.14 (Mojave), and I found some compilation issue regarding the path of mpi.h. In my system, I used home-brew to install openmpi 3.1.2 with gcc 8.2. In the meantime, I had openmpi 1.10.7 installed and linked with gcc 8.2 and used it to compile PETSc. However it send me an error saying that > "PETSc was configured with one OpenMPI mpi.h version but now appears to be compiling using a different OpenMPI mpi.h version? > My configure command was ./configure --with-blaslapack-dir=/usr/local/opt/openblas --with-mpi-dir=/Users/iancclin/softwares/openmpi/1.10.7/gcc8 --prefix=/Users/iancclin/softwares/petsc/3.10.2/openmpi1.10.7_gcc8.2.0 I guess this should be simple enough to avoid any mistake. However the problem still persists. Besides, when I tried to compile PETSc with home-brew installed openmpi 3.1.2, it compile without any problem. > > In make.log, somehow it was searching mpi.h in /usr/local/include instead of the include directory of my self installed openmpi 1.10.7. I attached my configure.log and make.log for your reference. Did I make any mistake on compiling? Or do you have any suggestion to workaround this? > > Thanks a lot, > Ian > > From jroman at dsic.upv.es Wed Oct 17 11:24:48 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Wed, 17 Oct 2018 18:24:48 +0200 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: Message-ID: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> To use BVVECS just add the command-line option -bv_type vecs This causes to use a separate Vec for each column, instead of a single long Vec of size n*m. But it is considerably slower than the default. Anyway, for such large problems you should consider using more than 1 MPI process. In that case the error may disappear because the local size is smaller than 768000. Jose > El 17 oct 2018, a las 17:58, Matthew Knepley escribi?: > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er wrote: > Hi all, > i am using slepc4py and petsc4py to solve for the smallest real eigenvalues and eigenvectors. For my test cases with a matrix A of the size 30k x 30k solving for the smallest soutions works quite well, but when i increase the dimension of my system to around A = 768000 x 768000 or 3 million x 3 million and ask for the smallest real 3000 (the number is increasing with increasing system size) eigenvalues and eigenvectors i get the output (for the 768000): > The product 4001 times 768000 overflows the size of PetscInt; consider reducing the number of columns, or use BVVECS instead > i understand that the requested number of eigenvectors and eigenvalues is causing an overflow but i do not understand the solution of the problem which is stated in the error message. Can someone tell me what exactly BVVECS is and how i can use it? Or is there any other solution to my problem ? > > You can also reconfigure with 64-bit integers: --with-64-bit-indices > > Thanks, > > Matt > > Thank you very much in advance, > Jan > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ From mailinglists at xgm.de Thu Oct 18 10:56:57 2018 From: mailinglists at xgm.de (Florian Lindner) Date: Thu, 18 Oct 2018 17:56:57 +0200 Subject: [petsc-users] KSP and matrix-free matrix (shell) Message-ID: <9c691647-b1a7-02ba-6c0c-d25b049208c1@xgm.de> Hello, I try to use the KSP solver package together with a shell matrix: MyContext mycontext; // an empty struct, not sure it it's needed? Mat s; ierr = MatCreateShell(PETSC_COMM_WORLD, size, size, PETSC_DECIDE, PETSC_DECIDE, &mycontext, &s); ierr = MatShellSetOperation(s, MATOP_MULT, (void(*)(void))usermult); CHKERRQ(ierr); To simulate a meaningfull usermult, I use MatMult on an actual existing matrix of same dimensions: extern PetscErrorCode usermult(Mat m ,Vec x, Vec y) { PetscErrorCode ierr = 0; ierr = MatMult(matrix, x, y); printf("Call\n"); return ierr; } Btw, what is the significance of the Mat m argument here? matrix is created like: ierr = MatCreate(PETSC_COMM_WORLD, &matrix); CHKERRQ(ierr); ierr = MatSetSizes(matrix, size, size, PETSC_DECIDE, PETSC_DECIDE); CHKERRQ(ierr); ierr = MatSetFromOptions(matrix); CHKERRQ(ierr); ierr = MatSetUp(matrix); CHKERRQ(ierr); MatMult(s, b, x); works. The usermult function is called. But trying to use a KSP gives an error: KSP solver; KSPCreate(PETSC_COMM_WORLD, &solver); KSPSetFromOptions(solver); KSPSetOperators(solver, s, s); error: [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/linearsolvertable.html for possible LU and Cholesky solvers [0]PETSC ERROR: Could not locate a solver package. Perhaps you must ./configure with --download- [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.9.3, unknown [0]PETSC ERROR: ./a.out on a arch-linux2-c-opt named asaru by lindnefn Thu Oct 18 17:39:52 2018 [0]PETSC ERROR: Configure options --with-debugging=0 COPTFLAGS="-O3 -march=native -mtune=native" CXXOPTFLAGS="-O3 -march=native -mtune=native" FOPTFLAGS="-O3 -march=native -mtune=native" --download-petsc4py --download-mpi4py --with-mpi-dir=/opt/mpich [0]PETSC ERROR: #1 MatGetFactor() line 4328 in /home/lindnefn/software/petsc/src/mat/interface/matrix.c [0]PETSC ERROR: #2 PCSetUp_ILU() line 142 in /home/lindnefn/software/petsc/src/ksp/pc/impls/factor/ilu/ilu.c [0]PETSC ERROR: #3 PCSetUp() line 923 in /home/lindnefn/software/petsc/src/ksp/pc/interface/precon.c [0]PETSC ERROR: #4 KSPSetUp() line 381 in /home/lindnefn/software/petsc/src/ksp/ksp/interface/itfunc.c [0]PETSC ERROR: #5 KSPSolve() line 612 in /home/lindnefn/software/petsc/src/ksp/ksp/interface/itfunc.c Do I need to MatShellSetOperations additional operations? Like MATOP_ILUFACTOR? How can I know what operations to implement? Best Thanks, Florian From hzhang at mcs.anl.gov Thu Oct 18 11:07:27 2018 From: hzhang at mcs.anl.gov (Zhang, Hong) Date: Thu, 18 Oct 2018 16:07:27 +0000 Subject: [petsc-users] KSP and matrix-free matrix (shell) In-Reply-To: <9c691647-b1a7-02ba-6c0c-d25b049208c1@xgm.de> References: <9c691647-b1a7-02ba-6c0c-d25b049208c1@xgm.de> Message-ID: When you use shell matrix, i.e., matrix-free, you cannot it as a preconditioner. Add option '-pc_type none'. Hong On Thu, Oct 18, 2018 at 10:57 AM Florian Lindner > wrote: Hello, I try to use the KSP solver package together with a shell matrix: MyContext mycontext; // an empty struct, not sure it it's needed? Mat s; ierr = MatCreateShell(PETSC_COMM_WORLD, size, size, PETSC_DECIDE, PETSC_DECIDE, &mycontext, &s); ierr = MatShellSetOperation(s, MATOP_MULT, (void(*)(void))usermult); CHKERRQ(ierr); To simulate a meaningfull usermult, I use MatMult on an actual existing matrix of same dimensions: extern PetscErrorCode usermult(Mat m ,Vec x, Vec y) { PetscErrorCode ierr = 0; ierr = MatMult(matrix, x, y); printf("Call\n"); return ierr; } Btw, what is the significance of the Mat m argument here? matrix is created like: ierr = MatCreate(PETSC_COMM_WORLD, &matrix); CHKERRQ(ierr); ierr = MatSetSizes(matrix, size, size, PETSC_DECIDE, PETSC_DECIDE); CHKERRQ(ierr); ierr = MatSetFromOptions(matrix); CHKERRQ(ierr); ierr = MatSetUp(matrix); CHKERRQ(ierr); MatMult(s, b, x); works. The usermult function is called. But trying to use a KSP gives an error: KSP solver; KSPCreate(PETSC_COMM_WORLD, &solver); KSPSetFromOptions(solver); KSPSetOperators(solver, s, s); error: [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/linearsolvertable.html for possible LU and Cholesky solvers [0]PETSC ERROR: Could not locate a solver package. Perhaps you must ./configure with --download- [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.9.3, unknown [0]PETSC ERROR: ./a.out on a arch-linux2-c-opt named asaru by lindnefn Thu Oct 18 17:39:52 2018 [0]PETSC ERROR: Configure options --with-debugging=0 COPTFLAGS="-O3 -march=native -mtune=native" CXXOPTFLAGS="-O3 -march=native -mtune=native" FOPTFLAGS="-O3 -march=native -mtune=native" --download-petsc4py --download-mpi4py --with-mpi-dir=/opt/mpich [0]PETSC ERROR: #1 MatGetFactor() line 4328 in /home/lindnefn/software/petsc/src/mat/interface/matrix.c [0]PETSC ERROR: #2 PCSetUp_ILU() line 142 in /home/lindnefn/software/petsc/src/ksp/pc/impls/factor/ilu/ilu.c [0]PETSC ERROR: #3 PCSetUp() line 923 in /home/lindnefn/software/petsc/src/ksp/pc/interface/precon.c [0]PETSC ERROR: #4 KSPSetUp() line 381 in /home/lindnefn/software/petsc/src/ksp/ksp/interface/itfunc.c [0]PETSC ERROR: #5 KSPSolve() line 612 in /home/lindnefn/software/petsc/src/ksp/ksp/interface/itfunc.c Do I need to MatShellSetOperations additional operations? Like MATOP_ILUFACTOR? How can I know what operations to implement? Best Thanks, Florian -------------- next part -------------- An HTML attachment was scrubbed... URL: From hzhang at mcs.anl.gov Thu Oct 18 11:07:28 2018 From: hzhang at mcs.anl.gov (Zhang, Hong) Date: Thu, 18 Oct 2018 16:07:28 +0000 Subject: [petsc-users] KSP and matrix-free matrix (shell) In-Reply-To: <9c691647-b1a7-02ba-6c0c-d25b049208c1@xgm.de> References: <9c691647-b1a7-02ba-6c0c-d25b049208c1@xgm.de> Message-ID: When you use shell matrix, i.e., matrix-free, you cannot it as a preconditioner. Add option '-pc_type none'. Hong On Thu, Oct 18, 2018 at 10:57 AM Florian Lindner > wrote: Hello, I try to use the KSP solver package together with a shell matrix: MyContext mycontext; // an empty struct, not sure it it's needed? Mat s; ierr = MatCreateShell(PETSC_COMM_WORLD, size, size, PETSC_DECIDE, PETSC_DECIDE, &mycontext, &s); ierr = MatShellSetOperation(s, MATOP_MULT, (void(*)(void))usermult); CHKERRQ(ierr); To simulate a meaningfull usermult, I use MatMult on an actual existing matrix of same dimensions: extern PetscErrorCode usermult(Mat m ,Vec x, Vec y) { PetscErrorCode ierr = 0; ierr = MatMult(matrix, x, y); printf("Call\n"); return ierr; } Btw, what is the significance of the Mat m argument here? matrix is created like: ierr = MatCreate(PETSC_COMM_WORLD, &matrix); CHKERRQ(ierr); ierr = MatSetSizes(matrix, size, size, PETSC_DECIDE, PETSC_DECIDE); CHKERRQ(ierr); ierr = MatSetFromOptions(matrix); CHKERRQ(ierr); ierr = MatSetUp(matrix); CHKERRQ(ierr); MatMult(s, b, x); works. The usermult function is called. But trying to use a KSP gives an error: KSP solver; KSPCreate(PETSC_COMM_WORLD, &solver); KSPSetFromOptions(solver); KSPSetOperators(solver, s, s); error: [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/linearsolvertable.html for possible LU and Cholesky solvers [0]PETSC ERROR: Could not locate a solver package. Perhaps you must ./configure with --download- [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. [0]PETSC ERROR: Petsc Release Version 3.9.3, unknown [0]PETSC ERROR: ./a.out on a arch-linux2-c-opt named asaru by lindnefn Thu Oct 18 17:39:52 2018 [0]PETSC ERROR: Configure options --with-debugging=0 COPTFLAGS="-O3 -march=native -mtune=native" CXXOPTFLAGS="-O3 -march=native -mtune=native" FOPTFLAGS="-O3 -march=native -mtune=native" --download-petsc4py --download-mpi4py --with-mpi-dir=/opt/mpich [0]PETSC ERROR: #1 MatGetFactor() line 4328 in /home/lindnefn/software/petsc/src/mat/interface/matrix.c [0]PETSC ERROR: #2 PCSetUp_ILU() line 142 in /home/lindnefn/software/petsc/src/ksp/pc/impls/factor/ilu/ilu.c [0]PETSC ERROR: #3 PCSetUp() line 923 in /home/lindnefn/software/petsc/src/ksp/pc/interface/precon.c [0]PETSC ERROR: #4 KSPSetUp() line 381 in /home/lindnefn/software/petsc/src/ksp/ksp/interface/itfunc.c [0]PETSC ERROR: #5 KSPSolve() line 612 in /home/lindnefn/software/petsc/src/ksp/ksp/interface/itfunc.c Do I need to MatShellSetOperations additional operations? Like MATOP_ILUFACTOR? How can I know what operations to implement? Best Thanks, Florian -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.mayhem23 at gmail.com Thu Oct 18 12:35:40 2018 From: dave.mayhem23 at gmail.com (Dave May) Date: Thu, 18 Oct 2018 19:35:40 +0200 Subject: [petsc-users] KSP and matrix-free matrix (shell) In-Reply-To: <9c691647-b1a7-02ba-6c0c-d25b049208c1@xgm.de> References: <9c691647-b1a7-02ba-6c0c-d25b049208c1@xgm.de> Message-ID: On Thu, 18 Oct 2018 at 17:57, Florian Lindner wrote: > Hello, > > I try to use the KSP solver package together with a shell matrix: > > > MyContext mycontext; // an empty struct, not sure it it's needed? > Mat s; > ierr = MatCreateShell(PETSC_COMM_WORLD, size, size, PETSC_DECIDE, > PETSC_DECIDE, &mycontext, &s); > ierr = MatShellSetOperation(s, MATOP_MULT, (void(*)(void))usermult); > CHKERRQ(ierr); > > To simulate a meaningfull usermult, I use MatMult on an actual existing > matrix of same dimensions: > > extern PetscErrorCode usermult(Mat m ,Vec x, Vec y) > { > PetscErrorCode ierr = 0; > ierr = MatMult(matrix, x, y); > printf("Call\n"); > return ierr; > } > > Btw, what is the significance of the Mat m argument here? m is your shell matrix. You should be calling MatShellGetContext(m,(void**)&myctx); https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatShellGetContext.html to get your user context inside usermult to retrieve any data you need for the mat-vec product. Where the hell is the variable "matrix"? Is it a global variable?? If yes - don't do that. > > matrix is created like: > > ierr = MatCreate(PETSC_COMM_WORLD, &matrix); CHKERRQ(ierr); > ierr = MatSetSizes(matrix, size, size, PETSC_DECIDE, PETSC_DECIDE); > CHKERRQ(ierr); > ierr = MatSetFromOptions(matrix); CHKERRQ(ierr); > ierr = MatSetUp(matrix); CHKERRQ(ierr); > > > MatMult(s, b, x); > > works. The usermult function is called. > > But trying to use a KSP gives an error: > > KSP solver; > KSPCreate(PETSC_COMM_WORLD, &solver); > KSPSetFromOptions(solver); > KSPSetOperators(solver, s, s); > > > error: > > [0]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [0]PETSC ERROR: See > http://www.mcs.anl.gov/petsc/documentation/linearsolvertable.html for > possible LU and Cholesky solvers > [0]PETSC ERROR: Could not locate a solver package. Perhaps you must > ./configure with --download- > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html > for trouble shooting. > [0]PETSC ERROR: Petsc Release Version 3.9.3, unknown > [0]PETSC ERROR: ./a.out on a arch-linux2-c-opt named asaru by lindnefn Thu > Oct 18 17:39:52 2018 > [0]PETSC ERROR: Configure options --with-debugging=0 COPTFLAGS="-O3 > -march=native -mtune=native" CXXOPTFLAGS="-O3 -march=native -mtune=native" > FOPTFLAGS="-O3 -march=native -mtune=native" --download-petsc4py > --download-mpi4py --with-mpi-dir=/opt/mpich > [0]PETSC ERROR: #1 MatGetFactor() line 4328 in > /home/lindnefn/software/petsc/src/mat/interface/matrix.c > [0]PETSC ERROR: #2 PCSetUp_ILU() line 142 in > /home/lindnefn/software/petsc/src/ksp/pc/impls/factor/ilu/ilu.c > [0]PETSC ERROR: #3 PCSetUp() line 923 in > /home/lindnefn/software/petsc/src/ksp/pc/interface/precon.c > [0]PETSC ERROR: #4 KSPSetUp() line 381 in > /home/lindnefn/software/petsc/src/ksp/ksp/interface/itfunc.c > [0]PETSC ERROR: #5 KSPSolve() line 612 in > /home/lindnefn/software/petsc/src/ksp/ksp/interface/itfunc.c > > Do I need to MatShellSetOperations additional operations? Like > MATOP_ILUFACTOR? How can I know what operations to implement? > > Best Thanks, > Florian > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Thu Oct 18 17:22:42 2018 From: knepley at gmail.com (Matthew Knepley) Date: Thu, 18 Oct 2018 18:22:42 -0400 Subject: [petsc-users] KSP and matrix-free matrix (shell) In-Reply-To: References: <9c691647-b1a7-02ba-6c0c-d25b049208c1@xgm.de> Message-ID: On Thu, Oct 18, 2018 at 12:07 PM Zhang, Hong wrote: > When you use shell matrix, i.e., matrix-free, you cannot it as a > preconditioner. Add option '-pc_type none'. > There are some you can use, like -pc_type cheby MAtt > Hong > > On Thu, Oct 18, 2018 at 10:57 AM Florian Lindner > wrote: > >> Hello, >> >> I try to use the KSP solver package together with a shell matrix: >> >> >> MyContext mycontext; // an empty struct, not sure it it's needed? >> Mat s; >> ierr = MatCreateShell(PETSC_COMM_WORLD, size, size, PETSC_DECIDE, >> PETSC_DECIDE, &mycontext, &s); >> ierr = MatShellSetOperation(s, MATOP_MULT, (void(*)(void))usermult); >> CHKERRQ(ierr); >> >> To simulate a meaningfull usermult, I use MatMult on an actual existing >> matrix of same dimensions: >> >> extern PetscErrorCode usermult(Mat m ,Vec x, Vec y) >> { >> PetscErrorCode ierr = 0; >> ierr = MatMult(matrix, x, y); >> printf("Call\n"); >> return ierr; >> } >> >> Btw, what is the significance of the Mat m argument here? >> >> matrix is created like: >> >> ierr = MatCreate(PETSC_COMM_WORLD, &matrix); CHKERRQ(ierr); >> ierr = MatSetSizes(matrix, size, size, PETSC_DECIDE, PETSC_DECIDE); >> CHKERRQ(ierr); >> ierr = MatSetFromOptions(matrix); CHKERRQ(ierr); >> ierr = MatSetUp(matrix); CHKERRQ(ierr); >> >> >> MatMult(s, b, x); >> >> works. The usermult function is called. >> >> But trying to use a KSP gives an error: >> >> KSP solver; >> KSPCreate(PETSC_COMM_WORLD, &solver); >> KSPSetFromOptions(solver); >> KSPSetOperators(solver, s, s); >> >> >> error: >> >> [0]PETSC ERROR: --------------------- Error Message >> -------------------------------------------------------------- >> [0]PETSC ERROR: See >> http://www.mcs.anl.gov/petsc/documentation/linearsolvertable.html for >> possible LU and Cholesky solvers >> [0]PETSC ERROR: Could not locate a solver package. Perhaps you must >> ./configure with --download- >> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html >> for trouble shooting. >> [0]PETSC ERROR: Petsc Release Version 3.9.3, unknown >> [0]PETSC ERROR: ./a.out on a arch-linux2-c-opt named asaru by lindnefn >> Thu Oct 18 17:39:52 2018 >> [0]PETSC ERROR: Configure options --with-debugging=0 COPTFLAGS="-O3 >> -march=native -mtune=native" CXXOPTFLAGS="-O3 -march=native -mtune=native" >> FOPTFLAGS="-O3 -march=native -mtune=native" --download-petsc4py >> --download-mpi4py --with-mpi-dir=/opt/mpich >> [0]PETSC ERROR: #1 MatGetFactor() line 4328 in >> /home/lindnefn/software/petsc/src/mat/interface/matrix.c >> [0]PETSC ERROR: #2 PCSetUp_ILU() line 142 in >> /home/lindnefn/software/petsc/src/ksp/pc/impls/factor/ilu/ilu.c >> [0]PETSC ERROR: #3 PCSetUp() line 923 in >> /home/lindnefn/software/petsc/src/ksp/pc/interface/precon.c >> [0]PETSC ERROR: #4 KSPSetUp() line 381 in >> /home/lindnefn/software/petsc/src/ksp/ksp/interface/itfunc.c >> [0]PETSC ERROR: #5 KSPSolve() line 612 in >> /home/lindnefn/software/petsc/src/ksp/ksp/interface/itfunc.c >> >> Do I need to MatShellSetOperations additional operations? Like >> MATOP_ILUFACTOR? How can I know what operations to implement? >> >> Best Thanks, >> Florian >> >> >> -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jed at jedbrown.org Thu Oct 18 21:10:30 2018 From: jed at jedbrown.org (Jed Brown) Date: Thu, 18 Oct 2018 20:10:30 -0600 Subject: [petsc-users] KSP and matrix-free matrix (shell) In-Reply-To: References: <9c691647-b1a7-02ba-6c0c-d25b049208c1@xgm.de> Message-ID: <87bm7qsn3d.fsf@jedbrown.org> Matthew Knepley writes: > On Thu, Oct 18, 2018 at 12:07 PM Zhang, Hong wrote: > >> When you use shell matrix, i.e., matrix-free, you cannot it as a >> preconditioner. Add option '-pc_type none'. >> > > There are some you can use, like -pc_type cheby That doesn't exist. You can do the nested iteration that Matt has in mind with -pc_type ksp -ksp_ksp_type chebyshev -ksp_pc_type none which can be useful if GMRES restarts are killing you, for example. But most people using matrix-free are either using geometric multigrid, defining the diagonal using MatShellSetOperation(A, MATOP_GET_DIAGONAL, f) and/or using PCShell for preconditioning. From mailinglists at xgm.de Fri Oct 19 03:39:12 2018 From: mailinglists at xgm.de (Florian Lindner) Date: Fri, 19 Oct 2018 10:39:12 +0200 Subject: [petsc-users] KSP and matrix-free matrix (shell) In-Reply-To: <9c691647-b1a7-02ba-6c0c-d25b049208c1@xgm.de> References: <9c691647-b1a7-02ba-6c0c-d25b049208c1@xgm.de> Message-ID: <348a13d0-8f92-424f-7a9b-41df637d4a11@xgm.de> Thanks for your help! Using -pc_type none makes it working so far. > Where the hell is the variable "matrix"? Is it a global variable?? If yes - don't do that. Yes, it's a global matrix and as I said, I just use it simulate a meaningful matrix-vector product in my 30 lines test program. Best Thanks, Florian Am 18.10.18 um 17:56 schrieb Florian Lindner: > Hello, > > I try to use the KSP solver package together with a shell matrix: > > > MyContext mycontext; // an empty struct, not sure it it's needed? > Mat s; > ierr = MatCreateShell(PETSC_COMM_WORLD, size, size, PETSC_DECIDE, PETSC_DECIDE, &mycontext, &s); > ierr = MatShellSetOperation(s, MATOP_MULT, (void(*)(void))usermult); CHKERRQ(ierr); > > To simulate a meaningfull usermult, I use MatMult on an actual existing matrix of same dimensions: > > extern PetscErrorCode usermult(Mat m ,Vec x, Vec y) > { > PetscErrorCode ierr = 0; > ierr = MatMult(matrix, x, y); > printf("Call\n"); > return ierr; > } > > Btw, what is the significance of the Mat m argument here? > > matrix is created like: > > ierr = MatCreate(PETSC_COMM_WORLD, &matrix); CHKERRQ(ierr); > ierr = MatSetSizes(matrix, size, size, PETSC_DECIDE, PETSC_DECIDE); CHKERRQ(ierr); > ierr = MatSetFromOptions(matrix); CHKERRQ(ierr); > ierr = MatSetUp(matrix); CHKERRQ(ierr); > > > MatMult(s, b, x); > > works. The usermult function is called. > > But trying to use a KSP gives an error: > > KSP solver; > KSPCreate(PETSC_COMM_WORLD, &solver); > KSPSetFromOptions(solver); > KSPSetOperators(solver, s, s); > > > error: > > [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/linearsolvertable.html for possible LU and Cholesky solvers > [0]PETSC ERROR: Could not locate a solver package. Perhaps you must ./configure with --download- > [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting. > [0]PETSC ERROR: Petsc Release Version 3.9.3, unknown > [0]PETSC ERROR: ./a.out on a arch-linux2-c-opt named asaru by lindnefn Thu Oct 18 17:39:52 2018 > [0]PETSC ERROR: Configure options --with-debugging=0 COPTFLAGS="-O3 -march=native -mtune=native" CXXOPTFLAGS="-O3 -march=native -mtune=native" FOPTFLAGS="-O3 -march=native -mtune=native" --download-petsc4py --download-mpi4py --with-mpi-dir=/opt/mpich > [0]PETSC ERROR: #1 MatGetFactor() line 4328 in /home/lindnefn/software/petsc/src/mat/interface/matrix.c > [0]PETSC ERROR: #2 PCSetUp_ILU() line 142 in /home/lindnefn/software/petsc/src/ksp/pc/impls/factor/ilu/ilu.c > [0]PETSC ERROR: #3 PCSetUp() line 923 in /home/lindnefn/software/petsc/src/ksp/pc/interface/precon.c > [0]PETSC ERROR: #4 KSPSetUp() line 381 in /home/lindnefn/software/petsc/src/ksp/ksp/interface/itfunc.c > [0]PETSC ERROR: #5 KSPSolve() line 612 in /home/lindnefn/software/petsc/src/ksp/ksp/interface/itfunc.c > > Do I need to MatShellSetOperations additional operations? Like MATOP_ILUFACTOR? How can I know what operations to implement? > > Best Thanks, > Florian > > From C.Klaij at marin.nl Fri Oct 19 03:51:30 2018 From: C.Klaij at marin.nl (Klaij, Christiaan) Date: Fri, 19 Oct 2018 08:51:30 +0000 Subject: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 Message-ID: <1539939090363.13492@marin.nl> I've recently upgraded from petsc-3.8.4 to petsc-3.10.2 and was surprised to find a number of segmentation faults in my test cases. These turned out to be related to user-defined MatMult and PCApply for shell matrices. For example: SUBROUTINE systemMatMult(aa_system,xx_system,rr_system,ierr) Mat, INTENT(in) :: aa_system Vec, INTENT(in) :: xx_system Vec, INTENT(out) :: rr_system PetscErrorCode, INTENT(out) :: ierr ... END where aa_system is the shell matrix. This code works fine with 3.8.4 and older, but fails with 3.10.2 due to invalid pointers (gdb backtrace shows failure of VecSetValues due to invalid first argument). After replacing by: SUBROUTINE mass_momentum_systemMatMult(aa_system,xx_system,rr_system,ierr) Mat :: aa_system Vec :: xx_system Vec :: rr_system PetscErrorCode :: ierr ... END everything's fine again. So clearly something has changed since 3.8.4 that now prevents the use of INTENT in Fortran (at least using intel 17.0.1 compilers). Any reason for this? Chris dr. ir. Christiaan Klaij | Senior Researcher | Research & Development MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl MARIN news: http://www.marin.nl/web/News/News-items/ReFRESCO-successfully-coupled-to-ParaView-Catalyst-for-insitu-analysis-1.htm From griesser.jan at googlemail.com Fri Oct 19 04:01:05 2018 From: griesser.jan at googlemail.com (=?UTF-8?B?SmFuIEdyaWXDn2Vy?=) Date: Fri, 19 Oct 2018 11:01:05 +0200 Subject: [petsc-users] PetscInt overflow In-Reply-To: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: With more than 1 MPI process you mean i should use spectrum slicing in divide the full problem in smaller subproblems? The --with-64-bit-indices is not a possibility for me since i configured petsc with mumps, which does not allow to use the 64-bit version (At least this was the error message when i tried to configure PETSc ) Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman : > To use BVVECS just add the command-line option -bv_type vecs > This causes to use a separate Vec for each column, instead of a single > long Vec of size n*m. But it is considerably slower than the default. > > Anyway, for such large problems you should consider using more than 1 MPI > process. In that case the error may disappear because the local size is > smaller than 768000. > > Jose > > > > El 17 oct 2018, a las 17:58, Matthew Knepley > escribi?: > > > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er < > griesser.jan at googlemail.com> wrote: > > Hi all, > > i am using slepc4py and petsc4py to solve for the smallest real > eigenvalues and eigenvectors. For my test cases with a matrix A of the size > 30k x 30k solving for the smallest soutions works quite well, but when i > increase the dimension of my system to around A = 768000 x 768000 or 3 > million x 3 million and ask for the smallest real 3000 (the number is > increasing with increasing system size) eigenvalues and eigenvectors i get > the output (for the 768000): > > The product 4001 times 768000 overflows the size of PetscInt; consider > reducing the number of columns, or use BVVECS instead > > i understand that the requested number of eigenvectors and eigenvalues > is causing an overflow but i do not understand the solution of the problem > which is stated in the error message. Can someone tell me what exactly > BVVECS is and how i can use it? Or is there any other solution to my > problem ? > > > > You can also reconfigure with 64-bit integers: --with-64-bit-indices > > > > Thanks, > > > > Matt > > > > Thank you very much in advance, > > Jan > > > > > > > > -- > > 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 > > > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Fri Oct 19 04:07:58 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Fri, 19 Oct 2018 11:07:58 +0200 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: <9F6535EC-BABB-4CB7-AD26-4B4A6C735E4F@dsic.upv.es> No, I mean to run in parallel: $ mpiexec -n 8 python ex1.py Jose > El 19 oct 2018, a las 11:01, Jan Grie?er escribi?: > > With more than 1 MPI process you mean i should use spectrum slicing in divide the full problem in smaller subproblems? > The --with-64-bit-indices is not a possibility for me since i configured petsc with mumps, which does not allow to use the 64-bit version (At least this was the error message when i tried to configure PETSc ) > > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman : > To use BVVECS just add the command-line option -bv_type vecs > This causes to use a separate Vec for each column, instead of a single long Vec of size n*m. But it is considerably slower than the default. > > Anyway, for such large problems you should consider using more than 1 MPI process. In that case the error may disappear because the local size is smaller than 768000. > > Jose > > > > El 17 oct 2018, a las 17:58, Matthew Knepley escribi?: > > > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er wrote: > > Hi all, > > i am using slepc4py and petsc4py to solve for the smallest real eigenvalues and eigenvectors. For my test cases with a matrix A of the size 30k x 30k solving for the smallest soutions works quite well, but when i increase the dimension of my system to around A = 768000 x 768000 or 3 million x 3 million and ask for the smallest real 3000 (the number is increasing with increasing system size) eigenvalues and eigenvectors i get the output (for the 768000): > > The product 4001 times 768000 overflows the size of PetscInt; consider reducing the number of columns, or use BVVECS instead > > i understand that the requested number of eigenvectors and eigenvalues is causing an overflow but i do not understand the solution of the problem which is stated in the error message. Can someone tell me what exactly BVVECS is and how i can use it? Or is there any other solution to my problem ? > > > > You can also reconfigure with 64-bit integers: --with-64-bit-indices > > > > Thanks, > > > > Matt > > > > Thank you very much in advance, > > Jan > > > > > > > > -- > > 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 > > > > https://www.cse.buffalo.edu/~knepley/ > From griesser.jan at googlemail.com Fri Oct 19 06:12:00 2018 From: griesser.jan at googlemail.com (=?UTF-8?B?SmFuIEdyaWXDn2Vy?=) Date: Fri, 19 Oct 2018 13:12:00 +0200 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> <9F6535EC-BABB-4CB7-AD26-4B4A6C735E4F@dsic.upv.es> Message-ID: Thiis i already did with mpiexec -n 20 ... and there the error occured. I was also a little bit surprised that this error occured. Our computation nodes have 20 cores with 6GB RAM. Is PETSc/ SLEPc saving the dense eigenvector error in one core ? Am Fr., 19. Okt. 2018 um 12:52 Uhr schrieb Jan Grie?er < griesser.jan at googlemail.com>: > Thiis i already did with mpiexec -n 20 ... and there the error occured. I > was also a little bit surprised that this error occured. Our computation > nodes have 20 cores with 6GB RAM. > Is PETSc/ SLEPc saving the dense eigenvector error in one core ? > > Am Fr., 19. Okt. 2018 um 11:08 Uhr schrieb Jose E. Roman < > jroman at dsic.upv.es>: > >> No, I mean to run in parallel: >> >> $ mpiexec -n 8 python ex1.py >> >> Jose >> >> >> > El 19 oct 2018, a las 11:01, Jan Grie?er >> escribi?: >> > >> > With more than 1 MPI process you mean i should use spectrum slicing in >> divide the full problem in smaller subproblems? >> > The --with-64-bit-indices is not a possibility for me since i >> configured petsc with mumps, which does not allow to use the 64-bit version >> (At least this was the error message when i tried to configure PETSc ) >> > >> > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman < >> jroman at dsic.upv.es>: >> > To use BVVECS just add the command-line option -bv_type vecs >> > This causes to use a separate Vec for each column, instead of a single >> long Vec of size n*m. But it is considerably slower than the default. >> > >> > Anyway, for such large problems you should consider using more than 1 >> MPI process. In that case the error may disappear because the local size is >> smaller than 768000. >> > >> > Jose >> > >> > >> > > El 17 oct 2018, a las 17:58, Matthew Knepley >> escribi?: >> > > >> > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er < >> griesser.jan at googlemail.com> wrote: >> > > Hi all, >> > > i am using slepc4py and petsc4py to solve for the smallest real >> eigenvalues and eigenvectors. For my test cases with a matrix A of the size >> 30k x 30k solving for the smallest soutions works quite well, but when i >> increase the dimension of my system to around A = 768000 x 768000 or 3 >> million x 3 million and ask for the smallest real 3000 (the number is >> increasing with increasing system size) eigenvalues and eigenvectors i get >> the output (for the 768000): >> > > The product 4001 times 768000 overflows the size of PetscInt; >> consider reducing the number of columns, or use BVVECS instead >> > > i understand that the requested number of eigenvectors and >> eigenvalues is causing an overflow but i do not understand the solution of >> the problem which is stated in the error message. Can someone tell me what >> exactly BVVECS is and how i can use it? Or is there any other solution to >> my problem ? >> > > >> > > You can also reconfigure with 64-bit integers: --with-64-bit-indices >> > > >> > > Thanks, >> > > >> > > Matt >> > > >> > > Thank you very much in advance, >> > > Jan >> > > >> > > >> > > >> > > -- >> > > 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 >> > > >> > > https://www.cse.buffalo.edu/~knepley/ >> > >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Fri Oct 19 06:18:56 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Fri, 19 Oct 2018 13:18:56 +0200 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> <9F6535EC-BABB-4CB7-AD26-4B4A6C735E4F@dsic.upv.es> Message-ID: <6FE29125-347F-4FBB-814F-454667F044BB@dsic.upv.es> Sorry, running in parallel does not change the thing. I was wrong, the limitation is for the global size and not the local size. So what you have to do is use -bv_type vecs or also -bv_type mat Let me know how this works. Jose > El 19 oct 2018, a las 13:12, Jan Grie?er escribi?: > > Thiis i already did with mpiexec -n 20 ... and there the error occured. I was also a little bit surprised that this error occured. Our computation nodes have 20 cores with 6GB RAM. > Is PETSc/ SLEPc saving the dense eigenvector error in one core ? > > > Am Fr., 19. Okt. 2018 um 12:52 Uhr schrieb Jan Grie?er : > Thiis i already did with mpiexec -n 20 ... and there the error occured. I was also a little bit surprised that this error occured. Our computation nodes have 20 cores with 6GB RAM. > Is PETSc/ SLEPc saving the dense eigenvector error in one core ? > > Am Fr., 19. Okt. 2018 um 11:08 Uhr schrieb Jose E. Roman : > No, I mean to run in parallel: > > $ mpiexec -n 8 python ex1.py > > Jose > > > > El 19 oct 2018, a las 11:01, Jan Grie?er escribi?: > > > > With more than 1 MPI process you mean i should use spectrum slicing in divide the full problem in smaller subproblems? > > The --with-64-bit-indices is not a possibility for me since i configured petsc with mumps, which does not allow to use the 64-bit version (At least this was the error message when i tried to configure PETSc ) > > > > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman : > > To use BVVECS just add the command-line option -bv_type vecs > > This causes to use a separate Vec for each column, instead of a single long Vec of size n*m. But it is considerably slower than the default. > > > > Anyway, for such large problems you should consider using more than 1 MPI process. In that case the error may disappear because the local size is smaller than 768000. > > > > Jose > > > > > > > El 17 oct 2018, a las 17:58, Matthew Knepley escribi?: > > > > > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er wrote: > > > Hi all, > > > i am using slepc4py and petsc4py to solve for the smallest real eigenvalues and eigenvectors. For my test cases with a matrix A of the size 30k x 30k solving for the smallest soutions works quite well, but when i increase the dimension of my system to around A = 768000 x 768000 or 3 million x 3 million and ask for the smallest real 3000 (the number is increasing with increasing system size) eigenvalues and eigenvectors i get the output (for the 768000): > > > The product 4001 times 768000 overflows the size of PetscInt; consider reducing the number of columns, or use BVVECS instead > > > i understand that the requested number of eigenvectors and eigenvalues is causing an overflow but i do not understand the solution of the problem which is stated in the error message. Can someone tell me what exactly BVVECS is and how i can use it? Or is there any other solution to my problem ? > > > > > > You can also reconfigure with 64-bit integers: --with-64-bit-indices > > > > > > Thanks, > > > > > > Matt > > > > > > Thank you very much in advance, > > > Jan > > > > > > > > > > > > -- > > > 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 > > > > > > https://www.cse.buffalo.edu/~knepley/ > > > From bsmith at mcs.anl.gov Fri Oct 19 07:32:21 2018 From: bsmith at mcs.anl.gov (Smith, Barry F.) Date: Fri, 19 Oct 2018 12:32:21 +0000 Subject: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 In-Reply-To: <1539939090363.13492@marin.nl> References: <1539939090363.13492@marin.nl> Message-ID: Hmm, the intent of all three first arguments should be in since they are passed in from the routine above. Does it work if you replace > Vec, INTENT(out) :: rr_system with > Vec, INTENT(in) :: rr_system ? Barry > On Oct 19, 2018, at 3:51 AM, Klaij, Christiaan wrote: > > I've recently upgraded from petsc-3.8.4 to petsc-3.10.2 and was > surprised to find a number of segmentation faults in my test > cases. These turned out to be related to user-defined MatMult and > PCApply for shell matrices. For example: > > SUBROUTINE systemMatMult(aa_system,xx_system,rr_system,ierr) > Mat, INTENT(in) :: aa_system > Vec, INTENT(in) :: xx_system > Vec, INTENT(out) :: rr_system > PetscErrorCode, INTENT(out) :: ierr > ... > END > > where aa_system is the shell matrix. This code works fine with > 3.8.4 and older, but fails with 3.10.2 due to invalid > pointers (gdb backtrace shows failure of VecSetValues due to > invalid first argument). After replacing by: > > SUBROUTINE mass_momentum_systemMatMult(aa_system,xx_system,rr_system,ierr) > Mat :: aa_system > Vec :: xx_system > Vec :: rr_system > PetscErrorCode :: ierr > ... > END > > everything's fine again. So clearly something has changed since > 3.8.4 that now prevents the use of INTENT in Fortran (at least > using intel 17.0.1 compilers). Any reason for this? > > Chris > > > dr. ir. Christiaan Klaij | Senior Researcher | Research & Development > MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl > > MARIN news: http://www.marin.nl/web/News/News-items/ReFRESCO-successfully-coupled-to-ParaView-Catalyst-for-insitu-analysis-1.htm > From knepley at gmail.com Fri Oct 19 07:44:00 2018 From: knepley at gmail.com (Matthew Knepley) Date: Fri, 19 Oct 2018 08:44:00 -0400 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: On Fri, Oct 19, 2018 at 5:01 AM Jan Grie?er wrote: > With more than 1 MPI process you mean i should use spectrum slicing in > divide the full problem in smaller subproblems? > The --with-64-bit-indices is not a possibility for me since i configured > petsc with mumps, which does not allow to use the 64-bit version (At least > this was the error message when i tried to configure PETSc ) > I believe you can replace MUMPS with SuperLU_dist for 64-bit ints. Matt > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman < > jroman at dsic.upv.es>: > >> To use BVVECS just add the command-line option -bv_type vecs >> This causes to use a separate Vec for each column, instead of a single >> long Vec of size n*m. But it is considerably slower than the default. >> >> Anyway, for such large problems you should consider using more than 1 MPI >> process. In that case the error may disappear because the local size is >> smaller than 768000. >> >> Jose >> >> >> > El 17 oct 2018, a las 17:58, Matthew Knepley >> escribi?: >> > >> > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er < >> griesser.jan at googlemail.com> wrote: >> > Hi all, >> > i am using slepc4py and petsc4py to solve for the smallest real >> eigenvalues and eigenvectors. For my test cases with a matrix A of the size >> 30k x 30k solving for the smallest soutions works quite well, but when i >> increase the dimension of my system to around A = 768000 x 768000 or 3 >> million x 3 million and ask for the smallest real 3000 (the number is >> increasing with increasing system size) eigenvalues and eigenvectors i get >> the output (for the 768000): >> > The product 4001 times 768000 overflows the size of PetscInt; consider >> reducing the number of columns, or use BVVECS instead >> > i understand that the requested number of eigenvectors and eigenvalues >> is causing an overflow but i do not understand the solution of the problem >> which is stated in the error message. Can someone tell me what exactly >> BVVECS is and how i can use it? Or is there any other solution to my >> problem ? >> > >> > You can also reconfigure with 64-bit integers: --with-64-bit-indices >> > >> > Thanks, >> > >> > Matt >> > >> > Thank you very much in advance, >> > Jan >> > >> > >> > >> > -- >> > 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 >> > >> > https://www.cse.buffalo.edu/~knepley/ >> >> -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jczhang at mcs.anl.gov Fri Oct 19 07:56:26 2018 From: jczhang at mcs.anl.gov (Zhang, Junchao) Date: Fri, 19 Oct 2018 12:56:26 +0000 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: On Fri, Oct 19, 2018 at 4:02 AM Jan Grie?er > wrote: With more than 1 MPI process you mean i should use spectrum slicing in divide the full problem in smaller subproblems? The --with-64-bit-indices is not a possibility for me since i configured petsc with mumps, which does not allow to use the 64-bit version (At least this was the error message when i tried to configure PETSc ) MUMPS 5.1.2 manual chapter 2.4.2 says it supports "Selective 64-bit integer feature" and "full 64-bit integer version" as well. Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman >: To use BVVECS just add the command-line option -bv_type vecs This causes to use a separate Vec for each column, instead of a single long Vec of size n*m. But it is considerably slower than the default. Anyway, for such large problems you should consider using more than 1 MPI process. In that case the error may disappear because the local size is smaller than 768000. Jose > El 17 oct 2018, a las 17:58, Matthew Knepley > escribi?: > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er > wrote: > Hi all, > i am using slepc4py and petsc4py to solve for the smallest real eigenvalues and eigenvectors. For my test cases with a matrix A of the size 30k x 30k solving for the smallest soutions works quite well, but when i increase the dimension of my system to around A = 768000 x 768000 or 3 million x 3 million and ask for the smallest real 3000 (the number is increasing with increasing system size) eigenvalues and eigenvectors i get the output (for the 768000): > The product 4001 times 768000 overflows the size of PetscInt; consider reducing the number of columns, or use BVVECS instead > i understand that the requested number of eigenvectors and eigenvalues is causing an overflow but i do not understand the solution of the problem which is stated in the error message. Can someone tell me what exactly BVVECS is and how i can use it? Or is there any other solution to my problem ? > > You can also reconfigure with 64-bit integers: --with-64-bit-indices > > Thanks, > > Matt > > Thank you very much in advance, > Jan > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From C.Klaij at marin.nl Fri Oct 19 09:37:58 2018 From: C.Klaij at marin.nl (Klaij, Christiaan) Date: Fri, 19 Oct 2018 14:37:58 +0000 Subject: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 In-Reply-To: References: <1539939090363.13492@marin.nl>, Message-ID: <1539959878384.42597@marin.nl> As far as I (mis)understand fortran, this is a data protection thing: all arguments are passed in from above but the subroutine is only allowed to change rr and ierr, not aa and xx (if you try, you get a compiler warning). That's why I find it very odd to give an intent(in) to rr. But I've tried your suggestion anyway: both intent(in) and intent(inout) for rr do work! Can't say I understand though. Below's a small example of what I was expecting. Change rr to intent(in) and the compiler complains. Chris $ cat intent.f90 program intent implicit none real, allocatable :: aa(:), xx(:), rr(:) integer :: ierr allocate(aa(10),xx(10),rr(10)) aa = 1.0 xx = 2.0 call matmult(aa,xx,rr,ierr) print *, rr(1) print *, ierr deallocate(aa,xx,rr) contains subroutine matmult(aa,xx,rr,ierr) real, intent(in) :: aa(:), xx(:) real, intent(out):: rr(:) integer, intent(out) :: ierr rr=aa*xx ierr=0 end subroutine matmult end program intent $ ./a.out 2.000000 0 dr. ir. Christiaan Klaij | Senior Researcher | Research & Development MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl MARIN news: http://www.marin.nl/web/News/News-items/Seminar-Scheepsbrandstof-en-de-mondiale-zwavelnorm-2020.htm ________________________________________ From: Smith, Barry F. Sent: Friday, October 19, 2018 2:32 PM To: Klaij, Christiaan Cc: petsc-users at mcs.anl.gov Subject: Re: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 Hmm, the intent of all three first arguments should be in since they are passed in from the routine above. Does it work if you replace > Vec, INTENT(out) :: rr_system with > Vec, INTENT(in) :: rr_system ? Barry > On Oct 19, 2018, at 3:51 AM, Klaij, Christiaan wrote: > > I've recently upgraded from petsc-3.8.4 to petsc-3.10.2 and was > surprised to find a number of segmentation faults in my test > cases. These turned out to be related to user-defined MatMult and > PCApply for shell matrices. For example: > > SUBROUTINE systemMatMult(aa_system,xx_system,rr_system,ierr) > Mat, INTENT(in) :: aa_system > Vec, INTENT(in) :: xx_system > Vec, INTENT(out) :: rr_system > PetscErrorCode, INTENT(out) :: ierr > ... > END > > where aa_system is the shell matrix. This code works fine with > 3.8.4 and older, but fails with 3.10.2 due to invalid > pointers (gdb backtrace shows failure of VecSetValues due to > invalid first argument). After replacing by: > > SUBROUTINE mass_momentum_systemMatMult(aa_system,xx_system,rr_system,ierr) > Mat :: aa_system > Vec :: xx_system > Vec :: rr_system > PetscErrorCode :: ierr > ... > END > > everything's fine again. So clearly something has changed since > 3.8.4 that now prevents the use of INTENT in Fortran (at least > using intel 17.0.1 compilers). Any reason for this? > > Chris > > > dr. ir. Christiaan Klaij | Senior Researcher | Research & Development > MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl > > MARIN news: http://www.marin.nl/web/News/News-items/ReFRESCO-successfully-coupled-to-ParaView-Catalyst-for-insitu-analysis-1.htm > From knepley at gmail.com Fri Oct 19 13:09:20 2018 From: knepley at gmail.com (Matthew Knepley) Date: Fri, 19 Oct 2018 14:09:20 -0400 Subject: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 In-Reply-To: <1539959878384.42597@marin.nl> References: <1539939090363.13492@marin.nl> <1539959878384.42597@marin.nl> Message-ID: On Fri, Oct 19, 2018 at 10:38 AM Klaij, Christiaan wrote: > As far as I (mis)understand fortran, this is a data protection > thing: all arguments are passed in from above but the subroutine > is only allowed to change rr and ierr, not aa and xx (if you try, > you get a compiler warning). That's why I find it very odd to > give an intent(in) to rr. rr is not changed, and it cannot be. You pass in a pointer to the object and we fill up the object with values. We cannot change that pointer. Matt > But I've tried your suggestion anyway: > both intent(in) and intent(inout) for rr do work! Can't say I > understand though. > > Below's a small example of what I was expecting. Change rr to > intent(in) and the compiler complains. > > Chris > > $ cat intent.f90 > program intent > > implicit none > > real, allocatable :: aa(:), xx(:), rr(:) > integer :: ierr > > allocate(aa(10),xx(10),rr(10)) > > aa = 1.0 > xx = 2.0 > > call matmult(aa,xx,rr,ierr) > > print *, rr(1) > print *, ierr > > deallocate(aa,xx,rr) > > contains > > subroutine matmult(aa,xx,rr,ierr) > real, intent(in) :: aa(:), xx(:) > real, intent(out):: rr(:) > integer, intent(out) :: ierr > rr=aa*xx > ierr=0 > end subroutine matmult > > end program intent > $ ./a.out > 2.000000 > 0 > > > > > dr. ir. Christiaan Klaij | Senior Researcher | Research & Development > MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl > > MARIN news: > http://www.marin.nl/web/News/News-items/Seminar-Scheepsbrandstof-en-de-mondiale-zwavelnorm-2020.htm > > ________________________________________ > From: Smith, Barry F. > Sent: Friday, October 19, 2018 2:32 PM > To: Klaij, Christiaan > Cc: petsc-users at mcs.anl.gov > Subject: Re: [petsc-users] fortran INTENT with petsc object gives segfault > after upgrade from 3.8.4 to 3.10.2 > > Hmm, the intent of all three first arguments should be in since they > are passed in from the routine above. Does it work if you replace > > > Vec, INTENT(out) :: rr_system > > with > > > Vec, INTENT(in) :: rr_system > > ? > > Barry > > > > On Oct 19, 2018, at 3:51 AM, Klaij, Christiaan wrote: > > > > I've recently upgraded from petsc-3.8.4 to petsc-3.10.2 and was > > surprised to find a number of segmentation faults in my test > > cases. These turned out to be related to user-defined MatMult and > > PCApply for shell matrices. For example: > > > > SUBROUTINE systemMatMult(aa_system,xx_system,rr_system,ierr) > > Mat, INTENT(in) :: aa_system > > Vec, INTENT(in) :: xx_system > > Vec, INTENT(out) :: rr_system > > PetscErrorCode, INTENT(out) :: ierr > > ... > > END > > > > where aa_system is the shell matrix. This code works fine with > > 3.8.4 and older, but fails with 3.10.2 due to invalid > > pointers (gdb backtrace shows failure of VecSetValues due to > > invalid first argument). After replacing by: > > > > SUBROUTINE > mass_momentum_systemMatMult(aa_system,xx_system,rr_system,ierr) > > Mat :: aa_system > > Vec :: xx_system > > Vec :: rr_system > > PetscErrorCode :: ierr > > ... > > END > > > > everything's fine again. So clearly something has changed since > > 3.8.4 that now prevents the use of INTENT in Fortran (at least > > using intel 17.0.1 compilers). Any reason for this? > > > > Chris > > > > > > dr. ir. Christiaan Klaij | Senior Researcher | Research & Development > > MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | > http://www.marin.nl > > > > MARIN news: > http://www.marin.nl/web/News/News-items/ReFRESCO-successfully-coupled-to-ParaView-Catalyst-for-insitu-analysis-1.htm > > > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Fri Oct 19 14:00:20 2018 From: bsmith at mcs.anl.gov (Smith, Barry F.) Date: Fri, 19 Oct 2018 19:00:20 +0000 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: > On Oct 19, 2018, at 7:56 AM, Zhang, Junchao wrote: > > > On Fri, Oct 19, 2018 at 4:02 AM Jan Grie?er wrote: > With more than 1 MPI process you mean i should use spectrum slicing in divide the full problem in smaller subproblems? > The --with-64-bit-indices is not a possibility for me since i configured petsc with mumps, which does not allow to use the 64-bit version (At least this was the error message when i tried to configure PETSc ) > > MUMPS 5.1.2 manual chapter 2.4.2 says it supports "Selective 64-bit integer feature" and "full 64-bit integer version" as well. They use to achieve this by compiling with special Fortran flags to promote integers to 64 bit; this is too fragile for our taste so we never hooked PETSc up wit it. If they have a dependable way of using 64 bit integers we should add that to our mumps.py and test it. Barry > > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman : > To use BVVECS just add the command-line option -bv_type vecs > This causes to use a separate Vec for each column, instead of a single long Vec of size n*m. But it is considerably slower than the default. > > Anyway, for such large problems you should consider using more than 1 MPI process. In that case the error may disappear because the local size is smaller than 768000. > > Jose > > > > El 17 oct 2018, a las 17:58, Matthew Knepley escribi?: > > > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er wrote: > > Hi all, > > i am using slepc4py and petsc4py to solve for the smallest real eigenvalues and eigenvectors. For my test cases with a matrix A of the size 30k x 30k solving for the smallest soutions works quite well, but when i increase the dimension of my system to around A = 768000 x 768000 or 3 million x 3 million and ask for the smallest real 3000 (the number is increasing with increasing system size) eigenvalues and eigenvectors i get the output (for the 768000): > > The product 4001 times 768000 overflows the size of PetscInt; consider reducing the number of columns, or use BVVECS instead > > i understand that the requested number of eigenvectors and eigenvalues is causing an overflow but i do not understand the solution of the problem which is stated in the error message. Can someone tell me what exactly BVVECS is and how i can use it? Or is there any other solution to my problem ? > > > > You can also reconfigure with 64-bit integers: --with-64-bit-indices > > > > Thanks, > > > > Matt > > > > Thank you very much in advance, > > Jan > > > > > > > > -- > > 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 > > > > https://www.cse.buffalo.edu/~knepley/ > From mcygorek at uottawa.ca Fri Oct 19 14:08:26 2018 From: mcygorek at uottawa.ca (Moritz Cygorek) Date: Fri, 19 Oct 2018 19:08:26 +0000 Subject: [petsc-users] random SLEPc segfault using openmpi-3.0.1 Message-ID: Hi, I'm using SLEPc to diagonalize a huge sparse matrix and I've encountered random segmentation faults. I'm actually using a the slepc example 4 without modifications to rule out errors due to coding. Concretely, I use the command line ompirun -n 28 ex4 \ -file amatrix.bin -eps_tol 1e-6 -eps_target 0 -eps_nev 18 \ -eps_harmonic -eps_ncv 40 -eps_max_it 100000 \ -eps_monitor -eps_view -eps_view_values -eps_view_vectors 2>&1 |tee -a $LOGFILE The program runs for some time (about half a day) and then stops with the error message [13]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range There is definitely enough memory, because I'm using less than 4% of the available 128GB. Since everything worked fine on a slower computer with a different setup and from previous mailing list comments, I have the feeling that this might be due to some issues with MPI. Unfortunately, I have to share the computer with other people and can not uninstall the current MPI implementation and I've also heard that there are issues if you install more than one MPI implementation. For your information: I've configured PETSc with ./configure --with-mpi-dir=/home/applications/builds/intel_2018/openmpi-3.0.1/ --with-scalar-type=complex --download-mumps --download-scalapack --with-blas-lapack-dir=/opt/intel/compilers_and_libraries_2018.2.199/linux/mkl I wanted to ask a few things: - Is there a known issue with openmpi causing random segmentation faults? - I've also tried to install everything needed by configuring PETSc with ./configure \ --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --with-scalar-type=complex \ --download-mumps --download-scalapack --download-mpich --download-fblaslapack Here, the problem is that performing the checks after "make" stops after the check with 1 MPI process, i.e., the check using 2 MPI just never finishes. Is that a known issue of conflict between the downloaded mpich and the installed openmpi? Do you know a way to install mpich without conflicts with openmpi without actually removing openmpi? - Some time ago a posted a question in the mailing list about how to compile SLEPc/PETSc with OpenMP only instead of MPI. After some time, I was able to get MPI to work on a different computer, but I was never really able to use OpenMP with slepc, but it would be very useful in the present situation. The programs compile but they never take more than 100% CPU load as displayed by top. The answers to my question contained the recommendations that I should configure with --download-openblas and have the OMP_NUM_THREADS variable set when executing the program. I did it, but it didn't help either. So, my question: has someone ever managed to find a configure line that disables MPI but enables the usage of OpenMP so that the slepc ex4 program uses significantly more than 100% CPU usage when executing the standard Krylov-Schur method? Regards, Moritz -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Fri Oct 19 14:35:05 2018 From: knepley at gmail.com (Matthew Knepley) Date: Fri, 19 Oct 2018 15:35:05 -0400 Subject: [petsc-users] random SLEPc segfault using openmpi-3.0.1 In-Reply-To: References: Message-ID: On Fri, Oct 19, 2018 at 3:09 PM Moritz Cygorek wrote: > Hi, > > I'm using SLEPc to diagonalize a huge sparse matrix and I've encountered > random segmentation faults. > > I'm actually using a the slepc example 4 without modifications to rule out > errors due to coding. > > Concretely, I use the command line > > > ompirun -n 28 ex4 \ > -file amatrix.bin -eps_tol 1e-6 -eps_target 0 -eps_nev 18 \ > -eps_harmonic -eps_ncv 40 -eps_max_it 100000 \ > -eps_monitor -eps_view -eps_view_values -eps_view_vectors 2>&1 |tee -a > $LOGFILE > > > > The program runs for some time (about half a day) and then stops with the > error message > > > > [13]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, > probably memory access out of range > > There is definitely enough memory, because I'm using less than 4% of the > available 128GB. > > > > > Since everything worked fine on a slower computer with a different setup > and from previous mailing list comments, I have the feeling that this might > be due to some issues with MPI. > > > Unfortunately, I have to share the computer with other people and can not > uninstall the current MPI implementation and I've also heard that there are > issues if you install more than one MPI implementation. > > > For your information: I've configured PETSc with > > > ./configure > --with-mpi-dir=/home/applications/builds/intel_2018/openmpi-3.0.1/ > --with-scalar-type=complex --download-mumps --download-scalapack > --with-blas-lapack-dir=/opt/intel/compilers_and_libraries_2018.2.199/linux/mkl > > I wanted to ask a few things: > > - Is there a known issue with openmpi causing random segmentation faults? > OpenMPI certainly has had bugs, but this is not a constrained enough question to pin the fault on any one of those. > - I've also tried to install everything needed by configuring PETSc with > ./configure \ > --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --with-scalar-type=complex > \ > --download-mumps --download-scalapack --download-mpich > --download-fblaslapack > > Here, the problem is that performing the checks after "make" stops after > the check with 1 MPI process, i.e., the check using 2 MPI just never > finishes. > Is that a known issue of conflict between the downloaded mpich and the > installed openmpi? > No, it likely has to do with the network configuration, that is mpiexec is waiting for gethostbyname() for your machine, which is failing. > Do you know a way to install mpich without conflicts with openmpi without > actually removing openmpi? > The above can work as long as OpenMPI is not in default compiler paths like /usr/lib. > - Some time ago a posted a question in the mailing list about how to > compile SLEPc/PETSc with OpenMP only instead of MPI. After some time, I was > able to get MPI to work on a different computer, > but I was never really able to use OpenMP with slepc, but it would be very > useful in the present situation. The > Why do you think so? > programs compile but they never take more than 100% CPU load as displayed > by top. > That is perfectly understandable since the memory bandwidth can be maxed out with fewer cores than are present. OpenMP will not help this. > The answers to my question contained the recommendations that I should > configure with --download-openblas and have the OMP_NUM_THREADS variable > set when executing the program. I did it, but it didn't help either. > Yep. > So, my question: has someone ever managed to find a configure line that > disables MPI but enables the usage of OpenMP so that the slepc ex4 program > uses significantly more than 100% CPU usage when executing the standard > Krylov-Schur method? > As I said, this is likely to be impossible for architecture reasons: https://www.mcs.anl.gov/petsc/documentation/faq.html#computers Thanks, Matt > Regards, > > Moritz > > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From bsmith at mcs.anl.gov Fri Oct 19 15:26:57 2018 From: bsmith at mcs.anl.gov (Smith, Barry F.) Date: Fri, 19 Oct 2018 20:26:57 +0000 Subject: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 In-Reply-To: <1539959878384.42597@marin.nl> References: <1539939090363.13492@marin.nl> <1539959878384.42597@marin.nl> Message-ID: <380804AB-7723-4539-9722-9B2D689D6A05@mcs.anl.gov> > On Oct 19, 2018, at 9:37 AM, Klaij, Christiaan wrote: > > As far as I (mis)understand fortran, this is a data protection > thing: all arguments are passed in from above but the subroutine > is only allowed to change rr and ierr, not aa and xx (if you try, > you get a compiler warning). The routine is not allowed to change rr (it is only allowed to change the values "inside" rr) that is why it needs to be intent in or inout. Otherwise the compiler can optimize and not pass down the value of the rr pointer to the subroutine since by declaring as it as out the compiler thinks your subroutine is going to set is value. Barry > That's why I find it very odd to > give an intent(in) to rr. But I've tried your suggestion anyway: > both intent(in) and intent(inout) for rr do work! Can't say I > understand though. > > Below's a small example of what I was expecting. Change rr to > intent(in) and the compiler complains. > > Chris > > $ cat intent.f90 > program intent > > implicit none > > real, allocatable :: aa(:), xx(:), rr(:) > integer :: ierr > > allocate(aa(10),xx(10),rr(10)) > > aa = 1.0 > xx = 2.0 > > call matmult(aa,xx,rr,ierr) > > print *, rr(1) > print *, ierr > > deallocate(aa,xx,rr) > > contains > > subroutine matmult(aa,xx,rr,ierr) > real, intent(in) :: aa(:), xx(:) > real, intent(out):: rr(:) > integer, intent(out) :: ierr > rr=aa*xx > ierr=0 > end subroutine matmult > > end program intent > $ ./a.out > 2.000000 > 0 > > > > > dr. ir. Christiaan Klaij | Senior Researcher | Research & Development > MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl > > MARIN news: http://www.marin.nl/web/News/News-items/Seminar-Scheepsbrandstof-en-de-mondiale-zwavelnorm-2020.htm > > ________________________________________ > From: Smith, Barry F. > Sent: Friday, October 19, 2018 2:32 PM > To: Klaij, Christiaan > Cc: petsc-users at mcs.anl.gov > Subject: Re: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 > > Hmm, the intent of all three first arguments should be in since they are passed in from the routine above. Does it work if you replace > >> Vec, INTENT(out) :: rr_system > > with > >> Vec, INTENT(in) :: rr_system > > ? > > Barry > > >> On Oct 19, 2018, at 3:51 AM, Klaij, Christiaan wrote: >> >> I've recently upgraded from petsc-3.8.4 to petsc-3.10.2 and was >> surprised to find a number of segmentation faults in my test >> cases. These turned out to be related to user-defined MatMult and >> PCApply for shell matrices. For example: >> >> SUBROUTINE systemMatMult(aa_system,xx_system,rr_system,ierr) >> Mat, INTENT(in) :: aa_system >> Vec, INTENT(in) :: xx_system >> Vec, INTENT(out) :: rr_system >> PetscErrorCode, INTENT(out) :: ierr >> ... >> END >> >> where aa_system is the shell matrix. This code works fine with >> 3.8.4 and older, but fails with 3.10.2 due to invalid >> pointers (gdb backtrace shows failure of VecSetValues due to >> invalid first argument). After replacing by: >> >> SUBROUTINE mass_momentum_systemMatMult(aa_system,xx_system,rr_system,ierr) >> Mat :: aa_system >> Vec :: xx_system >> Vec :: rr_system >> PetscErrorCode :: ierr >> ... >> END >> >> everything's fine again. So clearly something has changed since >> 3.8.4 that now prevents the use of INTENT in Fortran (at least >> using intel 17.0.1 compilers). Any reason for this? >> >> Chris >> >> >> dr. ir. Christiaan Klaij | Senior Researcher | Research & Development >> MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl >> >> MARIN news: http://www.marin.nl/web/News/News-items/ReFRESCO-successfully-coupled-to-ParaView-Catalyst-for-insitu-analysis-1.htm >> > From bsmith at mcs.anl.gov Fri Oct 19 16:21:44 2018 From: bsmith at mcs.anl.gov (Smith, Barry F.) Date: Fri, 19 Oct 2018 21:21:44 +0000 Subject: [petsc-users] random SLEPc segfault using openmpi-3.0.1 In-Reply-To: References: Message-ID: <6E2E99DF-1525-4F99-A787-89E13151A86B@anl.gov> > On Oct 19, 2018, at 2:08 PM, Moritz Cygorek wrote: > > Hi, > > I'm using SLEPc to diagonalize a huge sparse matrix and I've encountered random segmentation faults. https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind > > > I'm actually using a the slepc example 4 without modifications to rule out errors due to coding. > Concretely, I use the command line > > ompirun -n 28 ex4 \ > -file amatrix.bin -eps_tol 1e-6 -eps_target 0 -eps_nev 18 \ > -eps_harmonic -eps_ncv 40 -eps_max_it 100000 \ > -eps_monitor -eps_view -eps_view_values -eps_view_vectors 2>&1 |tee -a $LOGFILE > > > > The program runs for some time (about half a day) and then stops with the error message > > > [13]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range > > There is definitely enough memory, because I'm using less than 4% of the available 128GB. > > > > Since everything worked fine on a slower computer with a different setup and from previous mailing list comments, I have the feeling that this might be due to some issues with MPI. > > Unfortunately, I have to share the computer with other people and can not uninstall the current MPI implementation and I've also heard that there are issues if you install more than one MPI implementation. > > For your information: I've configured PETSc with > > ./configure --with-mpi-dir=/home/applications/builds/intel_2018/openmpi-3.0.1/ --with-scalar-type=complex --download-mumps --download-scalapack --with-blas-lapack-dir=/opt/intel/compilers_and_libraries_2018.2.199/linux/mkl > > > > > I wanted to ask a few things: > > - Is there a known issue with openmpi causing random segmentation faults? > > - I've also tried to install everything needed by configuring PETSc with > > ./configure \ > --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --with-scalar-type=complex \ > --download-mumps --download-scalapack --download-mpich --download-fblaslapack > > Here, the problem is that performing the checks after "make" stops after the check with 1 MPI process, i.e., the check using 2 MPI just never finishes. > Is that a known issue of conflict between the downloaded mpich and the installed openmpi? > Do you know a way to install mpich without conflicts with openmpi without actually removing openmpi? > > > - Some time ago a posted a question in the mailing list about how to compile SLEPc/PETSc with OpenMP only instead of MPI. After some time, I was able to get MPI to work on a different computer, > but I was never really able to use OpenMP with slepc, but it would be very useful in the present situation. The programs compile but they never take more than 100% CPU load as displayed by top. > The answers to my question contained the recommendations that I should configure with --download-openblas and have the OMP_NUM_THREADS variable set when executing the program. I did it, but it didn't help either. > So, my question: has someone ever managed to find a configure line that disables MPI but enables the usage of OpenMP so that the slepc ex4 program uses significantly more than 100% CPU usage when executing the standard Krylov-Schur method? > > > > > Regards, > Moritz From caleb at janmager.keurslager.nl Sat Oct 20 13:02:41 2018 From: caleb at janmager.keurslager.nl (Sherry) Date: Sat, 20 Oct 2018 11:02:41 -0700 (UTC) Subject: [petsc-users] Realize your dormant temper. Viagra Soft. Message-ID: <79749962536.7n3U.86714@sender.gy6.janmager.keurslager.nl> A non-text attachment was scrubbed... Name: not available Type: text/html:332933 Size: 262784 bytes Desc: not available URL: From mfadams at lbl.gov Sat Oct 20 15:52:54 2018 From: mfadams at lbl.gov (Mark Adams) Date: Sat, 20 Oct 2018 16:52:54 -0400 Subject: [petsc-users] p4est error Message-ID: I am getting this error. This was a clean build (nuked the arch directory). 13:50 nid12922 master= ~/petsc_install/petsc$ make PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel PETSC_ARCH="" test Running test examples to verify correct installation Using PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel and PETSC_ARCH= *******************Error detected during compile or link!******************* See http://www.mcs.anl.gov/petsc/documentation/faq.html /global/homes/m/madams/petsc_install/petsc/src/snes/examples/tutorials ex19 ********************************************************************************* cc -o ex19.o -c -g -fp-model fast -I/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/include `pwd`/ex19.c cc -g -fp-model fast -o ex19 ex19.o -L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib -Wl,-rpath,/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib -L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib -lpetsc -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord -lscalapack -lfftw3_mpi -lfftw3 -lp4est -lsc -lflapack -lfblas -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lchaco -lparmetis -lmetis -lstdc++ -ldl /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(dlimpl.o): In function `PetscDLOpen': /global/u2/m/madams/petsc_install/petsc/src/sys/dll/dlimpl.c:108: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: Warning: alignment 8 of symbol `ARCHITECTURE' in /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libchaco.a(user_params.o) is smaller than 32 in /opt/cray/pe/pmi/5.0.13/lib64/libpmi.a(_pmi_topology_discovery.o) /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(send.o): In function `PetscOpenSocket': /global/u2/m/madams/petsc_install/petsc/src/sys/classes/viewer/impls/socket/send.c:108: warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est.o): In function `p4est_checksum': /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: undefined reference to `adler32' /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: undefined reference to `adler32_combine' /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est_communication.o): In function `p4est_comm_checksum': /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: undefined reference to `adler32_combine' /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est.o): In function `p8est_checksum': /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: undefined reference to `adler32' /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: undefined reference to `adler32_combine' /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est_communication.o): In function `p8est_comm_checksum': /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: undefined reference to `adler32_combine' /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_containers.o): In function `sc_array_checksum': /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:565: undefined reference to `adler32' /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:571: undefined reference to `adler32' /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_io.o): In function `sc_vtk_write_compressed': /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:492: undefined reference to `compress2' /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:507: undefined reference to `compress2' /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/petsc/conf/test:13: recipe for target 'ex19' failed gmake[3]: [ex19] Error 1 (ignored) true ex19 rm ex19.o -------------- next part -------------- An HTML attachment was scrubbed... URL: From tisaac at cc.gatech.edu Sat Oct 20 16:14:03 2018 From: tisaac at cc.gatech.edu (Isaac, Tobin G) Date: Sat, 20 Oct 2018 21:14:03 +0000 Subject: [petsc-users] p4est error In-Reply-To: References: Message-ID: I think adler32 is in zlib: p4est typically finds it in configure. Can you send along config.log from externalpackages/git.p4est? On October 20, 2018 4:52:54 PM EDT, Mark Adams wrote: >I am getting this error. This was a clean build (nuked the arch >directory). > >13:50 nid12922 master= ~/petsc_install/petsc$ make >PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel >PETSC_ARCH="" test >Running test examples to verify correct installation >Using >PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel >and PETSC_ARCH= >*******************Error detected during compile or >link!******************* >See http://www.mcs.anl.gov/petsc/documentation/faq.html >/global/homes/m/madams/petsc_install/petsc/src/snes/examples/tutorials >ex19 >********************************************************************************* >cc -o ex19.o -c -g -fp-model fast >-I/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/include > `pwd`/ex19.c >cc -g -fp-model fast -o ex19 ex19.o >-L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib >-Wl,-rpath,/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib >-L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib >-lpetsc -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord >-lscalapack -lfftw3_mpi -lfftw3 -lp4est -lsc -lflapack -lfblas >-lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lchaco -lparmetis >-lmetis >-lstdc++ -ldl >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(dlimpl.o): >In function `PetscDLOpen': >/global/u2/m/madams/petsc_install/petsc/src/sys/dll/dlimpl.c:108: >warning: >Using 'dlopen' in statically linked applications requires at runtime >the >shared libraries from the glibc version used for linking >/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: >Warning: alignment 8 of symbol `ARCHITECTURE' in >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libchaco.a(user_params.o) >is smaller than 32 in >/opt/cray/pe/pmi/5.0.13/lib64/libpmi.a(_pmi_topology_discovery.o) >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(send.o): >In function `PetscOpenSocket': >/global/u2/m/madams/petsc_install/petsc/src/sys/classes/viewer/impls/socket/send.c:108: >warning: Using 'gethostbyname' in statically linked applications >requires >at runtime the shared libraries from the glibc version used for linking >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est.o): >In function `p4est_checksum': >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: >undefined reference to `adler32' >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: >undefined reference to `adler32_combine' >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est_communication.o): >In function `p4est_comm_checksum': >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: >undefined reference to `adler32_combine' >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est.o): >In function `p8est_checksum': >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: >undefined reference to `adler32' >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: >undefined reference to `adler32_combine' >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est_communication.o): >In function `p8est_comm_checksum': >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: >undefined reference to `adler32_combine' >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_containers.o): >In function `sc_array_checksum': >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:565: >undefined reference to `adler32' >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:571: >undefined reference to `adler32' >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_io.o): >In function `sc_vtk_write_compressed': >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:492: >undefined reference to `compress2' >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:507: >undefined reference to `compress2' >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/petsc/conf/test:13: >recipe for target 'ex19' failed >gmake[3]: [ex19] Error 1 (ignored) >true ex19 >rm ex19.o From bsmith at mcs.anl.gov Sat Oct 20 16:21:56 2018 From: bsmith at mcs.anl.gov (Smith, Barry F.) Date: Sat, 20 Oct 2018 21:21:56 +0000 Subject: [petsc-users] p4est error In-Reply-To: References: Message-ID: > On Oct 20, 2018, at 4:14 PM, Isaac, Tobin G wrote: > > I think adler32 is in zlib: p4est typically finds it in configure. Can you send along config.log from externalpackages/git.p4est? Is there a way to pass the zlib information to ./configure? We should add that to p4est.py Reason: we don't like external packages making their own decisions, we want PETSc's configure making the decisions and passing the decisions down to the packages. Barry This is especially true for hairy machines that Mark likes to build on, where standard configure sometimes makes the wrong decision or cannot figure out something. > > On October 20, 2018 4:52:54 PM EDT, Mark Adams wrote: >> I am getting this error. This was a clean build (nuked the arch >> directory). >> >> 13:50 nid12922 master= ~/petsc_install/petsc$ make >> PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel >> PETSC_ARCH="" test >> Running test examples to verify correct installation >> Using >> PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel >> and PETSC_ARCH= >> *******************Error detected during compile or >> link!******************* >> See http://www.mcs.anl.gov/petsc/documentation/faq.html >> /global/homes/m/madams/petsc_install/petsc/src/snes/examples/tutorials >> ex19 >> ********************************************************************************* >> cc -o ex19.o -c -g -fp-model fast >> -I/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/include >> `pwd`/ex19.c >> cc -g -fp-model fast -o ex19 ex19.o >> -L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib >> -Wl,-rpath,/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib >> -L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib >> -lpetsc -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord >> -lscalapack -lfftw3_mpi -lfftw3 -lp4est -lsc -lflapack -lfblas >> -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lchaco -lparmetis >> -lmetis >> -lstdc++ -ldl >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(dlimpl.o): >> In function `PetscDLOpen': >> /global/u2/m/madams/petsc_install/petsc/src/sys/dll/dlimpl.c:108: >> warning: >> Using 'dlopen' in statically linked applications requires at runtime >> the >> shared libraries from the glibc version used for linking >> /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: >> Warning: alignment 8 of symbol `ARCHITECTURE' in >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libchaco.a(user_params.o) >> is smaller than 32 in >> /opt/cray/pe/pmi/5.0.13/lib64/libpmi.a(_pmi_topology_discovery.o) >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(send.o): >> In function `PetscOpenSocket': >> /global/u2/m/madams/petsc_install/petsc/src/sys/classes/viewer/impls/socket/send.c:108: >> warning: Using 'gethostbyname' in statically linked applications >> requires >> at runtime the shared libraries from the glibc version used for linking >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est.o): >> In function `p4est_checksum': >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: >> undefined reference to `adler32' >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: >> undefined reference to `adler32_combine' >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est_communication.o): >> In function `p4est_comm_checksum': >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: >> undefined reference to `adler32_combine' >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est.o): >> In function `p8est_checksum': >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: >> undefined reference to `adler32' >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: >> undefined reference to `adler32_combine' >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est_communication.o): >> In function `p8est_comm_checksum': >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: >> undefined reference to `adler32_combine' >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_containers.o): >> In function `sc_array_checksum': >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:565: >> undefined reference to `adler32' >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:571: >> undefined reference to `adler32' >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_io.o): >> In function `sc_vtk_write_compressed': >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:492: >> undefined reference to `compress2' >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:507: >> undefined reference to `compress2' >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/petsc/conf/test:13: >> recipe for target 'ex19' failed >> gmake[3]: [ex19] Error 1 (ignored) >> true ex19 >> rm ex19.o From balay at mcs.anl.gov Sat Oct 20 16:31:42 2018 From: balay at mcs.anl.gov (Balay, Satish) Date: Sat, 20 Oct 2018 21:31:42 +0000 Subject: [petsc-users] p4est error In-Reply-To: References: Message-ID: I don't see an option for specifying zlib explicitly - so perhaps it can use it from LIBS? [untested patch] Satish -------- diff --git a/config/BuildSystem/config/packages/p4est.py b/config/BuildSystem/config/packages/p4est.py index 03d1e2fcb0..31d2307f2b 100644 --- a/config/BuildSystem/config/packages/p4est.py +++ b/config/BuildSystem/config/packages/p4est.py @@ -21,8 +21,9 @@ class Configure(config.package.GNUPackage): def setupDependencies(self, framework): config.package.GNUPackage.setupDependencies(self, framework) self.mpi = framework.require('config.packages.MPI',self) - self.blasLapack = self.framework.require('config.packages.BlasLapack',self) - self.deps = [self.mpi,self.blasLapack] + self.blasLapack = framework.require('config.packages.BlasLapack',self) + self.zlib = framework.require('config.packages.zlib',self) + self.deps = [self.mpi,self.blasLapack,self.zlib] return def formGNUConfigureArgs(self): @@ -30,7 +31,7 @@ class Configure(config.package.GNUPackage): if self.argDB['with-p4est-debugging']: args.append('--enable-debug') args.append('--enable-mpi') - args.append('LIBS="'+self.libraries.toString(self.blasLapack.dlib)+'"') + args.append('LIBS="'+self.libraries.toString(self.dlib)+'"') return args def updateGitDir(self): On Sat, 20 Oct 2018, Smith, Barry F. wrote: > > > > On Oct 20, 2018, at 4:14 PM, Isaac, Tobin G wrote: > > > > I think adler32 is in zlib: p4est typically finds it in configure. Can you send along config.log from externalpackages/git.p4est? > > Is there a way to pass the zlib information to ./configure? We should add that to p4est.py Reason: we don't like external packages making their own decisions, we want PETSc's configure making the decisions and passing the decisions down to the packages. > > Barry > > This is especially true for hairy machines that Mark likes to build on, where standard configure sometimes makes the wrong decision or cannot figure out something. > > > > > On October 20, 2018 4:52:54 PM EDT, Mark Adams wrote: > >> I am getting this error. This was a clean build (nuked the arch > >> directory). > >> > >> 13:50 nid12922 master= ~/petsc_install/petsc$ make > >> PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel > >> PETSC_ARCH="" test > >> Running test examples to verify correct installation > >> Using > >> PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel > >> and PETSC_ARCH= > >> *******************Error detected during compile or > >> link!******************* > >> See http://www.mcs.anl.gov/petsc/documentation/faq.html > >> /global/homes/m/madams/petsc_install/petsc/src/snes/examples/tutorials > >> ex19 > >> ********************************************************************************* > >> cc -o ex19.o -c -g -fp-model fast > >> -I/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/include > >> `pwd`/ex19.c > >> cc -g -fp-model fast -o ex19 ex19.o > >> -L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > >> -Wl,-rpath,/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > >> -L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > >> -lpetsc -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord > >> -lscalapack -lfftw3_mpi -lfftw3 -lp4est -lsc -lflapack -lfblas > >> -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lchaco -lparmetis > >> -lmetis > >> -lstdc++ -ldl > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(dlimpl.o): > >> In function `PetscDLOpen': > >> /global/u2/m/madams/petsc_install/petsc/src/sys/dll/dlimpl.c:108: > >> warning: > >> Using 'dlopen' in statically linked applications requires at runtime > >> the > >> shared libraries from the glibc version used for linking > >> /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: > >> Warning: alignment 8 of symbol `ARCHITECTURE' in > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libchaco.a(user_params.o) > >> is smaller than 32 in > >> /opt/cray/pe/pmi/5.0.13/lib64/libpmi.a(_pmi_topology_discovery.o) > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(send.o): > >> In function `PetscOpenSocket': > >> /global/u2/m/madams/petsc_install/petsc/src/sys/classes/viewer/impls/socket/send.c:108: > >> warning: Using 'gethostbyname' in statically linked applications > >> requires > >> at runtime the shared libraries from the glibc version used for linking > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est.o): > >> In function `p4est_checksum': > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: > >> undefined reference to `adler32' > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: > >> undefined reference to `adler32_combine' > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est_communication.o): > >> In function `p4est_comm_checksum': > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: > >> undefined reference to `adler32_combine' > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est.o): > >> In function `p8est_checksum': > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: > >> undefined reference to `adler32' > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: > >> undefined reference to `adler32_combine' > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est_communication.o): > >> In function `p8est_comm_checksum': > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: > >> undefined reference to `adler32_combine' > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_containers.o): > >> In function `sc_array_checksum': > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:565: > >> undefined reference to `adler32' > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:571: > >> undefined reference to `adler32' > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_io.o): > >> In function `sc_vtk_write_compressed': > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:492: > >> undefined reference to `compress2' > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:507: > >> undefined reference to `compress2' > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/petsc/conf/test:13: > >> recipe for target 'ex19' failed > >> gmake[3]: [ex19] Error 1 (ignored) > >> true ex19 > >> rm ex19.o > From balay at mcs.anl.gov Sat Oct 20 16:39:22 2018 From: balay at mcs.anl.gov (Balay, Satish) Date: Sat, 20 Oct 2018 21:39:22 +0000 Subject: [petsc-users] p4est error In-Reply-To: References: Message-ID: Pushed this change to branch balay/p4est-add-zlib-dep/maint [it works as desired on my laptop] Satish On Sat, 20 Oct 2018, Balay, Satish wrote: > I don't see an option for specifying zlib explicitly - so perhaps it can use it from LIBS? > > [untested patch] > > Satish > > -------- > > diff --git a/config/BuildSystem/config/packages/p4est.py b/config/BuildSystem/config/packages/p4est.py > index 03d1e2fcb0..31d2307f2b 100644 > --- a/config/BuildSystem/config/packages/p4est.py > +++ b/config/BuildSystem/config/packages/p4est.py > @@ -21,8 +21,9 @@ class Configure(config.package.GNUPackage): > def setupDependencies(self, framework): > config.package.GNUPackage.setupDependencies(self, framework) > self.mpi = framework.require('config.packages.MPI',self) > - self.blasLapack = self.framework.require('config.packages.BlasLapack',self) > - self.deps = [self.mpi,self.blasLapack] > + self.blasLapack = framework.require('config.packages.BlasLapack',self) > + self.zlib = framework.require('config.packages.zlib',self) > + self.deps = [self.mpi,self.blasLapack,self.zlib] > return > > def formGNUConfigureArgs(self): > @@ -30,7 +31,7 @@ class Configure(config.package.GNUPackage): > if self.argDB['with-p4est-debugging']: > args.append('--enable-debug') > args.append('--enable-mpi') > - args.append('LIBS="'+self.libraries.toString(self.blasLapack.dlib)+'"') > + args.append('LIBS="'+self.libraries.toString(self.dlib)+'"') > return args > > def updateGitDir(self): > > > On Sat, 20 Oct 2018, Smith, Barry F. wrote: > > > > > > > > On Oct 20, 2018, at 4:14 PM, Isaac, Tobin G wrote: > > > > > > I think adler32 is in zlib: p4est typically finds it in configure. Can you send along config.log from externalpackages/git.p4est? > > > > Is there a way to pass the zlib information to ./configure? We should add that to p4est.py Reason: we don't like external packages making their own decisions, we want PETSc's configure making the decisions and passing the decisions down to the packages. > > > > Barry > > > > This is especially true for hairy machines that Mark likes to build on, where standard configure sometimes makes the wrong decision or cannot figure out something. > > > > > > > > On October 20, 2018 4:52:54 PM EDT, Mark Adams wrote: > > >> I am getting this error. This was a clean build (nuked the arch > > >> directory). > > >> > > >> 13:50 nid12922 master= ~/petsc_install/petsc$ make > > >> PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel > > >> PETSC_ARCH="" test > > >> Running test examples to verify correct installation > > >> Using > > >> PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel > > >> and PETSC_ARCH= > > >> *******************Error detected during compile or > > >> link!******************* > > >> See http://www.mcs.anl.gov/petsc/documentation/faq.html > > >> /global/homes/m/madams/petsc_install/petsc/src/snes/examples/tutorials > > >> ex19 > > >> ********************************************************************************* > > >> cc -o ex19.o -c -g -fp-model fast > > >> -I/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/include > > >> `pwd`/ex19.c > > >> cc -g -fp-model fast -o ex19 ex19.o > > >> -L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > > >> -Wl,-rpath,/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > > >> -L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > > >> -lpetsc -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord > > >> -lscalapack -lfftw3_mpi -lfftw3 -lp4est -lsc -lflapack -lfblas > > >> -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lchaco -lparmetis > > >> -lmetis > > >> -lstdc++ -ldl > > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(dlimpl.o): > > >> In function `PetscDLOpen': > > >> /global/u2/m/madams/petsc_install/petsc/src/sys/dll/dlimpl.c:108: > > >> warning: > > >> Using 'dlopen' in statically linked applications requires at runtime > > >> the > > >> shared libraries from the glibc version used for linking > > >> /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: > > >> Warning: alignment 8 of symbol `ARCHITECTURE' in > > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libchaco.a(user_params.o) > > >> is smaller than 32 in > > >> /opt/cray/pe/pmi/5.0.13/lib64/libpmi.a(_pmi_topology_discovery.o) > > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(send.o): > > >> In function `PetscOpenSocket': > > >> /global/u2/m/madams/petsc_install/petsc/src/sys/classes/viewer/impls/socket/send.c:108: > > >> warning: Using 'gethostbyname' in statically linked applications > > >> requires > > >> at runtime the shared libraries from the glibc version used for linking > > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est.o): > > >> In function `p4est_checksum': > > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: > > >> undefined reference to `adler32' > > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: > > >> undefined reference to `adler32_combine' > > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est_communication.o): > > >> In function `p4est_comm_checksum': > > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: > > >> undefined reference to `adler32_combine' > > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est.o): > > >> In function `p8est_checksum': > > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: > > >> undefined reference to `adler32' > > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: > > >> undefined reference to `adler32_combine' > > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est_communication.o): > > >> In function `p8est_comm_checksum': > > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: > > >> undefined reference to `adler32_combine' > > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_containers.o): > > >> In function `sc_array_checksum': > > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:565: > > >> undefined reference to `adler32' > > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:571: > > >> undefined reference to `adler32' > > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_io.o): > > >> In function `sc_vtk_write_compressed': > > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:492: > > >> undefined reference to `compress2' > > >> /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:507: > > >> undefined reference to `compress2' > > >> /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/petsc/conf/test:13: > > >> recipe for target 'ex19' failed > > >> gmake[3]: [ex19] Error 1 (ignored) > > >> true ex19 > > >> rm ex19.o > > > From mfadams at lbl.gov Sat Oct 20 18:25:10 2018 From: mfadams at lbl.gov (Mark Adams) Date: Sat, 20 Oct 2018 19:25:10 -0400 Subject: [petsc-users] p4est error In-Reply-To: References: Message-ID: There is something going on with zlib. When I get on a compute node I get a message that zlib (and cmake) module is not found. But I add it manually and I see it, but still get the same error. I nuked p4est and am testing Satish's fix. I'll send the log file if it is not working. Thanks, On Sat, Oct 20, 2018 at 5:14 PM Isaac, Tobin G wrote: > I think adler32 is in zlib: p4est typically finds it in configure. Can > you send along config.log from externalpackages/git.p4est? > > On October 20, 2018 4:52:54 PM EDT, Mark Adams wrote: > >I am getting this error. This was a clean build (nuked the arch > >directory). > > > >13:50 nid12922 master= ~/petsc_install/petsc$ make > > >PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel > >PETSC_ARCH="" test > >Running test examples to verify correct installation > >Using > > >PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel > >and PETSC_ARCH= > >*******************Error detected during compile or > >link!******************* > >See http://www.mcs.anl.gov/petsc/documentation/faq.html > >/global/homes/m/madams/petsc_install/petsc/src/snes/examples/tutorials > >ex19 > > >********************************************************************************* > >cc -o ex19.o -c -g -fp-model fast > > >-I/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/include > > `pwd`/ex19.c > >cc -g -fp-model fast -o ex19 ex19.o > >-L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > > >-Wl,-rpath,/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > >-L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > >-lpetsc -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord > >-lscalapack -lfftw3_mpi -lfftw3 -lp4est -lsc -lflapack -lfblas > >-lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lchaco -lparmetis > >-lmetis > >-lstdc++ -ldl > > >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(dlimpl.o): > >In function `PetscDLOpen': > >/global/u2/m/madams/petsc_install/petsc/src/sys/dll/dlimpl.c:108: > >warning: > >Using 'dlopen' in statically linked applications requires at runtime > >the > >shared libraries from the glibc version used for linking > >/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: > >Warning: alignment 8 of symbol `ARCHITECTURE' in > > >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libchaco.a(user_params.o) > >is smaller than 32 in > >/opt/cray/pe/pmi/5.0.13/lib64/libpmi.a(_pmi_topology_discovery.o) > > >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(send.o): > >In function `PetscOpenSocket': > > >/global/u2/m/madams/petsc_install/petsc/src/sys/classes/viewer/impls/socket/send.c:108: > >warning: Using 'gethostbyname' in statically linked applications > >requires > >at runtime the shared libraries from the glibc version used for linking > > >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est.o): > >In function `p4est_checksum': > > >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: > >undefined reference to `adler32' > > >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: > >undefined reference to `adler32_combine' > > >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est_communication.o): > >In function `p4est_comm_checksum': > > >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: > >undefined reference to `adler32_combine' > > >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est.o): > >In function `p8est_checksum': > > >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: > >undefined reference to `adler32' > > >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: > >undefined reference to `adler32_combine' > > >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est_communication.o): > >In function `p8est_comm_checksum': > > >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: > >undefined reference to `adler32_combine' > > >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_containers.o): > >In function `sc_array_checksum': > > >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:565: > >undefined reference to `adler32' > > >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:571: > >undefined reference to `adler32' > > >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_io.o): > >In function `sc_vtk_write_compressed': > > >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:492: > >undefined reference to `compress2' > > >/global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:507: > >undefined reference to `compress2' > > >/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/petsc/conf/test:13: > >recipe for target 'ex19' failed > >gmake[3]: [ex19] Error 1 (ignored) > >true ex19 > >rm ex19.o > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mfadams at lbl.gov Sat Oct 20 19:44:16 2018 From: mfadams at lbl.gov (Mark Adams) Date: Sat, 20 Oct 2018 20:44:16 -0400 Subject: [petsc-users] p4est error In-Reply-To: References: Message-ID: Thanks Satish. I built this and it is working. On Sat, Oct 20, 2018 at 5:39 PM Balay, Satish wrote: > Pushed this change to branch balay/p4est-add-zlib-dep/maint [it works as > desired on my laptop] > > Satish > > On Sat, 20 Oct 2018, Balay, Satish wrote: > > > I don't see an option for specifying zlib explicitly - so perhaps it can > use it from LIBS? > > > > [untested patch] > > > > Satish > > > > -------- > > > > diff --git a/config/BuildSystem/config/packages/p4est.py > b/config/BuildSystem/config/packages/p4est.py > > index 03d1e2fcb0..31d2307f2b 100644 > > --- a/config/BuildSystem/config/packages/p4est.py > > +++ b/config/BuildSystem/config/packages/p4est.py > > @@ -21,8 +21,9 @@ class Configure(config.package.GNUPackage): > > def setupDependencies(self, framework): > > config.package.GNUPackage.setupDependencies(self, framework) > > self.mpi = framework.require('config.packages.MPI',self) > > - self.blasLapack = > self.framework.require('config.packages.BlasLapack',self) > > - self.deps = [self.mpi,self.blasLapack] > > + self.blasLapack = > framework.require('config.packages.BlasLapack',self) > > + self.zlib = framework.require('config.packages.zlib',self) > > + self.deps = [self.mpi,self.blasLapack,self.zlib] > > return > > > > def formGNUConfigureArgs(self): > > @@ -30,7 +31,7 @@ class Configure(config.package.GNUPackage): > > if self.argDB['with-p4est-debugging']: > > args.append('--enable-debug') > > args.append('--enable-mpi') > > - > args.append('LIBS="'+self.libraries.toString(self.blasLapack.dlib)+'"') > > + args.append('LIBS="'+self.libraries.toString(self.dlib)+'"') > > return args > > > > def updateGitDir(self): > > > > > > On Sat, 20 Oct 2018, Smith, Barry F. wrote: > > > > > > > > > > > > On Oct 20, 2018, at 4:14 PM, Isaac, Tobin G > wrote: > > > > > > > > I think adler32 is in zlib: p4est typically finds it in configure. > Can you send along config.log from externalpackages/git.p4est? > > > > > > Is there a way to pass the zlib information to ./configure? We > should add that to p4est.py Reason: we don't like external packages making > their own decisions, we want PETSc's configure making the decisions and > passing the decisions down to the packages. > > > > > > Barry > > > > > > This is especially true for hairy machines that Mark likes to build > on, where standard configure sometimes makes the wrong decision or cannot > figure out something. > > > > > > > > > > > On October 20, 2018 4:52:54 PM EDT, Mark Adams > wrote: > > > >> I am getting this error. This was a clean build (nuked the arch > > > >> directory). > > > >> > > > >> 13:50 nid12922 master= ~/petsc_install/petsc$ make > > > >> > PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel > > > >> PETSC_ARCH="" test > > > >> Running test examples to verify correct installation > > > >> Using > > > >> > PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel > > > >> and PETSC_ARCH= > > > >> *******************Error detected during compile or > > > >> link!******************* > > > >> See http://www.mcs.anl.gov/petsc/documentation/faq.html > > > >> > /global/homes/m/madams/petsc_install/petsc/src/snes/examples/tutorials > > > >> ex19 > > > >> > ********************************************************************************* > > > >> cc -o ex19.o -c -g -fp-model fast > > > >> > -I/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/include > > > >> `pwd`/ex19.c > > > >> cc -g -fp-model fast -o ex19 ex19.o > > > >> > -L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > > > >> > -Wl,-rpath,/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > > > >> > -L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > > > >> -lpetsc -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord > > > >> -lscalapack -lfftw3_mpi -lfftw3 -lp4est -lsc -lflapack -lfblas > > > >> -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lchaco -lparmetis > > > >> -lmetis > > > >> -lstdc++ -ldl > > > >> > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(dlimpl.o): > > > >> In function `PetscDLOpen': > > > >> /global/u2/m/madams/petsc_install/petsc/src/sys/dll/dlimpl.c:108: > > > >> warning: > > > >> Using 'dlopen' in statically linked applications requires at runtime > > > >> the > > > >> shared libraries from the glibc version used for linking > > > >> > /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: > > > >> Warning: alignment 8 of symbol `ARCHITECTURE' in > > > >> > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libchaco.a(user_params.o) > > > >> is smaller than 32 in > > > >> /opt/cray/pe/pmi/5.0.13/lib64/libpmi.a(_pmi_topology_discovery.o) > > > >> > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(send.o): > > > >> In function `PetscOpenSocket': > > > >> > /global/u2/m/madams/petsc_install/petsc/src/sys/classes/viewer/impls/socket/send.c:108: > > > >> warning: Using 'gethostbyname' in statically linked applications > > > >> requires > > > >> at runtime the shared libraries from the glibc version used for > linking > > > >> > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est.o): > > > >> In function `p4est_checksum': > > > >> > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: > > > >> undefined reference to `adler32' > > > >> > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: > > > >> undefined reference to `adler32_combine' > > > >> > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est_communication.o): > > > >> In function `p4est_comm_checksum': > > > >> > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: > > > >> undefined reference to `adler32_combine' > > > >> > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est.o): > > > >> In function `p8est_checksum': > > > >> > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: > > > >> undefined reference to `adler32' > > > >> > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: > > > >> undefined reference to `adler32_combine' > > > >> > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est_communication.o): > > > >> In function `p8est_comm_checksum': > > > >> > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: > > > >> undefined reference to `adler32_combine' > > > >> > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_containers.o): > > > >> In function `sc_array_checksum': > > > >> > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:565: > > > >> undefined reference to `adler32' > > > >> > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:571: > > > >> undefined reference to `adler32' > > > >> > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_io.o): > > > >> In function `sc_vtk_write_compressed': > > > >> > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:492: > > > >> undefined reference to `compress2' > > > >> > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:507: > > > >> undefined reference to `compress2' > > > >> > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/petsc/conf/test:13: > > > >> recipe for target 'ex19' failed > > > >> gmake[3]: [ex19] Error 1 (ignored) > > > >> true ex19 > > > >> rm ex19.o > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From balay at mcs.anl.gov Sat Oct 20 20:39:26 2018 From: balay at mcs.anl.gov (Balay, Satish) Date: Sun, 21 Oct 2018 01:39:26 +0000 Subject: [petsc-users] p4est error In-Reply-To: References: Message-ID: Thanks! merged to next. Satish On Sat, 20 Oct 2018, Mark Adams wrote: > Thanks Satish. > > I built this and it is working. > > On Sat, Oct 20, 2018 at 5:39 PM Balay, Satish wrote: > > > Pushed this change to branch balay/p4est-add-zlib-dep/maint [it works as > > desired on my laptop] > > > > Satish > > > > On Sat, 20 Oct 2018, Balay, Satish wrote: > > > > > I don't see an option for specifying zlib explicitly - so perhaps it can > > use it from LIBS? > > > > > > [untested patch] > > > > > > Satish > > > > > > -------- > > > > > > diff --git a/config/BuildSystem/config/packages/p4est.py > > b/config/BuildSystem/config/packages/p4est.py > > > index 03d1e2fcb0..31d2307f2b 100644 > > > --- a/config/BuildSystem/config/packages/p4est.py > > > +++ b/config/BuildSystem/config/packages/p4est.py > > > @@ -21,8 +21,9 @@ class Configure(config.package.GNUPackage): > > > def setupDependencies(self, framework): > > > config.package.GNUPackage.setupDependencies(self, framework) > > > self.mpi = framework.require('config.packages.MPI',self) > > > - self.blasLapack = > > self.framework.require('config.packages.BlasLapack',self) > > > - self.deps = [self.mpi,self.blasLapack] > > > + self.blasLapack = > > framework.require('config.packages.BlasLapack',self) > > > + self.zlib = framework.require('config.packages.zlib',self) > > > + self.deps = [self.mpi,self.blasLapack,self.zlib] > > > return > > > > > > def formGNUConfigureArgs(self): > > > @@ -30,7 +31,7 @@ class Configure(config.package.GNUPackage): > > > if self.argDB['with-p4est-debugging']: > > > args.append('--enable-debug') > > > args.append('--enable-mpi') > > > - > > args.append('LIBS="'+self.libraries.toString(self.blasLapack.dlib)+'"') > > > + args.append('LIBS="'+self.libraries.toString(self.dlib)+'"') > > > return args > > > > > > def updateGitDir(self): > > > > > > > > > On Sat, 20 Oct 2018, Smith, Barry F. wrote: > > > > > > > > > > > > > > > > On Oct 20, 2018, at 4:14 PM, Isaac, Tobin G > > wrote: > > > > > > > > > > I think adler32 is in zlib: p4est typically finds it in configure. > > Can you send along config.log from externalpackages/git.p4est? > > > > > > > > Is there a way to pass the zlib information to ./configure? We > > should add that to p4est.py Reason: we don't like external packages making > > their own decisions, we want PETSc's configure making the decisions and > > passing the decisions down to the packages. > > > > > > > > Barry > > > > > > > > This is especially true for hairy machines that Mark likes to build > > on, where standard configure sometimes makes the wrong decision or cannot > > figure out something. > > > > > > > > > > > > > > On October 20, 2018 4:52:54 PM EDT, Mark Adams > > wrote: > > > > >> I am getting this error. This was a clean build (nuked the arch > > > > >> directory). > > > > >> > > > > >> 13:50 nid12922 master= ~/petsc_install/petsc$ make > > > > >> > > PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel > > > > >> PETSC_ARCH="" test > > > > >> Running test examples to verify correct installation > > > > >> Using > > > > >> > > PETSC_DIR=/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel > > > > >> and PETSC_ARCH= > > > > >> *******************Error detected during compile or > > > > >> link!******************* > > > > >> See http://www.mcs.anl.gov/petsc/documentation/faq.html > > > > >> > > /global/homes/m/madams/petsc_install/petsc/src/snes/examples/tutorials > > > > >> ex19 > > > > >> > > ********************************************************************************* > > > > >> cc -o ex19.o -c -g -fp-model fast > > > > >> > > -I/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/include > > > > >> `pwd`/ex19.c > > > > >> cc -g -fp-model fast -o ex19 ex19.o > > > > >> > > -L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > > > > >> > > -Wl,-rpath,/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > > > > >> > > -L/global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib > > > > >> -lpetsc -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord > > > > >> -lscalapack -lfftw3_mpi -lfftw3 -lp4est -lsc -lflapack -lfblas > > > > >> -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5 -lchaco -lparmetis > > > > >> -lmetis > > > > >> -lstdc++ -ldl > > > > >> > > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(dlimpl.o): > > > > >> In function `PetscDLOpen': > > > > >> /global/u2/m/madams/petsc_install/petsc/src/sys/dll/dlimpl.c:108: > > > > >> warning: > > > > >> Using 'dlopen' in statically linked applications requires at runtime > > > > >> the > > > > >> shared libraries from the glibc version used for linking > > > > >> > > /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: > > > > >> Warning: alignment 8 of symbol `ARCHITECTURE' in > > > > >> > > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libchaco.a(user_params.o) > > > > >> is smaller than 32 in > > > > >> /opt/cray/pe/pmi/5.0.13/lib64/libpmi.a(_pmi_topology_discovery.o) > > > > >> > > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libpetsc.a(send.o): > > > > >> In function `PetscOpenSocket': > > > > >> > > /global/u2/m/madams/petsc_install/petsc/src/sys/classes/viewer/impls/socket/send.c:108: > > > > >> warning: Using 'gethostbyname' in statically linked applications > > > > >> requires > > > > >> at runtime the shared libraries from the glibc version used for > > linking > > > > >> > > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est.o): > > > > >> In function `p4est_checksum': > > > > >> > > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: > > > > >> undefined reference to `adler32' > > > > >> > > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: > > > > >> undefined reference to `adler32_combine' > > > > >> > > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p4est_communication.o): > > > > >> In function `p4est_comm_checksum': > > > > >> > > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: > > > > >> undefined reference to `adler32_combine' > > > > >> > > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est.o): > > > > >> In function `p8est_checksum': > > > > >> > > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3228: > > > > >> undefined reference to `adler32' > > > > >> > > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est.c:3236: > > > > >> undefined reference to `adler32_combine' > > > > >> > > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libp4est.a(src_libp4est_la-p8est_communication.o): > > > > >> In function `p8est_comm_checksum': > > > > >> > > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/src/p4est_communication.c:903: > > > > >> undefined reference to `adler32_combine' > > > > >> > > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_containers.o): > > > > >> In function `sc_array_checksum': > > > > >> > > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:565: > > > > >> undefined reference to `adler32' > > > > >> > > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_containers.c:571: > > > > >> undefined reference to `adler32' > > > > >> > > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/libsc.a(src_libsc_la-sc_io.o): > > > > >> In function `sc_vtk_write_compressed': > > > > >> > > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:492: > > > > >> undefined reference to `compress2' > > > > >> > > /global/u2/m/madams/petsc_install/petsc/arch-cori-haswell-opt-intel/externalpackages/git.p4est/sc/src/sc_io.c:507: > > > > >> undefined reference to `compress2' > > > > >> > > /global/homes/m/madams/petsc_install/petsc-cori-haswell-opt-intel/lib/petsc/conf/test:13: > > > > >> recipe for target 'ex19' failed > > > > >> gmake[3]: [ex19] Error 1 (ignored) > > > > >> true ex19 > > > > >> rm ex19.o > > > > > > > > > > > > From C.Klaij at marin.nl Mon Oct 22 04:33:14 2018 From: C.Klaij at marin.nl (Klaij, Christiaan) Date: Mon, 22 Oct 2018 09:33:14 +0000 Subject: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 In-Reply-To: <380804AB-7723-4539-9722-9B2D689D6A05@mcs.anl.gov> References: <1539939090363.13492@marin.nl> <1539959878384.42597@marin.nl>, <380804AB-7723-4539-9722-9B2D689D6A05@mcs.anl.gov> Message-ID: <1540200794411.69211@marin.nl> Thanks Barry and Matt, it makes sense if rr is a pointer instead of an allocatable. So: Vec, POINTER, INTENT(in) :: rr_system would be the proper way, right? And out of curiosity, why did petsc-3.8.4 tolerate my wrong INTENT(out)? Chris dr. ir. Christiaan Klaij | Senior Researcher | Research & Development MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl MARIN news: http://www.marin.nl/web/News/News-items/Seminar-Scheepsbrandstof-en-de-mondiale-zwavelnorm-2020.htm ________________________________________ From: Smith, Barry F. Sent: Friday, October 19, 2018 10:26 PM To: Klaij, Christiaan Cc: petsc-users at mcs.anl.gov Subject: Re: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 > On Oct 19, 2018, at 9:37 AM, Klaij, Christiaan wrote: > > As far as I (mis)understand fortran, this is a data protection > thing: all arguments are passed in from above but the subroutine > is only allowed to change rr and ierr, not aa and xx (if you try, > you get a compiler warning). The routine is not allowed to change rr (it is only allowed to change the values "inside" rr) that is why it needs to be intent in or inout. Otherwise the compiler can optimize and not pass down the value of the rr pointer to the subroutine since by declaring as it as out the compiler thinks your subroutine is going to set is value. Barry > That's why I find it very odd to > give an intent(in) to rr. But I've tried your suggestion anyway: > both intent(in) and intent(inout) for rr do work! Can't say I > understand though. > > Below's a small example of what I was expecting. Change rr to > intent(in) and the compiler complains. > > Chris > > $ cat intent.f90 > program intent > > implicit none > > real, allocatable :: aa(:), xx(:), rr(:) > integer :: ierr > > allocate(aa(10),xx(10),rr(10)) > > aa = 1.0 > xx = 2.0 > > call matmult(aa,xx,rr,ierr) > > print *, rr(1) > print *, ierr > > deallocate(aa,xx,rr) > > contains > > subroutine matmult(aa,xx,rr,ierr) > real, intent(in) :: aa(:), xx(:) > real, intent(out):: rr(:) > integer, intent(out) :: ierr > rr=aa*xx > ierr=0 > end subroutine matmult > > end program intent > $ ./a.out > 2.000000 > 0 > > > > > dr. ir. Christiaan Klaij | Senior Researcher | Research & Development > MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl > > MARIN news: http://www.marin.nl/web/News/News-items/Seminar-Scheepsbrandstof-en-de-mondiale-zwavelnorm-2020.htm > > ________________________________________ > From: Smith, Barry F. > Sent: Friday, October 19, 2018 2:32 PM > To: Klaij, Christiaan > Cc: petsc-users at mcs.anl.gov > Subject: Re: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 > > Hmm, the intent of all three first arguments should be in since they are passed in from the routine above. Does it work if you replace > >> Vec, INTENT(out) :: rr_system > > with > >> Vec, INTENT(in) :: rr_system > > ? > > Barry > > >> On Oct 19, 2018, at 3:51 AM, Klaij, Christiaan wrote: >> >> I've recently upgraded from petsc-3.8.4 to petsc-3.10.2 and was >> surprised to find a number of segmentation faults in my test >> cases. These turned out to be related to user-defined MatMult and >> PCApply for shell matrices. For example: >> >> SUBROUTINE systemMatMult(aa_system,xx_system,rr_system,ierr) >> Mat, INTENT(in) :: aa_system >> Vec, INTENT(in) :: xx_system >> Vec, INTENT(out) :: rr_system >> PetscErrorCode, INTENT(out) :: ierr >> ... >> END >> >> where aa_system is the shell matrix. This code works fine with >> 3.8.4 and older, but fails with 3.10.2 due to invalid >> pointers (gdb backtrace shows failure of VecSetValues due to >> invalid first argument). After replacing by: >> >> SUBROUTINE mass_momentum_systemMatMult(aa_system,xx_system,rr_system,ierr) >> Mat :: aa_system >> Vec :: xx_system >> Vec :: rr_system >> PetscErrorCode :: ierr >> ... >> END >> >> everything's fine again. So clearly something has changed since >> 3.8.4 that now prevents the use of INTENT in Fortran (at least >> using intel 17.0.1 compilers). Any reason for this? >> >> Chris >> >> >> dr. ir. Christiaan Klaij | Senior Researcher | Research & Development >> MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl >> >> MARIN news: http://www.marin.nl/web/News/News-items/ReFRESCO-successfully-coupled-to-ParaView-Catalyst-for-insitu-analysis-1.htm >> > From bsmith at mcs.anl.gov Mon Oct 22 11:37:27 2018 From: bsmith at mcs.anl.gov (Smith, Barry F.) Date: Mon, 22 Oct 2018 16:37:27 +0000 Subject: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 In-Reply-To: <1540200794411.69211@marin.nl> References: <1539939090363.13492@marin.nl> <1539959878384.42597@marin.nl> <380804AB-7723-4539-9722-9B2D689D6A05@mcs.anl.gov> <1540200794411.69211@marin.nl> Message-ID: > On Oct 22, 2018, at 4:33 AM, Klaij, Christiaan wrote: > > Thanks Barry and Matt, it makes sense if rr is a pointer instead > of an allocatable. So: > > Vec, POINTER, INTENT(in) :: rr_system > > would be the proper way, right? Yes > > And out of curiosity, why did petsc-3.8.4 tolerate my wrong > INTENT(out)? I think it is a compiler optimization that doesn't pass in the value for intent(out) hence the crash when it is used. > > Chris > > > > dr. ir. Christiaan Klaij | Senior Researcher | Research & Development > MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl > > MARIN news: http://www.marin.nl/web/News/News-items/Seminar-Scheepsbrandstof-en-de-mondiale-zwavelnorm-2020.htm > > ________________________________________ > From: Smith, Barry F. > Sent: Friday, October 19, 2018 10:26 PM > To: Klaij, Christiaan > Cc: petsc-users at mcs.anl.gov > Subject: Re: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 > >> On Oct 19, 2018, at 9:37 AM, Klaij, Christiaan wrote: >> >> As far as I (mis)understand fortran, this is a data protection >> thing: all arguments are passed in from above but the subroutine >> is only allowed to change rr and ierr, not aa and xx (if you try, >> you get a compiler warning). > > The routine is not allowed to change rr (it is only allowed to change the values "inside" rr) that is why it needs to be intent in or inout. Otherwise the compiler can optimize and not pass down the value of the rr pointer to the subroutine since by declaring as it as out the compiler thinks your subroutine is going to set is value. > > Barry > > >> That's why I find it very odd to >> give an intent(in) to rr. But I've tried your suggestion anyway: >> both intent(in) and intent(inout) for rr do work! Can't say I >> understand though. >> >> Below's a small example of what I was expecting. Change rr to >> intent(in) and the compiler complains. >> >> Chris >> >> $ cat intent.f90 >> program intent >> >> implicit none >> >> real, allocatable :: aa(:), xx(:), rr(:) >> integer :: ierr >> >> allocate(aa(10),xx(10),rr(10)) >> >> aa = 1.0 >> xx = 2.0 >> >> call matmult(aa,xx,rr,ierr) >> >> print *, rr(1) >> print *, ierr >> >> deallocate(aa,xx,rr) >> >> contains >> >> subroutine matmult(aa,xx,rr,ierr) >> real, intent(in) :: aa(:), xx(:) >> real, intent(out):: rr(:) >> integer, intent(out) :: ierr >> rr=aa*xx >> ierr=0 >> end subroutine matmult >> >> end program intent >> $ ./a.out >> 2.000000 >> 0 >> >> >> >> >> dr. ir. Christiaan Klaij | Senior Researcher | Research & Development >> MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl >> >> MARIN news: http://www.marin.nl/web/News/News-items/Seminar-Scheepsbrandstof-en-de-mondiale-zwavelnorm-2020.htm >> >> ________________________________________ >> From: Smith, Barry F. >> Sent: Friday, October 19, 2018 2:32 PM >> To: Klaij, Christiaan >> Cc: petsc-users at mcs.anl.gov >> Subject: Re: [petsc-users] fortran INTENT with petsc object gives segfault after upgrade from 3.8.4 to 3.10.2 >> >> Hmm, the intent of all three first arguments should be in since they are passed in from the routine above. Does it work if you replace >> >>> Vec, INTENT(out) :: rr_system >> >> with >> >>> Vec, INTENT(in) :: rr_system >> >> ? >> >> Barry >> >> >>> On Oct 19, 2018, at 3:51 AM, Klaij, Christiaan wrote: >>> >>> I've recently upgraded from petsc-3.8.4 to petsc-3.10.2 and was >>> surprised to find a number of segmentation faults in my test >>> cases. These turned out to be related to user-defined MatMult and >>> PCApply for shell matrices. For example: >>> >>> SUBROUTINE systemMatMult(aa_system,xx_system,rr_system,ierr) >>> Mat, INTENT(in) :: aa_system >>> Vec, INTENT(in) :: xx_system >>> Vec, INTENT(out) :: rr_system >>> PetscErrorCode, INTENT(out) :: ierr >>> ... >>> END >>> >>> where aa_system is the shell matrix. This code works fine with >>> 3.8.4 and older, but fails with 3.10.2 due to invalid >>> pointers (gdb backtrace shows failure of VecSetValues due to >>> invalid first argument). After replacing by: >>> >>> SUBROUTINE mass_momentum_systemMatMult(aa_system,xx_system,rr_system,ierr) >>> Mat :: aa_system >>> Vec :: xx_system >>> Vec :: rr_system >>> PetscErrorCode :: ierr >>> ... >>> END >>> >>> everything's fine again. So clearly something has changed since >>> 3.8.4 that now prevents the use of INTENT in Fortran (at least >>> using intel 17.0.1 compilers). Any reason for this? >>> >>> Chris >>> >>> >>> dr. ir. Christiaan Klaij | Senior Researcher | Research & Development >>> MARIN | T +31 317 49 33 44 | mailto:C.Klaij at marin.nl | http://www.marin.nl >>> >>> MARIN news: http://www.marin.nl/web/News/News-items/ReFRESCO-successfully-coupled-to-ParaView-Catalyst-for-insitu-analysis-1.htm >>> >> > From bhatiamanav at gmail.com Mon Oct 22 14:05:58 2018 From: bhatiamanav at gmail.com (Manav Bhatia) Date: Mon, 22 Oct 2018 14:05:58 -0500 Subject: [petsc-users] Slepc: Nonlinear eigenvalue problem Message-ID: <61B9AB6C-C7AE-4E6A-990D-9409AA3CA0A9@gmail.com> Hi, I am exploring the nonlinear eigenvalue problem solver in Slepc. From the notes in "Sec 6.4: Retrieving the Solution?, it appears that if I expect to find complex eigenpairs then I must compile the library (and Petsc) with complex scalars. Is that correct? Is there a way to include support for complex eigenpairs in a library complied with real scalars? Regards, Manav From jroman at dsic.upv.es Mon Oct 22 14:40:09 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Mon, 22 Oct 2018 21:40:09 +0200 Subject: [petsc-users] Slepc: Nonlinear eigenvalue problem In-Reply-To: <61B9AB6C-C7AE-4E6A-990D-9409AA3CA0A9@gmail.com> References: <61B9AB6C-C7AE-4E6A-990D-9409AA3CA0A9@gmail.com> Message-ID: > El 22 oct 2018, a las 21:05, Manav Bhatia escribi?: > > Hi, > > I am exploring the nonlinear eigenvalue problem solver in Slepc. > > From the notes in "Sec 6.4: Retrieving the Solution?, it appears that if I expect to find complex eigenpairs then I must compile the library (and Petsc) with complex scalars. Is that correct? > > Is there a way to include support for complex eigenpairs in a library complied with real scalars? > > Regards, > Manav > > Currently, the only combination that supports complex eigenpairs with real scalars is the split form for the nonlinear function with the NLEIGS solver. Jose From bhatiamanav at gmail.com Mon Oct 22 14:40:24 2018 From: bhatiamanav at gmail.com (Manav Bhatia) Date: Mon, 22 Oct 2018 14:40:24 -0500 Subject: [petsc-users] Slepc: Nonlinear eigenvalue problem In-Reply-To: <61B9AB6C-C7AE-4E6A-990D-9409AA3CA0A9@gmail.com> References: <61B9AB6C-C7AE-4E6A-990D-9409AA3CA0A9@gmail.com> Message-ID: As a followup to this, if I am using a shell matrix for eigensolution (linear or nonlinear eigenproblems), what operations should be defined for the shell matrix? -Manav > On Oct 22, 2018, at 2:05 PM, Manav Bhatia wrote: > > Hi, > > I am exploring the nonlinear eigenvalue problem solver in Slepc. > > From the notes in "Sec 6.4: Retrieving the Solution?, it appears that if I expect to find complex eigenpairs then I must compile the library (and Petsc) with complex scalars. Is that correct? > > Is there a way to include support for complex eigenpairs in a library complied with real scalars? > > Regards, > Manav > > From jroman at dsic.upv.es Mon Oct 22 14:56:28 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Mon, 22 Oct 2018 21:56:28 +0200 Subject: [petsc-users] Slepc: Nonlinear eigenvalue problem In-Reply-To: References: <61B9AB6C-C7AE-4E6A-990D-9409AA3CA0A9@gmail.com> Message-ID: It depends on the solver. For instance, NEPRII builds the matrix T(lambda) and then uses it for matrix-vector multiplications and also for linear solves. So the required operations depend on which preconditioner you use for the linear solves. This example can use Jacobi preconditioner: http://slepc.upv.es/documentation/current/src/nep/examples/tutorials/ex21.c.html Jose > El 22 oct 2018, a las 21:40, Manav Bhatia escribi?: > > As a followup to this, if I am using a shell matrix for eigensolution (linear or nonlinear eigenproblems), what operations should be defined for the shell matrix? > > -Manav > >> On Oct 22, 2018, at 2:05 PM, Manav Bhatia wrote: >> >> Hi, >> >> I am exploring the nonlinear eigenvalue problem solver in Slepc. >> >> From the notes in "Sec 6.4: Retrieving the Solution?, it appears that if I expect to find complex eigenpairs then I must compile the library (and Petsc) with complex scalars. Is that correct? >> >> Is there a way to include support for complex eigenpairs in a library complied with real scalars? >> >> Regards, >> Manav >> >> > From bhatiamanav at gmail.com Mon Oct 22 15:01:12 2018 From: bhatiamanav at gmail.com (Manav Bhatia) Date: Mon, 22 Oct 2018 15:01:12 -0500 Subject: [petsc-users] Slepc: Nonlinear eigenvalue problem In-Reply-To: References: <61B9AB6C-C7AE-4E6A-990D-9409AA3CA0A9@gmail.com> Message-ID: <98D6E03D-2804-47EA-94CF-219B3A2CD9DE@gmail.com> Thanks, Jose. How difficult would it be to add the support for the general case (if at all possible)? My eigenvalue problem is of the form shown in the attachment. Beta is the eigenvalue and X_s^\Delta is the eigenvector. While some of the matrices are known, others are defined only as matrix vector products. I am interested in eigenvalues with the largest real part. I expect to find complex eigenvalues, although for a small subset of cases these will be real. What is your recommendation for attacking this problem with the nonlinear eigenvalue support in Slepc? Would appreciate your guidance. Regards, Manav > On Oct 22, 2018, at 2:40 PM, Jose E. Roman wrote: > > > >> El 22 oct 2018, a las 21:05, Manav Bhatia escribi?: >> >> Hi, >> >> I am exploring the nonlinear eigenvalue problem solver in Slepc. >> >> From the notes in "Sec 6.4: Retrieving the Solution?, it appears that if I expect to find complex eigenpairs then I must compile the library (and Petsc) with complex scalars. Is that correct? >> >> Is there a way to include support for complex eigenpairs in a library complied with real scalars? >> >> Regards, >> Manav >> >> > > Currently, the only combination that supports complex eigenpairs with real scalars is the split form for the nonlinear function with the NLEIGS solver. > > Jose -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: PastedGraphic-1.pdf Type: application/pdf Size: 226918 bytes Desc: not available URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From weizhuo2 at illinois.edu Mon Oct 22 15:05:40 2018 From: weizhuo2 at illinois.edu (Weizhuo Wang) Date: Mon, 22 Oct 2018 15:05:40 -0500 Subject: [petsc-users] Increasing norm with finer mesh In-Reply-To: References: Message-ID: Amazing, right preconditioning fixes the problem. Thanks a lot! On Tue, Oct 16, 2018 at 8:31 PM Dave May wrote: > > > On Wed, 17 Oct 2018 at 03:15, Weizhuo Wang wrote: > >> I just tried both, neither of them make a difference. I got exactly the >> same curve with either combination. >> > > Try using right preconditioning. > > > https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPSetPCSide.html > > > Use the options: > > -ksp_type gmres -ksp_pc_side right -ksp_rtol 1e-12 > > Or; > > -ksp_type fgmres -ksp_rtol 1e-12 > > Fgmres does right preconditioning my default > > > >> Thanks! >> >> Wang weizhuo >> >> On Tue, Oct 16, 2018 at 8:06 PM Matthew Knepley >> wrote: >> >>> On Tue, Oct 16, 2018 at 7:26 PM Weizhuo Wang >>> wrote: >>> >>>> Hello again! >>>> >>>> After some tweaking the code is giving right answers now. However it >>>> start to disagree with MATLAB results ('traditional' way using matrix >>>> inverse) when the grid is larger than 100*100. My PhD advisor and I >>>> suspects that the default dimension of the Krylov subspace is 100 in the >>>> test case we are running. If so, is there a way to increase the size of the >>>> subspace? >>>> >>> >>> 1) The default subspace size is 30, not 100. You can increase the >>> subspace size using >>> >>> -ksp_gmres_restart n >>> >>> 2) The problem is likely your tolerance. The default solver tolerance is >>> 1e-5. You can change it using >>> >>> -ksp_rtol 1e-9 >>> >>> Thanks, >>> >>> Matt >>> >>> >>>> >>>> [image: Disagrees.png] >>>> >>>> Thanks! >>>> >>>> Wang Weizhuo >>>> >>>> On Tue, Oct 9, 2018 at 2:50 AM Mark Adams wrote: >>>> >>>>> To reiterate what Matt is saying, you seem to have the exact solution >>>>> on a 10x10 grid. That makes no sense unless the solution can be represented >>>>> exactly by your FE space (eg, u(x,y) = x + y). >>>>> >>>>> On Mon, Oct 8, 2018 at 9:33 PM Matthew Knepley >>>>> wrote: >>>>> >>>>>> On Mon, Oct 8, 2018 at 9:28 PM Weizhuo Wang >>>>>> wrote: >>>>>> >>>>>>> The code is attached in case anyone wants to take a look, I will try >>>>>>> the high frequency scenario later. >>>>>>> >>>>>> >>>>>> That is not the error. It is superconvergence at the vertices. The >>>>>> real solution is trigonometric, so your >>>>>> linear interpolants or whatever you use is not going to get the right >>>>>> value in between mesh points. You >>>>>> need to do a real integral over the whole interval to get the L_2 >>>>>> error. >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Matt >>>>>> >>>>>> >>>>>>> On Mon, Oct 8, 2018 at 7:58 PM Mark Adams wrote: >>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Mon, Oct 8, 2018 at 6:58 PM Weizhuo Wang >>>>>>>> wrote: >>>>>>>> >>>>>>>>> The first plot is the norm with the flag -pc_type lu with respect >>>>>>>>> to number of grids in one axis (n), and the second plot is the norm without >>>>>>>>> the flag -pc_type lu. >>>>>>>>> >>>>>>>> >>>>>>>> So you are using the default PC w/o LU. The default is ILU. This >>>>>>>> will reduce high frequency effectively but is not effective on the low >>>>>>>> frequency error. Don't expect your algebraic error reduction to be at the >>>>>>>> same scale as the residual reduction (what KSP measures). >>>>>>>> >>>>>>>> >>>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Wang Weizhuo >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> 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 >>>>>> >>>>>> https://www.cse.buffalo.edu/~knepley/ >>>>>> >>>>>> >>>>> >>>> >>>> -- >>>> Wang Weizhuo >>>> >>> >>> >>> -- >>> 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 >>> >>> https://www.cse.buffalo.edu/~knepley/ >>> >>> >> >> >> -- >> Wang Weizhuo >> > -- Wang Weizhuo -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Disagrees.png Type: image/png Size: 81967 bytes Desc: not available URL: From andrewh0 at uw.edu Mon Oct 22 18:43:21 2018 From: andrewh0 at uw.edu (Andrew Ho) Date: Mon, 22 Oct 2018 16:43:21 -0700 Subject: [petsc-users] Shell Matrix Operations required for KSP solvers? Message-ID: I have a specialized matrix structure I'm trying to take advantage of for solving large scale (non)linear systems. I think for this purpose using a Shell matrix is sufficient for interfacing with PETSc's KSP linear solvers. Looking at the examples which use shell matrices, it seems most only require implementing MatMult, and sometimes MatMultTranspose. Is there a list of what operations are required (or optional but good to have) for the different KSP solver types? This is specifically for the KSP solve itself, not constructing the actual matrix. I'd also be interested if any of the required/optional operations changes if preconditioners (left and/or right) are used. -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Mon Oct 22 19:22:42 2018 From: knepley at gmail.com (Matthew Knepley) Date: Mon, 22 Oct 2018 20:22:42 -0400 Subject: [petsc-users] Shell Matrix Operations required for KSP solvers? In-Reply-To: References: Message-ID: On Mon, Oct 22, 2018 at 7:44 PM Andrew Ho wrote: > I have a specialized matrix structure I'm trying to take advantage of for > solving large scale (non)linear systems. I think for this purpose using a > Shell matrix is sufficient for interfacing with PETSc's KSP linear solvers. > > Looking at the examples which use shell matrices, it seems most only > require implementing MatMult, and sometimes MatMultTranspose. Is there a > list of what operations are required (or optional but good to have) for the > different KSP solver types? This is specifically for the KSP solve itself, > not constructing the actual matrix. I'd also be interested if any of the > required/optional operations changes if preconditioners (left and/or right) > are used. > There is no list, but its hard to think of another operation KSP would ask for. Preconditioners are another story unfortunately. They often want explicit access to matrix entries. its really unusual for KSPs to work without a good preconditioner (the notable exception being well-conditioned systems like some boundary integral operators). Thanks, 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From Peterspy at outlook.com Mon Oct 22 20:55:46 2018 From: Peterspy at outlook.com (SONG Pengyang) Date: Tue, 23 Oct 2018 01:55:46 +0000 Subject: [petsc-users] Searching for a suitable example case for parallel linear solver Message-ID: Hi all, I am a new user of PETSC, and I am trying to use KSP to solve a 3D Poisson problem. The 3D Poisson problem is differenced by myself, which means that matrix A is given already. I have found several examples in KSP tutorials but I want to know which one is suitable for me in ?ex2f; ex6f; ex15f; ex21f; ex44f; ex45f? Thanks in advance. Regards, Pengyang ---------------------------------------------------------------- Pengyang Song????? MSc candidate in Physical Oceanography College of Oceanic and Atmospheric Sciences Ocean University of China No. 238 Songling Road, Qingdao 266100, Shandong, China TEL: (+86) 15762264643 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jed at jedbrown.org Mon Oct 22 22:01:38 2018 From: jed at jedbrown.org (Jed Brown) Date: Mon, 22 Oct 2018 21:01:38 -0600 Subject: [petsc-users] Searching for a suitable example case for parallel linear solver In-Reply-To: References: Message-ID: <87woq9pdrh.fsf@jedbrown.org> If you have a stored matrix (strongly discouraged as a workflow, but handy for tests), you can run ksp/ksp/examples/tutorials/ex10.c (no need to edit code). If you have a structured grid and want a fast solver, you should consider using geometric multigrid; see src/ksp/ksp/examples/tutorials/ex22f.F90 which has that capability. SONG Pengyang writes: > Hi all, > I am a new user of PETSC, and I am trying to use KSP to solve a 3D Poisson problem. The 3D Poisson problem is differenced by myself, which means that matrix A is given already. > I have found several examples in KSP tutorials but I want to know which one is suitable for me in ?ex2f; ex6f; ex15f; ex21f; ex44f; ex45f? > Thanks in advance. > Regards, > Pengyang > > ---------------------------------------------------------------- > Pengyang Song????? > MSc candidate in Physical Oceanography > College of Oceanic and Atmospheric Sciences > Ocean University of China > No. 238 Songling Road, Qingdao 266100, Shandong, China > TEL: (+86) 15762264643 From ysjosh.lo at gmail.com Tue Oct 23 02:11:32 2018 From: ysjosh.lo at gmail.com (Josh L) Date: Tue, 23 Oct 2018 02:11:32 -0500 Subject: [petsc-users] DMPlex, output value on gauss point to vertex Message-ID: Hi, My FEM codes calculate the stress field on gauss point, but when I output the stress field, I want it to on vertex. My old codes find the gauss points that surround a vertex and calculate the average. Is there any better way to do it with DMPlex? The PetscSF given by DMPlexDistribute has the info how mesh points are distributed. Can I create a mapping from it or it can be used to map mesh point in natural ordering to global ordering or the other way around? Thanks, Josh -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.mayhem23 at gmail.com Tue Oct 23 02:27:38 2018 From: dave.mayhem23 at gmail.com (Dave May) Date: Tue, 23 Oct 2018 09:27:38 +0200 Subject: [petsc-users] Shell Matrix Operations required for KSP solvers? In-Reply-To: References: Message-ID: On Tue, 23 Oct 2018 at 02:24, Matthew Knepley wrote: > On Mon, Oct 22, 2018 at 7:44 PM Andrew Ho wrote: > >> I have a specialized matrix structure I'm trying to take advantage of for >> solving large scale (non)linear systems. I think for this purpose using a >> Shell matrix is sufficient for interfacing with PETSc's KSP linear solvers. >> >> Looking at the examples which use shell matrices, it seems most only >> require implementing MatMult, and sometimes MatMultTranspose. Is there a >> list of what operations are required (or optional but good to have) for the >> different KSP solver types? This is specifically for the KSP solve itself, >> not constructing the actual matrix. I'd also be interested if any of the >> required/optional operations changes if preconditioners (left and/or right) >> are used. >> > > There is no list, but its hard to think of another operation KSP would ask > for. Preconditioners are another story unfortunately. They often want > explicit access to matrix entries. its really unusual for KSPs to work > without a good preconditioner (the notable exception being well-conditioned > systems like some boundary integral operators). > The most basic PC is Jacobi - for that to work you need to implement MatGetDiagonal. Thanks, Dave > Thanks, > > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yann.jobic at univ-amu.fr Tue Oct 23 02:56:16 2018 From: yann.jobic at univ-amu.fr (Yann Jobic) Date: Tue, 23 Oct 2018 09:56:16 +0200 Subject: [petsc-users] DMPlex, output value on gauss point to vertex In-Reply-To: References: Message-ID: Hi, You may want to look at : https://www.mcs.anl.gov/petsc/petsc-current/include/petsc/private/petscfeimpl.h.html#PetscFEInterpolate_Static It only gives the structure of what you are looking for. In order to use it, you have to use the FE implementation of Petsc, by looking at the examples. I hope it helps, Yann Le 23/10/2018 ? 09:11, Josh L a ?crit?: > Hi, > > My FEM codes calculate the stress field on gauss point, but when I > output the stress field, I want it to on vertex. My old codes find the > gauss points that surround a vertex and calculate the average. > Is there any better way to do it with DMPlex? > > > The PetscSF given by DMPlexDistribute has the info how mesh points are > distributed. > Can I create a mapping from it or it can be used to map mesh point in > natural ordering to global ordering or the other way around? > > Thanks, > Josh > -- ___________________________ Yann JOBIC HPC engineer IUSTI-CNRS UMR 7343 - Polytech Marseille Technop?le de Ch?teau Gombert 5 rue Enrico Fermi 13453 Marseille cedex 13 Tel : (33) 4 91 10 69 43 Fax : (33) 4 91 10 69 69 From jroman at dsic.upv.es Tue Oct 23 03:43:32 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Tue, 23 Oct 2018 10:43:32 +0200 Subject: [petsc-users] Slepc: Nonlinear eigenvalue problem In-Reply-To: <98D6E03D-2804-47EA-94CF-219B3A2CD9DE@gmail.com> References: <61B9AB6C-C7AE-4E6A-990D-9409AA3CA0A9@gmail.com> <98D6E03D-2804-47EA-94CF-219B3A2CD9DE@gmail.com> Message-ID: <701859C7-BC17-4121-929B-579DE4285BB7@dsic.upv.es> If eigenvalues are complex then NLEIGS also needs to work in complex arithmetic because it needs a region of the complex plane containing the wanted eigenvalues. It seems that complex arithmetic is the only change in your problem. Jose > El 22 oct 2018, a las 22:01, Manav Bhatia escribi?: > > Thanks, Jose. > > How difficult would it be to add the support for the general case (if at all possible)? > > My eigenvalue problem is of the form shown in the attachment. Beta is the eigenvalue and X_s^\Delta is the eigenvector. While some of the matrices are known, others are defined only as matrix vector products. > > I am interested in eigenvalues with the largest real part. I expect to find complex eigenvalues, although for a small subset of cases these will be real. > > What is your recommendation for attacking this problem with the nonlinear eigenvalue support in Slepc? > > Would appreciate your guidance. > > Regards, > Manav > > > > >> On Oct 22, 2018, at 2:40 PM, Jose E. Roman wrote: >> >> >> >>> El 22 oct 2018, a las 21:05, Manav Bhatia escribi?: >>> >>> Hi, >>> >>> I am exploring the nonlinear eigenvalue problem solver in Slepc. >>> >>> From the notes in "Sec 6.4: Retrieving the Solution?, it appears that if I expect to find complex eigenpairs then I must compile the library (and Petsc) with complex scalars. Is that correct? >>> >>> Is there a way to include support for complex eigenpairs in a library complied with real scalars? >>> >>> Regards, >>> Manav >>> >>> >> >> Currently, the only combination that supports complex eigenpairs with real scalars is the split form for the nonlinear function with the NLEIGS solver. >> >> Jose > From amfoggia at gmail.com Tue Oct 23 05:13:36 2018 From: amfoggia at gmail.com (Ale Foggia) Date: Tue, 23 Oct 2018 12:13:36 +0200 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos Message-ID: Hello, I'm currently using Lanczos solver (EPSLANCZOS) to get the smallest real eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem (EPS_HEP). Those are the only options I set for the solver. My aim is to be able to predict/estimate the time-to-solution. To do so, I was doing a scaling of the code for different sizes of matrices and for different number of MPI processes. As I was not observing a good scaling I checked the number of iterations of the solver (given by EPSGetIterationNumber). I've encounter that for the **same size** of matrix (that meaning, the same problem), when I change the number of MPI processes, the amount of iterations changes, and the behaviour is not monotonic. This are the numbers I've got: # procs # iters 960 157 992 189 1024 338 1056 190 1120 174 2048 136 I've checked the mailing list for a similar situation and I've found another person with the same problem but in another solver ("[SLEPc] GD is not deterministic when using different number of cores", Nov 19 2015), but I think the solution this person finds does not apply to my problem (removing "-eps_harmonic" option). Can you give me any hint on what is the reason for this behaviour? Is there a way to prevent this? It's not possible to estimate/predict any time consumption for bigger problems if the number of iterations varies this much. Ale -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Tue Oct 23 05:59:29 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Tue, 23 Oct 2018 12:59:29 +0200 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos In-Reply-To: References: Message-ID: <4EE63176-0CF1-47D7-83BD-A95162946BFD@dsic.upv.es> There is an undocumented option: -bv_reproducible_random It will force the initial vector of the Krylov subspace to be the same irrespective of the number of MPI processes. This should be used for scaling analyses as the one you are trying to do. An additional comment is that we strongly recommend to use the default solver (Krylov-Schur), which will do Lanczos with implicit restart. It is generally faster and more stable. Jose > El 23 oct 2018, a las 12:13, Ale Foggia escribi?: > > Hello, > > I'm currently using Lanczos solver (EPSLANCZOS) to get the smallest real eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem (EPS_HEP). Those are the only options I set for the solver. My aim is to be able to predict/estimate the time-to-solution. To do so, I was doing a scaling of the code for different sizes of matrices and for different number of MPI processes. As I was not observing a good scaling I checked the number of iterations of the solver (given by EPSGetIterationNumber). I've encounter that for the **same size** of matrix (that meaning, the same problem), when I change the number of MPI processes, the amount of iterations changes, and the behaviour is not monotonic. This are the numbers I've got: > > # procs # iters > 960 157 > 992 189 > 1024 338 > 1056 190 > 1120 174 > 2048 136 > > I've checked the mailing list for a similar situation and I've found another person with the same problem but in another solver ("[SLEPc] GD is not deterministic when using different number of cores", Nov 19 2015), but I think the solution this person finds does not apply to my problem (removing "-eps_harmonic" option). > > Can you give me any hint on what is the reason for this behaviour? Is there a way to prevent this? It's not possible to estimate/predict any time consumption for bigger problems if the number of iterations varies this much. > > Ale From knepley at gmail.com Tue Oct 23 06:53:27 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 23 Oct 2018 07:53:27 -0400 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos In-Reply-To: References: Message-ID: On Tue, Oct 23, 2018 at 6:24 AM Ale Foggia wrote: > Hello, > > I'm currently using Lanczos solver (EPSLANCZOS) to get the smallest real > eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem (EPS_HEP). Those are > the only options I set for the solver. My aim is to be able to > predict/estimate the time-to-solution. To do so, I was doing a scaling of > the code for different sizes of matrices and for different number of MPI > processes. As I was not observing a good scaling I checked the number of > iterations of the solver (given by EPSGetIterationNumber). I've encounter > that for the **same size** of matrix (that meaning, the same problem), when > I change the number of MPI processes, the amount of iterations changes, and > the behaviour is not monotonic. This are the numbers I've got: > I am sure you know this, but this test is strong scaling and will top out when the individual problem sizes become too small (we see this at several thousand unknowns). Thanks, Matt > > # procs # iters > 960 157 > 992 189 > 1024 338 > 1056 190 > 1120 174 > 2048 136 > > I've checked the mailing list for a similar situation and I've found > another person with the same problem but in another solver ("[SLEPc] GD is > not deterministic when using different number of cores", Nov 19 2015), but > I think the solution this person finds does not apply to my problem > (removing "-eps_harmonic" option). > > Can you give me any hint on what is the reason for this behaviour? Is > there a way to prevent this? It's not possible to estimate/predict any time > consumption for bigger problems if the number of iterations varies this > much. > > Ale > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From amfoggia at gmail.com Tue Oct 23 08:17:38 2018 From: amfoggia at gmail.com (Ale Foggia) Date: Tue, 23 Oct 2018 15:17:38 +0200 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos In-Reply-To: <4EE63176-0CF1-47D7-83BD-A95162946BFD@dsic.upv.es> References: <4EE63176-0CF1-47D7-83BD-A95162946BFD@dsic.upv.es> Message-ID: Hello Jose, thanks for your answer. El mar., 23 oct. 2018 a las 12:59, Jose E. Roman () escribi?: > There is an undocumented option: > > -bv_reproducible_random > > It will force the initial vector of the Krylov subspace to be the same > irrespective of the number of MPI processes. This should be used for > scaling analyses as the one you are trying to do. > What about when I'm not doing the scaling? Now I would like to ask for computing time for bigger size problems, should I also use this option in that case? Because, what happens if I have a "bad" configuration? Meaning, I ask for some time, enough if I take into account the "correct" scaling, but when I run it takes double the time/iterations, like it happened before when changing from 960 to 1024 processes? > > An additional comment is that we strongly recommend to use the default > solver (Krylov-Schur), which will do Lanczos with implicit restart. It is > generally faster and more stable. > I will be doing Dynamical Lanczos, that means that I'll need the "matrix whose rows are the eigenvectors of the tridiagonal matrix" (so, according to the Lanczos Technical Report notation, I need the "matrix whose rows are the eigenvectors of T_m", which should be the same as the vectors y_i). I checked the Technical Report for Krylov-Schur also and I think I can get the same information also from that solver, but I'm not sure. Can you confirm this please? Also, as the vectors I want are given by V_m^(-1)*x_i=y_i (following the notation on the Report), my idea to get them was to retrieve the invariant subspace V_m (with EPSGetInvariantSubspace), invert it, and then multiply it with the eigenvectors that I get with EPSGetEigenvector. Is there another easier (or with less computations) way to get this? > Jose > > > > > El 23 oct 2018, a las 12:13, Ale Foggia escribi?: > > > > Hello, > > > > I'm currently using Lanczos solver (EPSLANCZOS) to get the smallest real > eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem (EPS_HEP). Those are > the only options I set for the solver. My aim is to be able to > predict/estimate the time-to-solution. To do so, I was doing a scaling of > the code for different sizes of matrices and for different number of MPI > processes. As I was not observing a good scaling I checked the number of > iterations of the solver (given by EPSGetIterationNumber). I've encounter > that for the **same size** of matrix (that meaning, the same problem), when > I change the number of MPI processes, the amount of iterations changes, and > the behaviour is not monotonic. This are the numbers I've got: > > > > # procs # iters > > 960 157 > > 992 189 > > 1024 338 > > 1056 190 > > 1120 174 > > 2048 136 > > > > I've checked the mailing list for a similar situation and I've found > another person with the same problem but in another solver ("[SLEPc] GD is > not deterministic when using different number of cores", Nov 19 2015), but > I think the solution this person finds does not apply to my problem > (removing "-eps_harmonic" option). > > > > Can you give me any hint on what is the reason for this behaviour? Is > there a way to prevent this? It's not possible to estimate/predict any time > consumption for bigger problems if the number of iterations varies this > much. > > > > Ale > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Tue Oct 23 08:33:39 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Tue, 23 Oct 2018 15:33:39 +0200 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos In-Reply-To: References: <4EE63176-0CF1-47D7-83BD-A95162946BFD@dsic.upv.es> Message-ID: > El 23 oct 2018, a las 15:17, Ale Foggia escribi?: > > Hello Jose, thanks for your answer. > > El mar., 23 oct. 2018 a las 12:59, Jose E. Roman () escribi?: > There is an undocumented option: > > -bv_reproducible_random > > It will force the initial vector of the Krylov subspace to be the same irrespective of the number of MPI processes. This should be used for scaling analyses as the one you are trying to do. > > What about when I'm not doing the scaling? Now I would like to ask for computing time for bigger size problems, should I also use this option in that case? Because, what happens if I have a "bad" configuration? Meaning, I ask for some time, enough if I take into account the "correct" scaling, but when I run it takes double the time/iterations, like it happened before when changing from 960 to 1024 processes? When you increase the matrix size the spectrum of the matrix changes and probably also the convergence, so the computation time is not easy to predict in advance. > > An additional comment is that we strongly recommend to use the default solver (Krylov-Schur), which will do Lanczos with implicit restart. It is generally faster and more stable. > > I will be doing Dynamical Lanczos, that means that I'll need the "matrix whose rows are the eigenvectors of the tridiagonal matrix" (so, according to the Lanczos Technical Report notation, I need the "matrix whose rows are the eigenvectors of T_m", which should be the same as the vectors y_i). I checked the Technical Report for Krylov-Schur also and I think I can get the same information also from that solver, but I'm not sure. Can you confirm this please? > Also, as the vectors I want are given by V_m^(-1)*x_i=y_i (following the notation on the Report), my idea to get them was to retrieve the invariant subspace V_m (with EPSGetInvariantSubspace), invert it, and then multiply it with the eigenvectors that I get with EPSGetEigenvector. Is there another easier (or with less computations) way to get this? In Krylov-Schur the tridiagonal matrix T_m becomes arrowhead-plus-tridiagonal. Apart from this, it should be equivalent. The relevant information can be obtained with EPSGetBV() and EPSGetDS(). But this is a "developer level" interface. We could help you get this running. Send a small problem matrix to slepc-maint together with a more detailed description of what you need to compute. Jose > > > Jose > > > > > El 23 oct 2018, a las 12:13, Ale Foggia escribi?: > > > > Hello, > > > > I'm currently using Lanczos solver (EPSLANCZOS) to get the smallest real eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem (EPS_HEP). Those are the only options I set for the solver. My aim is to be able to predict/estimate the time-to-solution. To do so, I was doing a scaling of the code for different sizes of matrices and for different number of MPI processes. As I was not observing a good scaling I checked the number of iterations of the solver (given by EPSGetIterationNumber). I've encounter that for the **same size** of matrix (that meaning, the same problem), when I change the number of MPI processes, the amount of iterations changes, and the behaviour is not monotonic. This are the numbers I've got: > > > > # procs # iters > > 960 157 > > 992 189 > > 1024 338 > > 1056 190 > > 1120 174 > > 2048 136 > > > > I've checked the mailing list for a similar situation and I've found another person with the same problem but in another solver ("[SLEPc] GD is not deterministic when using different number of cores", Nov 19 2015), but I think the solution this person finds does not apply to my problem (removing "-eps_harmonic" option). > > > > Can you give me any hint on what is the reason for this behaviour? Is there a way to prevent this? It's not possible to estimate/predict any time consumption for bigger problems if the number of iterations varies this much. > > > > Ale > From amfoggia at gmail.com Tue Oct 23 08:46:16 2018 From: amfoggia at gmail.com (Ale Foggia) Date: Tue, 23 Oct 2018 15:46:16 +0200 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos In-Reply-To: References: <4EE63176-0CF1-47D7-83BD-A95162946BFD@dsic.upv.es> Message-ID: El mar., 23 oct. 2018 a las 15:33, Jose E. Roman () escribi?: > > > > El 23 oct 2018, a las 15:17, Ale Foggia escribi?: > > > > Hello Jose, thanks for your answer. > > > > El mar., 23 oct. 2018 a las 12:59, Jose E. Roman () > escribi?: > > There is an undocumented option: > > > > -bv_reproducible_random > > > > It will force the initial vector of the Krylov subspace to be the same > irrespective of the number of MPI processes. This should be used for > scaling analyses as the one you are trying to do. > > > > What about when I'm not doing the scaling? Now I would like to ask for > computing time for bigger size problems, should I also use this option in > that case? Because, what happens if I have a "bad" configuration? Meaning, > I ask for some time, enough if I take into account the "correct" scaling, > but when I run it takes double the time/iterations, like it happened before > when changing from 960 to 1024 processes? > > When you increase the matrix size the spectrum of the matrix changes and > probably also the convergence, so the computation time is not easy to > predict in advance. > Okey, I'll keep that in mine. I thought that, even if the spectrum changes, if I had a behaviour/tendency for 6 or 7 smaller cases I could predict more or less the time. It was working this way until I found this "iterations problem" which doubled the time of execution for the same size problem. To be completely sure, do you suggest me or not to use this run-time option when going in production? Can you elaborate a bit in the effect this option? Is the (huge) difference I got in the number of iterations something expected? > > > > An additional comment is that we strongly recommend to use the default > solver (Krylov-Schur), which will do Lanczos with implicit restart. It is > generally faster and more stable. > > > > I will be doing Dynamical Lanczos, that means that I'll need the "matrix > whose rows are the eigenvectors of the tridiagonal matrix" (so, according > to the Lanczos Technical Report notation, I need the "matrix whose rows are > the eigenvectors of T_m", which should be the same as the vectors y_i). I > checked the Technical Report for Krylov-Schur also and I think I can get > the same information also from that solver, but I'm not sure. Can you > confirm this please? > > Also, as the vectors I want are given by V_m^(-1)*x_i=y_i (following the > notation on the Report), my idea to get them was to retrieve the invariant > subspace V_m (with EPSGetInvariantSubspace), invert it, and then multiply > it with the eigenvectors that I get with EPSGetEigenvector. Is there > another easier (or with less computations) way to get this? > > In Krylov-Schur the tridiagonal matrix T_m becomes > arrowhead-plus-tridiagonal. Apart from this, it should be equivalent. The > relevant information can be obtained with EPSGetBV() and EPSGetDS(). But > this is a "developer level" interface. We could help you get this running. > Send a small problem matrix to slepc-maint together with a more detailed > description of what you need to compute. > Thanks! When I get to that part I'll write to slepc-maint for help. > Jose > > > > > > > Jose > > > > > > > > > El 23 oct 2018, a las 12:13, Ale Foggia escribi?: > > > > > > Hello, > > > > > > I'm currently using Lanczos solver (EPSLANCZOS) to get the smallest > real eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem (EPS_HEP). Those > are the only options I set for the solver. My aim is to be able to > predict/estimate the time-to-solution. To do so, I was doing a scaling of > the code for different sizes of matrices and for different number of MPI > processes. As I was not observing a good scaling I checked the number of > iterations of the solver (given by EPSGetIterationNumber). I've encounter > that for the **same size** of matrix (that meaning, the same problem), when > I change the number of MPI processes, the amount of iterations changes, and > the behaviour is not monotonic. This are the numbers I've got: > > > > > > # procs # iters > > > 960 157 > > > 992 189 > > > 1024 338 > > > 1056 190 > > > 1120 174 > > > 2048 136 > > > > > > I've checked the mailing list for a similar situation and I've found > another person with the same problem but in another solver ("[SLEPc] GD is > not deterministic when using different number of cores", Nov 19 2015), but > I think the solution this person finds does not apply to my problem > (removing "-eps_harmonic" option). > > > > > > Can you give me any hint on what is the reason for this behaviour? Is > there a way to prevent this? It's not possible to estimate/predict any time > consumption for bigger problems if the number of iterations varies this > much. > > > > > > Ale > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bhatiamanav at gmail.com Tue Oct 23 09:10:12 2018 From: bhatiamanav at gmail.com (Manav Bhatia) Date: Tue, 23 Oct 2018 09:10:12 -0500 Subject: [petsc-users] Slepc: Nonlinear eigenvalue problem In-Reply-To: <701859C7-BC17-4121-929B-579DE4285BB7@dsic.upv.es> References: <61B9AB6C-C7AE-4E6A-990D-9409AA3CA0A9@gmail.com> <98D6E03D-2804-47EA-94CF-219B3A2CD9DE@gmail.com> <701859C7-BC17-4121-929B-579DE4285BB7@dsic.upv.es> Message-ID: Thanks for the clarification. Does this also apply to the standard non-hermitian eigenvalue problem? Do I need to compile with complex numbers if I want to capture the complex eigenvalues? Or does it work with real number support? Thanks Manav Sent from my iPhone > On Oct 23, 2018, at 3:43 AM, Jose E. Roman wrote: > > If eigenvalues are complex then NLEIGS also needs to work in complex arithmetic because it needs a region of the complex plane containing the wanted eigenvalues. It seems that complex arithmetic is the only change in your problem. > > Jose > > >> El 22 oct 2018, a las 22:01, Manav Bhatia escribi?: >> >> Thanks, Jose. >> >> How difficult would it be to add the support for the general case (if at all possible)? >> >> My eigenvalue problem is of the form shown in the attachment. Beta is the eigenvalue and X_s^\Delta is the eigenvector. While some of the matrices are known, others are defined only as matrix vector products. >> >> I am interested in eigenvalues with the largest real part. I expect to find complex eigenvalues, although for a small subset of cases these will be real. >> >> What is your recommendation for attacking this problem with the nonlinear eigenvalue support in Slepc? >> >> Would appreciate your guidance. >> >> Regards, >> Manav >> >> >> >> >>> On Oct 22, 2018, at 2:40 PM, Jose E. Roman wrote: >>> >>> >>> >>>> El 22 oct 2018, a las 21:05, Manav Bhatia escribi?: >>>> >>>> Hi, >>>> >>>> I am exploring the nonlinear eigenvalue problem solver in Slepc. >>>> >>>> From the notes in "Sec 6.4: Retrieving the Solution?, it appears that if I expect to find complex eigenpairs then I must compile the library (and Petsc) with complex scalars. Is that correct? >>>> >>>> Is there a way to include support for complex eigenpairs in a library complied with real scalars? >>>> >>>> Regards, >>>> Manav >>>> >>>> >>> >>> Currently, the only combination that supports complex eigenpairs with real scalars is the split form for the nonlinear function with the NLEIGS solver. >>> >>> Jose >> > From knepley at gmail.com Tue Oct 23 09:40:27 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 23 Oct 2018 10:40:27 -0400 Subject: [petsc-users] DMPlex, output value on gauss point to vertex In-Reply-To: References: Message-ID: On Tue, Oct 23, 2018 at 3:12 AM Josh L wrote: > Hi, > > My FEM codes calculate the stress field on gauss point, but when I output > the stress field, I want it to on vertex. My old codes find the gauss > points that surround a vertex and calculate the average. > Is there any better way to do it with DMPlex? > In general, I would project the answer into a finite element space for output, unless you can think of a reason that this is unacceptable. You can easily project functions of finite element fields using DMPlexProjectField(). You would give a pointwise function that would calculate your stress and everything else should be automatic. > The PetscSF given by DMPlexDistribute has the info how mesh points are > distributed. > Can I create a mapping from it or it can be used to map mesh point in > natural ordering to global ordering or the other way around? > I would really discourage this kind of thinking. This is what made historical FEM code impossible to use or optimize. Thanks, Matt > Thanks, > Josh > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Tue Oct 23 09:42:40 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Tue, 23 Oct 2018 16:42:40 +0200 Subject: [petsc-users] Slepc: Nonlinear eigenvalue problem In-Reply-To: References: <61B9AB6C-C7AE-4E6A-990D-9409AA3CA0A9@gmail.com> <98D6E03D-2804-47EA-94CF-219B3A2CD9DE@gmail.com> <701859C7-BC17-4121-929B-579DE4285BB7@dsic.upv.es> Message-ID: <70A96A4A-6607-4CD6-8F3A-0D6071542ECC@dsic.upv.es> > El 23 oct 2018, a las 16:10, Manav Bhatia escribi?: > > Thanks for the clarification. > > Does this also apply to the standard non-hermitian eigenvalue problem? Do I need to compile with complex numbers if I want to capture the complex eigenvalues? Or does it work with real number support? No, linear eigenproblems (EPS) can be solved with real scalars for complex eigenvalues, but nonlinear eigenproblems (NEP) cannot. Jose > > Thanks > Manav > > Sent from my iPhone > >> On Oct 23, 2018, at 3:43 AM, Jose E. Roman wrote: >> >> If eigenvalues are complex then NLEIGS also needs to work in complex arithmetic because it needs a region of the complex plane containing the wanted eigenvalues. It seems that complex arithmetic is the only change in your problem. >> >> Jose >> >> >>> El 22 oct 2018, a las 22:01, Manav Bhatia escribi?: >>> >>> Thanks, Jose. >>> >>> How difficult would it be to add the support for the general case (if at all possible)? >>> >>> My eigenvalue problem is of the form shown in the attachment. Beta is the eigenvalue and X_s^\Delta is the eigenvector. While some of the matrices are known, others are defined only as matrix vector products. >>> >>> I am interested in eigenvalues with the largest real part. I expect to find complex eigenvalues, although for a small subset of cases these will be real. >>> >>> What is your recommendation for attacking this problem with the nonlinear eigenvalue support in Slepc? >>> >>> Would appreciate your guidance. >>> >>> Regards, >>> Manav >>> >>> >>> >>> >>>> On Oct 22, 2018, at 2:40 PM, Jose E. Roman wrote: >>>> >>>> >>>> >>>>> El 22 oct 2018, a las 21:05, Manav Bhatia escribi?: >>>>> >>>>> Hi, >>>>> >>>>> I am exploring the nonlinear eigenvalue problem solver in Slepc. >>>>> >>>>> From the notes in "Sec 6.4: Retrieving the Solution?, it appears that if I expect to find complex eigenpairs then I must compile the library (and Petsc) with complex scalars. Is that correct? >>>>> >>>>> Is there a way to include support for complex eigenpairs in a library complied with real scalars? >>>>> >>>>> Regards, >>>>> Manav >>>>> >>>>> >>>> >>>> Currently, the only combination that supports complex eigenpairs with real scalars is the split form for the nonlinear function with the NLEIGS solver. >>>> >>>> Jose >>> >> From jroman at dsic.upv.es Tue Oct 23 09:48:43 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Tue, 23 Oct 2018 16:48:43 +0200 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos In-Reply-To: References: <4EE63176-0CF1-47D7-83BD-A95162946BFD@dsic.upv.es> Message-ID: <8785019B-C52B-4022-B7A8-83F8466F9B71@dsic.upv.es> > El 23 oct 2018, a las 15:46, Ale Foggia escribi?: > > > > El mar., 23 oct. 2018 a las 15:33, Jose E. Roman () escribi?: > > > > El 23 oct 2018, a las 15:17, Ale Foggia escribi?: > > > > Hello Jose, thanks for your answer. > > > > El mar., 23 oct. 2018 a las 12:59, Jose E. Roman () escribi?: > > There is an undocumented option: > > > > -bv_reproducible_random > > > > It will force the initial vector of the Krylov subspace to be the same irrespective of the number of MPI processes. This should be used for scaling analyses as the one you are trying to do. > > > > What about when I'm not doing the scaling? Now I would like to ask for computing time for bigger size problems, should I also use this option in that case? Because, what happens if I have a "bad" configuration? Meaning, I ask for some time, enough if I take into account the "correct" scaling, but when I run it takes double the time/iterations, like it happened before when changing from 960 to 1024 processes? > > When you increase the matrix size the spectrum of the matrix changes and probably also the convergence, so the computation time is not easy to predict in advance. > > Okey, I'll keep that in mine. I thought that, even if the spectrum changes, if I had a behaviour/tendency for 6 or 7 smaller cases I could predict more or less the time. It was working this way until I found this "iterations problem" which doubled the time of execution for the same size problem. To be completely sure, do you suggest me or not to use this run-time option when going in production? Can you elaborate a bit in the effect this option? Is the (huge) difference I got in the number of iterations something expected? Ideally if you have a rough approximation of the eigenvector, you set it as the initial vector with EPSSetInitialSpace(). Otherwise, SLEPc generates a random initial vector, that is start the search blindly. The difference between using one random vector or another may be large, depending on the problem. Krylov-Schur is usually less sensitive to the initial vector. Jose > > > > > > An additional comment is that we strongly recommend to use the default solver (Krylov-Schur), which will do Lanczos with implicit restart. It is generally faster and more stable. > > > > I will be doing Dynamical Lanczos, that means that I'll need the "matrix whose rows are the eigenvectors of the tridiagonal matrix" (so, according to the Lanczos Technical Report notation, I need the "matrix whose rows are the eigenvectors of T_m", which should be the same as the vectors y_i). I checked the Technical Report for Krylov-Schur also and I think I can get the same information also from that solver, but I'm not sure. Can you confirm this please? > > Also, as the vectors I want are given by V_m^(-1)*x_i=y_i (following the notation on the Report), my idea to get them was to retrieve the invariant subspace V_m (with EPSGetInvariantSubspace), invert it, and then multiply it with the eigenvectors that I get with EPSGetEigenvector. Is there another easier (or with less computations) way to get this? > > In Krylov-Schur the tridiagonal matrix T_m becomes arrowhead-plus-tridiagonal. Apart from this, it should be equivalent. The relevant information can be obtained with EPSGetBV() and EPSGetDS(). But this is a "developer level" interface. We could help you get this running. Send a small problem matrix to slepc-maint together with a more detailed description of what you need to compute. > > Thanks! When I get to that part I'll write to slepc-maint for help. > > > Jose > > > > > > > Jose > > > > > > > > > El 23 oct 2018, a las 12:13, Ale Foggia escribi?: > > > > > > Hello, > > > > > > I'm currently using Lanczos solver (EPSLANCZOS) to get the smallest real eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem (EPS_HEP). Those are the only options I set for the solver. My aim is to be able to predict/estimate the time-to-solution. To do so, I was doing a scaling of the code for different sizes of matrices and for different number of MPI processes. As I was not observing a good scaling I checked the number of iterations of the solver (given by EPSGetIterationNumber). I've encounter that for the **same size** of matrix (that meaning, the same problem), when I change the number of MPI processes, the amount of iterations changes, and the behaviour is not monotonic. This are the numbers I've got: > > > > > > # procs # iters > > > 960 157 > > > 992 189 > > > 1024 338 > > > 1056 190 > > > 1120 174 > > > 2048 136 > > > > > > I've checked the mailing list for a similar situation and I've found another person with the same problem but in another solver ("[SLEPc] GD is not deterministic when using different number of cores", Nov 19 2015), but I think the solution this person finds does not apply to my problem (removing "-eps_harmonic" option). > > > > > > Can you give me any hint on what is the reason for this behaviour? Is there a way to prevent this? It's not possible to estimate/predict any time consumption for bigger problems if the number of iterations varies this much. > > > > > > Ale > > From bhatiamanav at gmail.com Tue Oct 23 09:51:51 2018 From: bhatiamanav at gmail.com (Manav Bhatia) Date: Tue, 23 Oct 2018 09:51:51 -0500 Subject: [petsc-users] Slepc: Nonlinear eigenvalue problem In-Reply-To: <70A96A4A-6607-4CD6-8F3A-0D6071542ECC@dsic.upv.es> References: <61B9AB6C-C7AE-4E6A-990D-9409AA3CA0A9@gmail.com> <98D6E03D-2804-47EA-94CF-219B3A2CD9DE@gmail.com> <701859C7-BC17-4121-929B-579DE4285BB7@dsic.upv.es> <70A96A4A-6607-4CD6-8F3A-0D6071542ECC@dsic.upv.es> Message-ID: <3814CB35-A7AF-48D1-8C5E-52BAA09E4B54@gmail.com> Really interesting! So this is a limitation of the algorithm and not the implementation. The challenge is that the eigenvalue solution in my workflow is a small component of a large computation done with real numbers in an optimization problem. I could do the whole thing with complex numbers, but would be wasting a lot of cpu cycles doing that. Do you know if there is anyway to link to both real and complex versions of the library or switch between them at runtime? -Manav Sent from my iPhone > On Oct 23, 2018, at 9:42 AM, Jose E. Roman wrote: > > > >> El 23 oct 2018, a las 16:10, Manav Bhatia escribi?: >> >> Thanks for the clarification. >> >> Does this also apply to the standard non-hermitian eigenvalue problem? Do I need to compile with complex numbers if I want to capture the complex eigenvalues? Or does it work with real number support? > > No, linear eigenproblems (EPS) can be solved with real scalars for complex eigenvalues, but nonlinear eigenproblems (NEP) cannot. > > Jose > >> >> Thanks >> Manav >> >> Sent from my iPhone >> >>> On Oct 23, 2018, at 3:43 AM, Jose E. Roman wrote: >>> >>> If eigenvalues are complex then NLEIGS also needs to work in complex arithmetic because it needs a region of the complex plane containing the wanted eigenvalues. It seems that complex arithmetic is the only change in your problem. >>> >>> Jose >>> >>> >>>> El 22 oct 2018, a las 22:01, Manav Bhatia escribi?: >>>> >>>> Thanks, Jose. >>>> >>>> How difficult would it be to add the support for the general case (if at all possible)? >>>> >>>> My eigenvalue problem is of the form shown in the attachment. Beta is the eigenvalue and X_s^\Delta is the eigenvector. While some of the matrices are known, others are defined only as matrix vector products. >>>> >>>> I am interested in eigenvalues with the largest real part. I expect to find complex eigenvalues, although for a small subset of cases these will be real. >>>> >>>> What is your recommendation for attacking this problem with the nonlinear eigenvalue support in Slepc? >>>> >>>> Would appreciate your guidance. >>>> >>>> Regards, >>>> Manav >>>> >>>> >>>> >>>> >>>>> On Oct 22, 2018, at 2:40 PM, Jose E. Roman wrote: >>>>> >>>>> >>>>> >>>>>> El 22 oct 2018, a las 21:05, Manav Bhatia escribi?: >>>>>> >>>>>> Hi, >>>>>> >>>>>> I am exploring the nonlinear eigenvalue problem solver in Slepc. >>>>>> >>>>>> From the notes in "Sec 6.4: Retrieving the Solution?, it appears that if I expect to find complex eigenpairs then I must compile the library (and Petsc) with complex scalars. Is that correct? >>>>>> >>>>>> Is there a way to include support for complex eigenpairs in a library complied with real scalars? >>>>>> >>>>>> Regards, >>>>>> Manav >>>>>> >>>>>> >>>>> >>>>> Currently, the only combination that supports complex eigenpairs with real scalars is the split form for the nonlinear function with the NLEIGS solver. >>>>> >>>>> Jose >>>> >>> > From knepley at gmail.com Tue Oct 23 09:58:25 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 23 Oct 2018 10:58:25 -0400 Subject: [petsc-users] Slepc: Nonlinear eigenvalue problem In-Reply-To: <3814CB35-A7AF-48D1-8C5E-52BAA09E4B54@gmail.com> References: <61B9AB6C-C7AE-4E6A-990D-9409AA3CA0A9@gmail.com> <98D6E03D-2804-47EA-94CF-219B3A2CD9DE@gmail.com> <701859C7-BC17-4121-929B-579DE4285BB7@dsic.upv.es> <70A96A4A-6607-4CD6-8F3A-0D6071542ECC@dsic.upv.es> <3814CB35-A7AF-48D1-8C5E-52BAA09E4B54@gmail.com> Message-ID: On Tue, Oct 23, 2018 at 10:53 AM Manav Bhatia wrote: > Really interesting! > > So this is a limitation of the algorithm and not the implementation. > > The challenge is that the eigenvalue solution in my workflow is a small > component of a large computation done with real numbers in an optimization > problem. I could do the whole thing with complex numbers, but would be > wasting a lot of cpu cycles doing that. > > Do you know if there is anyway to link to both real and complex versions > of the library or switch between them at runtime? > Unfortunately, that is a huge amount of work. One group has done it, but we do not support it. Thanks, Matt > -Manav > > Sent from my iPhone > > > On Oct 23, 2018, at 9:42 AM, Jose E. Roman wrote: > > > > > > > >> El 23 oct 2018, a las 16:10, Manav Bhatia > escribi?: > >> > >> Thanks for the clarification. > >> > >> Does this also apply to the standard non-hermitian eigenvalue problem? > Do I need to compile with complex numbers if I want to capture the complex > eigenvalues? Or does it work with real number support? > > > > No, linear eigenproblems (EPS) can be solved with real scalars for > complex eigenvalues, but nonlinear eigenproblems (NEP) cannot. > > > > Jose > > > >> > >> Thanks > >> Manav > >> > >> Sent from my iPhone > >> > >>> On Oct 23, 2018, at 3:43 AM, Jose E. Roman wrote: > >>> > >>> If eigenvalues are complex then NLEIGS also needs to work in complex > arithmetic because it needs a region of the complex plane containing the > wanted eigenvalues. It seems that complex arithmetic is the only change in > your problem. > >>> > >>> Jose > >>> > >>> > >>>> El 22 oct 2018, a las 22:01, Manav Bhatia > escribi?: > >>>> > >>>> Thanks, Jose. > >>>> > >>>> How difficult would it be to add the support for the general case (if > at all possible)? > >>>> > >>>> My eigenvalue problem is of the form shown in the attachment. Beta is > the eigenvalue and X_s^\Delta is the eigenvector. While some of the > matrices are known, others are defined only as matrix vector products. > >>>> > >>>> I am interested in eigenvalues with the largest real part. I expect > to find complex eigenvalues, although for a small subset of cases these > will be real. > >>>> > >>>> What is your recommendation for attacking this problem with the > nonlinear eigenvalue support in Slepc? > >>>> > >>>> Would appreciate your guidance. > >>>> > >>>> Regards, > >>>> Manav > >>>> > >>>> > >>>> > >>>> > >>>>> On Oct 22, 2018, at 2:40 PM, Jose E. Roman > wrote: > >>>>> > >>>>> > >>>>> > >>>>>> El 22 oct 2018, a las 21:05, Manav Bhatia > escribi?: > >>>>>> > >>>>>> Hi, > >>>>>> > >>>>>> I am exploring the nonlinear eigenvalue problem solver in Slepc. > >>>>>> > >>>>>> From the notes in "Sec 6.4: Retrieving the Solution?, it appears > that if I expect to find complex eigenpairs then I must compile the library > (and Petsc) with complex scalars. Is that correct? > >>>>>> > >>>>>> Is there a way to include support for complex eigenpairs in a > library complied with real scalars? > >>>>>> > >>>>>> Regards, > >>>>>> Manav > >>>>>> > >>>>>> > >>>>> > >>>>> Currently, the only combination that supports complex eigenpairs > with real scalars is the split form for the nonlinear function with the > NLEIGS solver. > >>>>> > >>>>> Jose > >>>> > >>> > > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From yjwu16 at gmail.com Tue Oct 23 10:35:32 2018 From: yjwu16 at gmail.com (Yingjie Wu) Date: Tue, 23 Oct 2018 23:35:32 +0800 Subject: [petsc-users] Problems about Compiling Multifile Program Message-ID: Dear Petsc developer: Hi, Thank you very much for your continuous help, I recently encountered some difficulties in developing programs on Petsc. 1. I want to use my class definition (class1. h) and class functions (class1. cpp) files in my Petsc program (myprogram. c) and compile my program. I have written other program before: g++ -c class1.cpp myprogram.c g++ -o myprogram *.o I also have some knowledge of Makefile, but I don't know how to modify it to achieve compilation. I really want your help. 2. In my class definition and function implementation program, I want to use Petsc data structures, such as PetscInt, PetscReal. In order to maintain consistency of the main program. What kind of header files should I add to my code, or do I need to add any code? Thanks, Yingjie -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Tue Oct 23 12:46:10 2018 From: knepley at gmail.com (Matthew Knepley) Date: Tue, 23 Oct 2018 13:46:10 -0400 Subject: [petsc-users] Problems about Compiling Multifile Program In-Reply-To: References: Message-ID: On Tue, Oct 23, 2018 at 11:37 AM Yingjie Wu wrote: > Dear Petsc developer: > Hi, > Thank you very much for your continuous help, I recently encountered some > difficulties in developing programs on Petsc. > > 1. I want to use my class definition (class1. h) and class functions > (class1. cpp) files in my Petsc program (myprogram. c) and compile my > program. I have written other program before: > g++ -c class1.cpp myprogram.c > g++ -o myprogram *.o > I also have some knowledge of Makefile, but I don't know how to modify it > to achieve compilation. I really want your help. > With PETSc makefiles, we have automatic rules, so you can use myprogram: class1.o myprogram.o ${CLINKER} -o myprogram class1.o myprogram.o ${PETSC_LIB} > 2. In my class definition and function implementation program, I want to > use Petsc data structures, such as PetscInt, PetscReal. In order to > maintain consistency of the main program. What kind of header files should > I add to my code, or do I need to add any code? > The easiest thing to do is just #include Thanks, Matt > Thanks, > Yingjie > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From overholt at capesim.com Tue Oct 23 13:29:59 2018 From: overholt at capesim.com (Matthew Overholt) Date: Tue, 23 Oct 2018 14:29:59 -0400 Subject: [petsc-users] Problems about Compiling Multifile Program In-Reply-To: References: Message-ID: Here is a sample makefile, like what I use with the Intel MPI compilers (used during PETSc configuration) and MKL library. Matt Overholt --------------------------------------------- # # makefile for Linux using the Intel C++ Compiler, MKL & MPI libraries + OpenMP # usage: make # or: make clean # # Although explicit paths are used for all libraries and compilers below, it is # still necessary to first call the Intel scripts as follows: # if [ -z "$I_MPI_ROOT" ]; then # source /opt/intel/compilers_and_libraries/linux/mpi/intel64/bin/mpivars.sh # fi # if [ -z "$MKLROOT" ]; then # source /opt/intel/parallel_studio_xe_2018/bin/psxevars.sh intel64 # fi # Use OMP_NUM_THREADS to set # of threads ### MPI Compilers for C++ and C ### COMPILER_DIR = /opt/intel/compilers_and_libraries/linux/mpi/intel64/bin COMPILER = $(COMPILER_DIR)/mpiicpc CCOMPILER = $(COMPILER_DIR)/mpiicc ### Intel MKL & MPI libraries ### MKL_DIR = /opt/intel/compilers_and_libraries/linux/mkl MKL_INC = $(MKL_DIR)/include MKL_LIB = $(MKL_DIR)/lib/intel64 ### Compiling Flags (debug and optimized) ### # CCFLAGS = -c -O0 -g -traceback -heap-arrays -check=stack,uninit -I$(MKL_INC) -qopenmp CCFLAGS = -c -I$(MKL_INC) -qopenmp ### Linking Flags (debug and optimized) ### # CLFLAGS = -g -lstdc++ -qopenmp CLFLAGS = -lstdc++ -qopenmp ### MKL Libraries ### # Sequential threading layer # MKLFLAGS = -Wl,--start-group \ # ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a \ # ${MKLROOT}/lib/intel64/libmkl_sequential.a \ # ${MKLROOT}/lib/intel64/libmkl_core.a \ # -Wl,--end-group -lpthread -lm -ldl # OpenMP parallel threading layer MKLFLAGS = -Wl,--start-group \ $(MKL_LIB)/libmkl_intel_lp64.a \ $(MKL_LIB)/libmkl_intel_thread.a \ $(MKL_LIB)/libmkl_core.a \ $(MKL_LIB)/libmkl_blacs_intelmpi_lp64.a \ -Wl,--end-group -liomp5 -lpthread -lm -ldl TARGET = myprogram ### Object Files ### OBJFILES = \ class1.o \ class2.o all: $(TARGET) # # Build (link) it $(TARGET) : $(OBJFILES) $(COMPILER) -o $(TARGET) $(OBJFILES) $(CLFLAGS) $(MKLFLAGS) echo $(TARGET) BUILT AS A 64-BIT LINUX APPLICATION! # # Compile the source files with C and CPP MPI compilers # CPP class1.o : class1.cpp $(COMPILER) $(CCFLAGS) class1.cpp # C class2.o : class2.c $(CCOMPILER) $(CCFLAGS) class2.c # main myprogram.o : myprogram.c $(CCOMPILER) $(CCFLAGS) myprogram.c # to clean up .PHONY : clean clean: -rm -f $(OBJFILES) -rm -f $(TARGET) echo myprogram cleaned --------------------------------------------- On Tue, Oct 23, 2018 at 1:46 PM Matthew Knepley wrote: > On Tue, Oct 23, 2018 at 11:37 AM Yingjie Wu wrote: > >> Dear Petsc developer: >> Hi, >> Thank you very much for your continuous help, I recently encountered some >> difficulties in developing programs on Petsc. >> >> 1. I want to use my class definition (class1. h) and class functions >> (class1. cpp) files in my Petsc program (myprogram. c) and compile my >> program. I have written other program before: >> g++ -c class1.cpp myprogram.c >> g++ -o myprogram *.o >> I also have some knowledge of Makefile, but I don't know how to modify it >> to achieve compilation. I really want your help. >> > > With PETSc makefiles, we have automatic rules, so you can use > > myprogram: class1.o myprogram.o > ${CLINKER} -o myprogram class1.o myprogram.o ${PETSC_LIB} > > >> 2. In my class definition and function implementation program, I want to >> use Petsc data structures, such as PetscInt, PetscReal. In order to >> maintain consistency of the main program. What kind of header files should >> I add to my code, or do I need to add any code? >> > > The easiest thing to do is just > > #include > > Thanks, > > Matt > > >> Thanks, >> Yingjie >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From overholt at capesim.com Tue Oct 23 13:33:43 2018 From: overholt at capesim.com (Matthew Overholt) Date: Tue, 23 Oct 2018 14:33:43 -0400 Subject: [petsc-users] Problems about Compiling Multifile Program In-Reply-To: References: Message-ID: Correction: OBJFILES = \ class1.o \ class2.o \ myprogram.o Matt Overholt On Tue, Oct 23, 2018 at 2:29 PM Matthew Overholt wrote: > Here is a sample makefile, like what I use with the Intel MPI compilers > (used during PETSc configuration) and MKL library. > > Matt Overholt > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jed at jedbrown.org Tue Oct 23 17:12:13 2018 From: jed at jedbrown.org (Jed Brown) Date: Tue, 23 Oct 2018 16:12:13 -0600 Subject: [petsc-users] Assistant Professorship in Computational Earth-Surface Process Modeling at CU Boulder Message-ID: <871s8g71oi.fsf@jedbrown.org> The Institute of Arctic and Alpine Research (INSTAAR) and Community Surface Dynamics Modeling System (CSDMS) at the University of Colorado invite applications for a tenure-track assistant professor position in Computational Earth-Surface Process Modeling, with an August 2019 start. CSDMS is an NSF-sponsored facility that supports modeling and prediction of erosion, transport, and deposition of sediment in landscapes and sedimentary basins over a broad range of environments and time and space scales. The candidate will join a team at INSTAAR at the University of Colorado, Boulder, responsible for promoting the growth of CSDMS by developing multidisciplinary and international collaboration in support of earth surface processes modeling. We seek a scientist who takes advantage of new opportunities in computing and remote sensing to advance understanding of landscape, coastal, and/or seascape geomorphology and sediment dynamics. Disciplinary areas of particular interest include, but are not limited to: modeling of terrestrial, coastal, cryospheric, and/or marine processes; use of high-resolution topographic data to test process models; earth surface interactions with the climate system; modeling human impacts; high-performance computing; and community scientific software development. CSDMS is hosted at INSTAAR. The new assistant professor would be rostered in the Research & Innovation Office (RIO) and also become a tenure-track professor in one of INSTAAR?s affiliated academic departments and programs that best suits their training and interests (Geological Sciences; Civil, Environmental, and Architectural Engineering; Atmospheric and Ocean Sciences; Computer Science). A strong commitment to teaching, and mentorship at the undergraduate and graduate levels, and to outreach activities, is expected. The candidate is expected to engage in development of coursework in his or her area of research expertise, and to teach at the undergraduate and graduate level in the home department. Incorporation of computing skills in undergraduate and graduate curricula is desirable. Applicants should have a Ph.D. in geosciences, engineering, or related field at the time of appointment. We seek a strong team player with excellent communication and networking skills, who is focused on achieving multidisciplinary research goals. We welcome candidates who will bring diverse intellectual, geographical, gender, and ethnic perspectives to CSDMS and the University of Colorado campus community. For further information and to apply: https://jobs.colorado.edu/jobs/JobDetail/?jobId=13976 From abdullahasivas at gmail.com Tue Oct 23 18:16:01 2018 From: abdullahasivas at gmail.com (Abdullah Ali Sivas) Date: Tue, 23 Oct 2018 19:16:01 -0400 Subject: [petsc-users] Using BDDC preconditioner for assembled matrices Message-ID: Dear all, I have a series of linear systems coming from a PDE for which BDDC is an optimal preconditioner. These linear systems are assembled and I read them from a file, then convert into MATIS as required (as in https://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex72.c.html ). I expect each of the systems converge to the solution in almost same number of iterations but I don't observe it. I think it is because I do not provide enough information to the preconditioner. I can get a list of inner dofs and interface dofs. However, I do not know how to use them. Has anyone have any insights about it or done something similar? Best wishes, Abdullah Ali Sivas -------------- next part -------------- An HTML attachment was scrubbed... URL: From jed at jedbrown.org Tue Oct 23 22:16:22 2018 From: jed at jedbrown.org (Jed Brown) Date: Tue, 23 Oct 2018 21:16:22 -0600 Subject: [petsc-users] Using BDDC preconditioner for assembled matrices In-Reply-To: References: Message-ID: <87sh0w5915.fsf@jedbrown.org> Did you assemble "Neumann" problems that are compatible with your definition of interior/interface degrees of freedom? Abdullah Ali Sivas writes: > Dear all, > > I have a series of linear systems coming from a PDE for which BDDC is an > optimal preconditioner. These linear systems are assembled and I read them > from a file, then convert into MATIS as required (as in > https://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex72.c.html > ). I expect each of the systems converge to the solution in almost same > number of iterations but I don't observe it. I think it is because I do not > provide enough information to the preconditioner. I can get a list of inner > dofs and interface dofs. However, I do not know how to use them. Has anyone > have any insights about it or done something similar? > > Best wishes, > Abdullah Ali Sivas From abdullahasivas at gmail.com Wed Oct 24 00:12:35 2018 From: abdullahasivas at gmail.com (Abdullah Ali Sivas) Date: Wed, 24 Oct 2018 01:12:35 -0400 Subject: [petsc-users] Using BDDC preconditioner for assembled matrices In-Reply-To: <87sh0w5915.fsf@jedbrown.org> References: <87sh0w5915.fsf@jedbrown.org> Message-ID: Hi Jed, Thanks for your reply. The assembled matrix I have corresponds to the full problem on the full mesh. There are no "Neumann" problems (or any sort of domain decomposition) defined in the code generates the matrix. However, I think assembling the full problem is equivalent to implicitly assembling the "Neumann" problems, since the system can be partitioned as; [A_{LL} | A_{LI}] [u_L] [F] -----------|------------ -------- = ----- [A_{IL} |A_{II} ] [u_I] [G] and G should correspond to the Neumann problem. I might be thinking wrong (or maybe I completely misunderstood the idea), if so please correct me. But I think that the problem is that I am not explicitly telling PCBDDC which dofs are interface dofs. Regards, Abdullah Ali Sivas On Tue, 23 Oct 2018 at 23:16, Jed Brown wrote: > Did you assemble "Neumann" problems that are compatible with your > definition of interior/interface degrees of freedom? > > Abdullah Ali Sivas writes: > > > Dear all, > > > > I have a series of linear systems coming from a PDE for which BDDC is an > > optimal preconditioner. These linear systems are assembled and I read > them > > from a file, then convert into MATIS as required (as in > > > https://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex72.c.html > > ). I expect each of the systems converge to the solution in almost same > > number of iterations but I don't observe it. I think it is because I do > not > > provide enough information to the preconditioner. I can get a list of > inner > > dofs and interface dofs. However, I do not know how to use them. Has > anyone > > have any insights about it or done something similar? > > > > Best wishes, > > Abdullah Ali Sivas > -------------- next part -------------- An HTML attachment was scrubbed... URL: From amfoggia at gmail.com Wed Oct 24 02:09:40 2018 From: amfoggia at gmail.com (Ale Foggia) Date: Wed, 24 Oct 2018 09:09:40 +0200 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos In-Reply-To: <8785019B-C52B-4022-B7A8-83F8466F9B71@dsic.upv.es> References: <4EE63176-0CF1-47D7-83BD-A95162946BFD@dsic.upv.es> <8785019B-C52B-4022-B7A8-83F8466F9B71@dsic.upv.es> Message-ID: I've tried the option that you gave me but I still get different number of iterations when changing the number of MPI processes: I did 960 procs and 1024 procs and I got 435 and 176 iterations, respectively. El mar., 23 oct. 2018 a las 16:48, Jose E. Roman () escribi?: > > > > El 23 oct 2018, a las 15:46, Ale Foggia escribi?: > > > > > > > > El mar., 23 oct. 2018 a las 15:33, Jose E. Roman () > escribi?: > > > > > > > El 23 oct 2018, a las 15:17, Ale Foggia escribi?: > > > > > > Hello Jose, thanks for your answer. > > > > > > El mar., 23 oct. 2018 a las 12:59, Jose E. Roman () > escribi?: > > > There is an undocumented option: > > > > > > -bv_reproducible_random > > > > > > It will force the initial vector of the Krylov subspace to be the same > irrespective of the number of MPI processes. This should be used for > scaling analyses as the one you are trying to do. > > > > > > What about when I'm not doing the scaling? Now I would like to ask for > computing time for bigger size problems, should I also use this option in > that case? Because, what happens if I have a "bad" configuration? Meaning, > I ask for some time, enough if I take into account the "correct" scaling, > but when I run it takes double the time/iterations, like it happened before > when changing from 960 to 1024 processes? > > > > When you increase the matrix size the spectrum of the matrix changes and > probably also the convergence, so the computation time is not easy to > predict in advance. > > > > Okey, I'll keep that in mine. I thought that, even if the spectrum > changes, if I had a behaviour/tendency for 6 or 7 smaller cases I could > predict more or less the time. It was working this way until I found this > "iterations problem" which doubled the time of execution for the same size > problem. To be completely sure, do you suggest me or not to use this > run-time option when going in production? Can you elaborate a bit in the > effect this option? Is the (huge) difference I got in the number of > iterations something expected? > > Ideally if you have a rough approximation of the eigenvector, you set it > as the initial vector with EPSSetInitialSpace(). Otherwise, SLEPc generates > a random initial vector, that is start the search blindly. The difference > between using one random vector or another may be large, depending on the > problem. Krylov-Schur is usually less sensitive to the initial vector. > > Jose > > > > > > > > > > > An additional comment is that we strongly recommend to use the default > solver (Krylov-Schur), which will do Lanczos with implicit restart. It is > generally faster and more stable. > > > > > > I will be doing Dynamical Lanczos, that means that I'll need the > "matrix whose rows are the eigenvectors of the tridiagonal matrix" (so, > according to the Lanczos Technical Report notation, I need the "matrix > whose rows are the eigenvectors of T_m", which should be the same as the > vectors y_i). I checked the Technical Report for Krylov-Schur also and I > think I can get the same information also from that solver, but I'm not > sure. Can you confirm this please? > > > Also, as the vectors I want are given by V_m^(-1)*x_i=y_i (following > the notation on the Report), my idea to get them was to retrieve the > invariant subspace V_m (with EPSGetInvariantSubspace), invert it, and then > multiply it with the eigenvectors that I get with EPSGetEigenvector. Is > there another easier (or with less computations) way to get this? > > > > In Krylov-Schur the tridiagonal matrix T_m becomes > arrowhead-plus-tridiagonal. Apart from this, it should be equivalent. The > relevant information can be obtained with EPSGetBV() and EPSGetDS(). But > this is a "developer level" interface. We could help you get this running. > Send a small problem matrix to slepc-maint together with a more detailed > description of what you need to compute. > > > > Thanks! When I get to that part I'll write to slepc-maint for help. > > > > > > Jose > > > > > > > > > > > Jose > > > > > > > > > > > > > El 23 oct 2018, a las 12:13, Ale Foggia > escribi?: > > > > > > > > Hello, > > > > > > > > I'm currently using Lanczos solver (EPSLANCZOS) to get the smallest > real eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem (EPS_HEP). Those > are the only options I set for the solver. My aim is to be able to > predict/estimate the time-to-solution. To do so, I was doing a scaling of > the code for different sizes of matrices and for different number of MPI > processes. As I was not observing a good scaling I checked the number of > iterations of the solver (given by EPSGetIterationNumber). I've encounter > that for the **same size** of matrix (that meaning, the same problem), when > I change the number of MPI processes, the amount of iterations changes, and > the behaviour is not monotonic. This are the numbers I've got: > > > > > > > > # procs # iters > > > > 960 157 > > > > 992 189 > > > > 1024 338 > > > > 1056 190 > > > > 1120 174 > > > > 2048 136 > > > > > > > > I've checked the mailing list for a similar situation and I've found > another person with the same problem but in another solver ("[SLEPc] GD is > not deterministic when using different number of cores", Nov 19 2015), but > I think the solution this person finds does not apply to my problem > (removing "-eps_harmonic" option). > > > > > > > > Can you give me any hint on what is the reason for this behaviour? > Is there a way to prevent this? It's not possible to estimate/predict any > time consumption for bigger problems if the number of iterations varies > this much. > > > > > > > > Ale > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Wed Oct 24 03:52:20 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Wed, 24 Oct 2018 10:52:20 +0200 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos In-Reply-To: References: <4EE63176-0CF1-47D7-83BD-A95162946BFD@dsic.upv.es> <8785019B-C52B-4022-B7A8-83F8466F9B71@dsic.upv.es> Message-ID: <3F900479-3123-413E-B279-9DE624E825F4@dsic.upv.es> This is very strange. Make sure you call EPSSetFromOptions in the code. Do iteration counts change also for two different runs with the same number of processes? Maybe Lanczos with default options is too sensitive (by default it does not reorthogonalize). Suggest using Krylov-Schur or Lanczos with full reorthogonalization (EPSLanczosSetReorthog). Also, send the output of -eps_view to see if there is anything abnormal. Jose > El 24 oct 2018, a las 9:09, Ale Foggia escribi?: > > I've tried the option that you gave me but I still get different number of iterations when changing the number of MPI processes: I did 960 procs and 1024 procs and I got 435 and 176 iterations, respectively. > > El mar., 23 oct. 2018 a las 16:48, Jose E. Roman () escribi?: > > > > El 23 oct 2018, a las 15:46, Ale Foggia escribi?: > > > > > > > > El mar., 23 oct. 2018 a las 15:33, Jose E. Roman () escribi?: > > > > > > > El 23 oct 2018, a las 15:17, Ale Foggia escribi?: > > > > > > Hello Jose, thanks for your answer. > > > > > > El mar., 23 oct. 2018 a las 12:59, Jose E. Roman () escribi?: > > > There is an undocumented option: > > > > > > -bv_reproducible_random > > > > > > It will force the initial vector of the Krylov subspace to be the same irrespective of the number of MPI processes. This should be used for scaling analyses as the one you are trying to do. > > > > > > What about when I'm not doing the scaling? Now I would like to ask for computing time for bigger size problems, should I also use this option in that case? Because, what happens if I have a "bad" configuration? Meaning, I ask for some time, enough if I take into account the "correct" scaling, but when I run it takes double the time/iterations, like it happened before when changing from 960 to 1024 processes? > > > > When you increase the matrix size the spectrum of the matrix changes and probably also the convergence, so the computation time is not easy to predict in advance. > > > > Okey, I'll keep that in mine. I thought that, even if the spectrum changes, if I had a behaviour/tendency for 6 or 7 smaller cases I could predict more or less the time. It was working this way until I found this "iterations problem" which doubled the time of execution for the same size problem. To be completely sure, do you suggest me or not to use this run-time option when going in production? Can you elaborate a bit in the effect this option? Is the (huge) difference I got in the number of iterations something expected? > > Ideally if you have a rough approximation of the eigenvector, you set it as the initial vector with EPSSetInitialSpace(). Otherwise, SLEPc generates a random initial vector, that is start the search blindly. The difference between using one random vector or another may be large, depending on the problem. Krylov-Schur is usually less sensitive to the initial vector. > > Jose > > > > > > > > > > > An additional comment is that we strongly recommend to use the default solver (Krylov-Schur), which will do Lanczos with implicit restart. It is generally faster and more stable. > > > > > > I will be doing Dynamical Lanczos, that means that I'll need the "matrix whose rows are the eigenvectors of the tridiagonal matrix" (so, according to the Lanczos Technical Report notation, I need the "matrix whose rows are the eigenvectors of T_m", which should be the same as the vectors y_i). I checked the Technical Report for Krylov-Schur also and I think I can get the same information also from that solver, but I'm not sure. Can you confirm this please? > > > Also, as the vectors I want are given by V_m^(-1)*x_i=y_i (following the notation on the Report), my idea to get them was to retrieve the invariant subspace V_m (with EPSGetInvariantSubspace), invert it, and then multiply it with the eigenvectors that I get with EPSGetEigenvector. Is there another easier (or with less computations) way to get this? > > > > In Krylov-Schur the tridiagonal matrix T_m becomes arrowhead-plus-tridiagonal. Apart from this, it should be equivalent. The relevant information can be obtained with EPSGetBV() and EPSGetDS(). But this is a "developer level" interface. We could help you get this running. Send a small problem matrix to slepc-maint together with a more detailed description of what you need to compute. > > > > Thanks! When I get to that part I'll write to slepc-maint for help. > > > > > > Jose > > > > > > > > > > > Jose > > > > > > > > > > > > > El 23 oct 2018, a las 12:13, Ale Foggia escribi?: > > > > > > > > Hello, > > > > > > > > I'm currently using Lanczos solver (EPSLANCZOS) to get the smallest real eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem (EPS_HEP). Those are the only options I set for the solver. My aim is to be able to predict/estimate the time-to-solution. To do so, I was doing a scaling of the code for different sizes of matrices and for different number of MPI processes. As I was not observing a good scaling I checked the number of iterations of the solver (given by EPSGetIterationNumber). I've encounter that for the **same size** of matrix (that meaning, the same problem), when I change the number of MPI processes, the amount of iterations changes, and the behaviour is not monotonic. This are the numbers I've got: > > > > > > > > # procs # iters > > > > 960 157 > > > > 992 189 > > > > 1024 338 > > > > 1056 190 > > > > 1120 174 > > > > 2048 136 > > > > > > > > I've checked the mailing list for a similar situation and I've found another person with the same problem but in another solver ("[SLEPc] GD is not deterministic when using different number of cores", Nov 19 2015), but I think the solution this person finds does not apply to my problem (removing "-eps_harmonic" option). > > > > > > > > Can you give me any hint on what is the reason for this behaviour? Is there a way to prevent this? It's not possible to estimate/predict any time consumption for bigger problems if the number of iterations varies this much. > > > > > > > > Ale > > > > From stefano.zampini at gmail.com Wed Oct 24 04:28:04 2018 From: stefano.zampini at gmail.com (Stefano Zampini) Date: Wed, 24 Oct 2018 12:28:04 +0300 Subject: [petsc-users] Using BDDC preconditioner for assembled matrices In-Reply-To: References: <87sh0w5915.fsf@jedbrown.org> Message-ID: Abdullah, The "Neumann" problems Jed is referring to result from assembling your problem on each subdomain ( = MPI process) separately. Assuming you are using FEM, these problems have been historically named "Neumann" as they correspond to a problem with natural boundary conditions (Neumann bc for Poisson). Note that in PETSc the subdomain decomposition is associated with the mesh decomposition. When converting from an assembled AIJ matrix to a MATIS format, such "Neumann" information is lost. You can disassemble an AIJ matrix, in the sense that you can find local matrices A_j such that A = \sum_j R^T_j A_j R_j (as it is done in ex72.c), but you cannot guarantee (unless if you solve an optimization problem) that the disassembling will produce subdomain Neumann problems that are consistent with your FEM problem. I have added such disassembling code a few months ago, just to have another alternative for preconditioning AIJ matrices in PETSc; there are few tweaks one can do to improve the quality of the disassembling, but I discourage its usage unless you don't have access to the FEM assembly code. With that said, what problem are you trying to solve? Are you using DMDA or DMPlex? What are the results you obtained with using the automatic disassembling? Il giorno mer 24 ott 2018 alle ore 08:14 Abdullah Ali Sivas < abdullahasivas at gmail.com> ha scritto: > Hi Jed, > > Thanks for your reply. The assembled matrix I have corresponds to the full > problem on the full mesh. There are no "Neumann" problems (or any sort of > domain decomposition) defined in the code generates the matrix. However, I > think assembling the full problem is equivalent to implicitly assembling > the "Neumann" problems, since the system can be partitioned as; > > [A_{LL} | A_{LI}] [u_L] [F] > -----------|------------ -------- = ----- > [A_{IL} |A_{II} ] [u_I] [G] > > and G should correspond to the Neumann problem. I might be thinking wrong > (or maybe I completely misunderstood the idea), if so please correct me. > But I think that the problem is that I am not explicitly telling PCBDDC > which dofs are interface dofs. > > Regards, > Abdullah Ali Sivas > > On Tue, 23 Oct 2018 at 23:16, Jed Brown wrote: > >> Did you assemble "Neumann" problems that are compatible with your >> definition of interior/interface degrees of freedom? >> >> Abdullah Ali Sivas writes: >> >> > Dear all, >> > >> > I have a series of linear systems coming from a PDE for which BDDC is an >> > optimal preconditioner. These linear systems are assembled and I read >> them >> > from a file, then convert into MATIS as required (as in >> > >> https://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex72.c.html >> > ). I expect each of the systems converge to the solution in almost same >> > number of iterations but I don't observe it. I think it is because I do >> not >> > provide enough information to the preconditioner. I can get a list of >> inner >> > dofs and interface dofs. However, I do not know how to use them. Has >> anyone >> > have any insights about it or done something similar? >> > >> > Best wishes, >> > Abdullah Ali Sivas >> > -- Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: From wence at gmx.li Wed Oct 24 05:29:28 2018 From: wence at gmx.li (Lawrence Mitchell) Date: Wed, 24 Oct 2018 11:29:28 +0100 Subject: [petsc-users] Periodic BC in petsc DMPlex / firedrake In-Reply-To: <2D9A9125-F4A2-4A50-A5F9-4D7C9B86B540@gmail.com> References: <2D9A9125-F4A2-4A50-A5F9-4D7C9B86B540@gmail.com> Message-ID: <2852F36F-0CB0-4737-A489-38A476FDAEF2@gmx.li> Hi Max, (I'm cc'ing in the petsc-users mailing list which may have more advice, if you are using PETSc you should definitely subscribe! > On 24 Oct 2018, at 09:27, Maximilian Hartig wrote: > > Hello Lawrence, > > sorry to message you out of the blue. My name is Max and I found your post on GitHub (https://github.com/firedrakeproject/firedrake/issues/1246 ) on DMPlex being able to read periodic gmsh files. I am currently trying to do just that (creating a periodic DMPlex mesh with gmsh) in the context of my PhD work. So far I haven? t found any documentation on the periodic BC?s with DMPlex and gmsh in the official petsc documentation. > I was wondering whether you?d be so kind as to point me in a general direction concerning how to achieve this. You seem experienced in using petsc and I would greatly appreciate your help. I think the answer is "it depends". If you're just using DMPlex directly and all the of the functionality with PetscDS, then I /think/ that reading periodic meshes via gmsh (assuming you're using the appropriate gmsh mesh format [v2]) "just works". From my side, the issue is to do with mapping that coordinate field into one that I understand (within Firedrake). You may not have this problem. Thanks, Lawrence From knepley at gmail.com Wed Oct 24 05:49:50 2018 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 24 Oct 2018 06:49:50 -0400 Subject: [petsc-users] Periodic BC in petsc DMPlex / firedrake In-Reply-To: <2852F36F-0CB0-4737-A489-38A476FDAEF2@gmx.li> References: <2D9A9125-F4A2-4A50-A5F9-4D7C9B86B540@gmail.com> <2852F36F-0CB0-4737-A489-38A476FDAEF2@gmx.li> Message-ID: On Wed, Oct 24, 2018 at 6:29 AM Lawrence Mitchell wrote: > Hi Max, > > (I'm cc'ing in the petsc-users mailing list which may have more advice, if > you are using PETSc you should definitely subscribe! > > > On 24 Oct 2018, at 09:27, Maximilian Hartig > wrote: > > > > Hello Lawrence, > > > > sorry to message you out of the blue. My name is Max and I found your > post on GitHub (https://github.com/firedrakeproject/firedrake/issues/1246 > ) on DMPlex being able to read periodic gmsh files. I am currently trying > to do just that (creating a periodic DMPlex mesh with gmsh) in the context > of my PhD work. So far I haven? t found any documentation on the periodic > BC?s with DMPlex and gmsh in the official petsc documentation. > > I was wondering whether you?d be so kind as to point me in a general > direction concerning how to achieve this. You seem experienced in using > petsc and I would greatly appreciate your help. > > > I think the answer is "it depends". If you're just using DMPlex directly > and all the of the functionality with PetscDS, then I /think/ that reading > periodic meshes via gmsh (assuming you're using the appropriate gmsh mesh > format [v2]) "just works". > There are two phases here: topological and geometric. DMPlex represents the periodic topological entity directly. For example, a circle is just a segment with one end hooked to the other. Vertices are not duplicated, or mapped to each other. This makes topology simple and easy to implement. However, then geometry is more complicated. What Plex does is allow coordinates to be represented by a discontinuous field taking values on cells, in addition to vertices. In our circle example, each cells near the cut will have 2 coordinates, one for each vertex, but they will not agree across the cut. If you define a periodic domain, then Plex can construct this coordinate field automatically using DMPlexLocalize(). These DG coordinates are then used by the integration routines. > From my side, the issue is to do with mapping that coordinate field into > one that I understand (within Firedrake). You may not have this problem. > Firedrake uses its own coordinate mapping and integration routines, so they must manage the second part independently. I hope to get change this slightly soon by making the Firedrake representation a DMField, so that it looks the same to Plex. Thanks, Matt > Thanks, > > Lawrence -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From amfoggia at gmail.com Wed Oct 24 07:59:02 2018 From: amfoggia at gmail.com (Ale Foggia) Date: Wed, 24 Oct 2018 14:59:02 +0200 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos In-Reply-To: <3F900479-3123-413E-B279-9DE624E825F4@dsic.upv.es> References: <4EE63176-0CF1-47D7-83BD-A95162946BFD@dsic.upv.es> <8785019B-C52B-4022-B7A8-83F8466F9B71@dsic.upv.es> <3F900479-3123-413E-B279-9DE624E825F4@dsic.upv.es> Message-ID: The functions called to set the solver are (in this order): EPSCreate(); EPSSetOperators(); EPSSetProblemType(EPS_HEP); EPSSetType(EPSLANCZOS); EPSSetWhichEigenpairs(EPS_SMALLEST_REAL); EPSSetFromOptions(); The output of -eps_view for each run is: ================================================================= EPS Object: 960 MPI processes type: lanczos LOCAL reorthogonalization problem type: symmetric eigenvalue problem selected portion of the spectrum: smallest real parts number of eigenvalues (nev): 1 number of column vectors (ncv): 16 maximum dimension of projected problem (mpd): 16 maximum number of iterations: 291700777 tolerance: 1e-08 convergence test: relative to the eigenvalue BV Object: 960 MPI processes type: svec 17 columns of global length 2333606220 vector orthogonalization method: modified Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) block orthogonalization method: GS doing matmult as a single matrix-matrix product generating random vectors independent of the number of processes DS Object: 960 MPI processes type: hep parallel operation mode: REDUNDANT solving the problem with: Implicit QR method (_steqr) ST Object: 960 MPI processes type: shift shift: 0. number of matrices: 1 ================================================================= EPS Object: 1024 MPI processes type: lanczos LOCAL reorthogonalization problem type: symmetric eigenvalue problem selected portion of the spectrum: smallest real parts number of eigenvalues (nev): 1 number of column vectors (ncv): 16 maximum dimension of projected problem (mpd): 16 maximum number of iterations: 291700777 tolerance: 1e-08 convergence test: relative to the eigenvalue BV Object: 1024 MPI processes type: svec 17 columns of global length 2333606220 vector orthogonalization method: modified Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) block orthogonalization method: GS doing matmult as a single matrix-matrix product generating random vectors independent of the number of processes DS Object: 1024 MPI processes type: hep parallel operation mode: REDUNDANT solving the problem with: Implicit QR method (_steqr) ST Object: 1024 MPI processes type: shift shift: 0. number of matrices: 1 ================================================================= I run again the same configurations and I got the same result in term of the number of iterations. I also tried the full reorthogonalization (always with the -bv_reproducible_random option) but I still get different number of iterations: for 960 procs I get 172 iters, and for 1024 I get 362 iters. The -esp_view output for this case (only for 960 procs, the other one has the same information -except the number of processes-) is: ================================================================= EPS Object: 960 MPI processes type: lanczos FULL reorthogonalization problem type: symmetric eigenvalue problem selected portion of the spectrum: smallest real parts number of eigenvalues (nev): 1 number of column vectors (ncv): 16 maximum dimension of projected problem (mpd): 16 maximum number of iterations: 291700777 tolerance: 1e-08 convergence test: relative to the eigenvalue BV Object: 960 MPI processes type: svec 17 columns of global length 2333606220 vector orthogonalization method: classical Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) block orthogonalization method: GS doing matmult as a single matrix-matrix product generating random vectors independent of the number of processes DS Object: 960 MPI processes type: hep parallel operation mode: REDUNDANT solving the problem with: Implicit QR method (_steqr) ST Object: 960 MPI processes type: shift shift: 0. number of matrices: 1 ================================================================= El mi?., 24 oct. 2018 a las 10:52, Jose E. Roman () escribi?: > This is very strange. Make sure you call EPSSetFromOptions in the code. Do > iteration counts change also for two different runs with the same number of > processes? > Maybe Lanczos with default options is too sensitive (by default it does > not reorthogonalize). Suggest using Krylov-Schur or Lanczos with full > reorthogonalization (EPSLanczosSetReorthog). > Also, send the output of -eps_view to see if there is anything abnormal. > > Jose > > > > El 24 oct 2018, a las 9:09, Ale Foggia escribi?: > > > > I've tried the option that you gave me but I still get different number > of iterations when changing the number of MPI processes: I did 960 procs > and 1024 procs and I got 435 and 176 iterations, respectively. > > > > El mar., 23 oct. 2018 a las 16:48, Jose E. Roman () > escribi?: > > > > > > > El 23 oct 2018, a las 15:46, Ale Foggia escribi?: > > > > > > > > > > > > El mar., 23 oct. 2018 a las 15:33, Jose E. Roman () > escribi?: > > > > > > > > > > El 23 oct 2018, a las 15:17, Ale Foggia > escribi?: > > > > > > > > Hello Jose, thanks for your answer. > > > > > > > > El mar., 23 oct. 2018 a las 12:59, Jose E. Roman (< > jroman at dsic.upv.es>) escribi?: > > > > There is an undocumented option: > > > > > > > > -bv_reproducible_random > > > > > > > > It will force the initial vector of the Krylov subspace to be the > same irrespective of the number of MPI processes. This should be used for > scaling analyses as the one you are trying to do. > > > > > > > > What about when I'm not doing the scaling? Now I would like to ask > for computing time for bigger size problems, should I also use this option > in that case? Because, what happens if I have a "bad" configuration? > Meaning, I ask for some time, enough if I take into account the "correct" > scaling, but when I run it takes double the time/iterations, like it > happened before when changing from 960 to 1024 processes? > > > > > > When you increase the matrix size the spectrum of the matrix changes > and probably also the convergence, so the computation time is not easy to > predict in advance. > > > > > > Okey, I'll keep that in mine. I thought that, even if the spectrum > changes, if I had a behaviour/tendency for 6 or 7 smaller cases I could > predict more or less the time. It was working this way until I found this > "iterations problem" which doubled the time of execution for the same size > problem. To be completely sure, do you suggest me or not to use this > run-time option when going in production? Can you elaborate a bit in the > effect this option? Is the (huge) difference I got in the number of > iterations something expected? > > > > Ideally if you have a rough approximation of the eigenvector, you set it > as the initial vector with EPSSetInitialSpace(). Otherwise, SLEPc generates > a random initial vector, that is start the search blindly. The difference > between using one random vector or another may be large, depending on the > problem. Krylov-Schur is usually less sensitive to the initial vector. > > > > Jose > > > > > > > > > > > > > > > > An additional comment is that we strongly recommend to use the > default solver (Krylov-Schur), which will do Lanczos with implicit restart. > It is generally faster and more stable. > > > > > > > > I will be doing Dynamical Lanczos, that means that I'll need the > "matrix whose rows are the eigenvectors of the tridiagonal matrix" (so, > according to the Lanczos Technical Report notation, I need the "matrix > whose rows are the eigenvectors of T_m", which should be the same as the > vectors y_i). I checked the Technical Report for Krylov-Schur also and I > think I can get the same information also from that solver, but I'm not > sure. Can you confirm this please? > > > > Also, as the vectors I want are given by V_m^(-1)*x_i=y_i (following > the notation on the Report), my idea to get them was to retrieve the > invariant subspace V_m (with EPSGetInvariantSubspace), invert it, and then > multiply it with the eigenvectors that I get with EPSGetEigenvector. Is > there another easier (or with less computations) way to get this? > > > > > > In Krylov-Schur the tridiagonal matrix T_m becomes > arrowhead-plus-tridiagonal. Apart from this, it should be equivalent. The > relevant information can be obtained with EPSGetBV() and EPSGetDS(). But > this is a "developer level" interface. We could help you get this running. > Send a small problem matrix to slepc-maint together with a more detailed > description of what you need to compute. > > > > > > Thanks! When I get to that part I'll write to slepc-maint for help. > > > > > > > > > Jose > > > > > > > > > > > > > > > Jose > > > > > > > > > > > > > > > > > El 23 oct 2018, a las 12:13, Ale Foggia > escribi?: > > > > > > > > > > Hello, > > > > > > > > > > I'm currently using Lanczos solver (EPSLANCZOS) to get the > smallest real eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem > (EPS_HEP). Those are the only options I set for the solver. My aim is to be > able to predict/estimate the time-to-solution. To do so, I was doing a > scaling of the code for different sizes of matrices and for different > number of MPI processes. As I was not observing a good scaling I checked > the number of iterations of the solver (given by EPSGetIterationNumber). > I've encounter that for the **same size** of matrix (that meaning, the same > problem), when I change the number of MPI processes, the amount of > iterations changes, and the behaviour is not monotonic. This are the > numbers I've got: > > > > > > > > > > # procs # iters > > > > > 960 157 > > > > > 992 189 > > > > > 1024 338 > > > > > 1056 190 > > > > > 1120 174 > > > > > 2048 136 > > > > > > > > > > I've checked the mailing list for a similar situation and I've > found another person with the same problem but in another solver ("[SLEPc] > GD is not deterministic when using different number of cores", Nov 19 > 2015), but I think the solution this person finds does not apply to my > problem (removing "-eps_harmonic" option). > > > > > > > > > > Can you give me any hint on what is the reason for this behaviour? > Is there a way to prevent this? It's not possible to estimate/predict any > time consumption for bigger problems if the number of iterations varies > this much. > > > > > > > > > > Ale > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefano.zampini at gmail.com Wed Oct 24 08:11:53 2018 From: stefano.zampini at gmail.com (Stefano Zampini) Date: Wed, 24 Oct 2018 16:11:53 +0300 Subject: [petsc-users] Periodic BC in petsc DMPlex / firedrake In-Reply-To: References: <2D9A9125-F4A2-4A50-A5F9-4D7C9B86B540@gmail.com> <2852F36F-0CB0-4737-A489-38A476FDAEF2@gmx.li> Message-ID: To read periodic meshes from GMSH, you need to use the option -dm_plex_gmsh_periodic and DMPlexCreateFromFile See src/dm/impls/plex/examples/tests/ex1.c. An example runs $ ./ex1 -filename ${PETSC_DIR}/share/petsc/datafiles/meshes/cube_periodic_bin.msh -dm_plex_gmsh_periodic -dm_view ::ascii_info_detail -interpolate -test_shape generating periodic meshes in gmsh may be tricky, Lisandro for sure may advice. Il giorno mer 24 ott 2018 alle ore 13:51 Matthew Knepley ha scritto: > On Wed, Oct 24, 2018 at 6:29 AM Lawrence Mitchell wrote: > >> Hi Max, >> >> (I'm cc'ing in the petsc-users mailing list which may have more advice, >> if you are using PETSc you should definitely subscribe! >> >> > On 24 Oct 2018, at 09:27, Maximilian Hartig >> wrote: >> > >> > Hello Lawrence, >> > >> > sorry to message you out of the blue. My name is Max and I found your >> post on GitHub (https://github.com/firedrakeproject/firedrake/issues/1246 >> ) on DMPlex being able to read periodic gmsh files. I am currently trying >> to do just that (creating a periodic DMPlex mesh with gmsh) in the context >> of my PhD work. So far I haven? t found any documentation on the periodic >> BC?s with DMPlex and gmsh in the official petsc documentation. >> > I was wondering whether you?d be so kind as to point me in a general >> direction concerning how to achieve this. You seem experienced in using >> petsc and I would greatly appreciate your help. >> >> >> I think the answer is "it depends". If you're just using DMPlex directly >> and all the of the functionality with PetscDS, then I /think/ that reading >> periodic meshes via gmsh (assuming you're using the appropriate gmsh mesh >> format [v2]) "just works". >> > > There are two phases here: topological and geometric. DMPlex represents > the periodic topological entity directly. For example, a circle is just a > segment with one end hooked to the other. Vertices are not duplicated, or > mapped to each other. This makes topology simple and easy to implement. > However, then geometry is more complicated. What Plex does is allow > coordinates to be represented by a discontinuous field taking values on > cells, in addition to vertices. In our circle example, each cells near the > cut will have 2 coordinates, one for each vertex, but they will not agree > across the cut. If you define a periodic domain, then Plex can construct > this coordinate field automatically using DMPlexLocalize(). These DG > coordinates are then used by the integration routines. > > >> From my side, the issue is to do with mapping that coordinate field into >> one that I understand (within Firedrake). You may not have this problem. >> > > Firedrake uses its own coordinate mapping and integration routines, so > they must manage the second part independently. I hope to get change this > slightly soon by making the Firedrake representation a DMField, so that it > looks the same to Plex. > > Thanks, > > Matt > > >> Thanks, >> >> Lawrence > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -- Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: From griesser.jan at googlemail.com Wed Oct 24 08:36:40 2018 From: griesser.jan at googlemail.com (=?UTF-8?B?SmFuIEdyaWXDn2Vy?=) Date: Wed, 24 Oct 2018 15:36:40 +0200 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: Hey, i tried to run my program as you said with -bv_type vecs and/or -bv_type mat, but instead of the PETScInt overflow i now get an MPI Error 9 message, which i assume (after googling a little bit around) should be a memory problem. I tried to run it also on slightly bigger compute nodes on our cluster with 20 cores with each 12 GB and 24 GB but the problem still remains. The actual limit appears to be a 1.5 Million x 1.5 Million where i searched for NEV = 1500 and MPD = 500/ 200 eigenvalues. Do you have maybe an idea what the error could be? I appended also the python method i used to solve the problem. I also tried to solve the problem with spectrum solving but the error message remains the same. def solve_eigensystem(DynMatrix_nn, NEV, MPD, Dimension): # Create the solver # E is used as an acronym for the EPS solver (EPS = Eigenvalue problem solver) E = SLEPc.EPS().create() # Set the preconditioner pc = PETSc.PC().create() pc.setType(pc.Type.BJACOBI) # Set the linear solver # Create the KSP object ksp = PETSc.KSP().create() # Create the solver, in this case GMRES ksp.setType(ksp.Type.GMRES) # Set the tolerances of the GMRES solver # Link it to the PC ksp.setPC(pc) # Set up the spectral transformations st = SLEPc.ST().create() st.setType("shift") st.setKSP(ksp) # MPD stands for "maximum projected dimension". It has to due with computational cost, please read Chap. 2.6.5 of SLEPc docu for # an explanation. At the moment mpd is only a guess E.setDimensions(nev=NEV, mpd = MPD) # Eigenvalues should be real, therefore we start to order them from the smallest real value |l.real| E.setWhichEigenpairs(E.Which.SMALLEST_REAL) # Since the dynamical matrix is symmetric and real it is hermitian E.setProblemType(SLEPc.EPS.ProblemType.HEP) # Use the Krylov Schur method to solve the eigenvalue problem E.setType(E.Type.KRYLOVSCHUR) # Set the convergence criterion to relative to the eigenvalue and the maximal number of iterations E.setConvergenceTest(E.Conv.REL) E.setTolerances(tol = 1e-8, max_it = 5000) # Set the matrix in order to solve E.setOperators(DynMatrix_nn, None) # Sets EPS options from the options database. This routine must be called before `setUp()` if the user is to be allowed to set dthe solver type. E.setFromOptions() # Sets up all the internal data structures necessary for the execution of the eigensolver. E.setUp() # Solve eigenvalue problem E.solve() Print = PETSc.Sys.Print Print() Print("****************************") Print("***SLEPc Solution Results***") Print("****************************") its = E.getIterationNumber() Print("Number of iterations of the method: ", its) eps_type = E.getType() Print("Solution method: ", eps_type) nev, ncv, mpd = E.getDimensions() Print("Number of requested eigenvalues: ", nev) Print("Number of computeded eigenvectors: ", ncv) tol, maxit = E.getTolerances() Print("Stopping condition: (tol, maxit)", (tol, maxit)) # Get the type of convergence conv_test = E.getConvergenceTest() Print("Selected convergence test: ", conv_test) # Get the used spectral transformation get_st = E.getST() Print("Selected spectral transformation: ", get_st) # Get the applied direct solver get_ksp = E.getDS() Print("Selected direct solver: ", get_ksp) nconv = E.getConverged() Print("Number of converged eigenpairs: ", nconv) ..... Am Fr., 19. Okt. 2018 um 21:00 Uhr schrieb Smith, Barry F. < bsmith at mcs.anl.gov>: > > > > On Oct 19, 2018, at 7:56 AM, Zhang, Junchao wrote: > > > > > > On Fri, Oct 19, 2018 at 4:02 AM Jan Grie?er > wrote: > > With more than 1 MPI process you mean i should use spectrum slicing in > divide the full problem in smaller subproblems? > > The --with-64-bit-indices is not a possibility for me since i configured > petsc with mumps, which does not allow to use the 64-bit version (At least > this was the error message when i tried to configure PETSc ) > > > > MUMPS 5.1.2 manual chapter 2.4.2 says it supports "Selective 64-bit > integer feature" and "full 64-bit integer version" as well. > > They use to achieve this by compiling with special Fortran flags to > promote integers to 64 bit; this is too fragile for our taste so we never > hooked PETSc up wit it. If they have a dependable way of using 64 bit > integers we should add that to our mumps.py and test it. > > Barry > > > > > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman < > jroman at dsic.upv.es>: > > To use BVVECS just add the command-line option -bv_type vecs > > This causes to use a separate Vec for each column, instead of a single > long Vec of size n*m. But it is considerably slower than the default. > > > > Anyway, for such large problems you should consider using more than 1 > MPI process. In that case the error may disappear because the local size is > smaller than 768000. > > > > Jose > > > > > > > El 17 oct 2018, a las 17:58, Matthew Knepley > escribi?: > > > > > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er < > griesser.jan at googlemail.com> wrote: > > > Hi all, > > > i am using slepc4py and petsc4py to solve for the smallest real > eigenvalues and eigenvectors. For my test cases with a matrix A of the size > 30k x 30k solving for the smallest soutions works quite well, but when i > increase the dimension of my system to around A = 768000 x 768000 or 3 > million x 3 million and ask for the smallest real 3000 (the number is > increasing with increasing system size) eigenvalues and eigenvectors i get > the output (for the 768000): > > > The product 4001 times 768000 overflows the size of PetscInt; > consider reducing the number of columns, or use BVVECS instead > > > i understand that the requested number of eigenvectors and eigenvalues > is causing an overflow but i do not understand the solution of the problem > which is stated in the error message. Can someone tell me what exactly > BVVECS is and how i can use it? Or is there any other solution to my > problem ? > > > > > > You can also reconfigure with 64-bit integers: --with-64-bit-indices > > > > > > Thanks, > > > > > > Matt > > > > > > Thank you very much in advance, > > > Jan > > > > > > > > > > > > -- > > > 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 > > > > > > https://www.cse.buffalo.edu/~knepley/ > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Wed Oct 24 08:48:15 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Wed, 24 Oct 2018 15:48:15 +0200 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos In-Reply-To: References: <4EE63176-0CF1-47D7-83BD-A95162946BFD@dsic.upv.es> <8785019B-C52B-4022-B7A8-83F8466F9B71@dsic.upv.es> <3F900479-3123-413E-B279-9DE624E825F4@dsic.upv.es> Message-ID: Everything seems correct. I don't know, maybe your problem is very sensitive? Is the eigenvalue tiny? I would still try with Krylov-Schur. Jose > El 24 oct 2018, a las 14:59, Ale Foggia escribi?: > > The functions called to set the solver are (in this order): EPSCreate(); EPSSetOperators(); EPSSetProblemType(EPS_HEP); EPSSetType(EPSLANCZOS); EPSSetWhichEigenpairs(EPS_SMALLEST_REAL); EPSSetFromOptions(); > > The output of -eps_view for each run is: > ================================================================= > EPS Object: 960 MPI processes > type: lanczos > LOCAL reorthogonalization > problem type: symmetric eigenvalue problem > selected portion of the spectrum: smallest real parts > number of eigenvalues (nev): 1 > number of column vectors (ncv): 16 > maximum dimension of projected problem (mpd): 16 > maximum number of iterations: 291700777 > tolerance: 1e-08 > convergence test: relative to the eigenvalue > BV Object: 960 MPI processes > type: svec > 17 columns of global length 2333606220 > vector orthogonalization method: modified Gram-Schmidt > orthogonalization refinement: if needed (eta: 0.7071) > block orthogonalization method: GS > doing matmult as a single matrix-matrix product > generating random vectors independent of the number of processes > DS Object: 960 MPI processes > type: hep > parallel operation mode: REDUNDANT > solving the problem with: Implicit QR method (_steqr) > ST Object: 960 MPI processes > type: shift > shift: 0. > number of matrices: 1 > ================================================================= > EPS Object: 1024 MPI processes > type: lanczos > LOCAL reorthogonalization > problem type: symmetric eigenvalue problem > selected portion of the spectrum: smallest real parts > number of eigenvalues (nev): 1 > number of column vectors (ncv): 16 > maximum dimension of projected problem (mpd): 16 > maximum number of iterations: 291700777 > tolerance: 1e-08 > convergence test: relative to the eigenvalue > BV Object: 1024 MPI processes > type: svec > 17 columns of global length 2333606220 > vector orthogonalization method: modified Gram-Schmidt > orthogonalization refinement: if needed (eta: 0.7071) > block orthogonalization method: GS > doing matmult as a single matrix-matrix product > generating random vectors independent of the number of processes > DS Object: 1024 MPI processes > type: hep > parallel operation mode: REDUNDANT > solving the problem with: Implicit QR method (_steqr) > ST Object: 1024 MPI processes > type: shift > shift: 0. > number of matrices: 1 > ================================================================= > > I run again the same configurations and I got the same result in term of the number of iterations. > > I also tried the full reorthogonalization (always with the -bv_reproducible_random option) but I still get different number of iterations: for 960 procs I get 172 iters, and for 1024 I get 362 iters. The -esp_view output for this case (only for 960 procs, the other one has the same information -except the number of processes-) is: > ================================================================= > EPS Object: 960 MPI processes > type: lanczos > FULL reorthogonalization > problem type: symmetric eigenvalue problem > selected portion of the spectrum: smallest real parts > number of eigenvalues (nev): 1 > number of column vectors (ncv): 16 > maximum dimension of projected problem (mpd): 16 > maximum number of iterations: 291700777 > tolerance: 1e-08 > convergence test: relative to the eigenvalue > BV Object: 960 MPI processes > type: svec > 17 columns of global length 2333606220 > vector orthogonalization method: classical Gram-Schmidt > orthogonalization refinement: if needed (eta: 0.7071) > block orthogonalization method: GS > doing matmult as a single matrix-matrix product > generating random vectors independent of the number of processes > DS Object: 960 MPI processes > type: hep > parallel operation mode: REDUNDANT > solving the problem with: Implicit QR method (_steqr) > ST Object: 960 MPI processes > type: shift > shift: 0. > number of matrices: 1 > ================================================================= > > El mi?., 24 oct. 2018 a las 10:52, Jose E. Roman () escribi?: > This is very strange. Make sure you call EPSSetFromOptions in the code. Do iteration counts change also for two different runs with the same number of processes? > Maybe Lanczos with default options is too sensitive (by default it does not reorthogonalize). Suggest using Krylov-Schur or Lanczos with full reorthogonalization (EPSLanczosSetReorthog). > Also, send the output of -eps_view to see if there is anything abnormal. > > Jose > > > > El 24 oct 2018, a las 9:09, Ale Foggia escribi?: > > > > I've tried the option that you gave me but I still get different number of iterations when changing the number of MPI processes: I did 960 procs and 1024 procs and I got 435 and 176 iterations, respectively. > > > > El mar., 23 oct. 2018 a las 16:48, Jose E. Roman () escribi?: > > > > > > > El 23 oct 2018, a las 15:46, Ale Foggia escribi?: > > > > > > > > > > > > El mar., 23 oct. 2018 a las 15:33, Jose E. Roman () escribi?: > > > > > > > > > > El 23 oct 2018, a las 15:17, Ale Foggia escribi?: > > > > > > > > Hello Jose, thanks for your answer. > > > > > > > > El mar., 23 oct. 2018 a las 12:59, Jose E. Roman () escribi?: > > > > There is an undocumented option: > > > > > > > > -bv_reproducible_random > > > > > > > > It will force the initial vector of the Krylov subspace to be the same irrespective of the number of MPI processes. This should be used for scaling analyses as the one you are trying to do. > > > > > > > > What about when I'm not doing the scaling? Now I would like to ask for computing time for bigger size problems, should I also use this option in that case? Because, what happens if I have a "bad" configuration? Meaning, I ask for some time, enough if I take into account the "correct" scaling, but when I run it takes double the time/iterations, like it happened before when changing from 960 to 1024 processes? > > > > > > When you increase the matrix size the spectrum of the matrix changes and probably also the convergence, so the computation time is not easy to predict in advance. > > > > > > Okey, I'll keep that in mine. I thought that, even if the spectrum changes, if I had a behaviour/tendency for 6 or 7 smaller cases I could predict more or less the time. It was working this way until I found this "iterations problem" which doubled the time of execution for the same size problem. To be completely sure, do you suggest me or not to use this run-time option when going in production? Can you elaborate a bit in the effect this option? Is the (huge) difference I got in the number of iterations something expected? > > > > Ideally if you have a rough approximation of the eigenvector, you set it as the initial vector with EPSSetInitialSpace(). Otherwise, SLEPc generates a random initial vector, that is start the search blindly. The difference between using one random vector or another may be large, depending on the problem. Krylov-Schur is usually less sensitive to the initial vector. > > > > Jose > > > > > > > > > > > > > > > > An additional comment is that we strongly recommend to use the default solver (Krylov-Schur), which will do Lanczos with implicit restart. It is generally faster and more stable. > > > > > > > > I will be doing Dynamical Lanczos, that means that I'll need the "matrix whose rows are the eigenvectors of the tridiagonal matrix" (so, according to the Lanczos Technical Report notation, I need the "matrix whose rows are the eigenvectors of T_m", which should be the same as the vectors y_i). I checked the Technical Report for Krylov-Schur also and I think I can get the same information also from that solver, but I'm not sure. Can you confirm this please? > > > > Also, as the vectors I want are given by V_m^(-1)*x_i=y_i (following the notation on the Report), my idea to get them was to retrieve the invariant subspace V_m (with EPSGetInvariantSubspace), invert it, and then multiply it with the eigenvectors that I get with EPSGetEigenvector. Is there another easier (or with less computations) way to get this? > > > > > > In Krylov-Schur the tridiagonal matrix T_m becomes arrowhead-plus-tridiagonal. Apart from this, it should be equivalent. The relevant information can be obtained with EPSGetBV() and EPSGetDS(). But this is a "developer level" interface. We could help you get this running. Send a small problem matrix to slepc-maint together with a more detailed description of what you need to compute. > > > > > > Thanks! When I get to that part I'll write to slepc-maint for help. > > > > > > > > > Jose > > > > > > > > > > > > > > > Jose > > > > > > > > > > > > > > > > > El 23 oct 2018, a las 12:13, Ale Foggia escribi?: > > > > > > > > > > Hello, > > > > > > > > > > I'm currently using Lanczos solver (EPSLANCZOS) to get the smallest real eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem (EPS_HEP). Those are the only options I set for the solver. My aim is to be able to predict/estimate the time-to-solution. To do so, I was doing a scaling of the code for different sizes of matrices and for different number of MPI processes. As I was not observing a good scaling I checked the number of iterations of the solver (given by EPSGetIterationNumber). I've encounter that for the **same size** of matrix (that meaning, the same problem), when I change the number of MPI processes, the amount of iterations changes, and the behaviour is not monotonic. This are the numbers I've got: > > > > > > > > > > # procs # iters > > > > > 960 157 > > > > > 992 189 > > > > > 1024 338 > > > > > 1056 190 > > > > > 1120 174 > > > > > 2048 136 > > > > > > > > > > I've checked the mailing list for a similar situation and I've found another person with the same problem but in another solver ("[SLEPc] GD is not deterministic when using different number of cores", Nov 19 2015), but I think the solution this person finds does not apply to my problem (removing "-eps_harmonic" option). > > > > > > > > > > Can you give me any hint on what is the reason for this behaviour? Is there a way to prevent this? It's not possible to estimate/predict any time consumption for bigger problems if the number of iterations varies this much. > > > > > > > > > > Ale > > > > > > > From knepley at gmail.com Wed Oct 24 09:01:37 2018 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 24 Oct 2018 10:01:37 -0400 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: On Wed, Oct 24, 2018 at 9:38 AM Jan Grie?er wrote: > Hey, > i tried to run my program as you said with -bv_type vecs and/or -bv_type > mat, but instead of the PETScInt overflow i now get an MPI Error 9 > Send the actual error. Thanks, Matt > message, which i assume (after googling a little bit around) should be a > memory problem. I tried to run it also on slightly bigger compute nodes on > our cluster with 20 cores with each 12 GB and 24 GB but the problem still > remains. The actual limit appears to be a 1.5 Million x 1.5 Million where > i searched for NEV = 1500 and MPD = 500/ 200 eigenvalues. > Do you have maybe an idea what the error could be? I appended also the > python method i used to solve the problem. I also tried to solve the > problem with spectrum solving but the error message remains the same. > > def solve_eigensystem(DynMatrix_nn, NEV, MPD, Dimension): > # Create the solver > # E is used as an acronym for the EPS solver (EPS = Eigenvalue problem > solver) > E = SLEPc.EPS().create() > > # Set the preconditioner > pc = PETSc.PC().create() > pc.setType(pc.Type.BJACOBI) > > # Set the linear solver > # Create the KSP object > ksp = PETSc.KSP().create() > # Create the solver, in this case GMRES > ksp.setType(ksp.Type.GMRES) > # Set the tolerances of the GMRES solver > # Link it to the PC > ksp.setPC(pc) > > # Set up the spectral transformations > st = SLEPc.ST().create() > st.setType("shift") > st.setKSP(ksp) > # MPD stands for "maximum projected dimension". It has to due with > computational cost, please read Chap. 2.6.5 of SLEPc docu for > # an explanation. At the moment mpd is only a guess > E.setDimensions(nev=NEV, mpd = MPD) > # Eigenvalues should be real, therefore we start to order them from the > smallest real value |l.real| > E.setWhichEigenpairs(E.Which.SMALLEST_REAL) > # Since the dynamical matrix is symmetric and real it is hermitian > E.setProblemType(SLEPc.EPS.ProblemType.HEP) > # Use the Krylov Schur method to solve the eigenvalue problem > E.setType(E.Type.KRYLOVSCHUR) > # Set the convergence criterion to relative to the eigenvalue and the > maximal number of iterations > E.setConvergenceTest(E.Conv.REL) > E.setTolerances(tol = 1e-8, max_it = 5000) > # Set the matrix in order to solve > E.setOperators(DynMatrix_nn, None) > # Sets EPS options from the options database. This routine must be called > before `setUp()` if the user is to be allowed to set dthe solver type. > E.setFromOptions() > # Sets up all the internal data structures necessary for the execution of > the eigensolver. > E.setUp() > > # Solve eigenvalue problem > E.solve() > > Print = PETSc.Sys.Print > > Print() > Print("****************************") > Print("***SLEPc Solution Results***") > Print("****************************") > > its = E.getIterationNumber() > Print("Number of iterations of the method: ", its) > eps_type = E.getType() > Print("Solution method: ", eps_type) > nev, ncv, mpd = E.getDimensions() > Print("Number of requested eigenvalues: ", nev) > Print("Number of computeded eigenvectors: ", ncv) > tol, maxit = E.getTolerances() > Print("Stopping condition: (tol, maxit)", (tol, maxit)) > # Get the type of convergence > conv_test = E.getConvergenceTest() > Print("Selected convergence test: ", conv_test) > # Get the used spectral transformation > get_st = E.getST() > Print("Selected spectral transformation: ", get_st) > # Get the applied direct solver > get_ksp = E.getDS() > Print("Selected direct solver: ", get_ksp) > nconv = E.getConverged() > Print("Number of converged eigenpairs: ", nconv) > ..... > > > > Am Fr., 19. Okt. 2018 um 21:00 Uhr schrieb Smith, Barry F. < > bsmith at mcs.anl.gov>: > >> >> >> > On Oct 19, 2018, at 7:56 AM, Zhang, Junchao >> wrote: >> > >> > >> > On Fri, Oct 19, 2018 at 4:02 AM Jan Grie?er < >> griesser.jan at googlemail.com> wrote: >> > With more than 1 MPI process you mean i should use spectrum slicing in >> divide the full problem in smaller subproblems? >> > The --with-64-bit-indices is not a possibility for me since i >> configured petsc with mumps, which does not allow to use the 64-bit version >> (At least this was the error message when i tried to configure PETSc ) >> > >> > MUMPS 5.1.2 manual chapter 2.4.2 says it supports "Selective 64-bit >> integer feature" and "full 64-bit integer version" as well. >> >> They use to achieve this by compiling with special Fortran flags to >> promote integers to 64 bit; this is too fragile for our taste so we never >> hooked PETSc up wit it. If they have a dependable way of using 64 bit >> integers we should add that to our mumps.py and test it. >> >> Barry >> >> > >> > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman < >> jroman at dsic.upv.es>: >> > To use BVVECS just add the command-line option -bv_type vecs >> > This causes to use a separate Vec for each column, instead of a single >> long Vec of size n*m. But it is considerably slower than the default. >> > >> > Anyway, for such large problems you should consider using more than 1 >> MPI process. In that case the error may disappear because the local size is >> smaller than 768000. >> > >> > Jose >> > >> > >> > > El 17 oct 2018, a las 17:58, Matthew Knepley >> escribi?: >> > > >> > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er < >> griesser.jan at googlemail.com> wrote: >> > > Hi all, >> > > i am using slepc4py and petsc4py to solve for the smallest real >> eigenvalues and eigenvectors. For my test cases with a matrix A of the size >> 30k x 30k solving for the smallest soutions works quite well, but when i >> increase the dimension of my system to around A = 768000 x 768000 or 3 >> million x 3 million and ask for the smallest real 3000 (the number is >> increasing with increasing system size) eigenvalues and eigenvectors i get >> the output (for the 768000): >> > > The product 4001 times 768000 overflows the size of PetscInt; >> consider reducing the number of columns, or use BVVECS instead >> > > i understand that the requested number of eigenvectors and >> eigenvalues is causing an overflow but i do not understand the solution of >> the problem which is stated in the error message. Can someone tell me what >> exactly BVVECS is and how i can use it? Or is there any other solution to >> my problem ? >> > > >> > > You can also reconfigure with 64-bit integers: --with-64-bit-indices >> > > >> > > Thanks, >> > > >> > > Matt >> > > >> > > Thank you very much in advance, >> > > Jan >> > > >> > > >> > > >> > > -- >> > > 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 >> > > >> > > https://www.cse.buffalo.edu/~knepley/ >> > >> >> -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From griesser.jan at googlemail.com Wed Oct 24 09:03:08 2018 From: griesser.jan at googlemail.com (=?UTF-8?B?SmFuIEdyaWXDn2Vy?=) Date: Wed, 24 Oct 2018 16:03:08 +0200 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: This is the error message i get from my program: Shape of the dynamical matrix: (1500000, 1500000) =================================================================================== = BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES = PID 122676 RUNNING AT n3512.nemo.privat = EXIT CODE: 9 = CLEANING UP REMAINING PROCESSES = YOU CAN IGNORE THE BELOW CLEANUP MESSAGES =================================================================================== Intel(R) MPI Library troubleshooting guide: https://software.intel.com/node/561764 =================================================================================== Am Mi., 24. Okt. 2018 um 16:01 Uhr schrieb Matthew Knepley < knepley at gmail.com>: > On Wed, Oct 24, 2018 at 9:38 AM Jan Grie?er > wrote: > >> Hey, >> i tried to run my program as you said with -bv_type vecs and/or -bv_type >> mat, but instead of the PETScInt overflow i now get an MPI Error 9 >> > > Send the actual error. > > Thanks, > > Matt > > >> message, which i assume (after googling a little bit around) should be a >> memory problem. I tried to run it also on slightly bigger compute nodes on >> our cluster with 20 cores with each 12 GB and 24 GB but the problem still >> remains. The actual limit appears to be a 1.5 Million x 1.5 Million where >> i searched for NEV = 1500 and MPD = 500/ 200 eigenvalues. >> Do you have maybe an idea what the error could be? I appended also the >> python method i used to solve the problem. I also tried to solve the >> problem with spectrum solving but the error message remains the same. >> >> def solve_eigensystem(DynMatrix_nn, NEV, MPD, Dimension): >> # Create the solver >> # E is used as an acronym for the EPS solver (EPS = Eigenvalue problem >> solver) >> E = SLEPc.EPS().create() >> >> # Set the preconditioner >> pc = PETSc.PC().create() >> pc.setType(pc.Type.BJACOBI) >> >> # Set the linear solver >> # Create the KSP object >> ksp = PETSc.KSP().create() >> # Create the solver, in this case GMRES >> ksp.setType(ksp.Type.GMRES) >> # Set the tolerances of the GMRES solver >> # Link it to the PC >> ksp.setPC(pc) >> >> # Set up the spectral transformations >> st = SLEPc.ST().create() >> st.setType("shift") >> st.setKSP(ksp) >> # MPD stands for "maximum projected dimension". It has to due with >> computational cost, please read Chap. 2.6.5 of SLEPc docu for >> # an explanation. At the moment mpd is only a guess >> E.setDimensions(nev=NEV, mpd = MPD) >> # Eigenvalues should be real, therefore we start to order them from the >> smallest real value |l.real| >> E.setWhichEigenpairs(E.Which.SMALLEST_REAL) >> # Since the dynamical matrix is symmetric and real it is hermitian >> E.setProblemType(SLEPc.EPS.ProblemType.HEP) >> # Use the Krylov Schur method to solve the eigenvalue problem >> E.setType(E.Type.KRYLOVSCHUR) >> # Set the convergence criterion to relative to the eigenvalue and the >> maximal number of iterations >> E.setConvergenceTest(E.Conv.REL) >> E.setTolerances(tol = 1e-8, max_it = 5000) >> # Set the matrix in order to solve >> E.setOperators(DynMatrix_nn, None) >> # Sets EPS options from the options database. This routine must be called >> before `setUp()` if the user is to be allowed to set dthe solver type. >> E.setFromOptions() >> # Sets up all the internal data structures necessary for the execution of >> the eigensolver. >> E.setUp() >> >> # Solve eigenvalue problem >> E.solve() >> >> Print = PETSc.Sys.Print >> >> Print() >> Print("****************************") >> Print("***SLEPc Solution Results***") >> Print("****************************") >> >> its = E.getIterationNumber() >> Print("Number of iterations of the method: ", its) >> eps_type = E.getType() >> Print("Solution method: ", eps_type) >> nev, ncv, mpd = E.getDimensions() >> Print("Number of requested eigenvalues: ", nev) >> Print("Number of computeded eigenvectors: ", ncv) >> tol, maxit = E.getTolerances() >> Print("Stopping condition: (tol, maxit)", (tol, maxit)) >> # Get the type of convergence >> conv_test = E.getConvergenceTest() >> Print("Selected convergence test: ", conv_test) >> # Get the used spectral transformation >> get_st = E.getST() >> Print("Selected spectral transformation: ", get_st) >> # Get the applied direct solver >> get_ksp = E.getDS() >> Print("Selected direct solver: ", get_ksp) >> nconv = E.getConverged() >> Print("Number of converged eigenpairs: ", nconv) >> ..... >> >> >> >> Am Fr., 19. Okt. 2018 um 21:00 Uhr schrieb Smith, Barry F. < >> bsmith at mcs.anl.gov>: >> >>> >>> >>> > On Oct 19, 2018, at 7:56 AM, Zhang, Junchao >>> wrote: >>> > >>> > >>> > On Fri, Oct 19, 2018 at 4:02 AM Jan Grie?er < >>> griesser.jan at googlemail.com> wrote: >>> > With more than 1 MPI process you mean i should use spectrum slicing in >>> divide the full problem in smaller subproblems? >>> > The --with-64-bit-indices is not a possibility for me since i >>> configured petsc with mumps, which does not allow to use the 64-bit version >>> (At least this was the error message when i tried to configure PETSc ) >>> > >>> > MUMPS 5.1.2 manual chapter 2.4.2 says it supports "Selective 64-bit >>> integer feature" and "full 64-bit integer version" as well. >>> >>> They use to achieve this by compiling with special Fortran flags to >>> promote integers to 64 bit; this is too fragile for our taste so we never >>> hooked PETSc up wit it. If they have a dependable way of using 64 bit >>> integers we should add that to our mumps.py and test it. >>> >>> Barry >>> >>> > >>> > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman < >>> jroman at dsic.upv.es>: >>> > To use BVVECS just add the command-line option -bv_type vecs >>> > This causes to use a separate Vec for each column, instead of a single >>> long Vec of size n*m. But it is considerably slower than the default. >>> > >>> > Anyway, for such large problems you should consider using more than 1 >>> MPI process. In that case the error may disappear because the local size is >>> smaller than 768000. >>> > >>> > Jose >>> > >>> > >>> > > El 17 oct 2018, a las 17:58, Matthew Knepley >>> escribi?: >>> > > >>> > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er < >>> griesser.jan at googlemail.com> wrote: >>> > > Hi all, >>> > > i am using slepc4py and petsc4py to solve for the smallest real >>> eigenvalues and eigenvectors. For my test cases with a matrix A of the size >>> 30k x 30k solving for the smallest soutions works quite well, but when i >>> increase the dimension of my system to around A = 768000 x 768000 or 3 >>> million x 3 million and ask for the smallest real 3000 (the number is >>> increasing with increasing system size) eigenvalues and eigenvectors i get >>> the output (for the 768000): >>> > > The product 4001 times 768000 overflows the size of PetscInt; >>> consider reducing the number of columns, or use BVVECS instead >>> > > i understand that the requested number of eigenvectors and >>> eigenvalues is causing an overflow but i do not understand the solution of >>> the problem which is stated in the error message. Can someone tell me what >>> exactly BVVECS is and how i can use it? Or is there any other solution to >>> my problem ? >>> > > >>> > > You can also reconfigure with 64-bit integers: --with-64-bit-indices >>> > > >>> > > Thanks, >>> > > >>> > > Matt >>> > > >>> > > Thank you very much in advance, >>> > > Jan >>> > > >>> > > >>> > > >>> > > -- >>> > > 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 >>> > > >>> > > https://www.cse.buffalo.edu/~knepley/ >>> > >>> >>> > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jroman at dsic.upv.es Wed Oct 24 09:13:23 2018 From: jroman at dsic.upv.es (Jose E. Roman) Date: Wed, 24 Oct 2018 16:13:23 +0200 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: The program seems correct, although in your case you don't need any KSP or preconditioner, so you could remove all code related to PC, KSP and ST - anyway, this should not affect memory consumption. Add the option -eps_view_pre and send the output. Jose > El 24 oct 2018, a las 16:03, Jan Grie?er escribi?: > > This is the error message i get from my program: > Shape of the dynamical matrix: (1500000, 1500000) > > =================================================================================== > = BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES > = PID 122676 RUNNING AT n3512.nemo.privat > = EXIT CODE: 9 > = CLEANING UP REMAINING PROCESSES > = YOU CAN IGNORE THE BELOW CLEANUP MESSAGES > =================================================================================== > Intel(R) MPI Library troubleshooting guide: > https://software.intel.com/node/561764 > =================================================================================== > > > Am Mi., 24. Okt. 2018 um 16:01 Uhr schrieb Matthew Knepley : > On Wed, Oct 24, 2018 at 9:38 AM Jan Grie?er wrote: > Hey, > i tried to run my program as you said with -bv_type vecs and/or -bv_type mat, but instead of the PETScInt overflow i now get an MPI Error 9 > > Send the actual error. > > Thanks, > > Matt > > message, which i assume (after googling a little bit around) should be a memory problem. I tried to run it also on slightly bigger compute nodes on our cluster with 20 cores with each 12 GB and 24 GB but the problem still remains. The actual limit appears to be a 1.5 Million x 1.5 Million where i searched for NEV = 1500 and MPD = 500/ 200 eigenvalues. > Do you have maybe an idea what the error could be? I appended also the python method i used to solve the problem. I also tried to solve the problem with spectrum solving but the error message remains the same. > > def solve_eigensystem(DynMatrix_nn, NEV, MPD, Dimension): > # Create the solver > # E is used as an acronym for the EPS solver (EPS = Eigenvalue problem solver) > E = SLEPc.EPS().create() > > # Set the preconditioner > pc = PETSc.PC().create() > pc.setType(pc.Type.BJACOBI) > > # Set the linear solver > # Create the KSP object > ksp = PETSc.KSP().create() > # Create the solver, in this case GMRES > ksp.setType(ksp.Type.GMRES) > # Set the tolerances of the GMRES solver > # Link it to the PC > ksp.setPC(pc) > > # Set up the spectral transformations > st = SLEPc.ST().create() > st.setType("shift") > st.setKSP(ksp) > > # MPD stands for "maximum projected dimension". It has to due with computational cost, please read Chap. 2.6.5 of SLEPc docu for > # an explanation. At the moment mpd is only a guess > E.setDimensions(nev=NEV, mpd = MPD) > # Eigenvalues should be real, therefore we start to order them from the smallest real value |l.real| > E.setWhichEigenpairs(E.Which.SMALLEST_REAL) > # Since the dynamical matrix is symmetric and real it is hermitian > E.setProblemType(SLEPc.EPS.ProblemType.HEP) > # Use the Krylov Schur method to solve the eigenvalue problem > E.setType(E.Type.KRYLOVSCHUR) > # Set the convergence criterion to relative to the eigenvalue and the maximal number of iterations > E.setConvergenceTest(E.Conv.REL) > E.setTolerances(tol = 1e-8, max_it = 5000) > # Set the matrix in order to solve > E.setOperators(DynMatrix_nn, None) > # Sets EPS options from the options database. This routine must be called before `setUp()` if the user is to be allowed to set dthe solver type. > E.setFromOptions() > # Sets up all the internal data structures necessary for the execution of the eigensolver. > E.setUp() > > # Solve eigenvalue problem > E.solve() > > Print = PETSc.Sys.Print > > Print() > Print("****************************") > Print("***SLEPc Solution Results***") > Print("****************************") > > its = E.getIterationNumber() > Print("Number of iterations of the method: ", its) > eps_type = E.getType() > Print("Solution method: ", eps_type) > nev, ncv, mpd = E.getDimensions() > Print("Number of requested eigenvalues: ", nev) > Print("Number of computeded eigenvectors: ", ncv) > tol, maxit = E.getTolerances() > Print("Stopping condition: (tol, maxit)", (tol, maxit)) > # Get the type of convergence > conv_test = E.getConvergenceTest() > Print("Selected convergence test: ", conv_test) > # Get the used spectral transformation > get_st = E.getST() > Print("Selected spectral transformation: ", get_st) > # Get the applied direct solver > get_ksp = E.getDS() > Print("Selected direct solver: ", get_ksp) > nconv = E.getConverged() > Print("Number of converged eigenpairs: ", nconv) > ..... > > > > Am Fr., 19. Okt. 2018 um 21:00 Uhr schrieb Smith, Barry F. : > > > > On Oct 19, 2018, at 7:56 AM, Zhang, Junchao wrote: > > > > > > On Fri, Oct 19, 2018 at 4:02 AM Jan Grie?er wrote: > > With more than 1 MPI process you mean i should use spectrum slicing in divide the full problem in smaller subproblems? > > The --with-64-bit-indices is not a possibility for me since i configured petsc with mumps, which does not allow to use the 64-bit version (At least this was the error message when i tried to configure PETSc ) > > > > MUMPS 5.1.2 manual chapter 2.4.2 says it supports "Selective 64-bit integer feature" and "full 64-bit integer version" as well. > > They use to achieve this by compiling with special Fortran flags to promote integers to 64 bit; this is too fragile for our taste so we never hooked PETSc up wit it. If they have a dependable way of using 64 bit integers we should add that to our mumps.py and test it. > > Barry > > > > > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman : > > To use BVVECS just add the command-line option -bv_type vecs > > This causes to use a separate Vec for each column, instead of a single long Vec of size n*m. But it is considerably slower than the default. > > > > Anyway, for such large problems you should consider using more than 1 MPI process. In that case the error may disappear because the local size is smaller than 768000. > > > > Jose > > > > > > > El 17 oct 2018, a las 17:58, Matthew Knepley escribi?: > > > > > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er wrote: > > > Hi all, > > > i am using slepc4py and petsc4py to solve for the smallest real eigenvalues and eigenvectors. For my test cases with a matrix A of the size 30k x 30k solving for the smallest soutions works quite well, but when i increase the dimension of my system to around A = 768000 x 768000 or 3 million x 3 million and ask for the smallest real 3000 (the number is increasing with increasing system size) eigenvalues and eigenvectors i get the output (for the 768000): > > > The product 4001 times 768000 overflows the size of PetscInt; consider reducing the number of columns, or use BVVECS instead > > > i understand that the requested number of eigenvectors and eigenvalues is causing an overflow but i do not understand the solution of the problem which is stated in the error message. Can someone tell me what exactly BVVECS is and how i can use it? Or is there any other solution to my problem ? > > > > > > You can also reconfigure with 64-bit integers: --with-64-bit-indices > > > > > > Thanks, > > > > > > Matt > > > > > > Thank you very much in advance, > > > Jan > > > > > > > > > > > > -- > > > 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 > > > > > > https://www.cse.buffalo.edu/~knepley/ > > > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ From knepley at gmail.com Wed Oct 24 09:14:35 2018 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 24 Oct 2018 10:14:35 -0400 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: On Wed, Oct 24, 2018 at 10:03 AM Jan Grie?er wrote: > This is the error message i get from my program: > Shape of the dynamical matrix: (1500000, 1500000) > Petsc installs a signal handler, so there should be a PETSc-specific message before this one. Is something eating your output? Thanks, Matt > > =================================================================================== > = BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES > = PID 122676 RUNNING AT n3512.nemo.privat > = EXIT CODE: 9 > = CLEANING UP REMAINING PROCESSES > = YOU CAN IGNORE THE BELOW CLEANUP MESSAGES > > =================================================================================== > Intel(R) MPI Library troubleshooting guide: > https://software.intel.com/node/561764 > > =================================================================================== > > > Am Mi., 24. Okt. 2018 um 16:01 Uhr schrieb Matthew Knepley < > knepley at gmail.com>: > >> On Wed, Oct 24, 2018 at 9:38 AM Jan Grie?er >> wrote: >> >>> Hey, >>> i tried to run my program as you said with -bv_type vecs and/or -bv_type >>> mat, but instead of the PETScInt overflow i now get an MPI Error 9 >>> >> >> Send the actual error. >> >> Thanks, >> >> Matt >> >> >>> message, which i assume (after googling a little bit around) should be a >>> memory problem. I tried to run it also on slightly bigger compute nodes on >>> our cluster with 20 cores with each 12 GB and 24 GB but the problem still >>> remains. The actual limit appears to be a 1.5 Million x 1.5 Million where >>> i searched for NEV = 1500 and MPD = 500/ 200 eigenvalues. >>> Do you have maybe an idea what the error could be? I appended also the >>> python method i used to solve the problem. I also tried to solve the >>> problem with spectrum solving but the error message remains the same. >>> >>> def solve_eigensystem(DynMatrix_nn, NEV, MPD, Dimension): >>> # Create the solver >>> # E is used as an acronym for the EPS solver (EPS = Eigenvalue problem >>> solver) >>> E = SLEPc.EPS().create() >>> >>> # Set the preconditioner >>> pc = PETSc.PC().create() >>> pc.setType(pc.Type.BJACOBI) >>> >>> # Set the linear solver >>> # Create the KSP object >>> ksp = PETSc.KSP().create() >>> # Create the solver, in this case GMRES >>> ksp.setType(ksp.Type.GMRES) >>> # Set the tolerances of the GMRES solver >>> # Link it to the PC >>> ksp.setPC(pc) >>> >>> # Set up the spectral transformations >>> st = SLEPc.ST().create() >>> st.setType("shift") >>> st.setKSP(ksp) >>> # MPD stands for "maximum projected dimension". It has to due with >>> computational cost, please read Chap. 2.6.5 of SLEPc docu for >>> # an explanation. At the moment mpd is only a guess >>> E.setDimensions(nev=NEV, mpd = MPD) >>> # Eigenvalues should be real, therefore we start to order them from the >>> smallest real value |l.real| >>> E.setWhichEigenpairs(E.Which.SMALLEST_REAL) >>> # Since the dynamical matrix is symmetric and real it is hermitian >>> E.setProblemType(SLEPc.EPS.ProblemType.HEP) >>> # Use the Krylov Schur method to solve the eigenvalue problem >>> E.setType(E.Type.KRYLOVSCHUR) >>> # Set the convergence criterion to relative to the eigenvalue and the >>> maximal number of iterations >>> E.setConvergenceTest(E.Conv.REL) >>> E.setTolerances(tol = 1e-8, max_it = 5000) >>> # Set the matrix in order to solve >>> E.setOperators(DynMatrix_nn, None) >>> # Sets EPS options from the options database. This routine must be >>> called before `setUp()` if the user is to be allowed to set dthe solver >>> type. >>> E.setFromOptions() >>> # Sets up all the internal data structures necessary for the execution >>> of the eigensolver. >>> E.setUp() >>> >>> # Solve eigenvalue problem >>> E.solve() >>> >>> Print = PETSc.Sys.Print >>> >>> Print() >>> Print("****************************") >>> Print("***SLEPc Solution Results***") >>> Print("****************************") >>> >>> its = E.getIterationNumber() >>> Print("Number of iterations of the method: ", its) >>> eps_type = E.getType() >>> Print("Solution method: ", eps_type) >>> nev, ncv, mpd = E.getDimensions() >>> Print("Number of requested eigenvalues: ", nev) >>> Print("Number of computeded eigenvectors: ", ncv) >>> tol, maxit = E.getTolerances() >>> Print("Stopping condition: (tol, maxit)", (tol, maxit)) >>> # Get the type of convergence >>> conv_test = E.getConvergenceTest() >>> Print("Selected convergence test: ", conv_test) >>> # Get the used spectral transformation >>> get_st = E.getST() >>> Print("Selected spectral transformation: ", get_st) >>> # Get the applied direct solver >>> get_ksp = E.getDS() >>> Print("Selected direct solver: ", get_ksp) >>> nconv = E.getConverged() >>> Print("Number of converged eigenpairs: ", nconv) >>> ..... >>> >>> >>> >>> Am Fr., 19. Okt. 2018 um 21:00 Uhr schrieb Smith, Barry F. < >>> bsmith at mcs.anl.gov>: >>> >>>> >>>> >>>> > On Oct 19, 2018, at 7:56 AM, Zhang, Junchao >>>> wrote: >>>> > >>>> > >>>> > On Fri, Oct 19, 2018 at 4:02 AM Jan Grie?er < >>>> griesser.jan at googlemail.com> wrote: >>>> > With more than 1 MPI process you mean i should use spectrum slicing >>>> in divide the full problem in smaller subproblems? >>>> > The --with-64-bit-indices is not a possibility for me since i >>>> configured petsc with mumps, which does not allow to use the 64-bit version >>>> (At least this was the error message when i tried to configure PETSc ) >>>> > >>>> > MUMPS 5.1.2 manual chapter 2.4.2 says it supports "Selective 64-bit >>>> integer feature" and "full 64-bit integer version" as well. >>>> >>>> They use to achieve this by compiling with special Fortran flags to >>>> promote integers to 64 bit; this is too fragile for our taste so we never >>>> hooked PETSc up wit it. If they have a dependable way of using 64 bit >>>> integers we should add that to our mumps.py and test it. >>>> >>>> Barry >>>> >>>> > >>>> > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman < >>>> jroman at dsic.upv.es>: >>>> > To use BVVECS just add the command-line option -bv_type vecs >>>> > This causes to use a separate Vec for each column, instead of a >>>> single long Vec of size n*m. But it is considerably slower than the default. >>>> > >>>> > Anyway, for such large problems you should consider using more than 1 >>>> MPI process. In that case the error may disappear because the local size is >>>> smaller than 768000. >>>> > >>>> > Jose >>>> > >>>> > >>>> > > El 17 oct 2018, a las 17:58, Matthew Knepley >>>> escribi?: >>>> > > >>>> > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er < >>>> griesser.jan at googlemail.com> wrote: >>>> > > Hi all, >>>> > > i am using slepc4py and petsc4py to solve for the smallest real >>>> eigenvalues and eigenvectors. For my test cases with a matrix A of the size >>>> 30k x 30k solving for the smallest soutions works quite well, but when i >>>> increase the dimension of my system to around A = 768000 x 768000 or 3 >>>> million x 3 million and ask for the smallest real 3000 (the number is >>>> increasing with increasing system size) eigenvalues and eigenvectors i get >>>> the output (for the 768000): >>>> > > The product 4001 times 768000 overflows the size of PetscInt; >>>> consider reducing the number of columns, or use BVVECS instead >>>> > > i understand that the requested number of eigenvectors and >>>> eigenvalues is causing an overflow but i do not understand the solution of >>>> the problem which is stated in the error message. Can someone tell me what >>>> exactly BVVECS is and how i can use it? Or is there any other solution to >>>> my problem ? >>>> > > >>>> > > You can also reconfigure with 64-bit integers: --with-64-bit-indices >>>> > > >>>> > > Thanks, >>>> > > >>>> > > Matt >>>> > > >>>> > > Thank you very much in advance, >>>> > > Jan >>>> > > >>>> > > >>>> > > >>>> > > -- >>>> > > 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 >>>> > > >>>> > > https://www.cse.buffalo.edu/~knepley/ >>>> > >>>> >>>> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From Peterspy at outlook.com Wed Oct 24 10:06:40 2018 From: Peterspy at outlook.com (SONG Pengyang) Date: Wed, 24 Oct 2018 15:06:40 +0000 Subject: [petsc-users] Problems with a Laplacian problem with Neumann boundary condition Message-ID: Hi all, I am trying to change PETSC KSP tutorial ex34 to fortran code ex34f and I referred to ex22f, but it somehow seems wrong in my code. Important error information points to MatSetValuesStencil() [argument out of range]. Can anyone look over my code and give any advice? Many thanks. ---------------------------------------------------------------- SONG Pengyang ????? MSc candidate in Physical Oceanography College of Oceanic and Atmospheric Sciences Ocean University of China No. 238 Songling Road, Qingdao 266100, Shandong, China TEL: (+86)15762264643 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ex34f.F90 Type: application/octet-stream Size: 9597 bytes Desc: ex34f.F90 URL: From yjwu16 at gmail.com Wed Oct 24 10:30:09 2018 From: yjwu16 at gmail.com (Yingjie Wu) Date: Wed, 24 Oct 2018 23:30:09 +0800 Subject: [petsc-users] Problems about Compiling Multifile Program In-Reply-To: References: Message-ID: Thank you very much for your reply. Because the files I added are written in c++, including definitions of classes and functions. I encountered a mistake when I used your method. myprogram: class1.o myprogram.o ${CLINKER} -o myprogram class1.o myprogram.o ${PETSC_LIB} Error information is : unknown type name 'class' It seems that I did not compile using the c++ compiler. How should I set it up so that it can compile successfully? Thanks, Yingjie Matthew Knepley ?2018?10?24??? ??1:46??? > On Tue, Oct 23, 2018 at 11:37 AM Yingjie Wu wrote: > >> Dear Petsc developer: >> Hi, >> Thank you very much for your continuous help, I recently encountered some >> difficulties in developing programs on Petsc. >> >> 1. I want to use my class definition (class1. h) and class functions >> (class1. cpp) files in my Petsc program (myprogram. c) and compile my >> program. I have written other program before: >> g++ -c class1.cpp myprogram.c >> g++ -o myprogram *.o >> I also have some knowledge of Makefile, but I don't know how to modify it >> to achieve compilation. I really want your help. >> > > With PETSc makefiles, we have automatic rules, so you can use > > myprogram: class1.o myprogram.o > ${CLINKER} -o myprogram class1.o myprogram.o ${PETSC_LIB} > > >> 2. In my class definition and function implementation program, I want to >> use Petsc data structures, such as PetscInt, PetscReal. In order to >> maintain consistency of the main program. What kind of header files should >> I add to my code, or do I need to add any code? >> > > The easiest thing to do is just > > #include > > Thanks, > > Matt > > >> Thanks, >> Yingjie >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From balay at mcs.anl.gov Wed Oct 24 10:35:28 2018 From: balay at mcs.anl.gov (Balay, Satish) Date: Wed, 24 Oct 2018 15:35:28 +0000 Subject: [petsc-users] Problems about Compiling Multifile Program In-Reply-To: References: Message-ID: Please send complete logs. [i.e the complete compile output from your makefile. Also send your makefile] If your c++ code uses .cxx - it should get compiled with a c++ compiler. You might benefit by change CLINKER to CXXLINKER Satish On Wed, 24 Oct 2018, Yingjie Wu wrote: > Thank you very much for your reply. > > Because the files I added are written in c++, including definitions of > classes and functions. I encountered a mistake when I used your method. > myprogram: class1.o myprogram.o > ${CLINKER} -o myprogram class1.o myprogram.o ${PETSC_LIB} > Error information is : unknown type name 'class' > It seems that I did not compile using the c++ compiler. > > How should I set it up so that it can compile successfully? > > Thanks, > Yingjie > > Matthew Knepley ?2018?10?24??? ??1:46??? > > > On Tue, Oct 23, 2018 at 11:37 AM Yingjie Wu wrote: > > > >> Dear Petsc developer: > >> Hi, > >> Thank you very much for your continuous help, I recently encountered some > >> difficulties in developing programs on Petsc. > >> > >> 1. I want to use my class definition (class1. h) and class functions > >> (class1. cpp) files in my Petsc program (myprogram. c) and compile my > >> program. I have written other program before: > >> g++ -c class1.cpp myprogram.c > >> g++ -o myprogram *.o > >> I also have some knowledge of Makefile, but I don't know how to modify it > >> to achieve compilation. I really want your help. > >> > > > > With PETSc makefiles, we have automatic rules, so you can use > > > > myprogram: class1.o myprogram.o > > ${CLINKER} -o myprogram class1.o myprogram.o ${PETSC_LIB} > > > > > >> 2. In my class definition and function implementation program, I want to > >> use Petsc data structures, such as PetscInt, PetscReal. In order to > >> maintain consistency of the main program. What kind of header files should > >> I add to my code, or do I need to add any code? > >> > > > > The easiest thing to do is just > > > > #include > > > > Thanks, > > > > Matt > > > > > >> Thanks, > >> Yingjie > >> > > > > > > -- > > 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 > > > > https://www.cse.buffalo.edu/~knepley/ > > > > > From imilian.hartig at gmail.com Wed Oct 24 10:36:11 2018 From: imilian.hartig at gmail.com (Maximilian Hartig) Date: Wed, 24 Oct 2018 17:36:11 +0200 Subject: [petsc-users] Periodic BC in petsc DMPlex / firedrake In-Reply-To: References: <2D9A9125-F4A2-4A50-A5F9-4D7C9B86B540@gmail.com> <2852F36F-0CB0-4737-A489-38A476FDAEF2@gmx.li> Message-ID: <6E65EDD0-AB80-4FE5-AF9F-49B9D4D8B9E3@gmail.com> > On 24. Oct 2018, at 12:49, Matthew Knepley wrote: > > On Wed, Oct 24, 2018 at 6:29 AM Lawrence Mitchell > wrote: > Hi Max, > > (I'm cc'ing in the petsc-users mailing list which may have more advice, if you are using PETSc you should definitely subscribe! > > > On 24 Oct 2018, at 09:27, Maximilian Hartig > wrote: > > > > Hello Lawrence, > > > > sorry to message you out of the blue. My name is Max and I found your post on GitHub (https://github.com/firedrakeproject/firedrake/issues/1246 ) on DMPlex being able to read periodic gmsh files. I am currently trying to do just that (creating a periodic DMPlex mesh with gmsh) in the context of my PhD work. So far I haven? t found any documentation on the periodic BC?s with DMPlex and gmsh in the official petsc documentation. > > I was wondering whether you?d be so kind as to point me in a general direction concerning how to achieve this. You seem experienced in using petsc and I would greatly appreciate your help. > > > I think the answer is "it depends". If you're just using DMPlex directly and all the of the functionality with PetscDS, then I /think/ that reading periodic meshes via gmsh (assuming you're using the appropriate gmsh mesh format [v2]) "just works". > > There are two phases here: topological and geometric. DMPlex represents the periodic topological entity directly. For example, a circle is just a segment with one end hooked to the other. Vertices are not duplicated, or mapped to each other. This makes topology simple and easy to implement. However, then geometry is more complicated. What Plex does is allow coordinates to be represented by a discontinuous field taking values on cells, in addition to vertices. In our circle example, each cells near the cut will have 2 coordinates, one for each vertex, but they will not agree across the cut. If you define a periodic domain, then Plex can construct this coordinate field automatically using DMPlexLocalize(). These DG coordinates are then used by the integration routines. Ok, I think I understand the concept. DMPlex reads information about both topology and coordinates from the .msh file. Creating a periodic mesh in gmsh then should allow DMPlex to identify the periodic boundaries as the ?cut? and build the mesh topology accordingly. Coordinate information is handled separately. That means, as Lawrence suggested, building periodic meshes in gmsh and reading them in to petsc?s DMPlex should indeed ?just work?. (From the user perspective). The only extra step is to call DMLocalizeCoordinates() after DMPlexReadFromFile(). Sorry to reiterate, I am just trying to make sense of this. > > From my side, the issue is to do with mapping that coordinate field into one that I understand (within Firedrake). You may not have this problem. > > Firedrake uses its own coordinate mapping and integration routines, so they must manage the second part independently. I hope to get change this slightly soon by making the Firedrake representation a DMField, so that it looks the same to Plex. > > Thanks, > > Matt > > Thanks, > > Lawrence > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > To read periodic meshes from GMSH, you need to use the option -dm_plex_gmsh_periodic and DMPlexCreateFromFile Ahh, thanks. I was missing the option " -dm_plex_gmsh_periodic ?. But using this option I now generate a segmentation fault error when calling VecView() on the solution vector with vtk and hdf5 viewers. Any suggestions? > > See src/dm/impls/plex/examples/tests/ex1.c. An example runs > > $ ./ex1 -filename ${PETSC_DIR}/share/petsc/datafiles/meshes/cube_periodic_bin.msh -dm_plex_gmsh_periodic -dm_view ::ascii_info_detail -interpolate -test_shape > > generating periodic meshes in gmsh may be tricky, Lisandro for sure may advice. Thanks, Max -------------- next part -------------- An HTML attachment was scrubbed... URL: From yjwu16 at gmail.com Wed Oct 24 10:48:15 2018 From: yjwu16 at gmail.com (Yingjie Wu) Date: Wed, 24 Oct 2018 23:48:15 +0800 Subject: [petsc-users] Problems about Compiling Multifile Program In-Reply-To: References: Message-ID: Sorry, I made a mistake. I have a.C file with the same name in the current directory. When I remove it, the compiler can be passed. It seems that ${CLINKER} can automatically identify the extension of files and compile them with different compilers. Thanks for helping me. Yingjie Balay, Satish ?2018?10?24??? ??11:35??? > Please send complete logs. [i.e the complete compile output from your > makefile. Also send your makefile] > > If your c++ code uses .cxx - it should get compiled with a c++ compiler. > > You might benefit by change CLINKER to CXXLINKER > > Satish > > On Wed, 24 Oct 2018, Yingjie Wu wrote: > > > Thank you very much for your reply. > > > > Because the files I added are written in c++, including definitions of > > classes and functions. I encountered a mistake when I used your method. > > myprogram: class1.o myprogram.o > > ${CLINKER} -o myprogram class1.o myprogram.o ${PETSC_LIB} > > Error information is : unknown type name 'class' > > It seems that I did not compile using the c++ compiler. > > > > How should I set it up so that it can compile successfully? > > > > Thanks, > > Yingjie > > > > Matthew Knepley ?2018?10?24??? ??1:46??? > > > > > On Tue, Oct 23, 2018 at 11:37 AM Yingjie Wu wrote: > > > > > >> Dear Petsc developer: > > >> Hi, > > >> Thank you very much for your continuous help, I recently encountered > some > > >> difficulties in developing programs on Petsc. > > >> > > >> 1. I want to use my class definition (class1. h) and class functions > > >> (class1. cpp) files in my Petsc program (myprogram. c) and compile my > > >> program. I have written other program before: > > >> g++ -c class1.cpp myprogram.c > > >> g++ -o myprogram *.o > > >> I also have some knowledge of Makefile, but I don't know how to > modify it > > >> to achieve compilation. I really want your help. > > >> > > > > > > With PETSc makefiles, we have automatic rules, so you can use > > > > > > myprogram: class1.o myprogram.o > > > ${CLINKER} -o myprogram class1.o myprogram.o ${PETSC_LIB} > > > > > > > > >> 2. In my class definition and function implementation program, I > want to > > >> use Petsc data structures, such as PetscInt, PetscReal. In order to > > >> maintain consistency of the main program. What kind of header files > should > > >> I add to my code, or do I need to add any code? > > >> > > > > > > The easiest thing to do is just > > > > > > #include > > > > > > Thanks, > > > > > > Matt > > > > > > > > >> Thanks, > > >> Yingjie > > >> > > > > > > > > > -- > > > 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 > > > > > > https://www.cse.buffalo.edu/~knepley/ > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From griesser.jan at googlemail.com Wed Oct 24 11:07:49 2018 From: griesser.jan at googlemail.com (=?UTF-8?B?SmFuIEdyaWXDn2Vy?=) Date: Wed, 24 Oct 2018 18:07:49 +0200 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: For some reason i get only this error message, also when is use the -eps_view_pre. I started the program with nev=1, there the output is (with -bv_type vecs -bv_type mat -eps_view_pre) EPS Object: 20 MPI processes type: krylovschur 50% of basis vectors kept after restart using the locking variant problem type: symmetric eigenvalue problem selected portion of the spectrum: smallest real parts number of eigenvalues (nev): 1 number of column vectors (ncv): 3 maximum dimension of projected problem (mpd): 2 maximum number of iterations: 1000 tolerance: 1e-08 convergence test: relative to the eigenvalue BV Object: 20 MPI processes type: mat 4 columns of global length 1500000 vector orthogonalization method: classical Gram-Schmidt orthogonalization refinement: if needed (eta: 0.7071) block orthogonalization method: GS doing matmult as a single matrix-matrix product DS Object: 20 MPI processes type: hep parallel operation mode: REDUNDANT solving the problem with: Implicit QR method (_steqr) ST Object: 20 MPI processes type: shift shift: 0. number of matrices: 1 Am Mi., 24. Okt. 2018 um 16:14 Uhr schrieb Matthew Knepley < knepley at gmail.com>: > On Wed, Oct 24, 2018 at 10:03 AM Jan Grie?er > wrote: > >> This is the error message i get from my program: >> Shape of the dynamical matrix: (1500000, 1500000) >> > > Petsc installs a signal handler, so there should be a PETSc-specific > message before this one. Is something eating > your output? > > Thanks, > > Matt > > >> >> =================================================================================== >> = BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES >> = PID 122676 RUNNING AT n3512.nemo.privat >> = EXIT CODE: 9 >> = CLEANING UP REMAINING PROCESSES >> = YOU CAN IGNORE THE BELOW CLEANUP MESSAGES >> >> =================================================================================== >> Intel(R) MPI Library troubleshooting guide: >> https://software.intel.com/node/561764 >> >> =================================================================================== >> >> >> Am Mi., 24. Okt. 2018 um 16:01 Uhr schrieb Matthew Knepley < >> knepley at gmail.com>: >> >>> On Wed, Oct 24, 2018 at 9:38 AM Jan Grie?er >>> wrote: >>> >>>> Hey, >>>> i tried to run my program as you said with -bv_type vecs and/or >>>> -bv_type mat, but instead of the PETScInt overflow i now get an MPI Error 9 >>>> >>> >>> Send the actual error. >>> >>> Thanks, >>> >>> Matt >>> >>> >>>> message, which i assume (after googling a little bit around) should be >>>> a memory problem. I tried to run it also on slightly bigger compute nodes >>>> on our cluster with 20 cores with each 12 GB and 24 GB but the problem >>>> still remains. The actual limit appears to be a 1.5 Million x 1.5 Million >>>> where i searched for NEV = 1500 and MPD = 500/ 200 eigenvalues. >>>> Do you have maybe an idea what the error could be? I appended also the >>>> python method i used to solve the problem. I also tried to solve the >>>> problem with spectrum solving but the error message remains the same. >>>> >>>> def solve_eigensystem(DynMatrix_nn, NEV, MPD, Dimension): >>>> # Create the solver >>>> # E is used as an acronym for the EPS solver (EPS = Eigenvalue problem >>>> solver) >>>> E = SLEPc.EPS().create() >>>> >>>> # Set the preconditioner >>>> pc = PETSc.PC().create() >>>> pc.setType(pc.Type.BJACOBI) >>>> >>>> # Set the linear solver >>>> # Create the KSP object >>>> ksp = PETSc.KSP().create() >>>> # Create the solver, in this case GMRES >>>> ksp.setType(ksp.Type.GMRES) >>>> # Set the tolerances of the GMRES solver >>>> # Link it to the PC >>>> ksp.setPC(pc) >>>> >>>> # Set up the spectral transformations >>>> st = SLEPc.ST().create() >>>> st.setType("shift") >>>> st.setKSP(ksp) >>>> # MPD stands for "maximum projected dimension". It has to due with >>>> computational cost, please read Chap. 2.6.5 of SLEPc docu for >>>> # an explanation. At the moment mpd is only a guess >>>> E.setDimensions(nev=NEV, mpd = MPD) >>>> # Eigenvalues should be real, therefore we start to order them from the >>>> smallest real value |l.real| >>>> E.setWhichEigenpairs(E.Which.SMALLEST_REAL) >>>> # Since the dynamical matrix is symmetric and real it is hermitian >>>> E.setProblemType(SLEPc.EPS.ProblemType.HEP) >>>> # Use the Krylov Schur method to solve the eigenvalue problem >>>> E.setType(E.Type.KRYLOVSCHUR) >>>> # Set the convergence criterion to relative to the eigenvalue and the >>>> maximal number of iterations >>>> E.setConvergenceTest(E.Conv.REL) >>>> E.setTolerances(tol = 1e-8, max_it = 5000) >>>> # Set the matrix in order to solve >>>> E.setOperators(DynMatrix_nn, None) >>>> # Sets EPS options from the options database. This routine must be >>>> called before `setUp()` if the user is to be allowed to set dthe solver >>>> type. >>>> E.setFromOptions() >>>> # Sets up all the internal data structures necessary for the execution >>>> of the eigensolver. >>>> E.setUp() >>>> >>>> # Solve eigenvalue problem >>>> E.solve() >>>> >>>> Print = PETSc.Sys.Print >>>> >>>> Print() >>>> Print("****************************") >>>> Print("***SLEPc Solution Results***") >>>> Print("****************************") >>>> >>>> its = E.getIterationNumber() >>>> Print("Number of iterations of the method: ", its) >>>> eps_type = E.getType() >>>> Print("Solution method: ", eps_type) >>>> nev, ncv, mpd = E.getDimensions() >>>> Print("Number of requested eigenvalues: ", nev) >>>> Print("Number of computeded eigenvectors: ", ncv) >>>> tol, maxit = E.getTolerances() >>>> Print("Stopping condition: (tol, maxit)", (tol, maxit)) >>>> # Get the type of convergence >>>> conv_test = E.getConvergenceTest() >>>> Print("Selected convergence test: ", conv_test) >>>> # Get the used spectral transformation >>>> get_st = E.getST() >>>> Print("Selected spectral transformation: ", get_st) >>>> # Get the applied direct solver >>>> get_ksp = E.getDS() >>>> Print("Selected direct solver: ", get_ksp) >>>> nconv = E.getConverged() >>>> Print("Number of converged eigenpairs: ", nconv) >>>> ..... >>>> >>>> >>>> >>>> Am Fr., 19. Okt. 2018 um 21:00 Uhr schrieb Smith, Barry F. < >>>> bsmith at mcs.anl.gov>: >>>> >>>>> >>>>> >>>>> > On Oct 19, 2018, at 7:56 AM, Zhang, Junchao >>>>> wrote: >>>>> > >>>>> > >>>>> > On Fri, Oct 19, 2018 at 4:02 AM Jan Grie?er < >>>>> griesser.jan at googlemail.com> wrote: >>>>> > With more than 1 MPI process you mean i should use spectrum slicing >>>>> in divide the full problem in smaller subproblems? >>>>> > The --with-64-bit-indices is not a possibility for me since i >>>>> configured petsc with mumps, which does not allow to use the 64-bit version >>>>> (At least this was the error message when i tried to configure PETSc ) >>>>> > >>>>> > MUMPS 5.1.2 manual chapter 2.4.2 says it supports "Selective 64-bit >>>>> integer feature" and "full 64-bit integer version" as well. >>>>> >>>>> They use to achieve this by compiling with special Fortran flags >>>>> to promote integers to 64 bit; this is too fragile for our taste so we >>>>> never hooked PETSc up wit it. If they have a dependable way of using 64 bit >>>>> integers we should add that to our mumps.py and test it. >>>>> >>>>> Barry >>>>> >>>>> > >>>>> > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman < >>>>> jroman at dsic.upv.es>: >>>>> > To use BVVECS just add the command-line option -bv_type vecs >>>>> > This causes to use a separate Vec for each column, instead of a >>>>> single long Vec of size n*m. But it is considerably slower than the default. >>>>> > >>>>> > Anyway, for such large problems you should consider using more than >>>>> 1 MPI process. In that case the error may disappear because the local size >>>>> is smaller than 768000. >>>>> > >>>>> > Jose >>>>> > >>>>> > >>>>> > > El 17 oct 2018, a las 17:58, Matthew Knepley >>>>> escribi?: >>>>> > > >>>>> > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er < >>>>> griesser.jan at googlemail.com> wrote: >>>>> > > Hi all, >>>>> > > i am using slepc4py and petsc4py to solve for the smallest real >>>>> eigenvalues and eigenvectors. For my test cases with a matrix A of the size >>>>> 30k x 30k solving for the smallest soutions works quite well, but when i >>>>> increase the dimension of my system to around A = 768000 x 768000 or 3 >>>>> million x 3 million and ask for the smallest real 3000 (the number is >>>>> increasing with increasing system size) eigenvalues and eigenvectors i get >>>>> the output (for the 768000): >>>>> > > The product 4001 times 768000 overflows the size of PetscInt; >>>>> consider reducing the number of columns, or use BVVECS instead >>>>> > > i understand that the requested number of eigenvectors and >>>>> eigenvalues is causing an overflow but i do not understand the solution of >>>>> the problem which is stated in the error message. Can someone tell me what >>>>> exactly BVVECS is and how i can use it? Or is there any other solution to >>>>> my problem ? >>>>> > > >>>>> > > You can also reconfigure with 64-bit integers: >>>>> --with-64-bit-indices >>>>> > > >>>>> > > Thanks, >>>>> > > >>>>> > > Matt >>>>> > > >>>>> > > Thank you very much in advance, >>>>> > > Jan >>>>> > > >>>>> > > >>>>> > > >>>>> > > -- >>>>> > > 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 >>>>> > > >>>>> > > https://www.cse.buffalo.edu/~knepley/ >>>>> > >>>>> >>>>> >>> >>> -- >>> 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 >>> >>> https://www.cse.buffalo.edu/~knepley/ >>> >>> >> > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From iancclin at umich.edu Wed Oct 24 11:13:27 2018 From: iancclin at umich.edu (Ian Lin) Date: Wed, 24 Oct 2018 12:13:27 -0400 Subject: [petsc-users] Usage of MATMPISBAIJ Message-ID: Hi PETSc team, I am currently thinking of doing a Sparse-Dense matrix matrix multiplication, where the Sparse matrix is a larger symmetric matrix, and the dense matrix is a skinny matrix. The sparse matrix is used mainly because of the memory issue, and the sparsity is just around 10~20%. Thus I am thinking of using MPISBAIJ type to reduce the memory cost. Does MPISBAIJ support MatMatMult with MPIDense matrix? If so, how would the data be distributed over processors? Would it be the same as MPIAIJ (row are by default evenly distributed over processors, but that does not make sense to MPISBAIJ as I suppose the lower part of the matrix is not stored)? Also, just another quick question, in your experience, considering the overhead cost for sparse algorithm, how sparse should a matrix be for the sparse algorithm to outperform dense algorithm in terms of computation time? Thanks a lot for your help. Best regards, Ian From griesser.jan at googlemail.com Wed Oct 24 11:29:49 2018 From: griesser.jan at googlemail.com (=?UTF-8?B?SmFuIEdyaWXDn2Vy?=) Date: Wed, 24 Oct 2018 18:29:49 +0200 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: I also run it with the -log_summary : ---------------------------------------------- PETSc Performance Summary: ---------------------------------------------- ########################################################## # # # WARNING!!! # # # # This code was compiled with a debugging option, # # To get timing results run ./configure # # using --with-debugging=no, the performance will # # be generally two or three times faster. # # # ########################################################## /work/ws/nemo/fr_jg1080-FreeSurface_Glass-0/GlassSystems/PeriodicSystems/N500000T0.001/SolveEigenvalueProblem_par/Test/Eigensolver_petsc_slepc_no_argparse.py on a arch-linux2-c-debug named int02.nemo.privat with 20 processors, by fr_jg1080 Wed Oct 24 18:26:30 2018 Using Petsc Release Version 3.9.4, Sep, 11, 2018 Max Max/Min Avg Total Time (sec): 7.474e+02 1.00000 7.474e+02 Objects: 3.600e+01 1.00000 3.600e+01 Flop: 1.090e+11 1.00346 1.089e+11 2.177e+12 Flop/sec: 1.459e+08 1.00346 1.457e+08 2.913e+09 Memory: 3.950e+08 1.00296 7.891e+09 MPI Messages: 3.808e+04 1.00000 3.808e+04 7.615e+05 MPI Message Lengths: 2.211e+10 1.00217 5.802e+05 4.419e+11 MPI Reductions: 1.023e+05 1.00000 Flop counting convention: 1 flop = 1 real number operation of type (multiply/divide/add/subtract) e.g., VecAXPY() for real vectors of length N --> 2N flop and VecAXPY() for complex vectors of length N --> 8N flop Summary of Stages: ----- Time ------ ----- Flop ----- --- Messages --- -- Message Lengths -- -- Reductions -- Avg %Total Avg %Total counts %Total Avg %Total counts %Total 0: Main Stage: 7.4739e+02 100.0% 2.1773e+12 100.0% 7.615e+05 100.0% 5.802e+05 100.0% 1.022e+05 100.0% ------------------------------------------------------------------------------------------------------------------------ See the 'Profiling' chapter of the users' manual for details on interpreting output. Phase summary info: Count: number of times phase was executed Time and Flop: Max - maximum over all processors Ratio - ratio of maximum to minimum over all processors Mess: number of messages sent Avg. len: average message length (bytes) Reduct: number of global reductions Global: entire computation Stage: stages of a computation. Set stages with PetscLogStagePush() and PetscLogStagePop(). %T - percent time in this phase %F - percent flop in this phase %M - percent messages in this phase %L - percent message lengths in this phase %R - percent reductions in this phase Total Mflop/s: 10e-6 * (sum of flop over all processors)/(max time over all processors) ------------------------------------------------------------------------------------------------------------------------ ########################################################## # # # WARNING!!! # # # # This code was compiled with a debugging option, # # To get timing results run ./configure # # using --with-debugging=no, the performance will # # be generally two or three times faster. # # # ########################################################## Event Count Time (sec) Flop --- Global --- --- Stage --- Total Max Ratio Max Ratio Max Ratio Mess Avg len Reduct %T %F %M %L %R %T %F %M %L %R Mflop/s ------------------------------------------------------------------------------------------------------------------------ --- Event Stage 0: Main Stage BuildTwoSidedF 2 1.0 2.6670e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 VecSet 2 1.0 6.8650e-03 1.8 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 VecScatterBegin 2002 1.0 1.4380e+01 1.0 0.00e+00 0.0 7.6e+05 5.8e+05 0.0e+00 2 0100100 0 2 0100100 0 0 VecScatterEnd 2002 1.0 3.7604e+01 1.5 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 4 0 0 0 0 4 0 0 0 0 0 VecSetRandom 1 1.0 1.6440e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 MatMult 2002 1.0 6.0846e+02 1.2 1.03e+11 1.0 7.6e+05 5.8e+05 0.0e+00 71 94100100 0 71 94100100 0 3376 MatAssemblyBegin 3 1.0 2.8129e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 6.0e+00 0 0 0 0 0 0 0 0 0 0 0 MatAssemblyEnd 3 1.0 8.5094e+00 1.0 0.00e+00 0.0 7.6e+02 1.5e+05 3.6e+01 1 0 0 0 0 1 0 0 0 0 0 EPSSetUp 1 1.0 1.7351e-02 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 7.6e+01 0 0 0 0 0 0 0 0 0 0 0 EPSSolve 1 1.0 6.7891e+02 1.0 1.09e+11 1.0 7.6e+05 5.8e+05 1.0e+05 91100100100100 91100100100100 3207 STSetUp 1 1.0 2.2221e-04 1.3 0.00e+00 0.0 0.0e+00 0.0e+00 6.0e+00 0 0 0 0 0 0 0 0 0 0 0 STApply 2002 1.0 6.0879e+02 1.2 1.03e+11 1.0 7.6e+05 5.8e+05 0.0e+00 71 94100100 0 71 94100100 0 3374 BVCopy 999 1.0 2.7157e-01 1.2 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 BVMultVec 4004 1.0 2.2918e+00 1.0 2.10e+09 1.0 0.0e+00 0.0e+00 1.6e+04 0 2 0 0 16 0 2 0 0 16 18332 BVMultInPlace 999 1.0 4.8399e+01 1.0 1.20e+09 1.0 0.0e+00 0.0e+00 0.0e+00 6 1 0 0 0 6 1 0 0 0 495 BVDotVec 4004 1.0 1.0835e+01 1.0 2.70e+09 1.0 0.0e+00 0.0e+00 2.0e+04 1 2 0 0 20 1 2 0 0 20 4986 BVOrthogonalizeV 2003 1.0 1.3272e+01 1.0 4.80e+09 1.0 0.0e+00 0.0e+00 5.2e+04 2 4 0 0 51 2 4 0 0 51 7236 BVScale 2003 1.0 2.3521e-01 1.0 1.50e+08 1.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 12773 BVSetRandom 1 1.0 1.6456e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 4.0e+00 0 0 0 0 0 0 0 0 0 0 0 DSSolve 1000 1.0 3.3338e+00 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 DSVectors 1000 1.0 6.0029e-03 1.1 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 DSOther 2999 1.0 7.8770e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 ------------------------------------------------------------------------------------------------------------------------ Memory usage is given in bytes: Object Type Creations Destructions Memory Descendants' Mem. Reports information only for process 0. --- Event Stage 0: Main Stage Viewer 2 1 840 0. PetscRandom 1 1 646 0. Index Set 4 4 5510472 0. Vector 9 9 11629608 0. Vec Scatter 2 2 1936 0. Matrix 10 10 331855732 0. Preconditioner 1 1 1000 0. Krylov Solver 1 1 1176 0. EPS Solver 1 1 1600 0. Spectral Transform 2 2 1624 0. Basis Vectors 1 1 2168 0. Direct Solver 1 1 2520 0. Region 1 1 672 0. ======================================================================================================================== Average time to get PetscTime(): 1.19209e-07 Average time for MPI_Barrier(): 2.67982e-05 Average time for zero size MPI_Send(): 1.08957e-05 #PETSc Option Table entries: -bv_type mat -eps_view_pre -log_summary #End of PETSc Option Table entries Compiled without FORTRAN kernels Compiled with full precision matrices (default) sizeof(short) 2 sizeof(int) 4 sizeof(long) 8 sizeof(void*) 8 sizeof(PetscScalar) 8 sizeof(PetscInt) 4 Configure options: --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90 --download-mumps --with-shared-libraries=True --download-scalapack ----------------------------------------- Libraries compiled on 2018-10-17 20:02:31 on login2.nemo.privat Machine characteristics: Linux-3.10.0-693.21.1.el7.x86_64-x86_64-with-centos-7.4.1708-Core Using PETSc directory: /home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4 Using PETSc arch: arch-linux2-c-debug ----------------------------------------- Using C compiler: mpicc -fPIC -wd1572 -g Using Fortran compiler: mpif90 -fPIC -g ----------------------------------------- Using include paths: -I/home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4/include -I/home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4/arch-linux2-c-debug/include ----------------------------------------- Using C linker: mpicc Using Fortran linker: mpif90 Using libraries: -Wl,-rpath,/home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4/arch-linux2-c-debug/lib -L/home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4/arch-linux2-c-debug/lib -lpetsc -Wl,-rpath,/home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4/arch-linux2-c-debug/lib -L/home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4/arch-linux2-c-debug/lib -Wl,-rpath,/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries/linux/mpi/intel64/lib/debug_mt -L/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries/linux/mpi/intel64/lib/debug_mt -Wl,-rpath,/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries/linux/mpi/intel64/lib -L/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries/linux/mpi/intel64/lib -Wl,-rpath,/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries/linux/lib/intel64 -L/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries/linux/lib/intel64 -Wl,-rpath,/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries_2018.3.222/linux/compiler/lib/intel64_lin -L/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries_2018.3.222/linux/compiler/lib/intel64_lin -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 -Wl,-rpath,/opt/intel/mpi-rt/2017.0.0/intel64/lib/debug_mt -Wl,-rpath,/opt/intel/mpi-rt/2017.0.0/intel64/lib -lcmumps -ldmumps -lsmumps -lzmumps -lmumps_common -lpord -lscalapack -llapack -lblas -lX11 -lstdc++ -ldl -lmpifort -lmpi -lmpigi -lrt -lpthread -lifport -lifcoremt_pic -limf -lsvml -lm -lipgo -lirc -lgcc_s -lirc_s -lstdc++ -ldl ----------------------------------------- ########################################################## # # # WARNING!!! # # # # This code was compiled with a debugging option, # # To get timing results run ./configure # # using --with-debugging=no, the performance will # # be generally two or three times faster. # # # ########################################################## Am Mi., 24. Okt. 2018 um 18:07 Uhr schrieb Jan Grie?er < griesser.jan at googlemail.com>: > For some reason i get only this error message, also when is use the > -eps_view_pre. I started the program with nev=1, there the output is (with > -bv_type vecs -bv_type mat -eps_view_pre) > EPS Object: 20 MPI processes > type: krylovschur > 50% of basis vectors kept after restart > using the locking variant > problem type: symmetric eigenvalue problem > selected portion of the spectrum: smallest real parts > number of eigenvalues (nev): 1 > number of column vectors (ncv): 3 > maximum dimension of projected problem (mpd): 2 > maximum number of iterations: 1000 > tolerance: 1e-08 > convergence test: relative to the eigenvalue > BV Object: 20 MPI processes > type: mat > 4 columns of global length 1500000 > vector orthogonalization method: classical Gram-Schmidt > orthogonalization refinement: if needed (eta: 0.7071) > block orthogonalization method: GS > doing matmult as a single matrix-matrix product > DS Object: 20 MPI processes > type: hep > parallel operation mode: REDUNDANT > solving the problem with: Implicit QR method (_steqr) > ST Object: 20 MPI processes > type: shift > shift: 0. > number of matrices: 1 > > > > > Am Mi., 24. Okt. 2018 um 16:14 Uhr schrieb Matthew Knepley < > knepley at gmail.com>: > >> On Wed, Oct 24, 2018 at 10:03 AM Jan Grie?er >> wrote: >> >>> This is the error message i get from my program: >>> Shape of the dynamical matrix: (1500000, 1500000) >>> >> >> Petsc installs a signal handler, so there should be a PETSc-specific >> message before this one. Is something eating >> your output? >> >> Thanks, >> >> Matt >> >> >>> >>> =================================================================================== >>> = BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES >>> = PID 122676 RUNNING AT n3512.nemo.privat >>> = EXIT CODE: 9 >>> = CLEANING UP REMAINING PROCESSES >>> = YOU CAN IGNORE THE BELOW CLEANUP MESSAGES >>> >>> =================================================================================== >>> Intel(R) MPI Library troubleshooting guide: >>> https://software.intel.com/node/561764 >>> >>> =================================================================================== >>> >>> >>> Am Mi., 24. Okt. 2018 um 16:01 Uhr schrieb Matthew Knepley < >>> knepley at gmail.com>: >>> >>>> On Wed, Oct 24, 2018 at 9:38 AM Jan Grie?er < >>>> griesser.jan at googlemail.com> wrote: >>>> >>>>> Hey, >>>>> i tried to run my program as you said with -bv_type vecs and/or >>>>> -bv_type mat, but instead of the PETScInt overflow i now get an MPI Error 9 >>>>> >>>> >>>> Send the actual error. >>>> >>>> Thanks, >>>> >>>> Matt >>>> >>>> >>>>> message, which i assume (after googling a little bit around) should be >>>>> a memory problem. I tried to run it also on slightly bigger compute nodes >>>>> on our cluster with 20 cores with each 12 GB and 24 GB but the problem >>>>> still remains. The actual limit appears to be a 1.5 Million x 1.5 Million >>>>> where i searched for NEV = 1500 and MPD = 500/ 200 eigenvalues. >>>>> Do you have maybe an idea what the error could be? I appended also the >>>>> python method i used to solve the problem. I also tried to solve the >>>>> problem with spectrum solving but the error message remains the same. >>>>> >>>>> def solve_eigensystem(DynMatrix_nn, NEV, MPD, Dimension): >>>>> # Create the solver >>>>> # E is used as an acronym for the EPS solver (EPS = Eigenvalue problem >>>>> solver) >>>>> E = SLEPc.EPS().create() >>>>> >>>>> # Set the preconditioner >>>>> pc = PETSc.PC().create() >>>>> pc.setType(pc.Type.BJACOBI) >>>>> >>>>> # Set the linear solver >>>>> # Create the KSP object >>>>> ksp = PETSc.KSP().create() >>>>> # Create the solver, in this case GMRES >>>>> ksp.setType(ksp.Type.GMRES) >>>>> # Set the tolerances of the GMRES solver >>>>> # Link it to the PC >>>>> ksp.setPC(pc) >>>>> >>>>> # Set up the spectral transformations >>>>> st = SLEPc.ST().create() >>>>> st.setType("shift") >>>>> st.setKSP(ksp) >>>>> # MPD stands for "maximum projected dimension". It has to due with >>>>> computational cost, please read Chap. 2.6.5 of SLEPc docu for >>>>> # an explanation. At the moment mpd is only a guess >>>>> E.setDimensions(nev=NEV, mpd = MPD) >>>>> # Eigenvalues should be real, therefore we start to order them from >>>>> the smallest real value |l.real| >>>>> E.setWhichEigenpairs(E.Which.SMALLEST_REAL) >>>>> # Since the dynamical matrix is symmetric and real it is hermitian >>>>> E.setProblemType(SLEPc.EPS.ProblemType.HEP) >>>>> # Use the Krylov Schur method to solve the eigenvalue problem >>>>> E.setType(E.Type.KRYLOVSCHUR) >>>>> # Set the convergence criterion to relative to the eigenvalue and the >>>>> maximal number of iterations >>>>> E.setConvergenceTest(E.Conv.REL) >>>>> E.setTolerances(tol = 1e-8, max_it = 5000) >>>>> # Set the matrix in order to solve >>>>> E.setOperators(DynMatrix_nn, None) >>>>> # Sets EPS options from the options database. This routine must be >>>>> called before `setUp()` if the user is to be allowed to set dthe solver >>>>> type. >>>>> E.setFromOptions() >>>>> # Sets up all the internal data structures necessary for the execution >>>>> of the eigensolver. >>>>> E.setUp() >>>>> >>>>> # Solve eigenvalue problem >>>>> E.solve() >>>>> >>>>> Print = PETSc.Sys.Print >>>>> >>>>> Print() >>>>> Print("****************************") >>>>> Print("***SLEPc Solution Results***") >>>>> Print("****************************") >>>>> >>>>> its = E.getIterationNumber() >>>>> Print("Number of iterations of the method: ", its) >>>>> eps_type = E.getType() >>>>> Print("Solution method: ", eps_type) >>>>> nev, ncv, mpd = E.getDimensions() >>>>> Print("Number of requested eigenvalues: ", nev) >>>>> Print("Number of computeded eigenvectors: ", ncv) >>>>> tol, maxit = E.getTolerances() >>>>> Print("Stopping condition: (tol, maxit)", (tol, maxit)) >>>>> # Get the type of convergence >>>>> conv_test = E.getConvergenceTest() >>>>> Print("Selected convergence test: ", conv_test) >>>>> # Get the used spectral transformation >>>>> get_st = E.getST() >>>>> Print("Selected spectral transformation: ", get_st) >>>>> # Get the applied direct solver >>>>> get_ksp = E.getDS() >>>>> Print("Selected direct solver: ", get_ksp) >>>>> nconv = E.getConverged() >>>>> Print("Number of converged eigenpairs: ", nconv) >>>>> ..... >>>>> >>>>> >>>>> >>>>> Am Fr., 19. Okt. 2018 um 21:00 Uhr schrieb Smith, Barry F. < >>>>> bsmith at mcs.anl.gov>: >>>>> >>>>>> >>>>>> >>>>>> > On Oct 19, 2018, at 7:56 AM, Zhang, Junchao >>>>>> wrote: >>>>>> > >>>>>> > >>>>>> > On Fri, Oct 19, 2018 at 4:02 AM Jan Grie?er < >>>>>> griesser.jan at googlemail.com> wrote: >>>>>> > With more than 1 MPI process you mean i should use spectrum slicing >>>>>> in divide the full problem in smaller subproblems? >>>>>> > The --with-64-bit-indices is not a possibility for me since i >>>>>> configured petsc with mumps, which does not allow to use the 64-bit version >>>>>> (At least this was the error message when i tried to configure PETSc ) >>>>>> > >>>>>> > MUMPS 5.1.2 manual chapter 2.4.2 says it supports "Selective 64-bit >>>>>> integer feature" and "full 64-bit integer version" as well. >>>>>> >>>>>> They use to achieve this by compiling with special Fortran flags >>>>>> to promote integers to 64 bit; this is too fragile for our taste so we >>>>>> never hooked PETSc up wit it. If they have a dependable way of using 64 bit >>>>>> integers we should add that to our mumps.py and test it. >>>>>> >>>>>> Barry >>>>>> >>>>>> > >>>>>> > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman < >>>>>> jroman at dsic.upv.es>: >>>>>> > To use BVVECS just add the command-line option -bv_type vecs >>>>>> > This causes to use a separate Vec for each column, instead of a >>>>>> single long Vec of size n*m. But it is considerably slower than the default. >>>>>> > >>>>>> > Anyway, for such large problems you should consider using more than >>>>>> 1 MPI process. In that case the error may disappear because the local size >>>>>> is smaller than 768000. >>>>>> > >>>>>> > Jose >>>>>> > >>>>>> > >>>>>> > > El 17 oct 2018, a las 17:58, Matthew Knepley >>>>>> escribi?: >>>>>> > > >>>>>> > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er < >>>>>> griesser.jan at googlemail.com> wrote: >>>>>> > > Hi all, >>>>>> > > i am using slepc4py and petsc4py to solve for the smallest real >>>>>> eigenvalues and eigenvectors. For my test cases with a matrix A of the size >>>>>> 30k x 30k solving for the smallest soutions works quite well, but when i >>>>>> increase the dimension of my system to around A = 768000 x 768000 or 3 >>>>>> million x 3 million and ask for the smallest real 3000 (the number is >>>>>> increasing with increasing system size) eigenvalues and eigenvectors i get >>>>>> the output (for the 768000): >>>>>> > > The product 4001 times 768000 overflows the size of PetscInt; >>>>>> consider reducing the number of columns, or use BVVECS instead >>>>>> > > i understand that the requested number of eigenvectors and >>>>>> eigenvalues is causing an overflow but i do not understand the solution of >>>>>> the problem which is stated in the error message. Can someone tell me what >>>>>> exactly BVVECS is and how i can use it? Or is there any other solution to >>>>>> my problem ? >>>>>> > > >>>>>> > > You can also reconfigure with 64-bit integers: >>>>>> --with-64-bit-indices >>>>>> > > >>>>>> > > Thanks, >>>>>> > > >>>>>> > > Matt >>>>>> > > >>>>>> > > Thank you very much in advance, >>>>>> > > Jan >>>>>> > > >>>>>> > > >>>>>> > > >>>>>> > > -- >>>>>> > > 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 >>>>>> > > >>>>>> > > https://www.cse.buffalo.edu/~knepley/ >>>>>> > >>>>>> >>>>>> >>>> >>>> -- >>>> 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 >>>> >>>> https://www.cse.buffalo.edu/~knepley/ >>>> >>>> >>> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Wed Oct 24 11:46:34 2018 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 24 Oct 2018 12:46:34 -0400 Subject: [petsc-users] PetscInt overflow In-Reply-To: References: <97941479-55EC-4D8B-B8D4-13675EBBF628@dsic.upv.es> Message-ID: As it says, if you are looking at performance, you should configure using --with-debugging=0. It says SLEPc is using 8GB. Is this what you see? Matt On Wed, Oct 24, 2018 at 12:30 PM Jan Grie?er wrote: > I also run it with the -log_summary : > ---------------------------------------------- PETSc Performance Summary: > ---------------------------------------------- > > > > ########################################################## > # # > # WARNING!!! # > # # > # This code was compiled with a debugging option, # > # To get timing results run ./configure # > # using --with-debugging=no, the performance will # > # be generally two or three times faster. # > # # > ########################################################## > > > /work/ws/nemo/fr_jg1080-FreeSurface_Glass-0/GlassSystems/PeriodicSystems/N500000T0.001/SolveEigenvalueProblem_par/Test/Eigensolver_petsc_slepc_no_argparse.py > on a arch-linux2-c-debug named int02.nemo.privat with 20 processors, by > fr_jg1080 Wed Oct 24 18:26:30 2018 > Using Petsc Release Version 3.9.4, Sep, 11, 2018 > > Max Max/Min Avg Total > Time (sec): 7.474e+02 1.00000 7.474e+02 > Objects: 3.600e+01 1.00000 3.600e+01 > Flop: 1.090e+11 1.00346 1.089e+11 2.177e+12 > Flop/sec: 1.459e+08 1.00346 1.457e+08 2.913e+09 > Memory: 3.950e+08 1.00296 7.891e+09 > MPI Messages: 3.808e+04 1.00000 3.808e+04 7.615e+05 > MPI Message Lengths: 2.211e+10 1.00217 5.802e+05 4.419e+11 > MPI Reductions: 1.023e+05 1.00000 > > Flop counting convention: 1 flop = 1 real number operation of type > (multiply/divide/add/subtract) > e.g., VecAXPY() for real vectors of length N > --> 2N flop > and VecAXPY() for complex vectors of length N > --> 8N flop > > Summary of Stages: ----- Time ------ ----- Flop ----- --- Messages > --- -- Message Lengths -- -- Reductions -- > Avg %Total Avg %Total counts > %Total Avg %Total counts %Total > 0: Main Stage: 7.4739e+02 100.0% 2.1773e+12 100.0% 7.615e+05 > 100.0% 5.802e+05 100.0% 1.022e+05 100.0% > > > ------------------------------------------------------------------------------------------------------------------------ > See the 'Profiling' chapter of the users' manual for details on > interpreting output. > Phase summary info: > Count: number of times phase was executed > Time and Flop: Max - maximum over all processors > Ratio - ratio of maximum to minimum over all processors > Mess: number of messages sent > Avg. len: average message length (bytes) > Reduct: number of global reductions > Global: entire computation > Stage: stages of a computation. Set stages with PetscLogStagePush() and > PetscLogStagePop(). > %T - percent time in this phase %F - percent flop in this > phase > %M - percent messages in this phase %L - percent message lengths > in this phase > %R - percent reductions in this phase > Total Mflop/s: 10e-6 * (sum of flop over all processors)/(max time over > all processors) > > ------------------------------------------------------------------------------------------------------------------------ > > > ########################################################## > # # > # WARNING!!! # > # # > # This code was compiled with a debugging option, # > # To get timing results run ./configure # > # using --with-debugging=no, the performance will # > # be generally two or three times faster. # > # # > ########################################################## > > > Event Count Time (sec) Flop > --- Global --- --- Stage --- Total > Max Ratio Max Ratio Max Ratio Mess Avg len > Reduct %T %F %M %L %R %T %F %M %L %R Mflop/s > > ------------------------------------------------------------------------------------------------------------------------ > > --- Event Stage 0: Main Stage > > BuildTwoSidedF 2 1.0 2.6670e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 > 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 > VecSet 2 1.0 6.8650e-03 1.8 0.00e+00 0.0 0.0e+00 0.0e+00 > 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 > VecScatterBegin 2002 1.0 1.4380e+01 1.0 0.00e+00 0.0 7.6e+05 5.8e+05 > 0.0e+00 2 0100100 0 2 0100100 0 0 > VecScatterEnd 2002 1.0 3.7604e+01 1.5 0.00e+00 0.0 0.0e+00 0.0e+00 > 0.0e+00 4 0 0 0 0 4 0 0 0 0 0 > VecSetRandom 1 1.0 1.6440e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 > 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 > MatMult 2002 1.0 6.0846e+02 1.2 1.03e+11 1.0 7.6e+05 5.8e+05 > 0.0e+00 71 94100100 0 71 94100100 0 3376 > MatAssemblyBegin 3 1.0 2.8129e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 > 6.0e+00 0 0 0 0 0 0 0 0 0 0 0 > MatAssemblyEnd 3 1.0 8.5094e+00 1.0 0.00e+00 0.0 7.6e+02 1.5e+05 > 3.6e+01 1 0 0 0 0 1 0 0 0 0 0 > EPSSetUp 1 1.0 1.7351e-02 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 > 7.6e+01 0 0 0 0 0 0 0 0 0 0 0 > EPSSolve 1 1.0 6.7891e+02 1.0 1.09e+11 1.0 7.6e+05 5.8e+05 > 1.0e+05 91100100100100 91100100100100 3207 > STSetUp 1 1.0 2.2221e-04 1.3 0.00e+00 0.0 0.0e+00 0.0e+00 > 6.0e+00 0 0 0 0 0 0 0 0 0 0 0 > STApply 2002 1.0 6.0879e+02 1.2 1.03e+11 1.0 7.6e+05 5.8e+05 > 0.0e+00 71 94100100 0 71 94100100 0 3374 > BVCopy 999 1.0 2.7157e-01 1.2 0.00e+00 0.0 0.0e+00 0.0e+00 > 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 > BVMultVec 4004 1.0 2.2918e+00 1.0 2.10e+09 1.0 0.0e+00 0.0e+00 > 1.6e+04 0 2 0 0 16 0 2 0 0 16 18332 > BVMultInPlace 999 1.0 4.8399e+01 1.0 1.20e+09 1.0 0.0e+00 0.0e+00 > 0.0e+00 6 1 0 0 0 6 1 0 0 0 495 > BVDotVec 4004 1.0 1.0835e+01 1.0 2.70e+09 1.0 0.0e+00 0.0e+00 > 2.0e+04 1 2 0 0 20 1 2 0 0 20 4986 > BVOrthogonalizeV 2003 1.0 1.3272e+01 1.0 4.80e+09 1.0 0.0e+00 0.0e+00 > 5.2e+04 2 4 0 0 51 2 4 0 0 51 7236 > BVScale 2003 1.0 2.3521e-01 1.0 1.50e+08 1.0 0.0e+00 0.0e+00 > 0.0e+00 0 0 0 0 0 0 0 0 0 0 12773 > BVSetRandom 1 1.0 1.6456e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 > 4.0e+00 0 0 0 0 0 0 0 0 0 0 0 > DSSolve 1000 1.0 3.3338e+00 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 > 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 > DSVectors 1000 1.0 6.0029e-03 1.1 0.00e+00 0.0 0.0e+00 0.0e+00 > 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 > DSOther 2999 1.0 7.8770e-01 1.0 0.00e+00 0.0 0.0e+00 0.0e+00 > 0.0e+00 0 0 0 0 0 0 0 0 0 0 0 > > ------------------------------------------------------------------------------------------------------------------------ > > Memory usage is given in bytes: > > Object Type Creations Destructions Memory Descendants' Mem. > Reports information only for process 0. > > --- Event Stage 0: Main Stage > > Viewer 2 1 840 0. > PetscRandom 1 1 646 0. > Index Set 4 4 5510472 0. > Vector 9 9 11629608 0. > Vec Scatter 2 2 1936 0. > Matrix 10 10 331855732 0. > Preconditioner 1 1 1000 0. > Krylov Solver 1 1 1176 0. > EPS Solver 1 1 1600 0. > Spectral Transform 2 2 1624 0. > Basis Vectors 1 1 2168 0. > Direct Solver 1 1 2520 0. > Region 1 1 672 0. > > ======================================================================================================================== > Average time to get PetscTime(): 1.19209e-07 > Average time for MPI_Barrier(): 2.67982e-05 > Average time for zero size MPI_Send(): 1.08957e-05 > #PETSc Option Table entries: > -bv_type mat > -eps_view_pre > -log_summary > #End of PETSc Option Table entries > Compiled without FORTRAN kernels > Compiled with full precision matrices (default) > sizeof(short) 2 sizeof(int) 4 sizeof(long) 8 sizeof(void*) 8 > sizeof(PetscScalar) 8 sizeof(PetscInt) 4 > Configure options: --with-cc=mpicc --with-cxx=mpicxx --with-fc=mpif90 > --download-mumps --with-shared-libraries=True --download-scalapack > ----------------------------------------- > Libraries compiled on 2018-10-17 20:02:31 on login2.nemo.privat > Machine characteristics: > Linux-3.10.0-693.21.1.el7.x86_64-x86_64-with-centos-7.4.1708-Core > Using PETSc directory: /home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4 > Using PETSc arch: arch-linux2-c-debug > ----------------------------------------- > > Using C compiler: mpicc -fPIC -wd1572 -g > Using Fortran compiler: mpif90 -fPIC -g > ----------------------------------------- > > Using include paths: > -I/home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4/include > -I/home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4/arch-linux2-c-debug/include > ----------------------------------------- > > Using C linker: mpicc > Using Fortran linker: mpif90 > Using libraries: > -Wl,-rpath,/home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4/arch-linux2-c-debug/lib > -L/home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4/arch-linux2-c-debug/lib > -lpetsc > -Wl,-rpath,/home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4/arch-linux2-c-debug/lib > -L/home/fr/fr_fr/fr_jg1080/Libaries/petsc-3.9.4/arch-linux2-c-debug/lib > -Wl,-rpath,/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries/linux/mpi/intel64/lib/debug_mt > -L/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries/linux/mpi/intel64/lib/debug_mt > -Wl,-rpath,/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries/linux/mpi/intel64/lib > -L/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries/linux/mpi/intel64/lib > -Wl,-rpath,/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries/linux/lib/intel64 > -L/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries/linux/lib/intel64 > -Wl,-rpath,/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries_2018.3.222/linux/compiler/lib/intel64_lin > -L/opt/bwhpc/common/compiler/intel/2018.3.222/compilers_and_libraries_2018.3.222/linux/compiler/lib/intel64_lin > -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.8.5 > -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5 > -Wl,-rpath,/opt/intel/mpi-rt/2017.0.0/intel64/lib/debug_mt > -Wl,-rpath,/opt/intel/mpi-rt/2017.0.0/intel64/lib -lcmumps -ldmumps > -lsmumps -lzmumps -lmumps_common -lpord -lscalapack -llapack -lblas -lX11 > -lstdc++ -ldl -lmpifort -lmpi -lmpigi -lrt -lpthread -lifport > -lifcoremt_pic -limf -lsvml -lm -lipgo -lirc -lgcc_s -lirc_s -lstdc++ -ldl > ----------------------------------------- > > > > ########################################################## > # # > # WARNING!!! # > # # > # This code was compiled with a debugging option, # > # To get timing results run ./configure # > # using --with-debugging=no, the performance will # > # be generally two or three times faster. # > # # > ########################################################## > > > Am Mi., 24. Okt. 2018 um 18:07 Uhr schrieb Jan Grie?er < > griesser.jan at googlemail.com>: > >> For some reason i get only this error message, also when is use the >> -eps_view_pre. I started the program with nev=1, there the output is (with >> -bv_type vecs -bv_type mat -eps_view_pre) >> EPS Object: 20 MPI processes >> type: krylovschur >> 50% of basis vectors kept after restart >> using the locking variant >> problem type: symmetric eigenvalue problem >> selected portion of the spectrum: smallest real parts >> number of eigenvalues (nev): 1 >> number of column vectors (ncv): 3 >> maximum dimension of projected problem (mpd): 2 >> maximum number of iterations: 1000 >> tolerance: 1e-08 >> convergence test: relative to the eigenvalue >> BV Object: 20 MPI processes >> type: mat >> 4 columns of global length 1500000 >> vector orthogonalization method: classical Gram-Schmidt >> orthogonalization refinement: if needed (eta: 0.7071) >> block orthogonalization method: GS >> doing matmult as a single matrix-matrix product >> DS Object: 20 MPI processes >> type: hep >> parallel operation mode: REDUNDANT >> solving the problem with: Implicit QR method (_steqr) >> ST Object: 20 MPI processes >> type: shift >> shift: 0. >> number of matrices: 1 >> >> >> >> >> Am Mi., 24. Okt. 2018 um 16:14 Uhr schrieb Matthew Knepley < >> knepley at gmail.com>: >> >>> On Wed, Oct 24, 2018 at 10:03 AM Jan Grie?er < >>> griesser.jan at googlemail.com> wrote: >>> >>>> This is the error message i get from my program: >>>> Shape of the dynamical matrix: (1500000, 1500000) >>>> >>> >>> Petsc installs a signal handler, so there should be a PETSc-specific >>> message before this one. Is something eating >>> your output? >>> >>> Thanks, >>> >>> Matt >>> >>> >>>> >>>> =================================================================================== >>>> = BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES >>>> = PID 122676 RUNNING AT n3512.nemo.privat >>>> = EXIT CODE: 9 >>>> = CLEANING UP REMAINING PROCESSES >>>> = YOU CAN IGNORE THE BELOW CLEANUP MESSAGES >>>> >>>> =================================================================================== >>>> Intel(R) MPI Library troubleshooting guide: >>>> https://software.intel.com/node/561764 >>>> >>>> =================================================================================== >>>> >>>> >>>> Am Mi., 24. Okt. 2018 um 16:01 Uhr schrieb Matthew Knepley < >>>> knepley at gmail.com>: >>>> >>>>> On Wed, Oct 24, 2018 at 9:38 AM Jan Grie?er < >>>>> griesser.jan at googlemail.com> wrote: >>>>> >>>>>> Hey, >>>>>> i tried to run my program as you said with -bv_type vecs and/or >>>>>> -bv_type mat, but instead of the PETScInt overflow i now get an MPI Error 9 >>>>>> >>>>> >>>>> Send the actual error. >>>>> >>>>> Thanks, >>>>> >>>>> Matt >>>>> >>>>> >>>>>> message, which i assume (after googling a little bit around) should >>>>>> be a memory problem. I tried to run it also on slightly bigger compute >>>>>> nodes on our cluster with 20 cores with each 12 GB and 24 GB but the >>>>>> problem still remains. The actual limit appears to be a 1.5 Million x 1.5 >>>>>> Million where i searched for NEV = 1500 and MPD = 500/ 200 eigenvalues. >>>>>> Do you have maybe an idea what the error could be? I appended also >>>>>> the python method i used to solve the problem. I also tried to solve the >>>>>> problem with spectrum solving but the error message remains the same. >>>>>> >>>>>> def solve_eigensystem(DynMatrix_nn, NEV, MPD, Dimension): >>>>>> # Create the solver >>>>>> # E is used as an acronym for the EPS solver (EPS = Eigenvalue >>>>>> problem solver) >>>>>> E = SLEPc.EPS().create() >>>>>> >>>>>> # Set the preconditioner >>>>>> pc = PETSc.PC().create() >>>>>> pc.setType(pc.Type.BJACOBI) >>>>>> >>>>>> # Set the linear solver >>>>>> # Create the KSP object >>>>>> ksp = PETSc.KSP().create() >>>>>> # Create the solver, in this case GMRES >>>>>> ksp.setType(ksp.Type.GMRES) >>>>>> # Set the tolerances of the GMRES solver >>>>>> # Link it to the PC >>>>>> ksp.setPC(pc) >>>>>> >>>>>> # Set up the spectral transformations >>>>>> st = SLEPc.ST().create() >>>>>> st.setType("shift") >>>>>> st.setKSP(ksp) >>>>>> # MPD stands for "maximum projected dimension". It has to due with >>>>>> computational cost, please read Chap. 2.6.5 of SLEPc docu for >>>>>> # an explanation. At the moment mpd is only a guess >>>>>> E.setDimensions(nev=NEV, mpd = MPD) >>>>>> # Eigenvalues should be real, therefore we start to order them from >>>>>> the smallest real value |l.real| >>>>>> E.setWhichEigenpairs(E.Which.SMALLEST_REAL) >>>>>> # Since the dynamical matrix is symmetric and real it is hermitian >>>>>> E.setProblemType(SLEPc.EPS.ProblemType.HEP) >>>>>> # Use the Krylov Schur method to solve the eigenvalue problem >>>>>> E.setType(E.Type.KRYLOVSCHUR) >>>>>> # Set the convergence criterion to relative to the eigenvalue and the >>>>>> maximal number of iterations >>>>>> E.setConvergenceTest(E.Conv.REL) >>>>>> E.setTolerances(tol = 1e-8, max_it = 5000) >>>>>> # Set the matrix in order to solve >>>>>> E.setOperators(DynMatrix_nn, None) >>>>>> # Sets EPS options from the options database. This routine must be >>>>>> called before `setUp()` if the user is to be allowed to set dthe solver >>>>>> type. >>>>>> E.setFromOptions() >>>>>> # Sets up all the internal data structures necessary for the >>>>>> execution of the eigensolver. >>>>>> E.setUp() >>>>>> >>>>>> # Solve eigenvalue problem >>>>>> E.solve() >>>>>> >>>>>> Print = PETSc.Sys.Print >>>>>> >>>>>> Print() >>>>>> Print("****************************") >>>>>> Print("***SLEPc Solution Results***") >>>>>> Print("****************************") >>>>>> >>>>>> its = E.getIterationNumber() >>>>>> Print("Number of iterations of the method: ", its) >>>>>> eps_type = E.getType() >>>>>> Print("Solution method: ", eps_type) >>>>>> nev, ncv, mpd = E.getDimensions() >>>>>> Print("Number of requested eigenvalues: ", nev) >>>>>> Print("Number of computeded eigenvectors: ", ncv) >>>>>> tol, maxit = E.getTolerances() >>>>>> Print("Stopping condition: (tol, maxit)", (tol, maxit)) >>>>>> # Get the type of convergence >>>>>> conv_test = E.getConvergenceTest() >>>>>> Print("Selected convergence test: ", conv_test) >>>>>> # Get the used spectral transformation >>>>>> get_st = E.getST() >>>>>> Print("Selected spectral transformation: ", get_st) >>>>>> # Get the applied direct solver >>>>>> get_ksp = E.getDS() >>>>>> Print("Selected direct solver: ", get_ksp) >>>>>> nconv = E.getConverged() >>>>>> Print("Number of converged eigenpairs: ", nconv) >>>>>> ..... >>>>>> >>>>>> >>>>>> >>>>>> Am Fr., 19. Okt. 2018 um 21:00 Uhr schrieb Smith, Barry F. < >>>>>> bsmith at mcs.anl.gov>: >>>>>> >>>>>>> >>>>>>> >>>>>>> > On Oct 19, 2018, at 7:56 AM, Zhang, Junchao >>>>>>> wrote: >>>>>>> > >>>>>>> > >>>>>>> > On Fri, Oct 19, 2018 at 4:02 AM Jan Grie?er < >>>>>>> griesser.jan at googlemail.com> wrote: >>>>>>> > With more than 1 MPI process you mean i should use spectrum >>>>>>> slicing in divide the full problem in smaller subproblems? >>>>>>> > The --with-64-bit-indices is not a possibility for me since i >>>>>>> configured petsc with mumps, which does not allow to use the 64-bit version >>>>>>> (At least this was the error message when i tried to configure PETSc ) >>>>>>> > >>>>>>> > MUMPS 5.1.2 manual chapter 2.4.2 says it supports "Selective >>>>>>> 64-bit integer feature" and "full 64-bit integer version" as well. >>>>>>> >>>>>>> They use to achieve this by compiling with special Fortran flags >>>>>>> to promote integers to 64 bit; this is too fragile for our taste so we >>>>>>> never hooked PETSc up wit it. If they have a dependable way of using 64 bit >>>>>>> integers we should add that to our mumps.py and test it. >>>>>>> >>>>>>> Barry >>>>>>> >>>>>>> > >>>>>>> > Am Mi., 17. Okt. 2018 um 18:24 Uhr schrieb Jose E. Roman < >>>>>>> jroman at dsic.upv.es>: >>>>>>> > To use BVVECS just add the command-line option -bv_type vecs >>>>>>> > This causes to use a separate Vec for each column, instead of a >>>>>>> single long Vec of size n*m. But it is considerably slower than the default. >>>>>>> > >>>>>>> > Anyway, for such large problems you should consider using more >>>>>>> than 1 MPI process. In that case the error may disappear because the local >>>>>>> size is smaller than 768000. >>>>>>> > >>>>>>> > Jose >>>>>>> > >>>>>>> > >>>>>>> > > El 17 oct 2018, a las 17:58, Matthew Knepley >>>>>>> escribi?: >>>>>>> > > >>>>>>> > > On Wed, Oct 17, 2018 at 11:54 AM Jan Grie?er < >>>>>>> griesser.jan at googlemail.com> wrote: >>>>>>> > > Hi all, >>>>>>> > > i am using slepc4py and petsc4py to solve for the smallest real >>>>>>> eigenvalues and eigenvectors. For my test cases with a matrix A of the size >>>>>>> 30k x 30k solving for the smallest soutions works quite well, but when i >>>>>>> increase the dimension of my system to around A = 768000 x 768000 or 3 >>>>>>> million x 3 million and ask for the smallest real 3000 (the number is >>>>>>> increasing with increasing system size) eigenvalues and eigenvectors i get >>>>>>> the output (for the 768000): >>>>>>> > > The product 4001 times 768000 overflows the size of PetscInt; >>>>>>> consider reducing the number of columns, or use BVVECS instead >>>>>>> > > i understand that the requested number of eigenvectors and >>>>>>> eigenvalues is causing an overflow but i do not understand the solution of >>>>>>> the problem which is stated in the error message. Can someone tell me what >>>>>>> exactly BVVECS is and how i can use it? Or is there any other solution to >>>>>>> my problem ? >>>>>>> > > >>>>>>> > > You can also reconfigure with 64-bit integers: >>>>>>> --with-64-bit-indices >>>>>>> > > >>>>>>> > > Thanks, >>>>>>> > > >>>>>>> > > Matt >>>>>>> > > >>>>>>> > > Thank you very much in advance, >>>>>>> > > Jan >>>>>>> > > >>>>>>> > > >>>>>>> > > >>>>>>> > > -- >>>>>>> > > 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 >>>>>>> > > >>>>>>> > > https://www.cse.buffalo.edu/~knepley/ >>>>>>> > >>>>>>> >>>>>>> >>>>> >>>>> -- >>>>> 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 >>>>> >>>>> https://www.cse.buffalo.edu/~knepley/ >>>>> >>>>> >>>> >>> >>> -- >>> 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 >>> >>> https://www.cse.buffalo.edu/~knepley/ >>> >>> >> -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From hzhang at mcs.anl.gov Wed Oct 24 11:49:34 2018 From: hzhang at mcs.anl.gov (Zhang, Hong) Date: Wed, 24 Oct 2018 16:49:34 +0000 Subject: [petsc-users] Usage of MATMPISBAIJ In-Reply-To: References: Message-ID: Ian: I am currently thinking of doing a Sparse-Dense matrix matrix multiplication, where the Sparse matrix is a larger symmetric matrix, and the dense matrix is a skinny matrix. The sparse matrix is used mainly because of the memory issue, and the sparsity is just around 10~20%. Thus I am thinking of using MPISBAIJ type to reduce the memory cost. Does MPISBAIJ support MatMatMult with MPIDense matrix? If so, how would the data be distributed over processors? Would it be the same as MPIAIJ (row are by default evenly distributed over processors, but that does not make sense to MPISBAIJ as I suppose the lower part of the matrix is not stored)? We do not support MatMatMult with MPISBAIJ and MPIDense matrix, only MPIAIJ and MPIDense matrix. Also, just another quick question, in your experience, considering the overhead cost for sparse algorithm, how sparse should a matrix be for the sparse algorithm to outperform dense algorithm in terms of computation time? Sparse matrix normally is defined as the sparsity less than 10%, or less than 1%. I would consider 20% as a dense matrix. The complexity of C=A*B is O(nnzA*nnzB), nnzA = num of nonzeros of A. Hong -------------- next part -------------- An HTML attachment was scrubbed... URL: From abdullahasivas at gmail.com Wed Oct 24 12:59:23 2018 From: abdullahasivas at gmail.com (Abdullah Ali Sivas) Date: Wed, 24 Oct 2018 13:59:23 -0400 Subject: [petsc-users] Using BDDC preconditioner for assembled matrices In-Reply-To: References: <87sh0w5915.fsf@jedbrown.org> Message-ID: Hi Stefano, I am trying to solve the div-div problem (or grad-div problem in strong form) with a H(div)-conforming FEM. I am getting the matrices from an external source (to be clear, from an ngsolve script) and I am not sure if it is possible to get a MATIS matrix out of that. So I am just treating it as if I am not able to access the assembly code. The results are 2, 31, 26, 27, 31 iterations, respectively, for matrix sizes 282, 1095, 4314, 17133, 67242, 267549. However, norm of the residual also grows significantly; 7.38369e-09 for 1095 and 5.63828e-07 for 267549. I can try larger sizes, or maybe this is expected for this case. As a side question, if we are dividing the domain into number of MPI processes subdomains, does it mean that convergence is affected negatively by the increasing number of processes? I know that alternating Schwarz method and some other domain decomposition methods sometimes suffer from the decreasing radius of the subdomains. It sounds like BDDC is pretty similar to those by your description. Best wishes, Abdullah Ali Sivas On Wed, 24 Oct 2018 at 05:28, Stefano Zampini wrote: > Abdullah, > > The "Neumann" problems Jed is referring to result from assembling your > problem on each subdomain ( = MPI process) separately. > Assuming you are using FEM, these problems have been historically named > "Neumann" as they correspond to a problem with natural boundary conditions > (Neumann bc for Poisson). > Note that in PETSc the subdomain decomposition is associated with the mesh > decomposition. > > When converting from an assembled AIJ matrix to a MATIS format, such > "Neumann" information is lost. > You can disassemble an AIJ matrix, in the sense that you can find local > matrices A_j such that A = \sum_j R^T_j A_j R_j (as it is done in ex72.c), > but you cannot guarantee (unless if you solve an optimization problem) that > the disassembling will produce subdomain Neumann problems that are > consistent with your FEM problem. > > I have added such disassembling code a few months ago, just to have > another alternative for preconditioning AIJ matrices in PETSc; there are > few tweaks one can do to improve the quality of the disassembling, but I > discourage its usage unless you don't have access to the FEM assembly code. > > With that said, what problem are you trying to solve? Are you using DMDA > or DMPlex? What are the results you obtained with using the automatic > disassembling? > > Il giorno mer 24 ott 2018 alle ore 08:14 Abdullah Ali Sivas < > abdullahasivas at gmail.com> ha scritto: > >> Hi Jed, >> >> Thanks for your reply. The assembled matrix I have corresponds to the >> full problem on the full mesh. There are no "Neumann" problems (or any sort >> of domain decomposition) defined in the code generates the matrix. However, >> I think assembling the full problem is equivalent to implicitly assembling >> the "Neumann" problems, since the system can be partitioned as; >> >> [A_{LL} | A_{LI}] [u_L] [F] >> -----------|------------ -------- = ----- >> [A_{IL} |A_{II} ] [u_I] [G] >> >> and G should correspond to the Neumann problem. I might be thinking wrong >> (or maybe I completely misunderstood the idea), if so please correct me. >> But I think that the problem is that I am not explicitly telling PCBDDC >> which dofs are interface dofs. >> >> Regards, >> Abdullah Ali Sivas >> >> On Tue, 23 Oct 2018 at 23:16, Jed Brown wrote: >> >>> Did you assemble "Neumann" problems that are compatible with your >>> definition of interior/interface degrees of freedom? >>> >>> Abdullah Ali Sivas writes: >>> >>> > Dear all, >>> > >>> > I have a series of linear systems coming from a PDE for which BDDC is >>> an >>> > optimal preconditioner. These linear systems are assembled and I read >>> them >>> > from a file, then convert into MATIS as required (as in >>> > >>> https://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex72.c.html >>> > ). I expect each of the systems converge to the solution in almost same >>> > number of iterations but I don't observe it. I think it is because I >>> do not >>> > provide enough information to the preconditioner. I can get a list of >>> inner >>> > dofs and interface dofs. However, I do not know how to use them. Has >>> anyone >>> > have any insights about it or done something similar? >>> > >>> > Best wishes, >>> > Abdullah Ali Sivas >>> >> > > -- > Stefano > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Wed Oct 24 13:04:01 2018 From: knepley at gmail.com (Matthew Knepley) Date: Wed, 24 Oct 2018 14:04:01 -0400 Subject: [petsc-users] Periodic BC in petsc DMPlex / firedrake In-Reply-To: <6E65EDD0-AB80-4FE5-AF9F-49B9D4D8B9E3@gmail.com> References: <2D9A9125-F4A2-4A50-A5F9-4D7C9B86B540@gmail.com> <2852F36F-0CB0-4737-A489-38A476FDAEF2@gmx.li> <6E65EDD0-AB80-4FE5-AF9F-49B9D4D8B9E3@gmail.com> Message-ID: On Wed, Oct 24, 2018 at 11:36 AM Maximilian Hartig wrote: > > > On 24. Oct 2018, at 12:49, Matthew Knepley wrote: > > On Wed, Oct 24, 2018 at 6:29 AM Lawrence Mitchell wrote: > >> Hi Max, >> >> (I'm cc'ing in the petsc-users mailing list which may have more advice, >> if you are using PETSc you should definitely subscribe! >> >> > On 24 Oct 2018, at 09:27, Maximilian Hartig >> wrote: >> > >> > Hello Lawrence, >> > >> > sorry to message you out of the blue. My name is Max and I found your >> post on GitHub (https://github.com/firedrakeproject/firedrake/issues/1246 >> ) on DMPlex being able to read periodic gmsh files. I am currently >> trying to do just that (creating a periodic DMPlex mesh with gmsh) in the >> context of my PhD work. So far I haven? t found any documentation on the >> periodic BC?s with DMPlex and gmsh in the official petsc documentation. >> > I was wondering whether you?d be so kind as to point me in a general >> direction concerning how to achieve this. You seem experienced in using >> petsc and I would greatly appreciate your help. >> >> >> I think the answer is "it depends". If you're just using DMPlex directly >> and all the of the functionality with PetscDS, then I /think/ that reading >> periodic meshes via gmsh (assuming you're using the appropriate gmsh mesh >> format [v2]) "just works". >> > > There are two phases here: topological and geometric. DMPlex represents > the periodic topological entity directly. For example, a circle is just a > segment with one end hooked to the other. Vertices are not duplicated, or > mapped to each other. This makes topology simple and easy to implement. > However, then geometry is more complicated. What Plex does is allow > coordinates to be represented by a discontinuous field taking values on > cells, in addition to vertices. In our circle example, each cells near the > cut will have 2 coordinates, one for each vertex, but they will not agree > across the cut. If you define a periodic domain, then Plex can construct > this coordinate field automatically using DMPlexLocalize(). These DG > coordinates are then used by the integration routines. > > > Ok, I think I understand the concept. DMPlex reads information about both > topology and coordinates from the .msh file. Creating a periodic mesh in > gmsh then should allow DMPlex to identify the periodic boundaries as the > ?cut? and build the mesh topology accordingly. Coordinate information is > handled separately. > That means, as Lawrence suggested, building periodic meshes in gmsh and > reading them in to petsc?s DMPlex should indeed ?just work?. (From the > user perspective). The only extra step is to call DMLocalizeCoordinates() > after DMPlexReadFromFile(). Sorry to reiterate, I am just trying to make > sense of this. > > > >> From my side, the issue is to do with mapping that coordinate field into >> one that I understand (within Firedrake). You may not have this problem. >> > > Firedrake uses its own coordinate mapping and integration routines, so > they must manage the second part independently. I hope to get change this > slightly soon by making the Firedrake representation a DMField, so that it > looks the same to Plex. > > Thanks, > > Matt > > >> Thanks, >> >> Lawrence > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > > To read periodic meshes from GMSH, you need to use the option > -dm_plex_gmsh_periodic and DMPlexCreateFromFile > > > Ahh, thanks. I was missing the option " -dm_plex_gmsh_periodic ?. But > using this option I now generate a segmentation fault error when calling > VecView() on the solution vector with vtk and hdf5 viewers. Any suggestions? > Small example? VTK is deprecated. HDF5 should work, although it will require you to have proper coordinates I think. We have to think about what you mean. If its for a checkpoint, there is no problem, but for viz, those programs do not understand periodicity. Thus I embed it in a higher dimensional space. Matt > See src/dm/impls/plex/examples/tests/ex1.c. An example runs > > $ ./ex1 -filename > ${PETSC_DIR}/share/petsc/datafiles/meshes/cube_periodic_bin.msh > -dm_plex_gmsh_periodic -dm_view ::ascii_info_detail -interpolate -test_shape > > generating periodic meshes in gmsh may be tricky, Lisandro for sure may > advice. > > > Thanks, > Max > > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From amfoggia at gmail.com Thu Oct 25 06:48:09 2018 From: amfoggia at gmail.com (Ale Foggia) Date: Thu, 25 Oct 2018 13:48:09 +0200 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos In-Reply-To: References: Message-ID: El mar., 23 oct. 2018 a las 13:53, Matthew Knepley () escribi?: > On Tue, Oct 23, 2018 at 6:24 AM Ale Foggia wrote: > >> Hello, >> >> I'm currently using Lanczos solver (EPSLANCZOS) to get the smallest real >> eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem (EPS_HEP). Those are >> the only options I set for the solver. My aim is to be able to >> predict/estimate the time-to-solution. To do so, I was doing a scaling of >> the code for different sizes of matrices and for different number of MPI >> processes. As I was not observing a good scaling I checked the number of >> iterations of the solver (given by EPSGetIterationNumber). I've encounter >> that for the **same size** of matrix (that meaning, the same problem), when >> I change the number of MPI processes, the amount of iterations changes, and >> the behaviour is not monotonic. This are the numbers I've got: >> > > I am sure you know this, but this test is strong scaling and will top out > when the individual problem sizes become too small (we see this at several > thousand unknowns). > Thanks for pointing this out, we are aware of that and I've been "playing" around to try to see by myself this behaviour. Now, I think I'll go with the Krylov-Schur method because is the only solution to the problem of the number of iterations. With this I think I'll be able to see the individual problem size effect in the scaling. > Thanks, > > Matt > > >> >> # procs # iters >> 960 157 >> 992 189 >> 1024 338 >> 1056 190 >> 1120 174 >> 2048 136 >> >> I've checked the mailing list for a similar situation and I've found >> another person with the same problem but in another solver ("[SLEPc] GD is >> not deterministic when using different number of cores", Nov 19 2015), but >> I think the solution this person finds does not apply to my problem >> (removing "-eps_harmonic" option). >> >> Can you give me any hint on what is the reason for this behaviour? Is >> there a way to prevent this? It's not possible to estimate/predict any time >> consumption for bigger problems if the number of iterations varies this >> much. >> >> Ale >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From amfoggia at gmail.com Thu Oct 25 06:54:04 2018 From: amfoggia at gmail.com (Ale Foggia) Date: Thu, 25 Oct 2018 13:54:04 +0200 Subject: [petsc-users] [SLEPc] Number of iterations changes with MPI processes in Lanczos In-Reply-To: References: <4EE63176-0CF1-47D7-83BD-A95162946BFD@dsic.upv.es> <8785019B-C52B-4022-B7A8-83F8466F9B71@dsic.upv.es> <3F900479-3123-413E-B279-9DE624E825F4@dsic.upv.es> Message-ID: No, the eigenvalue is around -15. I've tried KS and the number of iterations differs in one when I change the number of MPI processes, which seems fine for me. So, I'll see if this method is fine for my specific goal or not, and I'll try to use. Thanks for the help. El mi?., 24 oct. 2018 a las 15:48, Jose E. Roman () escribi?: > Everything seems correct. I don't know, maybe your problem is very > sensitive? Is the eigenvalue tiny? > I would still try with Krylov-Schur. > Jose > > > > El 24 oct 2018, a las 14:59, Ale Foggia escribi?: > > > > The functions called to set the solver are (in this order): EPSCreate(); > EPSSetOperators(); EPSSetProblemType(EPS_HEP); EPSSetType(EPSLANCZOS); > EPSSetWhichEigenpairs(EPS_SMALLEST_REAL); EPSSetFromOptions(); > > > > The output of -eps_view for each run is: > > ================================================================= > > EPS Object: 960 MPI processes > > type: lanczos > > LOCAL reorthogonalization > > problem type: symmetric eigenvalue problem > > selected portion of the spectrum: smallest real parts > > number of eigenvalues (nev): 1 > > number of column vectors (ncv): 16 > > maximum dimension of projected problem (mpd): 16 > > maximum number of iterations: 291700777 > > tolerance: 1e-08 > > convergence test: relative to the eigenvalue > > BV Object: 960 MPI processes > > type: svec > > 17 columns of global length 2333606220 > > vector orthogonalization method: modified Gram-Schmidt > > orthogonalization refinement: if needed (eta: 0.7071) > > block orthogonalization method: GS > > doing matmult as a single matrix-matrix product > > generating random vectors independent of the number of processes > > DS Object: 960 MPI processes > > type: hep > > parallel operation mode: REDUNDANT > > solving the problem with: Implicit QR method (_steqr) > > ST Object: 960 MPI processes > > type: shift > > shift: 0. > > number of matrices: 1 > > ================================================================= > > EPS Object: 1024 MPI processes > > type: lanczos > > LOCAL reorthogonalization > > problem type: symmetric eigenvalue problem > > selected portion of the spectrum: smallest real parts > > number of eigenvalues (nev): 1 > > number of column vectors (ncv): 16 > > maximum dimension of projected problem (mpd): 16 > > maximum number of iterations: 291700777 > > tolerance: 1e-08 > > convergence test: relative to the eigenvalue > > BV Object: 1024 MPI processes > > type: svec > > 17 columns of global length 2333606220 > > vector orthogonalization method: modified Gram-Schmidt > > orthogonalization refinement: if needed (eta: 0.7071) > > block orthogonalization method: GS > > doing matmult as a single matrix-matrix product > > generating random vectors independent of the number of processes > > DS Object: 1024 MPI processes > > type: hep > > parallel operation mode: REDUNDANT > > solving the problem with: Implicit QR method (_steqr) > > ST Object: 1024 MPI processes > > type: shift > > shift: 0. > > number of matrices: 1 > > ================================================================= > > > > I run again the same configurations and I got the same result in term of > the number of iterations. > > > > I also tried the full reorthogonalization (always with the > -bv_reproducible_random option) but I still get different number of > iterations: for 960 procs I get 172 iters, and for 1024 I get 362 iters. > The -esp_view output for this case (only for 960 procs, the other one has > the same information -except the number of processes-) is: > > ================================================================= > > EPS Object: 960 MPI processes > > type: lanczos > > FULL reorthogonalization > > problem type: symmetric eigenvalue problem > > selected portion of the spectrum: smallest real parts > > number of eigenvalues (nev): 1 > > number of column vectors (ncv): 16 > > maximum dimension of projected problem (mpd): 16 > > maximum number of iterations: 291700777 > > tolerance: 1e-08 > > convergence test: relative to the eigenvalue > > BV Object: 960 MPI processes > > type: svec > > 17 columns of global length 2333606220 > > vector orthogonalization method: classical Gram-Schmidt > > orthogonalization refinement: if needed (eta: 0.7071) > > block orthogonalization method: GS > > doing matmult as a single matrix-matrix product > > generating random vectors independent of the number of processes > > DS Object: 960 MPI processes > > type: hep > > parallel operation mode: REDUNDANT > > solving the problem with: Implicit QR method (_steqr) > > ST Object: 960 MPI processes > > type: shift > > shift: 0. > > number of matrices: 1 > > ================================================================= > > > > El mi?., 24 oct. 2018 a las 10:52, Jose E. Roman () > escribi?: > > This is very strange. Make sure you call EPSSetFromOptions in the code. > Do iteration counts change also for two different runs with the same number > of processes? > > Maybe Lanczos with default options is too sensitive (by default it does > not reorthogonalize). Suggest using Krylov-Schur or Lanczos with full > reorthogonalization (EPSLanczosSetReorthog). > > Also, send the output of -eps_view to see if there is anything abnormal. > > > > Jose > > > > > > > El 24 oct 2018, a las 9:09, Ale Foggia escribi?: > > > > > > I've tried the option that you gave me but I still get different > number of iterations when changing the number of MPI processes: I did 960 > procs and 1024 procs and I got 435 and 176 iterations, respectively. > > > > > > El mar., 23 oct. 2018 a las 16:48, Jose E. Roman () > escribi?: > > > > > > > > > > El 23 oct 2018, a las 15:46, Ale Foggia > escribi?: > > > > > > > > > > > > > > > > El mar., 23 oct. 2018 a las 15:33, Jose E. Roman (< > jroman at dsic.upv.es>) escribi?: > > > > > > > > > > > > > El 23 oct 2018, a las 15:17, Ale Foggia > escribi?: > > > > > > > > > > Hello Jose, thanks for your answer. > > > > > > > > > > El mar., 23 oct. 2018 a las 12:59, Jose E. Roman (< > jroman at dsic.upv.es>) escribi?: > > > > > There is an undocumented option: > > > > > > > > > > -bv_reproducible_random > > > > > > > > > > It will force the initial vector of the Krylov subspace to be the > same irrespective of the number of MPI processes. This should be used for > scaling analyses as the one you are trying to do. > > > > > > > > > > What about when I'm not doing the scaling? Now I would like to ask > for computing time for bigger size problems, should I also use this option > in that case? Because, what happens if I have a "bad" configuration? > Meaning, I ask for some time, enough if I take into account the "correct" > scaling, but when I run it takes double the time/iterations, like it > happened before when changing from 960 to 1024 processes? > > > > > > > > When you increase the matrix size the spectrum of the matrix changes > and probably also the convergence, so the computation time is not easy to > predict in advance. > > > > > > > > Okey, I'll keep that in mine. I thought that, even if the spectrum > changes, if I had a behaviour/tendency for 6 or 7 smaller cases I could > predict more or less the time. It was working this way until I found this > "iterations problem" which doubled the time of execution for the same size > problem. To be completely sure, do you suggest me or not to use this > run-time option when going in production? Can you elaborate a bit in the > effect this option? Is the (huge) difference I got in the number of > iterations something expected? > > > > > > Ideally if you have a rough approximation of the eigenvector, you set > it as the initial vector with EPSSetInitialSpace(). Otherwise, SLEPc > generates a random initial vector, that is start the search blindly. The > difference between using one random vector or another may be large, > depending on the problem. Krylov-Schur is usually less sensitive to the > initial vector. > > > > > > Jose > > > > > > > > > > > > > > > > > > > > > An additional comment is that we strongly recommend to use the > default solver (Krylov-Schur), which will do Lanczos with implicit restart. > It is generally faster and more stable. > > > > > > > > > > I will be doing Dynamical Lanczos, that means that I'll need the > "matrix whose rows are the eigenvectors of the tridiagonal matrix" (so, > according to the Lanczos Technical Report notation, I need the "matrix > whose rows are the eigenvectors of T_m", which should be the same as the > vectors y_i). I checked the Technical Report for Krylov-Schur also and I > think I can get the same information also from that solver, but I'm not > sure. Can you confirm this please? > > > > > Also, as the vectors I want are given by V_m^(-1)*x_i=y_i > (following the notation on the Report), my idea to get them was to retrieve > the invariant subspace V_m (with EPSGetInvariantSubspace), invert it, and > then multiply it with the eigenvectors that I get with EPSGetEigenvector. > Is there another easier (or with less computations) way to get this? > > > > > > > > In Krylov-Schur the tridiagonal matrix T_m becomes > arrowhead-plus-tridiagonal. Apart from this, it should be equivalent. The > relevant information can be obtained with EPSGetBV() and EPSGetDS(). But > this is a "developer level" interface. We could help you get this running. > Send a small problem matrix to slepc-maint together with a more detailed > description of what you need to compute. > > > > > > > > Thanks! When I get to that part I'll write to slepc-maint for help. > > > > > > > > > > > > Jose > > > > > > > > > > > > > > > > > > > Jose > > > > > > > > > > > > > > > > > > > > > El 23 oct 2018, a las 12:13, Ale Foggia > escribi?: > > > > > > > > > > > > Hello, > > > > > > > > > > > > I'm currently using Lanczos solver (EPSLANCZOS) to get the > smallest real eigenvalue (EPS_SMALLEST_REAL) of a Hermitian problem > (EPS_HEP). Those are the only options I set for the solver. My aim is to be > able to predict/estimate the time-to-solution. To do so, I was doing a > scaling of the code for different sizes of matrices and for different > number of MPI processes. As I was not observing a good scaling I checked > the number of iterations of the solver (given by EPSGetIterationNumber). > I've encounter that for the **same size** of matrix (that meaning, the same > problem), when I change the number of MPI processes, the amount of > iterations changes, and the behaviour is not monotonic. This are the > numbers I've got: > > > > > > > > > > > > # procs # iters > > > > > > 960 157 > > > > > > 992 189 > > > > > > 1024 338 > > > > > > 1056 190 > > > > > > 1120 174 > > > > > > 2048 136 > > > > > > > > > > > > I've checked the mailing list for a similar situation and I've > found another person with the same problem but in another solver ("[SLEPc] > GD is not deterministic when using different number of cores", Nov 19 > 2015), but I think the solution this person finds does not apply to my > problem (removing "-eps_harmonic" option). > > > > > > > > > > > > Can you give me any hint on what is the reason for this > behaviour? Is there a way to prevent this? It's not possible to > estimate/predict any time consumption for bigger problems if the number of > iterations varies this much. > > > > > > > > > > > > Ale > > > > > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefano.zampini at gmail.com Thu Oct 25 07:11:07 2018 From: stefano.zampini at gmail.com (Stefano Zampini) Date: Thu, 25 Oct 2018 15:11:07 +0300 Subject: [petsc-users] Periodic BC in petsc DMPlex / firedrake In-Reply-To: References: <2D9A9125-F4A2-4A50-A5F9-4D7C9B86B540@gmail.com> <2852F36F-0CB0-4737-A489-38A476FDAEF2@gmx.li> <6E65EDD0-AB80-4FE5-AF9F-49B9D4D8B9E3@gmail.com> Message-ID: Matt, you can reproduce it via $ valgrind ./ex12 -quiet -run_type test -interpolate 1 -bc_type dirichlet -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh -dm_plex_gmsh_periodic Long time ago I added support for viewing meshes with periodic vertices in the VTK_VTU viewer, but I did not fix the part that writes fields Il giorno mer 24 ott 2018 alle ore 21:04 Matthew Knepley ha scritto: > On Wed, Oct 24, 2018 at 11:36 AM Maximilian Hartig < > imilian.hartig at gmail.com> wrote: > >> >> >> On 24. Oct 2018, at 12:49, Matthew Knepley wrote: >> >> On Wed, Oct 24, 2018 at 6:29 AM Lawrence Mitchell wrote: >> >>> Hi Max, >>> >>> (I'm cc'ing in the petsc-users mailing list which may have more advice, >>> if you are using PETSc you should definitely subscribe! >>> >>> > On 24 Oct 2018, at 09:27, Maximilian Hartig >>> wrote: >>> > >>> > Hello Lawrence, >>> > >>> > sorry to message you out of the blue. My name is Max and I found your >>> post on GitHub ( >>> https://github.com/firedrakeproject/firedrake/issues/1246 ) on DMPlex >>> being able to read periodic gmsh files. I am currently trying to do just >>> that (creating a periodic DMPlex mesh with gmsh) in the context of my PhD >>> work. So far I haven? t found any documentation on the periodic BC?s with >>> DMPlex and gmsh in the official petsc documentation. >>> > I was wondering whether you?d be so kind as to point me in a general >>> direction concerning how to achieve this. You seem experienced in using >>> petsc and I would greatly appreciate your help. >>> >>> >>> I think the answer is "it depends". If you're just using DMPlex directly >>> and all the of the functionality with PetscDS, then I /think/ that reading >>> periodic meshes via gmsh (assuming you're using the appropriate gmsh mesh >>> format [v2]) "just works". >>> >> >> There are two phases here: topological and geometric. DMPlex represents >> the periodic topological entity directly. For example, a circle is just a >> segment with one end hooked to the other. Vertices are not duplicated, or >> mapped to each other. This makes topology simple and easy to implement. >> However, then geometry is more complicated. What Plex does is allow >> coordinates to be represented by a discontinuous field taking values on >> cells, in addition to vertices. In our circle example, each cells near the >> cut will have 2 coordinates, one for each vertex, but they will not agree >> across the cut. If you define a periodic domain, then Plex can construct >> this coordinate field automatically using DMPlexLocalize(). These DG >> coordinates are then used by the integration routines. >> >> >> Ok, I think I understand the concept. DMPlex reads information about both >> topology and coordinates from the .msh file. Creating a periodic mesh in >> gmsh then should allow DMPlex to identify the periodic boundaries as the >> ?cut? and build the mesh topology accordingly. Coordinate information is >> handled separately. >> That means, as Lawrence suggested, building periodic meshes in gmsh and >> reading them in to petsc?s DMPlex should indeed ?just work?. (From the >> user perspective). The only extra step is to call DMLocalizeCoordinates() >> after DMPlexReadFromFile(). Sorry to reiterate, I am just trying to make >> sense of this. >> >> >> >>> From my side, the issue is to do with mapping that coordinate field into >>> one that I understand (within Firedrake). You may not have this problem. >>> >> >> Firedrake uses its own coordinate mapping and integration routines, so >> they must manage the second part independently. I hope to get change this >> slightly soon by making the Firedrake representation a DMField, so that it >> looks the same to Plex. >> >> Thanks, >> >> Matt >> >> >>> Thanks, >>> >>> Lawrence >> >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> >> To read periodic meshes from GMSH, you need to use the option >> -dm_plex_gmsh_periodic and DMPlexCreateFromFile >> >> >> Ahh, thanks. I was missing the option " -dm_plex_gmsh_periodic ?. But >> using this option I now generate a segmentation fault error when calling >> VecView() on the solution vector with vtk and hdf5 viewers. Any suggestions? >> > > Small example? VTK is deprecated. HDF5 should work, although it will > require you to have proper coordinates I think. We have to > think about what you mean. If its for a checkpoint, there is no problem, > but for viz, those programs do not understand periodicity. Thus I embed it > in a higher dimensional space. > > Matt > >> See src/dm/impls/plex/examples/tests/ex1.c. An example runs >> >> $ ./ex1 -filename >> ${PETSC_DIR}/share/petsc/datafiles/meshes/cube_periodic_bin.msh >> -dm_plex_gmsh_periodic -dm_view ::ascii_info_detail -interpolate -test_shape >> >> generating periodic meshes in gmsh may be tricky, Lisandro for sure may >> advice. >> >> >> Thanks, >> Max >> >> > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -- Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefano.zampini at gmail.com Thu Oct 25 08:36:15 2018 From: stefano.zampini at gmail.com (Stefano Zampini) Date: Thu, 25 Oct 2018 16:36:15 +0300 Subject: [petsc-users] Periodic BC in petsc DMPlex / firedrake In-Reply-To: References: <2D9A9125-F4A2-4A50-A5F9-4D7C9B86B540@gmail.com> <2852F36F-0CB0-4737-A489-38A476FDAEF2@gmx.li> <6E65EDD0-AB80-4FE5-AF9F-49B9D4D8B9E3@gmail.com> Message-ID: Maybe this is a fix diff --git a/src/dm/impls/plex/plexvtu.c b/src/dm/impls/plex/plexvtu.c index acdea12c2f..1a8bbada6a 100644 --- a/src/dm/impls/plex/plexvtu.c +++ b/src/dm/impls/plex/plexvtu.c @@ -465,10 +465,11 @@ PetscErrorCode DMPlexVTKWriteAll_VTU(DM dm,PetscViewer viewer) if ((closure[v] >= vStart) && (closure[v] < vEnd)) { PetscScalar *xpoint; - ierr = DMPlexPointLocalRead(dm,v,x,&xpoint);CHKERRQ(ierr); + ierr = DMPlexPointLocalRead(dm,closure[v],x,&xpoint);CHKERRQ(ierr); y[cnt + off++] = xpoint[i]; } } + cnt += off; ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr); } } Max, does this fix your problem? If you confirm, I'll fix this in the maint branch If I run the below command line with the patch and with snes tutorials ex12 I get the nice picture attached $ ./ex12 -quiet -run_type test -interpolate 1 -bc_type dirichlet -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh -dm_plex_gmsh_periodic -x_periodicity periodic -y_periodicity periodic -dm_refine 4 Il giorno gio 25 ott 2018 alle ore 15:11 Stefano Zampini < stefano.zampini at gmail.com> ha scritto: > Matt, > > you can reproduce it via > > $ valgrind ./ex12 -quiet -run_type test -interpolate 1 -bc_type dirichlet > -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f > ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh > -dm_plex_gmsh_periodic > > Long time ago I added support for viewing meshes with periodic vertices in > the VTK_VTU viewer, but I did not fix the part that writes fields > > > Il giorno mer 24 ott 2018 alle ore 21:04 Matthew Knepley < > knepley at gmail.com> ha scritto: > >> On Wed, Oct 24, 2018 at 11:36 AM Maximilian Hartig < >> imilian.hartig at gmail.com> wrote: >> >>> >>> >>> On 24. Oct 2018, at 12:49, Matthew Knepley wrote: >>> >>> On Wed, Oct 24, 2018 at 6:29 AM Lawrence Mitchell wrote: >>> >>>> Hi Max, >>>> >>>> (I'm cc'ing in the petsc-users mailing list which may have more advice, >>>> if you are using PETSc you should definitely subscribe! >>>> >>>> > On 24 Oct 2018, at 09:27, Maximilian Hartig >>>> wrote: >>>> > >>>> > Hello Lawrence, >>>> > >>>> > sorry to message you out of the blue. My name is Max and I found your >>>> post on GitHub ( >>>> https://github.com/firedrakeproject/firedrake/issues/1246 ) on DMPlex >>>> being able to read periodic gmsh files. I am currently trying to do just >>>> that (creating a periodic DMPlex mesh with gmsh) in the context of my PhD >>>> work. So far I haven? t found any documentation on the periodic BC?s with >>>> DMPlex and gmsh in the official petsc documentation. >>>> > I was wondering whether you?d be so kind as to point me in a general >>>> direction concerning how to achieve this. You seem experienced in using >>>> petsc and I would greatly appreciate your help. >>>> >>>> >>>> I think the answer is "it depends". If you're just using DMPlex >>>> directly and all the of the functionality with PetscDS, then I /think/ that >>>> reading periodic meshes via gmsh (assuming you're using the appropriate >>>> gmsh mesh format [v2]) "just works". >>>> >>> >>> There are two phases here: topological and geometric. DMPlex represents >>> the periodic topological entity directly. For example, a circle is just a >>> segment with one end hooked to the other. Vertices are not duplicated, or >>> mapped to each other. This makes topology simple and easy to implement. >>> However, then geometry is more complicated. What Plex does is allow >>> coordinates to be represented by a discontinuous field taking values on >>> cells, in addition to vertices. In our circle example, each cells near the >>> cut will have 2 coordinates, one for each vertex, but they will not agree >>> across the cut. If you define a periodic domain, then Plex can construct >>> this coordinate field automatically using DMPlexLocalize(). These DG >>> coordinates are then used by the integration routines. >>> >>> >>> Ok, I think I understand the concept. DMPlex reads information about >>> both topology and coordinates from the .msh file. Creating a periodic mesh >>> in gmsh then should allow DMPlex to identify the periodic boundaries as the >>> ?cut? and build the mesh topology accordingly. Coordinate information is >>> handled separately. >>> That means, as Lawrence suggested, building periodic meshes in gmsh and >>> reading them in to petsc?s DMPlex should indeed ?just work?. (From the >>> user perspective). The only extra step is to call DMLocalizeCoordinates() >>> after DMPlexReadFromFile(). Sorry to reiterate, I am just trying to make >>> sense of this. >>> >>> >>> >>>> From my side, the issue is to do with mapping that coordinate field >>>> into one that I understand (within Firedrake). You may not have this >>>> problem. >>>> >>> >>> Firedrake uses its own coordinate mapping and integration routines, so >>> they must manage the second part independently. I hope to get change this >>> slightly soon by making the Firedrake representation a DMField, so that it >>> looks the same to Plex. >>> >>> Thanks, >>> >>> Matt >>> >>> >>>> Thanks, >>>> >>>> Lawrence >>> >>> >>> >>> -- >>> 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 >>> >>> https://www.cse.buffalo.edu/~knepley/ >>> >>> >>> To read periodic meshes from GMSH, you need to use the option >>> -dm_plex_gmsh_periodic and DMPlexCreateFromFile >>> >>> >>> Ahh, thanks. I was missing the option " -dm_plex_gmsh_periodic ?. But >>> using this option I now generate a segmentation fault error when calling >>> VecView() on the solution vector with vtk and hdf5 viewers. Any suggestions? >>> >> >> Small example? VTK is deprecated. HDF5 should work, although it will >> require you to have proper coordinates I think. We have to >> think about what you mean. If its for a checkpoint, there is no problem, >> but for viz, those programs do not understand periodicity. Thus I embed it >> in a higher dimensional space. >> >> Matt >> >>> See src/dm/impls/plex/examples/tests/ex1.c. An example runs >>> >>> $ ./ex1 -filename >>> ${PETSC_DIR}/share/petsc/datafiles/meshes/cube_periodic_bin.msh >>> -dm_plex_gmsh_periodic -dm_view ::ascii_info_detail -interpolate -test_shape >>> >>> generating periodic meshes in gmsh may be tricky, Lisandro for sure may >>> advice. >>> >>> >>> Thanks, >>> Max >>> >>> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> >> > > > -- > Stefano > -- Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: periodic.png Type: image/png Size: 255676 bytes Desc: not available URL: From stefano.zampini at gmail.com Thu Oct 25 08:53:03 2018 From: stefano.zampini at gmail.com (Stefano Zampini) Date: Thu, 25 Oct 2018 16:53:03 +0300 Subject: [petsc-users] Using BDDC preconditioner for assembled matrices In-Reply-To: References: <87sh0w5915.fsf@jedbrown.org> Message-ID: How many processes (subdomains) are you using? I would not say the number of iterations is bad, and it also seems to plateau. The grad-div problem is quite hard to be solved (unless you use hybridization), you can really benefit from the "Neumann" assembly. I believe you are using GMRES, as the preconditioned operator (i.e M_BDDC^-1 A) is not guaranteed to be positive definite when you use the automatic disassembling. You may slightly improve the quality of the disassembling by using -mat_is_disassemble_l2g_type nd -mat_partitioning_type parmetis if you have PETSc compiled with ParMETIS support. Il giorno mer 24 ott 2018 alle ore 20:59 Abdullah Ali Sivas < abdullahasivas at gmail.com> ha scritto: > Hi Stefano, > > I am trying to solve the div-div problem (or grad-div problem in strong > form) with a H(div)-conforming FEM. I am getting the matrices from an > external source (to be clear, from an ngsolve script) and I am not sure if > it is possible to get a MATIS matrix out of that. So I am just treating it > as if I am not able to access the assembly code. The results are 2, 31, 26, > 27, 31 iterations, respectively, for matrix sizes 282, 1095, 4314, 17133, > 67242, 267549. However, norm of the residual also grows significantly; > 7.38369e-09 for 1095 and 5.63828e-07 for 267549. I can try larger sizes, or > maybe this is expected for this case. > > As a side question, if we are dividing the domain into number of MPI > processes subdomains, does it mean that convergence is affected negatively > by the increasing number of processes? I know that alternating Schwarz > method and some other domain decomposition methods sometimes suffer from > the decreasing radius of the subdomains. It sounds like BDDC is pretty > similar to those by your description. > > Best wishes, > Abdullah Ali Sivas > > On Wed, 24 Oct 2018 at 05:28, Stefano Zampini > wrote: > >> Abdullah, >> >> The "Neumann" problems Jed is referring to result from assembling your >> problem on each subdomain ( = MPI process) separately. >> Assuming you are using FEM, these problems have been historically named >> "Neumann" as they correspond to a problem with natural boundary conditions >> (Neumann bc for Poisson). >> Note that in PETSc the subdomain decomposition is associated with the >> mesh decomposition. >> >> When converting from an assembled AIJ matrix to a MATIS format, such >> "Neumann" information is lost. >> You can disassemble an AIJ matrix, in the sense that you can find local >> matrices A_j such that A = \sum_j R^T_j A_j R_j (as it is done in ex72.c), >> but you cannot guarantee (unless if you solve an optimization problem) that >> the disassembling will produce subdomain Neumann problems that are >> consistent with your FEM problem. >> >> I have added such disassembling code a few months ago, just to have >> another alternative for preconditioning AIJ matrices in PETSc; there are >> few tweaks one can do to improve the quality of the disassembling, but I >> discourage its usage unless you don't have access to the FEM assembly code. >> >> With that said, what problem are you trying to solve? Are you using DMDA >> or DMPlex? What are the results you obtained with using the automatic >> disassembling? >> >> Il giorno mer 24 ott 2018 alle ore 08:14 Abdullah Ali Sivas < >> abdullahasivas at gmail.com> ha scritto: >> >>> Hi Jed, >>> >>> Thanks for your reply. The assembled matrix I have corresponds to the >>> full problem on the full mesh. There are no "Neumann" problems (or any sort >>> of domain decomposition) defined in the code generates the matrix. However, >>> I think assembling the full problem is equivalent to implicitly assembling >>> the "Neumann" problems, since the system can be partitioned as; >>> >>> [A_{LL} | A_{LI}] [u_L] [F] >>> -----------|------------ -------- = ----- >>> [A_{IL} |A_{II} ] [u_I] [G] >>> >>> and G should correspond to the Neumann problem. I might be thinking >>> wrong (or maybe I completely misunderstood the idea), if so please correct >>> me. But I think that the problem is that I am not explicitly telling PCBDDC >>> which dofs are interface dofs. >>> >>> Regards, >>> Abdullah Ali Sivas >>> >>> On Tue, 23 Oct 2018 at 23:16, Jed Brown wrote: >>> >>>> Did you assemble "Neumann" problems that are compatible with your >>>> definition of interior/interface degrees of freedom? >>>> >>>> Abdullah Ali Sivas writes: >>>> >>>> > Dear all, >>>> > >>>> > I have a series of linear systems coming from a PDE for which BDDC is >>>> an >>>> > optimal preconditioner. These linear systems are assembled and I read >>>> them >>>> > from a file, then convert into MATIS as required (as in >>>> > >>>> https://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex72.c.html >>>> > ). I expect each of the systems converge to the solution in almost >>>> same >>>> > number of iterations but I don't observe it. I think it is because I >>>> do not >>>> > provide enough information to the preconditioner. I can get a list of >>>> inner >>>> > dofs and interface dofs. However, I do not know how to use them. Has >>>> anyone >>>> > have any insights about it or done something similar? >>>> > >>>> > Best wishes, >>>> > Abdullah Ali Sivas >>>> >>> >> >> -- >> Stefano >> > -- Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: From abdullahasivas at gmail.com Thu Oct 25 09:19:53 2018 From: abdullahasivas at gmail.com (Abdullah Ali Sivas) Date: Thu, 25 Oct 2018 10:19:53 -0400 Subject: [petsc-users] Using BDDC preconditioner for assembled matrices In-Reply-To: References: <87sh0w5915.fsf@jedbrown.org> Message-ID: Right now, one to four. I am just running some tests with small matrices. Later on, I am planning to do large scale tests hopefully up to 1024 processes. I was worried that iteration numbers may get worse. I actually use hybridization and I was reading the preprint "Algebraic Hybridization and Static Condensation with Application to Scalable H(div) Preconditioning" by Dobrev et al. ( https://arxiv.org/abs/1801.08914 ) and they show that multigrid is optimal for the grad-div problem discretized with H(div) conforming FEMs when hybridized. That is actually why I think that BDDC also would be optimal. I will look into ngsolve to see if I can have such a domain decomposition. Maybe I can do it manually just as proof of concept. I am using GMRES. I was wondering if the application of BDDC is a linear operator, if it is not maybe I should use FGMRES. But I could not find any comments about that. I will recompile PETSc with ParMETIS and try your suggestions. Thank you! I will update you soon. Best wishes, Abdullah Ali Sivas On Thu, 25 Oct 2018 at 09:53, Stefano Zampini wrote: > How many processes (subdomains) are you using? > I would not say the number of iterations is bad, and it also seems to > plateau. > The grad-div problem is quite hard to be solved (unless you use > hybridization), you can really benefit from the "Neumann" assembly. > I believe you are using GMRES, as the preconditioned operator (i.e > M_BDDC^-1 A) is not guaranteed to be positive definite when you use the > automatic disassembling. > You may slightly improve the quality of the disassembling by using > -mat_is_disassemble_l2g_type nd -mat_partitioning_type parmetis if you have > PETSc compiled with ParMETIS support. > > > Il giorno mer 24 ott 2018 alle ore 20:59 Abdullah Ali Sivas < > abdullahasivas at gmail.com> ha scritto: > >> Hi Stefano, >> >> I am trying to solve the div-div problem (or grad-div problem in strong >> form) with a H(div)-conforming FEM. I am getting the matrices from an >> external source (to be clear, from an ngsolve script) and I am not sure if >> it is possible to get a MATIS matrix out of that. So I am just treating it >> as if I am not able to access the assembly code. The results are 2, 31, 26, >> 27, 31 iterations, respectively, for matrix sizes 282, 1095, 4314, 17133, >> 67242, 267549. However, norm of the residual also grows significantly; >> 7.38369e-09 for 1095 and 5.63828e-07 for 267549. I can try larger sizes, or >> maybe this is expected for this case. >> >> As a side question, if we are dividing the domain into number of MPI >> processes subdomains, does it mean that convergence is affected negatively >> by the increasing number of processes? I know that alternating Schwarz >> method and some other domain decomposition methods sometimes suffer from >> the decreasing radius of the subdomains. It sounds like BDDC is pretty >> similar to those by your description. >> >> Best wishes, >> Abdullah Ali Sivas >> >> On Wed, 24 Oct 2018 at 05:28, Stefano Zampini >> wrote: >> >>> Abdullah, >>> >>> The "Neumann" problems Jed is referring to result from assembling your >>> problem on each subdomain ( = MPI process) separately. >>> Assuming you are using FEM, these problems have been historically named >>> "Neumann" as they correspond to a problem with natural boundary conditions >>> (Neumann bc for Poisson). >>> Note that in PETSc the subdomain decomposition is associated with the >>> mesh decomposition. >>> >>> When converting from an assembled AIJ matrix to a MATIS format, such >>> "Neumann" information is lost. >>> You can disassemble an AIJ matrix, in the sense that you can find local >>> matrices A_j such that A = \sum_j R^T_j A_j R_j (as it is done in ex72.c), >>> but you cannot guarantee (unless if you solve an optimization problem) that >>> the disassembling will produce subdomain Neumann problems that are >>> consistent with your FEM problem. >>> >>> I have added such disassembling code a few months ago, just to have >>> another alternative for preconditioning AIJ matrices in PETSc; there are >>> few tweaks one can do to improve the quality of the disassembling, but I >>> discourage its usage unless you don't have access to the FEM assembly code. >>> >>> With that said, what problem are you trying to solve? Are you using DMDA >>> or DMPlex? What are the results you obtained with using the automatic >>> disassembling? >>> >>> Il giorno mer 24 ott 2018 alle ore 08:14 Abdullah Ali Sivas < >>> abdullahasivas at gmail.com> ha scritto: >>> >>>> Hi Jed, >>>> >>>> Thanks for your reply. The assembled matrix I have corresponds to the >>>> full problem on the full mesh. There are no "Neumann" problems (or any sort >>>> of domain decomposition) defined in the code generates the matrix. However, >>>> I think assembling the full problem is equivalent to implicitly assembling >>>> the "Neumann" problems, since the system can be partitioned as; >>>> >>>> [A_{LL} | A_{LI}] [u_L] [F] >>>> -----------|------------ -------- = ----- >>>> [A_{IL} |A_{II} ] [u_I] [G] >>>> >>>> and G should correspond to the Neumann problem. I might be thinking >>>> wrong (or maybe I completely misunderstood the idea), if so please correct >>>> me. But I think that the problem is that I am not explicitly telling PCBDDC >>>> which dofs are interface dofs. >>>> >>>> Regards, >>>> Abdullah Ali Sivas >>>> >>>> On Tue, 23 Oct 2018 at 23:16, Jed Brown wrote: >>>> >>>>> Did you assemble "Neumann" problems that are compatible with your >>>>> definition of interior/interface degrees of freedom? >>>>> >>>>> Abdullah Ali Sivas writes: >>>>> >>>>> > Dear all, >>>>> > >>>>> > I have a series of linear systems coming from a PDE for which BDDC >>>>> is an >>>>> > optimal preconditioner. These linear systems are assembled and I >>>>> read them >>>>> > from a file, then convert into MATIS as required (as in >>>>> > >>>>> https://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex72.c.html >>>>> > ). I expect each of the systems converge to the solution in almost >>>>> same >>>>> > number of iterations but I don't observe it. I think it is because I >>>>> do not >>>>> > provide enough information to the preconditioner. I can get a list >>>>> of inner >>>>> > dofs and interface dofs. However, I do not know how to use them. Has >>>>> anyone >>>>> > have any insights about it or done something similar? >>>>> > >>>>> > Best wishes, >>>>> > Abdullah Ali Sivas >>>>> >>>> >>> >>> -- >>> Stefano >>> >> > > -- > Stefano > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefano.zampini at gmail.com Thu Oct 25 09:26:36 2018 From: stefano.zampini at gmail.com (Stefano Zampini) Date: Thu, 25 Oct 2018 17:26:36 +0300 Subject: [petsc-users] Using BDDC preconditioner for assembled matrices In-Reply-To: References: <87sh0w5915.fsf@jedbrown.org> Message-ID: > I actually use hybridization and I was reading the preprint "Algebraic > Hybridization and Static Condensation with Application to Scalable H(div) > Preconditioning" by Dobrev et al. ( https://arxiv.org/abs/1801.08914 ) > and they show that multigrid is optimal for the grad-div problem > discretized with H(div) conforming FEMs when hybridized. That is actually > why I think that BDDC also would be optimal. I will look into ngsolve to > see if I can have such a domain decomposition. Maybe I can do it manually > just as proof of concept. > > If you are using hybridization, you can use PCGAMG (i.e. -pc_type gamg) > I am using GMRES. I was wondering if the application of BDDC is a linear > operator, if it is not maybe I should use FGMRES. But I could not find any > comments about that. > > BDDC is linear. The problem is that when you disassemble an already assembled matrix, the operator of the preconditioner is not guaranteed to stay positive definite for positive definite assembled problems, > I will recompile PETSc with ParMETIS and try your suggestions. Thank you! > I will update you soon. > > Best wishes, > Abdullah Ali Sivas > > On Thu, 25 Oct 2018 at 09:53, Stefano Zampini > wrote: > >> How many processes (subdomains) are you using? >> I would not say the number of iterations is bad, and it also seems to >> plateau. >> The grad-div problem is quite hard to be solved (unless you use >> hybridization), you can really benefit from the "Neumann" assembly. >> I believe you are using GMRES, as the preconditioned operator (i.e >> M_BDDC^-1 A) is not guaranteed to be positive definite when you use the >> automatic disassembling. >> You may slightly improve the quality of the disassembling by using >> -mat_is_disassemble_l2g_type nd -mat_partitioning_type parmetis if you have >> PETSc compiled with ParMETIS support. >> >> >> Il giorno mer 24 ott 2018 alle ore 20:59 Abdullah Ali Sivas < >> abdullahasivas at gmail.com> ha scritto: >> >>> Hi Stefano, >>> >>> I am trying to solve the div-div problem (or grad-div problem in strong >>> form) with a H(div)-conforming FEM. I am getting the matrices from an >>> external source (to be clear, from an ngsolve script) and I am not sure if >>> it is possible to get a MATIS matrix out of that. So I am just treating it >>> as if I am not able to access the assembly code. The results are 2, 31, 26, >>> 27, 31 iterations, respectively, for matrix sizes 282, 1095, 4314, 17133, >>> 67242, 267549. However, norm of the residual also grows significantly; >>> 7.38369e-09 for 1095 and 5.63828e-07 for 267549. I can try larger sizes, or >>> maybe this is expected for this case. >>> >>> As a side question, if we are dividing the domain into number of MPI >>> processes subdomains, does it mean that convergence is affected negatively >>> by the increasing number of processes? I know that alternating Schwarz >>> method and some other domain decomposition methods sometimes suffer from >>> the decreasing radius of the subdomains. It sounds like BDDC is pretty >>> similar to those by your description. >>> >>> Best wishes, >>> Abdullah Ali Sivas >>> >>> On Wed, 24 Oct 2018 at 05:28, Stefano Zampini >>> wrote: >>> >>>> Abdullah, >>>> >>>> The "Neumann" problems Jed is referring to result from assembling your >>>> problem on each subdomain ( = MPI process) separately. >>>> Assuming you are using FEM, these problems have been historically >>>> named "Neumann" as they correspond to a problem with natural boundary >>>> conditions (Neumann bc for Poisson). >>>> Note that in PETSc the subdomain decomposition is associated with the >>>> mesh decomposition. >>>> >>>> When converting from an assembled AIJ matrix to a MATIS format, such >>>> "Neumann" information is lost. >>>> You can disassemble an AIJ matrix, in the sense that you can find local >>>> matrices A_j such that A = \sum_j R^T_j A_j R_j (as it is done in ex72.c), >>>> but you cannot guarantee (unless if you solve an optimization problem) that >>>> the disassembling will produce subdomain Neumann problems that are >>>> consistent with your FEM problem. >>>> >>>> I have added such disassembling code a few months ago, just to have >>>> another alternative for preconditioning AIJ matrices in PETSc; there are >>>> few tweaks one can do to improve the quality of the disassembling, but I >>>> discourage its usage unless you don't have access to the FEM assembly code. >>>> >>>> With that said, what problem are you trying to solve? Are you using >>>> DMDA or DMPlex? What are the results you obtained with using the automatic >>>> disassembling? >>>> >>>> Il giorno mer 24 ott 2018 alle ore 08:14 Abdullah Ali Sivas < >>>> abdullahasivas at gmail.com> ha scritto: >>>> >>>>> Hi Jed, >>>>> >>>>> Thanks for your reply. The assembled matrix I have corresponds to the >>>>> full problem on the full mesh. There are no "Neumann" problems (or any sort >>>>> of domain decomposition) defined in the code generates the matrix. However, >>>>> I think assembling the full problem is equivalent to implicitly assembling >>>>> the "Neumann" problems, since the system can be partitioned as; >>>>> >>>>> [A_{LL} | A_{LI}] [u_L] [F] >>>>> -----------|------------ -------- = ----- >>>>> [A_{IL} |A_{II} ] [u_I] [G] >>>>> >>>>> and G should correspond to the Neumann problem. I might be thinking >>>>> wrong (or maybe I completely misunderstood the idea), if so please correct >>>>> me. But I think that the problem is that I am not explicitly telling PCBDDC >>>>> which dofs are interface dofs. >>>>> >>>>> Regards, >>>>> Abdullah Ali Sivas >>>>> >>>>> On Tue, 23 Oct 2018 at 23:16, Jed Brown wrote: >>>>> >>>>>> Did you assemble "Neumann" problems that are compatible with your >>>>>> definition of interior/interface degrees of freedom? >>>>>> >>>>>> Abdullah Ali Sivas writes: >>>>>> >>>>>> > Dear all, >>>>>> > >>>>>> > I have a series of linear systems coming from a PDE for which BDDC >>>>>> is an >>>>>> > optimal preconditioner. These linear systems are assembled and I >>>>>> read them >>>>>> > from a file, then convert into MATIS as required (as in >>>>>> > >>>>>> https://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex72.c.html >>>>>> > ). I expect each of the systems converge to the solution in almost >>>>>> same >>>>>> > number of iterations but I don't observe it. I think it is because >>>>>> I do not >>>>>> > provide enough information to the preconditioner. I can get a list >>>>>> of inner >>>>>> > dofs and interface dofs. However, I do not know how to use them. >>>>>> Has anyone >>>>>> > have any insights about it or done something similar? >>>>>> > >>>>>> > Best wishes, >>>>>> > Abdullah Ali Sivas >>>>>> >>>>> >>>> >>>> -- >>>> Stefano >>>> >>> >> >> -- >> Stefano >> > -- Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: From knepley at gmail.com Thu Oct 25 09:43:57 2018 From: knepley at gmail.com (Matthew Knepley) Date: Thu, 25 Oct 2018 10:43:57 -0400 Subject: [petsc-users] Periodic BC in petsc DMPlex / firedrake In-Reply-To: References: <2D9A9125-F4A2-4A50-A5F9-4D7C9B86B540@gmail.com> <2852F36F-0CB0-4737-A489-38A476FDAEF2@gmx.li> <6E65EDD0-AB80-4FE5-AF9F-49B9D4D8B9E3@gmail.com> Message-ID: Good catch Stefano. Matt On Thu, Oct 25, 2018 at 9:36 AM Stefano Zampini wrote: > Maybe this is a fix > > diff --git a/src/dm/impls/plex/plexvtu.c b/src/dm/impls/plex/plexvtu.c > index acdea12c2f..1a8bbada6a 100644 > --- a/src/dm/impls/plex/plexvtu.c > +++ b/src/dm/impls/plex/plexvtu.c > @@ -465,10 +465,11 @@ PetscErrorCode DMPlexVTKWriteAll_VTU(DM > dm,PetscViewer viewer) > if ((closure[v] >= vStart) && (closure[v] < vEnd)) { > PetscScalar *xpoint; > > - ierr = > DMPlexPointLocalRead(dm,v,x,&xpoint);CHKERRQ(ierr); > + ierr = > DMPlexPointLocalRead(dm,closure[v],x,&xpoint);CHKERRQ(ierr); > y[cnt + off++] = xpoint[i]; > } > } > + cnt += off; > ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, > &closureSize, &closure);CHKERRQ(ierr); > } > } > > Max, does this fix your problem? If you confirm, I'll fix this in the > maint branch > > If I run the below command line with the patch and with snes tutorials > ex12 I get the nice picture attached > $ ./ex12 -quiet -run_type test -interpolate 1 -bc_type dirichlet > -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f > ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh > -dm_plex_gmsh_periodic -x_periodicity periodic -y_periodicity periodic > -dm_refine 4 > > Il giorno gio 25 ott 2018 alle ore 15:11 Stefano Zampini < > stefano.zampini at gmail.com> ha scritto: > >> Matt, >> >> you can reproduce it via >> >> $ valgrind ./ex12 -quiet -run_type test -interpolate 1 -bc_type dirichlet >> -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f >> ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh >> -dm_plex_gmsh_periodic >> >> Long time ago I added support for viewing meshes with periodic vertices >> in the VTK_VTU viewer, but I did not fix the part that writes fields >> >> >> Il giorno mer 24 ott 2018 alle ore 21:04 Matthew Knepley < >> knepley at gmail.com> ha scritto: >> >>> On Wed, Oct 24, 2018 at 11:36 AM Maximilian Hartig < >>> imilian.hartig at gmail.com> wrote: >>> >>>> >>>> >>>> On 24. Oct 2018, at 12:49, Matthew Knepley wrote: >>>> >>>> On Wed, Oct 24, 2018 at 6:29 AM Lawrence Mitchell wrote: >>>> >>>>> Hi Max, >>>>> >>>>> (I'm cc'ing in the petsc-users mailing list which may have more >>>>> advice, if you are using PETSc you should definitely subscribe! >>>>> >>>>> > On 24 Oct 2018, at 09:27, Maximilian Hartig < >>>>> imilian.hartig at gmail.com> wrote: >>>>> > >>>>> > Hello Lawrence, >>>>> > >>>>> > sorry to message you out of the blue. My name is Max and I found >>>>> your post on GitHub ( >>>>> https://github.com/firedrakeproject/firedrake/issues/1246 ) on DMPlex >>>>> being able to read periodic gmsh files. I am currently trying to do just >>>>> that (creating a periodic DMPlex mesh with gmsh) in the context of my PhD >>>>> work. So far I haven? t found any documentation on the periodic BC?s with >>>>> DMPlex and gmsh in the official petsc documentation. >>>>> > I was wondering whether you?d be so kind as to point me in a general >>>>> direction concerning how to achieve this. You seem experienced in using >>>>> petsc and I would greatly appreciate your help. >>>>> >>>>> >>>>> I think the answer is "it depends". If you're just using DMPlex >>>>> directly and all the of the functionality with PetscDS, then I /think/ that >>>>> reading periodic meshes via gmsh (assuming you're using the appropriate >>>>> gmsh mesh format [v2]) "just works". >>>>> >>>> >>>> There are two phases here: topological and geometric. DMPlex represents >>>> the periodic topological entity directly. For example, a circle is just a >>>> segment with one end hooked to the other. Vertices are not duplicated, or >>>> mapped to each other. This makes topology simple and easy to implement. >>>> However, then geometry is more complicated. What Plex does is allow >>>> coordinates to be represented by a discontinuous field taking values on >>>> cells, in addition to vertices. In our circle example, each cells near the >>>> cut will have 2 coordinates, one for each vertex, but they will not agree >>>> across the cut. If you define a periodic domain, then Plex can construct >>>> this coordinate field automatically using DMPlexLocalize(). These DG >>>> coordinates are then used by the integration routines. >>>> >>>> >>>> Ok, I think I understand the concept. DMPlex reads information about >>>> both topology and coordinates from the .msh file. Creating a periodic mesh >>>> in gmsh then should allow DMPlex to identify the periodic boundaries as the >>>> ?cut? and build the mesh topology accordingly. Coordinate information is >>>> handled separately. >>>> That means, as Lawrence suggested, building periodic meshes in gmsh and >>>> reading them in to petsc?s DMPlex should indeed ?just work?. (From the >>>> user perspective). The only extra step is to call DMLocalizeCoordinates() >>>> after DMPlexReadFromFile(). Sorry to reiterate, I am just trying to make >>>> sense of this. >>>> >>>> >>>> >>>>> From my side, the issue is to do with mapping that coordinate field >>>>> into one that I understand (within Firedrake). You may not have this >>>>> problem. >>>>> >>>> >>>> Firedrake uses its own coordinate mapping and integration routines, so >>>> they must manage the second part independently. I hope to get change this >>>> slightly soon by making the Firedrake representation a DMField, so that it >>>> looks the same to Plex. >>>> >>>> Thanks, >>>> >>>> Matt >>>> >>>> >>>>> Thanks, >>>>> >>>>> Lawrence >>>> >>>> >>>> >>>> -- >>>> 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 >>>> >>>> https://www.cse.buffalo.edu/~knepley/ >>>> >>>> >>>> To read periodic meshes from GMSH, you need to use the option >>>> -dm_plex_gmsh_periodic and DMPlexCreateFromFile >>>> >>>> >>>> Ahh, thanks. I was missing the option " -dm_plex_gmsh_periodic ?. But >>>> using this option I now generate a segmentation fault error when calling >>>> VecView() on the solution vector with vtk and hdf5 viewers. Any suggestions? >>>> >>> >>> Small example? VTK is deprecated. HDF5 should work, although it will >>> require you to have proper coordinates I think. We have to >>> think about what you mean. If its for a checkpoint, there is no problem, >>> but for viz, those programs do not understand periodicity. Thus I embed it >>> in a higher dimensional space. >>> >>> Matt >>> >>>> See src/dm/impls/plex/examples/tests/ex1.c. An example runs >>>> >>>> $ ./ex1 -filename >>>> ${PETSC_DIR}/share/petsc/datafiles/meshes/cube_periodic_bin.msh >>>> -dm_plex_gmsh_periodic -dm_view ::ascii_info_detail -interpolate -test_shape >>>> >>>> generating periodic meshes in gmsh may be tricky, Lisandro for sure may >>>> advice. >>>> >>>> >>>> Thanks, >>>> Max >>>> >>>> >>> >>> -- >>> 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 >>> >>> https://www.cse.buffalo.edu/~knepley/ >>> >>> >> >> >> -- >> Stefano >> > > > -- > Stefano > -- 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 https://www.cse.buffalo.edu/~knepley/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefano.zampini at gmail.com Thu Oct 25 09:47:43 2018 From: stefano.zampini at gmail.com (Stefano Zampini) Date: Thu, 25 Oct 2018 17:47:43 +0300 Subject: [petsc-users] Periodic BC in petsc DMPlex / firedrake In-Reply-To: References: <2D9A9125-F4A2-4A50-A5F9-4D7C9B86B540@gmail.com> <2852F36F-0CB0-4737-A489-38A476FDAEF2@gmx.li> <6E65EDD0-AB80-4FE5-AF9F-49B9D4D8B9E3@gmail.com> Message-ID: Opened the PR https://bitbucket.org/petsc/petsc/pull-requests/1203/fix-dump-vtk-field-with-periodic-meshes/diff Il giorno gio 25 ott 2018 alle ore 17:44 Matthew Knepley ha scritto: > Good catch Stefano. > > Matt > > On Thu, Oct 25, 2018 at 9:36 AM Stefano Zampini > wrote: > >> Maybe this is a fix >> >> diff --git a/src/dm/impls/plex/plexvtu.c b/src/dm/impls/plex/plexvtu.c >> index acdea12c2f..1a8bbada6a 100644 >> --- a/src/dm/impls/plex/plexvtu.c >> +++ b/src/dm/impls/plex/plexvtu.c >> @@ -465,10 +465,11 @@ PetscErrorCode DMPlexVTKWriteAll_VTU(DM >> dm,PetscViewer viewer) >> if ((closure[v] >= vStart) && (closure[v] < vEnd)) { >> PetscScalar *xpoint; >> >> - ierr = >> DMPlexPointLocalRead(dm,v,x,&xpoint);CHKERRQ(ierr); >> + ierr = >> DMPlexPointLocalRead(dm,closure[v],x,&xpoint);CHKERRQ(ierr); >> y[cnt + off++] = xpoint[i]; >> } >> } >> + cnt += off; >> ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, >> &closureSize, &closure);CHKERRQ(ierr); >> } >> } >> >> Max, does this fix your problem? If you confirm, I'll fix this in the >> maint branch >> >> If I run the below command line with the patch and with snes tutorials >> ex12 I get the nice picture attached >> $ ./ex12 -quiet -run_type test -interpolate 1 -bc_type dirichlet >> -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f >> ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh >> -dm_plex_gmsh_periodic -x_periodicity periodic -y_periodicity periodic >> -dm_refine 4 >> >> Il giorno gio 25 ott 2018 alle ore 15:11 Stefano Zampini < >> stefano.zampini at gmail.com> ha scritto: >> >>> Matt, >>> >>> you can reproduce it via >>> >>> $ valgrind ./ex12 -quiet -run_type test -interpolate 1 -bc_type >>> dirichlet -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f >>> ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh >>> -dm_plex_gmsh_periodic >>> >>> Long time ago I added support for viewing meshes with periodic vertices >>> in the VTK_VTU viewer, but I did not fix the part that writes fields >>> >>> >>> Il giorno mer 24 ott 2018 alle ore 21:04 Matthew Knepley < >>> knepley at gmail.com> ha scritto: >>> >>>> On Wed, Oct 24, 2018 at 11:36 AM Maximilian Hartig < >>>> imilian.hartig at gmail.com> wrote: >>>> >>>>> >>>>> >>>>> On 24. Oct 2018, at 12:49, Matthew Knepley wrote: >>>>> >>>>> On Wed, Oct 24, 2018 at 6:29 AM Lawrence Mitchell >>>>> wrote: >>>>> >>>>>> Hi Max, >>>>>> >>>>>> (I'm cc'ing in the petsc-users mailing list which may have more >>>>>> advice, if you are using PETSc you should definitely subscribe! >>>>>> >>>>>> > On 24 Oct 2018, at 09:27, Maximilian Hartig < >>>>>> imilian.hartig at gmail.com> wrote: >>>>>> > >>>>>> > Hello Lawrence, >>>>>> > >>>>>> > sorry to message you out of the blue. My name is Max and I found >>>>>> your post on GitHub ( >>>>>> https://github.com/firedrakeproject/firedrake/issues/1246 ) on >>>>>> DMPlex being able to read periodic gmsh files. I am currently trying to do >>>>>> just that (creating a periodic DMPlex mesh with gmsh) in the context of my >>>>>> PhD work. So far I haven? t found any documentation on the periodic BC?s >>>>>> with DMPlex and gmsh in the official petsc documentation. >>>>>> > I was wondering whether you?d be so kind as to point me in a >>>>>> general direction concerning how to achieve this. You seem experienced in >>>>>> using petsc and I would greatly appreciate your help. >>>>>> >>>>>> >>>>>> I think the answer is "it depends". If you're just using DMPlex >>>>>> directly and all the of the functionality with PetscDS, then I /think/ that >>>>>> reading periodic meshes via gmsh (assuming you're using the appropriate >>>>>> gmsh mesh format [v2]) "just works". >>>>>> >>>>> >>>>> There are two phases here: topological and geometric. DMPlex >>>>> represents the periodic topological entity directly. For example, a circle >>>>> is just a segment with one end hooked to the other. Vertices are not >>>>> duplicated, or mapped to each other. This makes topology simple and easy to >>>>> implement. However, then geometry is more complicated. What Plex does is >>>>> allow coordinates to be represented by a discontinuous field taking values >>>>> on cells, in addition to vertices. In our circle example, each cells near >>>>> the cut will have 2 coordinates, one for each vertex, but they will not >>>>> agree across the cut. If you define a periodic domain, then Plex can >>>>> construct this coordinate field automatically using DMPlexLocalize(). These >>>>> DG coordinates are then used by the integration routines. >>>>> >>>>> >>>>> Ok, I think I understand the concept. DMPlex reads information about >>>>> both topology and coordinates from the .msh file. Creating a periodic mesh >>>>> in gmsh then should allow DMPlex to identify the periodic boundaries as the >>>>> ?cut? and build the mesh topology accordingly. Coordinate information is >>>>> handled separately. >>>>> That means, as Lawrence suggested, building periodic meshes in gmsh >>>>> and reading them in to petsc?s DMPlex should indeed ?just work?. (From the >>>>> user perspective). The only extra step is to call DMLocalizeCoordinates() >>>>> after DMPlexReadFromFile(). Sorry to reiterate, I am just trying to make >>>>> sense of this. >>>>> >>>>> >>>>> >>>>>> From my side, the issue is to do with mapping that coordinate field >>>>>> into one that I understand (within Firedrake). You may not have this >>>>>> problem. >>>>>> >>>>> >>>>> Firedrake uses its own coordinate mapping and integration routines, so >>>>> they must manage the second part independently. I hope to get change this >>>>> slightly soon by making the Firedrake representation a DMField, so that it >>>>> looks the same to Plex. >>>>> >>>>> Thanks, >>>>> >>>>> Matt >>>>> >>>>> >>>>>> Thanks, >>>>>> >>>>>> Lawrence >>>>> >>>>> >>>>> >>>>> -- >>>>> 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 >>>>> >>>>> https://www.cse.buffalo.edu/~knepley/ >>>>> >>>>> >>>>> To read periodic meshes from GMSH, you need to use the option >>>>> -dm_plex_gmsh_periodic and DMPlexCreateFromFile >>>>> >>>>> >>>>> Ahh, thanks. I was missing the option " -dm_plex_gmsh_periodic ?. But >>>>> using this option I now generate a segmentation fault error when calling >>>>> VecView() on the solution vector with vtk and hdf5 viewers. Any suggestions? >>>>> >>>> >>>> Small example? VTK is deprecated. HDF5 should work, although it will >>>> require you to have proper coordinates I think. We have to >>>> think about what you mean. If its for a checkpoint, there is no >>>> problem, but for viz, those programs do not understand periodicity. Thus I >>>> embed it in a higher dimensional space. >>>> >>>> Matt >>>> >>>>> See src/dm/impls/plex/examples/tests/ex1.c. An example runs >>>>> >>>>> $ ./ex1 -filename >>>>> ${PETSC_DIR}/share/petsc/datafiles/meshes/cube_periodic_bin.msh >>>>> -dm_plex_gmsh_periodic -dm_view ::ascii_info_detail -interpolate -test_shape >>>>> >>>>> generating periodic meshes in gmsh may be tricky, Lisandro for sure >>>>> may advice. >>>>> >>>>> >>>>> Thanks, >>>>> Max >>>>> >>>>> >>>> >>>> -- >>>> 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 >>>> >>>> https://www.cse.buffalo.edu/~knepley/ >>>> >>>> >>> >>> >>> -- >>> Stefano >>> >> >> >> -- >> Stefano >> > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > -- Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephen.wornom at inria.fr Thu Oct 25 09:50:53 2018 From: stephen.wornom at inria.fr (Stephen Wornom) Date: Thu, 25 Oct 2018 16:50:53 +0200 (CEST) Subject: [petsc-users] Periodic BC in petsc DMPlex / firedrake In-Reply-To: References: <2D9A9125-F4A2-4A50-A5F9-4D7C9B86B540@gmail.com> <6E65EDD0-AB80-4FE5-AF9F-49B9D4D8B9E3@gmail.com> Message-ID: <216197717.27572033.1540479053626.JavaMail.zimbra@inria.fr> Did you forget to attach "The nice picture attached" Stephen > From: "Stefano Zampini" > To: "petsc-maint" > Cc: "imilian hartig" , "PETSc users list" > > Sent: Thursday, October 25, 2018 4:47:43 PM > Subject: Re: [petsc-users] Periodic BC in petsc DMPlex / firedrake > Opened the PR [ > https://bitbucket.org/petsc/petsc/pull-requests/1203/fix-dump-vtk-field-with-periodic-meshes/diff > | > https://bitbucket.org/petsc/petsc/pull-requests/1203/fix-dump-vtk-field-with-periodic-meshes/diff > ] > Il giorno gio 25 ott 2018 alle ore 17:44 Matthew Knepley < [ > mailto:knepley at gmail.com | knepley at gmail.com ] > ha scritto: >> Good catch Stefano. >> Matt >> On Thu, Oct 25, 2018 at 9:36 AM Stefano Zampini < [ >> mailto:stefano.zampini at gmail.com | stefano.zampini at gmail.com ] > wrote: >>> Maybe this is a fix >>> diff --git a/src/dm/impls/plex/plexvtu.c b/src/dm/impls/plex/plexvtu.c >>> index acdea12c2f..1a8bbada6a 100644 >>> --- a/src/dm/impls/plex/plexvtu.c >>> +++ b/src/dm/impls/plex/plexvtu.c >>> @@ -465,10 +465,11 @@ PetscErrorCode DMPlexVTKWriteAll_VTU(DM dm,PetscViewer >>> viewer) >>> if ((closure[v] >= vStart) && (closure[v] < vEnd)) { >>> PetscScalar *xpoint; >>> - ierr = DMPlexPointLocalRead(dm,v,x,&xpoint);CHKERRQ(ierr); >>> + ierr = DMPlexPointLocalRead(dm,closure[v],x,&xpoint);CHKERRQ(ierr); >>> y[cnt + off++] = xpoint[i]; >>> } >>> } >>> + cnt += off; >>> ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, >>> &closure);CHKERRQ(ierr); >>> } >>> } >>> Max, does this fix your problem? If you confirm, I'll fix this in the maint >>> branch >>> If I run the below command line with the patch and with snes tutorials ex12 I >>> get the nice picture attached >>> $ ./ex12 -quiet -run_type test -interpolate 1 -bc_type dirichlet >>> -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f >>> ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh >>> -dm_plex_gmsh_periodic -x_periodicity periodic -y_periodicity periodic >>> -dm_refine 4 >>> Il giorno gio 25 ott 2018 alle ore 15:11 Stefano Zampini < [ >>> mailto:stefano.zampini at gmail.com | stefano.zampini at gmail.com ] > ha scritto: >>>> Matt, >>>> you can reproduce it via >>>> $ valgrind ./ex12 -quiet -run_type test -interpolate 1 -bc_type dirichlet >>>> -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f >>>> ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh >>>> -dm_plex_gmsh_periodic >>>> Long time ago I added support for viewing meshes with periodic vertices in the >>>> VTK_VTU viewer, but I did not fix the part that writes fields >>>> Il giorno mer 24 ott 2018 alle ore 21:04 Matthew Knepley < [ >>>> mailto:knepley at gmail.com | knepley at gmail.com ] > ha scritto: >>>>> On Wed, Oct 24, 2018 at 11:36 AM Maximilian Hartig < [ >>>>> mailto:imilian.hartig at gmail.com | imilian.hartig at gmail.com ] > wrote: >>>>>>> On 24. Oct 2018, at 12:49, Matthew Knepley < [ mailto:knepley at gmail.com | >>>>>>> knepley at gmail.com ] > wrote: >>>>>>> On Wed, Oct 24, 2018 at 6:29 AM Lawrence Mitchell < [ mailto:wence at gmx.li | >>>>>>> wence at gmx.li ] > wrote: >>>>>>>> Hi Max, >>>>>>>> (I'm cc'ing in the petsc-users mailing list which may have more advice, if you >>>>>>>> are using PETSc you should definitely subscribe! >>>>>>>>> On 24 Oct 2018, at 09:27, Maximilian Hartig < [ mailto:imilian.hartig at gmail.com >>>>>>>> > | imilian.hartig at gmail.com ] > wrote: >>>>>>>> > Hello Lawrence, >>>>>>>>> sorry to message you out of the blue. My name is Max and I found your post on >>>>>>>>> GitHub ( [ https://github.com/firedrakeproject/firedrake/issues/1246 | >>>>>>>>> https://github.com/firedrakeproject/firedrake/issues/1246 ] ) on DMPlex being >>>>>>>>> able to read periodic gmsh files. I am currently trying to do just that >>>>>>>>> (creating a periodic DMPlex mesh with gmsh) in the context of my PhD work. So >>>>>>>>> far I haven? t found any documentation on the periodic BC?s with DMPlex and >>>>>>>> > gmsh in the official petsc documentation. >>>>>>>>> I was wondering whether you?d be so kind as to point me in a general direction >>>>>>>>> concerning how to achieve this. You seem experienced in using petsc and I would >>>>>>>> > greatly appreciate your help. >>>>>>>> I think the answer is "it depends". If you're just using DMPlex directly and all >>>>>>>> the of the functionality with PetscDS, then I /think/ that reading periodic >>>>>>>> meshes via gmsh (assuming you're using the appropriate gmsh mesh format [v2]) >>>>>>>> "just works". >>>>>>> There are two phases here: topological and geometric. DMPlex represents the >>>>>>> periodic topological entity directly. For example, a circle is just a segment >>>>>>> with one end hooked to the other. Vertices are not duplicated, or mapped to >>>>>>> each other. This makes topology simple and easy to implement. However, then >>>>>>> geometry is more complicated. What Plex does is allow coordinates to be >>>>>>> represented by a discontinuous field taking values on cells, in addition to >>>>>>> vertices. In our circle example, each cells near the cut will have 2 >>>>>>> coordinates, one for each vertex, but they will not agree across the cut. If >>>>>>> you define a periodic domain, then Plex can construct this coordinate field >>>>>>> automatically using DMPlexLocalize(). These DG coordinates are then used by the >>>>>>> integration routines. >>>>>> Ok, I think I understand the concept. DMPlex reads information about both >>>>>> topology and coordinates from the .msh file. Creating a periodic mesh in gmsh >>>>>> then should allow DMPlex to identify the periodic boundaries as the ?cut? and >>>>>> build the mesh topology accordingly. Coordinate information is handled >>>>>> separately. >>>>>> That means, as Lawrence suggested, building periodic meshes in gmsh and reading >>>>>> them in to petsc?s DMPlex should indeed ?just work?. (From the user >>>>>> perspective). The only extra step is to call DMLocalizeCoordinates() after >>>>>> DMPlexReadFromFile(). Sorry to reiterate, I am just trying to make sense of >>>>>> this. >>>>>>>> From my side, the issue is to do with mapping that coordinate field into one >>>>>>>> that I understand (within Firedrake). You may not have this problem. >>>>>>> Firedrake uses its own coordinate mapping and integration routines, so they must >>>>>>> manage the second part independently. I hope to get change this slightly soon >>>>>>> by making the Firedrake representation a DMField, so that it looks the same to >>>>>>> Plex. >>>>>>> Thanks, >>>>>>> Matt >>>>>>>> Thanks, >>>>>>>> Lawrence >>>>>>> -- >>>>>>> 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 >>>>>>> [ https://www.cse.buffalo.edu/~knepley/ | https://www.cse.buffalo.edu/~knepley/ >>>>>>> ] >>>>>>> To read periodic meshes from GMSH, you need to use the option >>>>>>> -dm_plex_gmsh_periodic and DMPlexCreateFromFile >>>>>> Ahh, thanks. I was missing the option " -dm_plex_gmsh_periodic ?. But using this >>>>>> option I now generate a segmentation fault error when calling VecView() on the >>>>>> solution vector with vtk and hdf5 viewers. Any suggestions? >>>>> Small example? VTK is deprecated. HDF5 should work, although it will require you >>>>> to have proper coordinates I think. We have to >>>>> think about what you mean. If its for a checkpoint, there is no problem, but for >>>>> viz, those programs do not understand periodicity. Thus I embed it in a higher >>>>> dimensional space. >>>>> Matt >>>>>>> See src/dm/impls/plex/examples/tests/ex1.c. An example runs >>>>>>> $ ./ex1 -filename >>>>>>> ${PETSC_DIR}/share/petsc/datafiles/meshes/cube_periodic_bin.msh >>>>>>> -dm_plex_gmsh_periodic -dm_view ::ascii_info_detail -interpolate -test_shape >>>>>>> generating periodic meshes in gmsh may be tricky, Lisandro for sure may advice. >>>>>> Thanks, >>>>>> Max >>>>> -- >>>>> 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 >>>>> [ http://www.cse.buffalo.edu/~knepley/ | https://www.cse.buffalo.edu/~knepley/ ] >>>> -- >>>> Stefano >>> -- >>> Stefano >> -- >> 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 >> [ http://www.cse.buffalo.edu/~knepley/ | https://www.cse.buffalo.edu/~knepley/ ] > -- > Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: From imilian.hartig at gmail.com Thu Oct 25 09:52:15 2018 From: imilian.hartig at gmail.com (Maximilian Hartig) Date: Thu, 25 Oct 2018 16:52:15 +0200 Subject: [petsc-users] Periodic BC in petsc DMPlex / firedrake In-Reply-To: References: <2D9A9125-F4A2-4A50-A5F9-4D7C9B86B540@gmail.com> <2852F36F-0CB0-4737-A489-38A476FDAEF2@gmx.li> <6E65EDD0-AB80-4FE5-AF9F-49B9D4D8B9E3@gmail.com> Message-ID: <3D5F0B86-0E9F-4A00-A717-633AE1BEFC9D@gmail.com> >> Ahh, thanks. I was missing the option " -dm_plex_gmsh_periodic ?. But using this option I now generate a segmentation fault error when calling VecView() on the solution vector with vtk and hdf5 viewers. Any suggestions? >> > Small example? VTK is deprecated. HDF5 should work, although it will require you to have proper coordinates I think. We have to > think about what you mean. If its for a checkpoint, there is no problem, but for viz, those programs do not understand periodicity. Thus I embed it in a higher dimensional space. > > Matt Building the small example I realised that hdf5 wasn?t working altogether. I?m trying to fix this and see if I can run VecView with the periodic DMPlex then. I planned using this for visualisation. > On 25. Oct 2018, at 15:36, Stefano Zampini wrote: > > Maybe this is a fix > > diff --git a/src/dm/impls/plex/plexvtu.c b/src/dm/impls/plex/plexvtu.c > index acdea12c2f..1a8bbada6a 100644 > --- a/src/dm/impls/plex/plexvtu.c > +++ b/src/dm/impls/plex/plexvtu.c > @@ -465,10 +465,11 @@ PetscErrorCode DMPlexVTKWriteAll_VTU(DM dm,PetscViewer viewer) > if ((closure[v] >= vStart) && (closure[v] < vEnd)) { > PetscScalar *xpoint; > > - ierr = DMPlexPointLocalRead(dm,v,x,&xpoint);CHKERRQ(ierr); > + ierr = DMPlexPointLocalRead(dm,closure[v],x,&xpoint);CHKERRQ(ierr); > y[cnt + off++] = xpoint[i]; > } > } > + cnt += off; > ierr = DMPlexRestoreTransitiveClosure(dm, c, PETSC_TRUE, &closureSize, &closure);CHKERRQ(ierr); > } > } > > Max, does this fix your problem? If you confirm, I'll fix this in the maint branch It did indeed fix the issue! Thank you. I?ve had problems with hdf5 before and switched to vtk. It?s good news I can continue to use it. > > If I run the below command line with the patch and with snes tutorials ex12 I get the nice picture attached > $ ./ex12 -quiet -run_type test -interpolate 1 -bc_type dirichlet -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh -dm_plex_gmsh_periodic -x_periodicity periodic -y_periodicity periodic -dm_refine 4 > > Il giorno gio 25 ott 2018 alle ore 15:11 Stefano Zampini > ha scritto: > Matt, > > you can reproduce it via > > $ valgrind ./ex12 -quiet -run_type test -interpolate 1 -bc_type dirichlet -petscspace_degree 1 -vec_view vtk:test.vtu:vtk_vtu -f ${PETSC_DIR}/share/petsc/datafiles/meshes/square_periodic.msh -dm_plex_gmsh_periodic > > Long time ago I added support for viewing meshes with periodic vertices in the VTK_VTU viewer, but I did not fix the part that writes fields > > > Il giorno mer 24 ott 2018 alle ore 21:04 Matthew Knepley > ha scritto: > On Wed, Oct 24, 2018 at 11:36 AM Maximilian Hartig > wrote: > > >> On 24. Oct 2018, at 12:49, Matthew Knepley > wrote: >> >> On Wed, Oct 24, 2018 at 6:29 AM Lawrence Mitchell > wrote: >> Hi Max, >> >> (I'm cc'ing in the petsc-users mailing list which may have more advice, if you are using PETSc you should definitely subscribe! >> >> > On 24 Oct 2018, at 09:27, Maximilian Hartig > wrote: >> > >> > Hello Lawrence, >> > >> > sorry to message you out of the blue. My name is Max and I found your post on GitHub (https://github.com/firedrakeproject/firedrake/issues/1246 ) on DMPlex being able to read periodic gmsh files. I am currently trying to do just that (creating a periodic DMPlex mesh with gmsh) in the context of my PhD work. So far I haven? t found any documentation on the periodic BC?s with DMPlex and gmsh in the official petsc documentation. >> > I was wondering whether you?d be so kind as to point me in a general direction concerning how to achieve this. You seem experienced in using petsc and I would greatly appreciate your help. >> >> >> I think the answer is "it depends". If you're just using DMPlex directly and all the of the functionality with PetscDS, then I /think/ that reading periodic meshes via gmsh (assuming you're using the appropriate gmsh mesh format [v2]) "just works". >> >> There are two phases here: topological and geometric. DMPlex represents the periodic topological entity directly. For example, a circle is just a segment with one end hooked to the other. Vertices are not duplicated, or mapped to each other. This makes topology simple and easy to implement. However, then geometry is more complicated. What Plex does is allow coordinates to be represented by a discontinuous field taking values on cells, in addition to vertices. In our circle example, each cells near the cut will have 2 coordinates, one for each vertex, but they will not agree across the cut. If you define a periodic domain, then Plex can construct this coordinate field automatically using DMPlexLocalize(). These DG coordinates are then used by the integration routines. > > Ok, I think I understand the concept. DMPlex reads information about both topology and coordinates from the .msh file. Creating a periodic mesh in gmsh then should allow DMPlex to identify the periodic boundaries as the ?cut? and build the mesh topology accordingly. Coordinate information is handled separately. > That means, as Lawrence suggested, building periodic meshes in gmsh and reading them in to petsc?s DMPlex should indeed ?just work?. (From the user perspective). The only extra step is to call DMLocalizeCoordinates() after DMPlexReadFromFile(). Sorry to reiterate, I am just trying to make sense of this. >> >> From my side, the issue is to do with mapping that coordinate field into one that I understand (within Firedrake). You may not have this problem. >> >> Firedrake uses its own coordinate mapping and integration routines, so they must manage the second part independently. I hope to get change this slightly soon by making the Firedrake representation a DMField, so that it looks the same to Plex. >> >> Thanks, >> >> Matt >> >> Thanks, >> >> Lawrence >> >> >> -- >> 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 >> >> https://www.cse.buffalo.edu/~knepley/ >> To read periodic meshes from GMSH, you need to use the option -dm_plex_gmsh_periodic and DMPlexCreateFromFile > > Ahh, thanks. I was missing the option " -dm_plex_gmsh_periodic ?. But using this option I now generate a segmentation fault error when calling VecView() on the solution vector with vtk and hdf5 viewers. Any suggestions? > > Small example? VTK is deprecated. HDF5 should work, although it will require you to have proper coordinates I think. We have to > think about what you mean. If its for a checkpoint, there is no problem, but for viz, those programs do not understand periodicity. Thus I embed it in a higher dimensional space. > > Matt >> See src/dm/impls/plex/examples/tests/ex1.c. An example runs >> >> $ ./ex1 -filename ${PETSC_DIR}/share/petsc/datafiles/meshes/cube_periodic_bin.msh -dm_plex_gmsh_periodic -dm_view ::ascii_info_detail -interpolate -test_shape >> >> generating periodic meshes in gmsh may be tricky, Lisandro for sure may advice. > > Thanks, > Max > > > > -- > 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 > > https://www.cse.buffalo.edu/~knepley/ > > > -- > Stefano > > > -- > Stefano > -------------- next part -------------- An HTML attachment was scrubbed... URL: From 648934229 at qq.com Thu Oct 25 17:18:07 2018 From: 648934229 at qq.com (=?gb18030?B?YXZhdGFy?=) Date: Fri, 26 Oct 2018 06:18:07 +0800 Subject: [petsc-users] "Could not find a suitable archiver. Use --with-ar to specify an archiver" Message-ID: Hi, When I try to configure PETSc to connect Matlab with the following command ./petsc-3.8.3/configure ?with-matlab , it prompts =============================================================================== Configuring PETSc to compile on your system =============================================================================== TESTING: checkArchiver from config.setCompilers(config/BuildSystem/config/setCompilers.py:1184) ******************************************************************************* UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log for details): ------------------------------------------------------------------------------- Could not find a suitable archiver. Use --with-ar to specify an archiver. ******************************************************************************* I am a newbie on Petsc. Could you please tell me how I should specify an archiver? I am on MacOX system. I have tried many ways but it still does not work. Thank you very much for your help. Best, Joe -------------- next part -------------- An HTML attachment was scrubbed... URL: From balay at mcs.anl.gov Thu Oct 25 17:23:59 2018 From: balay at mcs.anl.gov (Balay, Satish) Date: Thu, 25 Oct 2018 22:23:59 +0000 Subject: [petsc-users] "Could not find a suitable archiver. Use --with-ar to specify an archiver" In-Reply-To: References: Message-ID: Its best to stick with one list - so will follow up on petsc-maint. Satish On Fri, 26 Oct 2018, avatar wrote: > Hi, > > When I try to configure PETSc to connect Matlab with the following command > ./petsc-3.8.3/configure ??with-matlab > , it prompts > =============================================================================== > Configuring PETSc to compile on your system > =============================================================================== > TESTING: checkArchiver from config.setCompilers(config/BuildSystem/config/setCompilers.py:1184) ******************************************************************************* > UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log for details): > ------------------------------------------------------------------------------- > Could not find a suitable archiver. Use --with-ar to specify an archiver. > ******************************************************************************* > > > > I am a newbie on Petsc. Could you please tell me how I should specify an archiver? I am on MacOX system. I have tried many ways but it still does not work. > > > Thank you very much for your help. > > > Best, > Joe From 648934229 at qq.com Thu Oct 25 17:27:32 2018 From: 648934229 at qq.com (=?ISO-8859-1?B?YXZhdGFy?=) Date: Fri, 26 Oct 2018 06:27:32 +0800 Subject: [petsc-users] "Could not find a suitable archiver. Use --with-arto specify an archiver" In-Reply-To: References: Message-ID: Hi Satish, Thank you very much for your quick response. The log file is as follow: Pushing language C Popping language C Pushing language CUDA Popping language CUDA Pushing language Cxx Popping language Cxx Pushing language FC Popping language FC ================================================================================ ================================================================================ Starting Configure Run at Thu Oct 25 16:25:30 2018 Configure Options: --configModules=PETSc.Configure --optionsModule=config.compilerOptions --with-matlab Working directory: /Users/zhihui/igx/deps/srcs/petsc-3.8.3 Machine platform: ('Darwin', 'Scott-Grad-MBP', '16.7.0', 'Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64', 'x86_64', 'i386') Python version: 2.7.10 (default, Feb 7 2017, 00:08:15) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] ================================================================================ Pushing language C Popping language C Pushing language CUDA Popping language CUDA Pushing language Cxx Popping language Cxx Pushing language FC Popping language FC ================================================================================ TEST configureExternalPackagesDir from config.framework(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/BuildSystem/config/framework.py:841) TESTING: configureExternalPackagesDir from config.framework(config/BuildSystem/config/framework.py:841) ================================================================================ TEST configureDebuggers from config.utilities.debuggers(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/BuildSystem/config/utilities/debuggers.py:22) TESTING: configureDebuggers from config.utilities.debuggers(config/BuildSystem/config/utilities/debuggers.py:22) Find a default debugger and determine its arguments Checking for program /usr/local/bin/gdb...not found Checking for program /usr/bin/gdb...not found Checking for program /bin/gdb...not found Checking for program /usr/sbin/gdb...not found Checking for program /sbin/gdb...not found Checking for program /Applications/VMware Fusion.app/Contents/Public/gdb...not found Checking for program /Library/TeX/texbin/gdb...not found Checking for program /Users/zhihui/gdb...not found Checking for program /usr/local/bin/dbx...not found Checking for program /usr/bin/dbx...not found Checking for program /bin/dbx...not found Checking for program /usr/sbin/dbx...not found Checking for program /sbin/dbx...not found Checking for program /Applications/VMware Fusion.app/Contents/Public/dbx...not found Checking for program /Library/TeX/texbin/dbx...not found Checking for program /Users/zhihui/dbx...not found Checking for program /usr/local/bin/xdb...not found Checking for program /usr/bin/xdb...not found Checking for program /bin/xdb...not found Checking for program /usr/sbin/xdb...not found Checking for program /sbin/xdb...not found Checking for program /Applications/VMware Fusion.app/Contents/Public/xdb...not found Checking for program /Library/TeX/texbin/xdb...not found Checking for program /Users/zhihui/xdb...not found Checking for program /usr/local/bin/dsymutil...not found Checking for program /usr/bin/dsymutil...found Defined make macro "DSYMUTIL" to "/usr/bin/dsymutil" Defined make macro "DSYMUTIL" to "/usr/bin/dsymutil" ================================================================================ TEST configureGit from config.sourceControl(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/BuildSystem/config/sourceControl.py:24) TESTING: configureGit from config.sourceControl(config/BuildSystem/config/sourceControl.py:24) Find the Git executable Checking for program /usr/local/bin/git...not found Checking for program /usr/bin/git...found Defined make macro "GIT" to "git" Executing: git --version stdout: git version 2.14.3 (Apple Git-98) ================================================================================ TEST configureMercurial from config.sourceControl(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/BuildSystem/config/sourceControl.py:35) TESTING: configureMercurial from config.sourceControl(config/BuildSystem/config/sourceControl.py:35) Find the Mercurial executable Checking for program /usr/local/bin/hg...not found Checking for program /usr/bin/hg...not found Checking for program /bin/hg...not found Checking for program /usr/sbin/hg...not found Checking for program /sbin/hg...not found Checking for program /Applications/VMware Fusion.app/Contents/Public/hg...not found Checking for program /Library/TeX/texbin/hg...not found Checking for program /Users/zhihui/hg...not found ================================================================================ TEST configureCLanguage from PETSc.options.languages(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/PETSc/options/languages.py:27) TESTING: configureCLanguage from PETSc.options.languages(config/PETSc/options/languages.py:27) Choose whether to compile the PETSc library using a C or C++ compiler C language is C Defined "CLANGUAGE_C" to "1" ================================================================================ TEST configureDirectories from PETSc.options.petscdir(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/PETSc/options/petscdir.py:23) TESTING: configureDirectories from PETSc.options.petscdir(config/PETSc/options/petscdir.py:23) Checks PETSC_DIR and sets if not set Version Information: #define PETSC_VERSION_RELEASE 1 #define PETSC_VERSION_MAJOR 3 #define PETSC_VERSION_MINOR 8 #define PETSC_VERSION_SUBMINOR 3 #define PETSC_VERSION_PATCH 0 #define PETSC_VERSION_DATE "Dec, 09, 2017" #define PETSC_VERSION_GIT "v3.8.3" #define PETSC_VERSION_DATE_GIT "2017-12-09 22:33:04 -0600" #define PETSC_VERSION_EQ(MAJOR,MINOR,SUBMINOR) \ #define PETSC_VERSION_ PETSC_VERSION_EQ #define PETSC_VERSION_LT(MAJOR,MINOR,SUBMINOR) \ #define PETSC_VERSION_LE(MAJOR,MINOR,SUBMINOR) \ #define PETSC_VERSION_GT(MAJOR,MINOR,SUBMINOR) \ #define PETSC_VERSION_GE(MAJOR,MINOR,SUBMINOR) \ Defined make macro "DIR" to "/Users/zhihui/igx/deps/srcs/petsc-3.8.3" ================================================================================ TEST getDatafilespath from PETSc.options.dataFilesPath(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/PETSc/options/dataFilesPath.py:29) TESTING: getDatafilespath from PETSc.options.dataFilesPath(config/PETSc/options/dataFilesPath.py:29) Checks what DATAFILESPATH should be ================================================================================ TEST configureInstallationMethod from PETSc.options.petscclone(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/PETSc/options/petscclone.py:20) TESTING: configureInstallationMethod from PETSc.options.petscclone(config/PETSc/options/petscclone.py:20) This is a tarball installation ================================================================================ TEST configureArchitecture from PETSc.options.arch(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/PETSc/options/arch.py:36) TESTING: configureArchitecture from PETSc.options.arch(config/PETSc/options/arch.py:36) Checks PETSC_ARCH and sets if not set Defined "ARCH" to ""arch-darwin-c-debug"" ================================================================================ TEST setInstallDir from PETSc.options.installDir(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/PETSc/options/installDir.py:35) TESTING: setInstallDir from PETSc.options.installDir(config/PETSc/options/installDir.py:35) setup installDir to either prefix or if that is not set to PETSC_DIR/PETSC_ARCH ================================================================================ TEST saveReconfigure from PETSc.options.installDir(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/PETSc/options/installDir.py:75) TESTING: saveReconfigure from PETSc.options.installDir(config/PETSc/options/installDir.py:75) ================================================================================ TEST cleanInstallDir from PETSc.options.installDir(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/PETSc/options/installDir.py:68) TESTING: cleanInstallDir from PETSc.options.installDir(config/PETSc/options/installDir.py:68) ================================================================================ TEST configureInstallDir from PETSc.options.installDir(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/PETSc/options/installDir.py:52) TESTING: configureInstallDir from PETSc.options.installDir(config/PETSc/options/installDir.py:52) Makes installDir subdirectories if it does not exist for both prefix install location and PETSc work install location Changed persistence directory to /Users/zhihui/igx/deps/srcs/petsc-3.8.3/arch-darwin-c-debug/lib/petsc/conf ================================================================================ TEST restoreReconfigure from PETSc.options.installDir(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/PETSc/options/installDir.py:88) TESTING: restoreReconfigure from PETSc.options.installDir(config/PETSc/options/installDir.py:88) ================================================================================ TEST setExternalPackagesDir from PETSc.options.externalpackagesdir(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/PETSc/options/externalpackagesdir.py:15) TESTING: setExternalPackagesDir from PETSc.options.externalpackagesdir(config/PETSc/options/externalpackagesdir.py:15) ================================================================================ TEST cleanExternalpackagesDir from PETSc.options.externalpackagesdir(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/PETSc/options/externalpackagesdir.py:22) TESTING: cleanExternalpackagesDir from PETSc.options.externalpackagesdir(config/PETSc/options/externalpackagesdir.py:22) ================================================================================ TEST printEnvVariables from config.setCompilers(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/BuildSystem/config/setCompilers.py:1612) TESTING: printEnvVariables from config.setCompilers(config/BuildSystem/config/setCompilers.py:1612) **** printenv **** VERSIONER_PYTHON_PREFER_32_BIT=no TERM_PROGRAM_VERSION=3.2.4 LOGNAME=zhihui USER=zhihui PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin HOME=/Users/zhihui TERM_PROGRAM=iTerm.app LANG=en_US.UTF-8 TERM=xterm-256color Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.ybiDqNFoh0/Render COLORFGBG=7;0 VERSIONER_PYTHON_VERSION=2.7 SHLVL=1 XPC_FLAGS=0x0 ITERM_SESSION_ID=w0t0p0:52215AF3-F8D7-4DDE-BC06-683584748154 _=./configure TERM_SESSION_ID=w0t0p0:52215AF3-F8D7-4DDE-BC06-683584748154 XPC_SERVICE_NAME=0 SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.XYegXE4MrG/Listeners SHELL=/bin/bash ITERM_PROFILE=Default TMPDIR=tmp OLDPWD=/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config __CF_USER_TEXT_ENCODING=0x1F6:0x0:0x0 PWD=/Users/zhihui/igx/deps/srcs/petsc-3.8.3 COLORTERM=truecolor ================================================================================ TEST resetEnvCompilers from config.setCompilers(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/BuildSystem/config/setCompilers.py:1619) TESTING: resetEnvCompilers from config.setCompilers(config/BuildSystem/config/setCompilers.py:1619) ================================================================================ TEST checkEnvCompilers from config.setCompilers(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/BuildSystem/config/setCompilers.py:1649) TESTING: checkEnvCompilers from config.setCompilers(config/BuildSystem/config/setCompilers.py:1649) ================================================================================ TEST checkMPICompilerOverride from config.setCompilers(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/BuildSystem/config/setCompilers.py:1584) TESTING: checkMPICompilerOverride from config.setCompilers(config/BuildSystem/config/setCompilers.py:1584) Check if --with-mpi-dir is used along with CC CXX or FC compiler options. This usually prevents mpi compilers from being used - so issue a warning ================================================================================ TEST requireMpiLdPath from config.setCompilers(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/BuildSystem/config/setCompilers.py:1603) TESTING: requireMpiLdPath from config.setCompilers(config/BuildSystem/config/setCompilers.py:1603) OpenMPI wrappers require LD_LIBRARY_PATH set ================================================================================ TEST checkVendor from config.setCompilers(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/BuildSystem/config/setCompilers.py:426) TESTING: checkVendor from config.setCompilers(config/BuildSystem/config/setCompilers.py:426) Determine the compiler vendor Compiler vendor is "" ================================================================================ TEST checkInitialFlags from config.setCompilers(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/BuildSystem/config/setCompilers.py:436) TESTING: checkInitialFlags from config.setCompilers(config/BuildSystem/config/setCompilers.py:436) Initialize the compiler and linker flags Pushing language C Initialized CFLAGS to Initialized CFLAGS to Initialized LDFLAGS to Popping language C Pushing language CUDA Initialized CUDAFLAGS to Initialized CUDAFLAGS to Initialized LDFLAGS to Popping language CUDA Pushing language Cxx Initialized CXXFLAGS to Initialized CXX_CXXFLAGS to Initialized LDFLAGS to Popping language Cxx Pushing language FC Initialized FFLAGS to Initialized FFLAGS to Initialized LDFLAGS to Popping language FC Initialized CPPFLAGS to Initialized CUDAPPFLAGS to Initialized CXXCPPFLAGS to Initialized CC_LINKER_FLAGS to [] Initialized CXX_LINKER_FLAGS to [] Initialized FC_LINKER_FLAGS to [] Initialized CUDAC_LINKER_FLAGS to [] Initialized sharedLibraryFlags to [] Initialized dynamicLibraryFlags to [] ================================================================================ TEST checkCCompiler from config.setCompilers(/Users/zhihui/igx/deps/srcs/petsc-3.8.3/config/BuildSystem/config/setCompilers.py:566) TESTING: checkCCompiler from config.setCompilers(config/BuildSystem/config/setCompilers.py:566) Locate a functional C compiler Executing: mpicc --help stdout: OVERVIEW: clang LLVM compiler USAGE: clang-6.0 [options] OPTIONS: -### Print (but do not run) the commands to run for this compilation --analyzer-output Static analyzer report output format (html|plist|plist-multi-file|plist-html|text). --analyze Run the static analyzer -arcmt-migrate-emit-errors Emit ARC errors even if the migrator can fix them -arcmt-migrate-report-output Output path for the plist report -B Add to search path for binaries and object files used implicitly -CC Include comments from within macros in preprocessed output -cl-denorms-are-zero OpenCL only. Allow denormals to be flushed to zero. -cl-fast-relaxed-math OpenCL only. Sets -cl-finite-math-only and -cl-unsafe-math-optimizations, and defines __FAST_RELAXED_MATH__. -cl-finite-math-only OpenCL only. Allow floating-point optimizations that assume arguments and results are not NaNs or +-Inf. -cl-fp32-correctly-rounded-divide-sqrt OpenCL only. Specify that single precision floating-point divide and sqrt used in the program source are correctly rounded. -cl-kernel-arg-info OpenCL only. Generate kernel argument metadata. -cl-mad-enable OpenCL only. Allow use of less precise MAD computations in the generated binary. -cl-no-signed-zeros OpenCL only. Allow use of less precise no signed zeros computations in the generated binary. -cl-opt-disable OpenCL only. This option disables all optimizations. By default optimizations are enabled. -cl-single-precision-constant OpenCL only. Treat double precision floating-point constant as single precision constant. -cl-std= OpenCL language standard to compile for. -cl-strict-aliasing OpenCL only. This option is added for compatibility with OpenCL 1.0. -cl-unsafe-math-optimizations OpenCL only. Allow unsafe floating-point optimizations. Also implies -cl-no-signed-zeros and -cl-mad-enable. --config Specifies configuration file --cuda-compile-host-device Compile CUDA code for both host and device (default). Has no effect on non-CUDA compilations. --cuda-device-only Compile CUDA code for device only --cuda-gpu-arch= CUDA GPU architecture (e.g. sm_35). May be specified more than once. --cuda-host-only Compile CUDA code for host only. Has no effect on non-CUDA compilations. --cuda-noopt-device-debug Enable device-side debug info generation. Disables ptxas optimizations. --cuda-path= CUDA installation path -cxx-isystem Add directory to the C++ SYSTEM include search path -C Include comments in preprocessed output -c Only run preprocess, compile, and assemble steps -dD Print macro definitions in -E mode in addition to normal output -dependency-dot Filename to write DOT-formatted header dependencies to -dependency-file Filename (or -) to write dependency output to -dI Print include directives in -E mode in addition to normal output -dM Print macro definitions in -E mode instead of normal output -D = Define to (or 1 if omitted) -emit-ast Emit Clang AST files for source inputs -emit-llvm Use the LLVM representation for assembler and object files -E Only run the preprocessor -faligned-allocation Enable C++17 aligned allocation functions -fallow-editor-placeholders Treat editor placeholders as valid source code -fansi-escape-codes Use ANSI escape codes for diagnostics -fapple-kext Use Apple's kernel extensions ABI -fapple-pragma-pack Enable Apple gcc-compatible #pragma pack handling -fapplication-extension Restrict code to those available for App Extensions -fblocks Enable the 'blocks' language feature -fborland-extensions Accept non-standard constructs supported by the Borland compiler -fbuild-session-file= Use the last modification time of as the build session timestamp -fbuild-session-timestamp=