Re: [petsc-users] cray build error
Mark Adams mfad...@lbl.gov writes: I get this on Hopper with PETSC maint. Any ideas? The environment is broken: wrapper compiler is adding -lpspline and -lezcdf. Perhaps you need to unload modules or load other modules? | Executing: cc -o /scratch/scratchdirs/madams/petsc-pDazNU/config.setCompilers/conftest /scratch/scratchdirs/madams/petsc-pDazNU/config.setCompilers/conftest.o | sh: | Possible ERROR while running linker: ModuleCmd_Switch.c(172):ERROR:152: Module 'PrgEnv-pgi' is currently not loaded | ModuleCmd_Switch.c(172):ERROR:152: Module 'PrgEnv-pgi' is currently not loaded | ModuleCmd_Switch.c(172):ERROR:152: Module 'PrgEnv-pgi' is currently not loaded | /usr/bin/ld: cannot find -lpspline | /usr/bin/ld: cannot find -lezcdf | collect2: error: ld returned 1 exit status | output: ret = 256 | _LMFILES_=/opt/modulefiles/modules/3.2.6.6:/usr/syscom/nsg/modulefiles/nsg/1.2.0:/opt/modulefiles/modules/3.2.6.7:/opt/cray/xt-asyncpe/default/modulefiles/xtpe-network-gemini:/opt/modulefiles/PrgEnv-gnu/4.2.34:/opt/cray/modulefiles/atp/1.7.0:/opt/modulefiles/xe-sysroot/4.2.34:/opt/cray/gem/modulefiles/switch/1.0-1.0402.45840.2.63.gem:/opt/cray/gem/modulefiles/shared-root/1.0-1.0402.46893.3.17.gem:/opt/cray/gem/modulefiles/pdsh/2.26-1.0402.45278.1.1.gem:/opt/cray/gem/modulefiles/nodehealth/5.1-1.0402.45895.3.76.gem:/opt/cray/gem/modulefiles/lbcd/2.1-1.0402.45245.1.2.gem:/opt/cray/gem/modulefiles/hosts/1.0-1.0402.45251.1.86.gem:/opt/cray/gem/modulefiles/configuration/1.0-1.0402.45284.1.2.gem:/opt/cray/modulefiles/ccm/2.2.0-1.0402.46086.4.120:/opt/cray/gem/modulefiles/audit/1.0.0-1.0402.45273.1.86.gem:/opt/cray/gem/modulefiles/rca/1.0.0-2.0402.47290.7.1.gem:/opt/cray/gem/modulefiles/csa/3.0.0-1_2.0402.45268.1.90.gem:/opt/cray/gem/modulefiles/job/1.5.5-0.1_2.0402.45272.1.5.gem:/opt/cray/gem/modulefiles/xpmem/0.1-2.0402.45248.1.5.gem:/opt/cray/gem/modulefiles/gni-headers/2.1-1.0402.7541.1.5.gem:/opt/cray/gem/modulefiles/dmapp/4.0.1-1.0402.7784.4.1.gem:/opt/cray/gem/modulefiles/pmi/4.0.1-1..9753.86.3.gem:/opt/cray/gem/modulefiles/ugni/5.0-1.0402.7551.1.10.gem:/opt/cray/gem/modulefiles/udreg/2.3.2-1.0402.7546.1.5.gem:/opt/cray/modulefiles/cray-libsci/12.1.01:/opt/modulefiles/gcc/4.8.1:/opt/modulefiles/xt-asyncpe/5.23:/opt/modulefiles/eswrap/1.0.20-1.010102.662.0:/opt/cray/xt-asyncpe/default/modulefiles/craype-mc12:/opt/cray/modulefiles/cray-shmem/6.0.1:/opt/cray/modulefiles/cray-mpich/6.0.1:/opt/modulefiles/torque/4.2.3.h5_notcpretry:/opt/modulefiles/moab/7.2.3-r19-b121-SUSE11:/usr/common/usg/Modules/modulefiles/valgrind/3.8.1:/usr/common/usg/Modules/modulefiles/cmake/2.8.10.1:/usr/common/graphics/Modules/modulefiles/visit/2.7.0:/opt/cray/modulefiles/papi/5.1.2:/usr/common/usg/Modules/modulefiles/ipm/2.00:/usr/common/usg/Modules/modulefiles/allineatools/4.2-34404:/usr/common/usg/Modules/modulefiles/adios/1.2.1:/usr/common/usg/Modules/modulefiles/pspline/nersc1.0:/opt/cray/modulefiles/cray-hdf5/1.8.11:/opt/cray/modulefiles/cray-netcdf/4.3.0:/usr/common/usg/Modules/modulefiles/matlab/R2012a:/usr/common/usg/Modules/modulefiles/altd/1.0:/usr/common/usg/Modules/modulefiles/usg-default-modules/1.0 pgp1uEi5fzr5n.pgp Description: PGP signature
[petsc-users] undefined reference to `PetscMalloc1'
Am trying to build the code in a PETsc tutorial: http://www.mcs.anl.gov/petsc/petsc-dev/src/ksp/ksp/examples/tutorials/ex7.c.html Got past the compile error regarding KSPSetOperators by adding the fourth parameter: ierr = KSPSetOperators(ksp,A,A,SAME_PRECONDITIONER);CHKERRQ(ierr); Added the include file the man page said was needed: #include petscsys.h Using the following build command: gcc gmres_ex7.c -o gmres_ex7 -I $PET_HOME/pkgs/valgrind-3.6.1/include -I $PET_HOME/.unsupported/petsc-3.4.4/Installed/include -I $PET_HOME/.unsupported/mpich-3.0.3/Installed/include -L $PET_HOME/.unsupported/petsc-3.4.4/Installed/lib -l petsc Getting the following link error: undefined reference to `PetscMalloc1' Many thanks for any insights the group has to offer. Best, Peter. This electronic message transmission and any attachments that accompany it contain information from DRC® (Dynamics Research Corporation) or its subsidiaries, or the intended recipient, which is privileged, proprietary, business confidential, or otherwise protected from disclosure and is the exclusive property of DRC and/or the intended recipient. The information in this email is solely intended for the use of the individual or entity that is the intended recipient. If you are not the intended recipient, any use, dissemination, distribution, retention, or copying of this communication, attachments, or substance is prohibited. If you have received this electronic transmission in error, please immediately reply to the author via email that you received the message by mistake and also promptly and permanently delete this message and all copies of this email and any attachments. We thank you for your assistance and apologize for any inconvenience.
Re: [petsc-users] undefined reference to `PetscMalloc1'
On Mar 20, 2014, at 8:04 AM, Raeth . Peter pra...@drc.com wrote: Am trying to build the code in a PETsc tutorial: http://www.mcs.anl.gov/petsc/petsc-dev/src/ksp/ksp/examples/tutorials/ex7.c.html The examples in this directory, denoted by petsc-dev, work with the development version of PETSc. Sometimes they will be different than the examples in the release of PETSc http://www.mcs.anl.gov/petsc/petsc-current/src/ksp/ksp/examples/tutorials/ex7.c.html denoted by petsc-currant. They shouldn’t be mixed together. So either use the PETSc release and the examples in it or the development version of PETSc and the examples in it. Barry Got past the compile error regarding KSPSetOperators by adding the fourth parameter: ierr = KSPSetOperators(ksp,A,A,SAME_PRECONDITIONER);CHKERRQ(ierr); Added the include file the man page said was needed: #include petscsys.h Using the following build command: gcc gmres_ex7.c -o gmres_ex7 -I $PET_HOME/pkgs/valgrind-3.6.1/include -I $PET_HOME/.unsupported/petsc-3.4.4/Installed/include -I $PET_HOME/.unsupported/mpich-3.0.3/Installed/include -L $PET_HOME/.unsupported/petsc-3.4.4/Installed/lib -l petsc Getting the following link error: undefined reference to `PetscMalloc1' Many thanks for any insights the group has to offer. Best, Peter. This electronic message transmission and any attachments that accompany it contain information from DRC® (Dynamics Research Corporation) or its subsidiaries, or the intended recipient, which is privileged, proprietary, business confidential, or otherwise protected from disclosure and is the exclusive property of DRC and/or the intended recipient. The information in this email is solely intended for the use of the individual or entity that is the intended recipient. If you are not the intended recipient, any use, dissemination, distribution, retention, or copying of this communication, attachments, or substance is prohibited. If you have received this electronic transmission in error, please immediately reply to the author via email that you received the message by mistake and also promptly and permanently delete this message and all copies of this email and any attachments. We thank you for your assistance and apologize for any inconvenience.
Re: [petsc-users] undefined reference to `PetscMalloc1'
Oh my. Thanks Barry. Did not realize there would be a difference. Your input is most appreciated. Best, Peter. This electronic message transmission and any attachments that accompany it contain information from DRC® (Dynamics Research Corporation) or its subsidiaries, or the intended recipient, which is privileged, proprietary, business confidential, or otherwise protected from disclosure and is the exclusive property of DRC and/or the intended recipient. The information in this email is solely intended for the use of the individual or entity that is the intended recipient. If you are not the intended recipient, any use, dissemination, distribution, retention, or copying of this communication, attachments, or substance is prohibited. If you have received this electronic transmission in error, please immediately reply to the author via email that you received the message by mistake and also promptly and permanently delete this message and all copies of this email and any attachments. We thank you for your assistance and apologize for any inconvenience.
[petsc-users] Compute norm of a single component of DMDAVec struct
I'm using a struct for a multi-component PDE as suggested in the manual, like so: typedef struct { PetscScalar u,v,omega,temperature; } Node; Node **f,**u; DMDAVecGetArray(DM da,Vec local,u); DMDAVecGetArray(DM da,Vec global,f); Calling VecNorm(...) on these vectors gives a norm for the entire vector. If one wants separate norms for each component of the struct, i.e. Norm(u) or Norm(v), what's the right approach? Would I need to manually compute norms locally and then call an MPI reduce function, or is this ability built-in to PETSc somewhere? -Mark Lohry
Re: [petsc-users] Compute norm of a single component of DMDAVec struct
You could use http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/DM/DMCreateFieldDecomposition.html to get DMDAs representing the layout of the individual components and DMCreateGlobalVector() on those DMDAs to get properly laid-out individual field vectors. Then, you would use the ISes given by this function to build VecScatters using http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecScatterCreate.html from the monolithic vector to the component ones. Then apply the scatter and do whatever you want with those vectors (take norms, etc.) Hope this helps. - Peter On Thu, Mar 20, 2014 at 10:38 AM, Mark Lohry mlo...@gmail.com wrote: I'm using a struct for a multi-component PDE as suggested in the manual, like so: typedef struct { PetscScalar u,v,omega,temperature; } Node; Node **f,**u; DMDAVecGetArray(DM da,Vec local,u); DMDAVecGetArray(DM da,Vec global,f); Calling VecNorm(...) on these vectors gives a norm for the entire vector. If one wants separate norms for each component of the struct, i.e. Norm(u) or Norm(v), what's the right approach? Would I need to manually compute norms locally and then call an MPI reduce function, or is this ability built-in to PETSc somewhere? -Mark Lohry
[petsc-users] gamg failure with petsc-dev
Hi guys, We have been having some problems with GAMG on petsc-dev (master) for cases that worked fine on petsc 3.4. We're solving a Stokes equation (just the velocity block) for a simple convection in a square box (isoviscous). The problem only occurs if we supply a near null space (via MatSetNearNullSpace) where we supply the usual (1,0) (0,1) and (-y,x) (near) null space vectors. If we supply those, the smoother complains that the diagonal of the A matrix at the first coarsened level contains a zero. If I dump out the prolongator from the finest to the first coarsened level it indeed contains a zero column at that same index. We're pretty confident that the fine level A matrix is correct (it solves fine with LU). I've briefly spoken to Matt about this and he suggested trying to run with -pc_gamg_agg_nsmooths 0 (as the default changed from 3.4 - dev) but that didn't make any difference, the dumped out prolongator still has zero columns, and it crashes in the same way. Do you have any further suggestions what to try and how to further debug this? Cheers Stephan
Re: [petsc-users] Compute norm of a single component of DMDAVec struct
You can use VecStrideNorm() if you wish only a particular one or VecStrideNormAll() if you wish all the norms. Barry On Mar 20, 2014, at 10:38 AM, Mark Lohry mlo...@gmail.com wrote: I'm using a struct for a multi-component PDE as suggested in the manual, like so: typedef struct { PetscScalar u,v,omega,temperature; } Node; Node **f,**u; DMDAVecGetArray(DM da,Vec local,u); DMDAVecGetArray(DM da,Vec global,f); Calling VecNorm(...) on these vectors gives a norm for the entire vector. If one wants separate norms for each component of the struct, i.e. Norm(u) or Norm(v), what's the right approach? Would I need to manually compute norms locally and then call an MPI reduce function, or is this ability built-in to PETSc somewhere? -Mark Lohry
Re: [petsc-users] what kind of stuffs I forget to free?
Thanks, Jed, I tried valgrind, but it could not catch any noises. I used these options: mpirun -n 8 valgrind --tool=memcheck -q --num-callers=20 --log-file=valgrind.log.%p ./nonlinearElasticity3d -malloc off . I think I forget freeing something or petsc does. On Wed, Mar 19, 2014 at 4:58 PM, Jed Brown j...@jedbrown.org wrote: Fande Kong fd.k...@siat.ac.cn writes: I run my code with options: -malloc_debug -malloc_dump, then the following messages are produced, but nothing happened in my code. I want to know what kind of objects I forgot freeing. Any suggestions? Huh, those should show more stack. Before trying to think hard, can you run with valgrind? [0]Total space allocated 6864 bytes [ 0]256 bytes PetscSplitReductionCreate() line 91 in /home/fdkong/math/petsc-3.4.1/src/vec/vec/utils/comb.c [ 0]256 bytes PetscSplitReductionCreate() line 88 in /home/fdkong/math/petsc-3.4.1/src/vec/vec/utils/comb.c [ 0]512 bytes PetscSplitReductionCreate() line 87 in /home/fdkong/math/petsc-3.4.1/src/vec/vec/utils/comb.c [ 0]512 bytes PetscSplitReductionCreate() line 86 in /home/fdkong/math/petsc-3.4.1/src/vec/vec/utils/comb.c [ 0]80 bytes PetscSplitReductionCreate() line 81 in /home/fdkong/math/petsc-3.4.1/src/vec/vec/utils/comb.c [ 0]16 bytes PetscThreadCommReductionCreate() line 448 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcommred.c [ 0]512 bytes PetscThreadCommReductionCreate() line 440 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcommred.c [ 0]256 bytes PetscThreadCommReductionCreate() line 436 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcommred.c [ 0]1280 bytes PetscThreadCommReductionCreate() line 435 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcommred.c [ 0]32 bytes PetscThreadCommReductionCreate() line 432 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcommred.c [ 0]128 bytes PetscThreadCommWorldInitialize() line 1242 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcomm.c [ 0]2560 bytes PetscThreadCommWorldInitialize() line 1241 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcomm.c [ 0]32 bytes PetscThreadCommWorldInitialize() line 1233 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcomm.c [ 0]16 bytes PetscThreadCommSetAffinities() line 424 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcomm.c [ 0]48 bytes PetscThreadCommCreate() line 150 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcomm.c [ 0]336 bytes PetscThreadCommCreate() line 146 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcomm.c [ 0]32 bytes PetscCommDuplicate() line 151 in /home/fdkong/math/petsc-3.4.1/src/sys/objects/tagm.c Fande,
[petsc-users] PETSc and smoothed particle hydrodynamics
Hi, I was just wondering if anyone has ever used (or knows of someone using) PETSc for a smoothed particle hydrodynamics code? Thanks, Ben
Re: [petsc-users] SNESSetConvergenceTest
Hello Jed, Were you able to look into this issue ? Thanks Reddy On Tue, Feb 25, 2014 at 9:36 PM, Jed Brown j...@jedbrown.org wrote: Dharmendar Reddy dharmaredd...@gmail.com writes: Hello Jed, Sorry for the compilation issues, I do not have access to a machine with petsc and gfortran 4.7 to fix the compile issues. Can you make the follwing changes to the code in precision_m module. REAL64 and REAL32 should be available via iso_fortran_env module, I do not know why it is complaining. module precision_m implicit none integer,parameter :: DP = kind(1.0D0) integer,parameter :: SP = kind(1.0E0) integer,parameter :: WP=DP integer,parameter :: MSL=100 ! MAX_STR_LENGTH end module precision_m The f2003 dialect is not supported by mpif.h in my build of mpich-3.1. I'll try spinning up a new build of MPICH with -std=f2003 (hopefully its configure can sort this out). Did I mention Fortran is not my favorite language? /opt/mpich/include/mpif.h:16.18: Included at /home/jed/petsc/include/finclude/petscsys.h:11: Included at /home/jed/petsc/include/finclude/petsc.h:7: Included at /home/jed/petsc/include/finclude/petsc.h90:5: Included at Solver.F90:160: CHARACTER*1 MPI_ARGVS_NULL(1,1) 1 Warning: Obsolescent feature: Old-style character length at (1) /opt/mpich/include/mpif.h:17.18: Included at /home/jed/petsc/include/finclude/petscsys.h:11: Included at /home/jed/petsc/include/finclude/petsc.h:7: Included at /home/jed/petsc/include/finclude/petsc.h90:5: Included at Solver.F90:160: CHARACTER*1 MPI_ARGV_NULL(1) 1 Warning: Obsolescent feature: Old-style character length at (1) /opt/mpich/include/mpif.h:528.16: Included at /home/jed/petsc/include/finclude/petscsys.h:11: Included at /home/jed/petsc/include/finclude/petsc.h:7: Included at /home/jed/petsc/include/finclude/petsc.h90:5: Included at Solver.F90:160: integer*8 MPI_DISPLACEMENT_CURRENT 1 Error: GNU Extension: Nonstandard type declaration INTEGER*8 at (1) /opt/mpich/include/mpif.h:546.13: Included at /home/jed/petsc/include/finclude/petscsys.h:11: Included at /home/jed/petsc/include/finclude/petsc.h:7: Included at /home/jed/petsc/include/finclude/petsc.h90:5: Included at Solver.F90:160: REAL*8 MPI_WTIME, MPI_WTICK 1 Error: GNU Extension: Nonstandard type declaration REAL*8 at (1)
Re: [petsc-users] PETSc and smoothed particle hydrodynamics
I've not seen anyone doing this before. For representing particle data in parallel, petsc objects (eg vecs) are not really suitable as they don't support dynamic resizing of the local or global size. Most SPH calculations are explicit. If you're doing incompressible flow and use a projection scheme which enforces the in compressibility via a variable coefficient poisson solve, petsc would be useful for that solve. Cheers Dave On Thursday, 20 March 2014, Ben Huntington bhuntington2...@gmail.com wrote: Hi, I was just wondering if anyone has ever used (or knows of someone using) PETSc for a smoothed particle hydrodynamics code? Thanks, Ben
[petsc-users] 2 level schur
Hi all, I am solving a four field problem using two Schur complements. Here are the arguments that I usually pass to PETSc to do it: -ksp_type gmres -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -pc_fieldsplit_schur_precondition selfp -pc_fieldsplit_0_fields 2,3 -pc_fieldsplit_1_fields 0,1 -fieldsplit_0_ksp_type preonly -fieldsplit_0_pc_type fieldsplit -fieldsplit_0_pc_fieldsplit_type schur -fieldsplit_0_pc_fieldsplit_schur_factorization_type full -fieldsplit_0_pc_fieldsplit_schur_precondition selfp -fieldsplit_0_fieldsplit_Field_2_fields 2 -fieldsplit_0_fieldsplit_Field_3_fields 3 -fieldsplit_0_fieldsplit_Field_2_ksp_type preonly -fieldsplit_0_fieldsplit_Field_2_pc_type ilu -fieldsplit_0_fieldsplit_Field_3_ksp_type preonly -fieldsplit_0_fieldsplit_Field_3_pc_type jacobi -fieldsplit_1_ksp_type preonly -fieldsplit_1_pc_type lu -malloc_log mlog -log_summary time.log One issue with this is that when I change -fieldsplit_0_fieldsplit_Field_2_fields 2 to -fieldsplit_0_fieldsplit_Field_2_fields 3 it is ineffective, as if PETSc automatically assign IS 2 to Field 2 even though it is not what I want. Is there a way to pass the arguments correctly so that PETSc goes about switching the IS set of -fieldsplit_0_fieldsplit_Field_2 and -fieldsplit_0_fieldsplit_Field_3? This is crucial to me since I am using the selfp option and the matrix associated to IS 3 is diagonal. By assigning the fields correctly I can get an exact Schur preconditioner and hence very fast convergence. Right now my convergence is not optimal because of this. Thanks! Best, Luc
Re: [petsc-users] 2 level schur
On Thu, Mar 20, 2014 at 6:20 PM, Luc Berger-Vergiat lb2...@columbia.eduwrote: Hi all, I am solving a four field problem using two Schur complements. Here are the arguments that I usually pass to PETSc to do it: -ksp_type gmres -pc_type fieldsplit -pc_fieldsplit_type schur -pc_fieldsplit_schur_factorization_type full -pc_fieldsplit_schur_precondition selfp -pc_fieldsplit_0_fields 2,3 -pc_fieldsplit_1_fields 0,1 -fieldsplit_0_ksp_type preonly -fieldsplit_0_pc_type fieldsplit -fieldsplit_0_pc_fieldsplit_type schur -fieldsplit_0_pc_fieldsplit_schur_factorization_type full -fieldsplit_0_pc_fieldsplit_schur_precondition selfp -fieldsplit_0_fieldsplit_Field_2_fields 2 -fieldsplit_0_fieldsplit_Field_3_fields 3 -fieldsplit_0_fieldsplit_Field_2_ksp_type preonly -fieldsplit_0_fieldsplit_Field_2_pc_type ilu -fieldsplit_0_fieldsplit_Field_3_ksp_type preonly -fieldsplit_0_fieldsplit_Field_3_pc_type jacobi -fieldsplit_1_ksp_type preonly -fieldsplit_1_pc_type lu -malloc_log mlog -log_summary time.log One issue with this is that when I change -fieldsplit_0_fieldsplit_Field_2_fields 2 to -fieldsplit_0_fieldsplit_Field_2_fields 3 it is ineffective, as if PETSc automatically assign IS 2 to Field 2 even though it is not what I want. Is there a way to pass the arguments correctly so that PETSc goes about switching the IS set of -fieldsplit_0_fieldsplit_Field_2 and -fieldsplit_0_fieldsplit_Field_3? This is crucial to me since I am using the selfp option and the matrix associated to IS 3 is diagonal. By assigning the fields correctly I can get an exact Schur preconditioner and hence very fast convergence. Right now my convergence is not optimal because of this. I believe the inner Schur field statements should not be using the original numbering, but the inner numbering, after they have been reordered. Matt Thanks! Best, Luc -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
Re: [petsc-users] what kind of stuffs I forget to free?
Hi Jed, I finally figured out why. I think there is a bug in the PETSc. I write a very simple program that can reproduce the same results. Please check the attachment. Type make all -f makefilet to run this code. Could you know how to fix this issue? Thanks, On Thu, Mar 20, 2014 at 11:29 AM, Fande Kong fd.k...@siat.ac.cn wrote: Thanks, Jed, I tried valgrind, but it could not catch any noises. I used these options: mpirun -n 8 valgrind --tool=memcheck -q --num-callers=20 --log-file=valgrind.log.%p ./nonlinearElasticity3d -malloc off . I think I forget freeing something or petsc does. On Wed, Mar 19, 2014 at 4:58 PM, Jed Brown j...@jedbrown.org wrote: Fande Kong fd.k...@siat.ac.cn writes: I run my code with options: -malloc_debug -malloc_dump, then the following messages are produced, but nothing happened in my code. I want to know what kind of objects I forgot freeing. Any suggestions? Huh, those should show more stack. Before trying to think hard, can you run with valgrind? [0]Total space allocated 6864 bytes [ 0]256 bytes PetscSplitReductionCreate() line 91 in /home/fdkong/math/petsc-3.4.1/src/vec/vec/utils/comb.c [ 0]256 bytes PetscSplitReductionCreate() line 88 in /home/fdkong/math/petsc-3.4.1/src/vec/vec/utils/comb.c [ 0]512 bytes PetscSplitReductionCreate() line 87 in /home/fdkong/math/petsc-3.4.1/src/vec/vec/utils/comb.c [ 0]512 bytes PetscSplitReductionCreate() line 86 in /home/fdkong/math/petsc-3.4.1/src/vec/vec/utils/comb.c [ 0]80 bytes PetscSplitReductionCreate() line 81 in /home/fdkong/math/petsc-3.4.1/src/vec/vec/utils/comb.c [ 0]16 bytes PetscThreadCommReductionCreate() line 448 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcommred.c [ 0]512 bytes PetscThreadCommReductionCreate() line 440 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcommred.c [ 0]256 bytes PetscThreadCommReductionCreate() line 436 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcommred.c [ 0]1280 bytes PetscThreadCommReductionCreate() line 435 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcommred.c [ 0]32 bytes PetscThreadCommReductionCreate() line 432 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcommred.c [ 0]128 bytes PetscThreadCommWorldInitialize() line 1242 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcomm.c [ 0]2560 bytes PetscThreadCommWorldInitialize() line 1241 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcomm.c [ 0]32 bytes PetscThreadCommWorldInitialize() line 1233 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcomm.c [ 0]16 bytes PetscThreadCommSetAffinities() line 424 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcomm.c [ 0]48 bytes PetscThreadCommCreate() line 150 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcomm.c [ 0]336 bytes PetscThreadCommCreate() line 146 in /home/fdkong/math/petsc-3.4.1/src/sys/threadcomm/interface/threadcomm.c [ 0]32 bytes PetscCommDuplicate() line 151 in /home/fdkong/math/petsc-3.4.1/src/sys/objects/tagm.c Fande, /* * commproblem.cpp * * Created on: Mar 20, 2014 * Author: fdkong */ #include petscsnes.h #include petscdm.h #include petsc-private/snesimpl.h static char help[] = Need helps.\n\n; #undef __FUNCT__ #define __FUNCT__ main int main(int argc,char **argv) { Vec vec; MPI_Request request; MPI_Statusstatus; PetscMPIInt tag =123; MPI_Comm comm; PetscMPIInt rank, size; PetscInt recv =10; PetscInt send = 0; DM dm; PetscErrorCodeierr; PetscInitialize(argc,argv,(char *)0,help); comm = PETSC_COMM_WORLD; ierr = MPI_Comm_rank(comm, rank);CHKERRQ(ierr); ierr = MPI_Comm_size(comm, size);CHKERRQ(ierr); // create an object ierr = VecCreate(comm, vec);CHKERRQ(ierr); // take a comm from that object comm = ((PetscObject) vec)-comm; // if we set comm back to PETSC_COMM_WORLD, the code should work fine //comm = PETSC_COMM_WORLD; // receive messages from rank 0 if( rank!=0) { ierr = MPI_Irecv(recv, 1, MPIU_INT, 0,tag, comm, request);CHKERRQ(ierr); } if(!rank) { //send messages to all others for(PetscMPIInt i =1; isize;i++) { ierr = MPI_Isend(send, 1, MPIU_INT, i, tag, comm, request);CHKERRQ(ierr); } } // rank 0 doest not need to wait, it could continue to do other things. if(rank !=0) { ierr = MPI_Waitall(1,request, status);CHKERRQ(ierr); } ierr = VecDestroy(vec);CHKERRQ(ierr); ierr = PetscFinalize();CHKERRQ(ierr); } makefilet Description: Binary data
[petsc-users] Preallocation Memory of Finite Element Method's Sparse Matrices
Your faithfully: program src/ksp/ksp/examples/tutorials/ex3.c.html is about Bilinear elements on the unit square for Laplacian. After preallocation using ierr = MatMPIAIJSetPreallocation(A,9,NULL,5,NULL);CHKERRQ(ierr); /* More than necessary */, Results of commands of mpiexec -n 2 ./ex3 and mpiexec -n 2 ./ex3 are Norm of error 2.22327e-06 Iterations 6 and Norm of error 3.12849e-07 Iterations 8. Both results is good! However, if I use mpiexec -n 4 ./ex3 or 5,6,7...precesses, error [2]PETSC ERROR: New nonzero at (4,29) (here is for process 4, other positions for different processes) caused a malloc! appear!. For me, this error is unbelievable, because first, the preallocation is more than necessary,how can the new malloc appear? Second, the global number 4 point originally have no neighbor vertices whose global number is 29! This error have tortured me for long times. This error seems meaningless, however, my recent 3d finite element method cannot be caculated by more processesowing to the new nonzero malloc!And this is why I want to use 4 or much more processes to compute ex3.c. Thank you for all previous assistence and hope you have a good life! your sincerely LV CHAO 2014/3/21
Re: [petsc-users] gamg failure with petsc-dev
Stephan Kramer s.kra...@imperial.ac.uk writes: We have been having some problems with GAMG on petsc-dev (master) for cases that worked fine on petsc 3.4. We're solving a Stokes equation (just the velocity block) for a simple convection in a square box (isoviscous). The problem only occurs if we supply a near null space (via MatSetNearNullSpace) where we supply the usual (1,0) (0,1) and (-y,x) (near) null space vectors. If we supply those, the smoother complains that the diagonal of the A matrix at the first coarsened level contains a zero. If I dump out the prolongator from the finest to the first coarsened level it indeed contains a zero column at that same index. We're pretty confident that the fine level A matrix is correct (it solves fine with LU). I've briefly spoken to Matt about this and he suggested trying to run with -pc_gamg_agg_nsmooths 0 (as the default changed from 3.4 - dev) but that didn't make any difference, the dumped out prolongator still has zero columns, and it crashes in the same way. Do you have any further suggestions what to try and how to further debug this? Do you set the block size? Can you reproduce by modifying src/ksp/ksp/examples/tutorials/ex49.c (plane strain elasticity)? pgpPgaQmgzqBP.pgp Description: PGP signature
Re: [petsc-users] what kind of stuffs I forget to free?
Fande Kong fd.k...@siat.ac.cn writes: /* * commproblem.cpp * * Created on: Mar 20, 2014 * Author: fdkong */ #include petscsnes.h #include petscdm.h #include petsc-private/snesimpl.h static char help[] = Need helps.\n\n; #undef __FUNCT__ #define __FUNCT__ main int main(int argc,char **argv) { Vec vec; MPI_Request request; MPI_Statusstatus; PetscMPIInt tag =123; MPI_Comm comm; PetscMPIInt rank, size; PetscInt recv =10; PetscInt send = 0; DM dm; PetscErrorCodeierr; PetscInitialize(argc,argv,(char *)0,help); comm = PETSC_COMM_WORLD; ierr = MPI_Comm_rank(comm, rank);CHKERRQ(ierr); ierr = MPI_Comm_size(comm, size);CHKERRQ(ierr); // create an object ierr = VecCreate(comm, vec);CHKERRQ(ierr); // take a comm from that object comm = ((PetscObject) vec)-comm; // if we set comm back to PETSC_COMM_WORLD, the code should work fine //comm = PETSC_COMM_WORLD; // receive messages from rank 0 if( rank!=0) { ierr = MPI_Irecv(recv, 1, MPIU_INT, 0,tag, comm, request);CHKERRQ(ierr); } You have to wait on this request. MPI_Requests are not automatically collected at some point where you can prove that the operation has finished. The Wait should return immediately, but you have to call it. Otherwise MPI holds a reference to the communicator and will not call the destructors. if(!rank) { //send messages to all others for(PetscMPIInt i =1; isize;i++) { ierr = MPI_Isend(send, 1, MPIU_INT, i, tag, comm, request);CHKERRQ(ierr); } } // rank 0 doest not need to wait, it could continue to do other things. It *does* need to wait eventually. if(rank !=0) { ierr = MPI_Waitall(1,request, status);CHKERRQ(ierr); } ierr = VecDestroy(vec);CHKERRQ(ierr); ierr = PetscFinalize();CHKERRQ(ierr); } pgpHnMSShcFGH.pgp Description: PGP signature
Re: [petsc-users] what kind of stuffs I forget to free?
Jed, Thanks, On Thu, Mar 20, 2014 at 10:39 PM, Jed Brown j...@jedbrown.org wrote: Fande Kong fd.k...@siat.ac.cn writes: /* * commproblem.cpp * * Created on: Mar 20, 2014 * Author: fdkong */ #include petscsnes.h #include petscdm.h #include petsc-private/snesimpl.h static char help[] = Need helps.\n\n; #undef __FUNCT__ #define __FUNCT__ main int main(int argc,char **argv) { Vec vec; MPI_Request request; MPI_Statusstatus; PetscMPIInt tag =123; MPI_Comm comm; PetscMPIInt rank, size; PetscInt recv =10; PetscInt send = 0; DM dm; PetscErrorCodeierr; PetscInitialize(argc,argv,(char *)0,help); comm = PETSC_COMM_WORLD; ierr = MPI_Comm_rank(comm, rank);CHKERRQ(ierr); ierr = MPI_Comm_size(comm, size);CHKERRQ(ierr); // create an object ierr = VecCreate(comm, vec);CHKERRQ(ierr); // take a comm from that object comm = ((PetscObject) vec)-comm; // if we set comm back to PETSC_COMM_WORLD, the code should work fine //comm = PETSC_COMM_WORLD; // receive messages from rank 0 if( rank!=0) { ierr = MPI_Irecv(recv, 1, MPIU_INT, 0,tag, comm, request);CHKERRQ(ierr); } You have to wait on this request. MPI_Requests are not automatically collected at some point where you can prove that the operation has finished. The Wait should return immediately, but you have to call it. Otherwise MPI holds a reference to the communicator and will not call the destructors. if(!rank) { //send messages to all others for(PetscMPIInt i =1; isize;i++) { ierr = MPI_Isend(send, 1, MPIU_INT, i, tag, comm, request);CHKERRQ(ierr); } } // rank 0 doest not need to wait, it could continue to do other things. It *does* need to wait eventually. if(rank !=0) { ierr = MPI_Waitall(1,request, status);CHKERRQ(ierr); } ierr = VecDestroy(vec);CHKERRQ(ierr); ierr = PetscFinalize();CHKERRQ(ierr); }