[petsc-users] How to know the cpu rank that hold the minimum vec values
Dear professor: I got the location and value of the minimum in a vec with VecMin, But how to know the rank of CPU which holds the minimum values. This rank should be known in the whole communicator. Regards
[petsc-users] How to solve the Ax=b with parallel SOR or parallel GS only.
How to solve the Ax=b with parallel SOR or parallel GS only.
[petsc-users] How to scatter values
Dear professor: I partitioned my 2D cartesian grid with 4rows*4cols CPUS. 12 13 14 15 8 9 10 11 4 5 6 7 0 1 2 3 Now i need to scatter the values belonging to cpu5 to every cpu along x direction( 4 5 6 7) , which function should i use. Regards
[petsc-users] cannot convert ‘int*’ to ‘PetscInt*
Dear professor: I met the following error for Petsc 3.7.3. I delcare LocalSize as int, but it doesn't work anymore. it works for 3.6.3. error: cannot convert ‘int*’ to ‘PetscInt* {aka long int*}’ for argument ‘2’ to ‘PetscErrorCode VecGetLocalSize(Vec, PetscInt*)’ VecGetLocalSize (Petsc_b, ); Regards
[petsc-users] How to Get the last absolute residual that has been computed
Dear professor: How to Get the last absolute residual that has been computed
[petsc-users] How to broadcast a double value to all the nodes in the cluster with Petsc
Dear professor: How to broadcast a double value to all the nodes in the cluster with Petsc
[petsc-users] Slep test error
Dear professor: I have sucessfully make the slep 3.7.2 package. But the final step "make test" gives me the following error: I do not the reason. make test makefile:31: /lib/slepc/conf/slepc_common: No such file or directory make: *** No rule to make target '/lib/slepc/conf/slepc_common'. Stop.
Re: [petsc-users] How to solve the pressure possion equations with four neuman bc
Dear professor: In the ksp example ex50.c, i do not understand the meaning of KSPSolve(ksp,NULL,NULL); nMatNullSpaceCreate(PETSC_COMM_WORLD,PETSC_TRUE,0,0,); What is the meaning of NULL in the kspsolve. and two "0" in the MatNullSpaceCreate. Regards At 2016-09-24 00:25:09, "Jed Brown"wrote: >"Kong, Fande" writes: > >> Any references on this topic except the users manual? I am interested in >> mathematics theory on this topic. > >These are relevant. I've only skimmed them briefly, but they might >suggest ways to improve PETSc's handling of singular systems. The >technique is ancient. > >https://doi.org/10.1137/S0895479803437803 > >https://doi.org/10.1007/s10543-009-0247-7
[petsc-users] How to solve the pressure possion equations with four neuman bc
Dear friends: In the projection method for the solution of incompressible flow, a pressure equation with four neuman bcs need to be solved. but the pressure matrix is singular. it gives divergence solution. how to solve this kind of equations. Regards
[petsc-users] Does Petsc support matrix diagonalization
Dear friends: I want to diagonalize matrix D: D=PAP^(-1). where A is the diagonal matrix , P is the transformation matrix. Does Petsc has this routine to perform this task. Regards
Re: [petsc-users] Question regarding updating PETSc Fortran examples to embrace post F77 constructs
Dear sir: I think we might following the history trend, forgot fortran77. We are facing HPC computation,so HPC fortran is out choice. Regard At 2016-08-27 10:54:14, "Barry Smith"wrote: > > PETSc users, > >We've always been very conservative in PETSc to keep almost all our > Fortran examples in a format that works with classic FORTRAN 77 constructs: > fixed line format, (72 character limit) and no use of ; to separate > operations on the same line, etc. > > Is it time to forgo these constructs and use more modern Fortran > conventions in all our examples? > >Any feedback is appreciated > >Barry > >Note: it would continue to be possible to use PETSc in the FORTRAN 77 style, >this is just a question about updating the examples. > >
[petsc-users] What caused this problem."PetscInitialize() must be called before PetscFinalize()"
Dear friends: My code run without any problem yesterday, but it gives me the following error. I do not know what is the reason? Regards [0]PETSC ERROR: #1 PetscOptionsInsertFile() line 563 in /home/ztdep/Downloads/petsc-3.6.3/src/sys/objects/options.c [0]PETSC ERROR: #2 PetscOptionsInsert() line 720 in /home/ztdep/Downloads/petsc-3.6.3/src/sys/objects/options.c [0]PETSC ERROR: #3 PetscInitialize() line 828 in /home/ztdep/Downloads/petsc-3.6.3/src/sys/objects/pinit.c PetscInitialize() must be called before PetscFinalize() Regards
[petsc-users] KSPSetOperators(ksp, A, A, SAME_NONZERO_PATTERN) does not work any more
Dear friends: I just update to 3.6.3, but the command " KSPSetOperators(ksp,A,A,SAME_NONZERO_PATTERN)" does not work any more. could you please give me some suggestions Regards
[petsc-users] error: AO was not declared in this scope.
Dear friends: I am adding the partition to my CFD code, but it give me error about " AO was not declared in this scope". the parallel code has been run suecesfuly with a off line mesh partition with ksp solver. Regards.
[petsc-users] Which command gather the distributed vector to the root rank
Dear friends: I Want to gather the vector to the root rank. which command perform this task. i only find that with viewer, we can write it to the root rank. Regards
[petsc-users] can i use MatCreatDense to creat a parallel matrix for KSP
Dear friends: I am receiving error about " not for unassembled matrix"
[petsc-users] how to compile the program with c++11 support.
Dear friends: I add the "-std=c++11" in the make file, but it still give me warning.
[petsc-users] which solver should i use to solve a dense matrix occured from spectral method
Dear friends: the matrix from spectral method is a dense matrix, and some entries at diagonal may have a zero value. which solver and preconditioner should i use to solve it. Regards
[petsc-users] how to install two different version petsc in the same pc
I need to install a library that could only be run with petsc 3.2. but i have installed the 3.3-p6. how to install the petesc 3.2 in the same pc
Re: [petsc-users] how to install two different version petsc in the same pc
how to set the PETSC_DIR with two different value. At 2014-08-18 08:36:28, Jed Brown j...@jedbrown.org wrote: 丁老师 ztdepya...@163.com writes: I need to install a library that could only be run with petsc 3.2. but i have installed the 3.3-p6. how to install the petesc 3.2 in the same pc Each version is a different PETSC_DIR. Also, please upgrade to petsc-3.5 at your earliest convenience.
[petsc-users] How to run a parallel code with mpiexec -np 1
Dear friends: I write a parallel code with Petsc, but it does not work with mpiexec -np 1 . since Petsc automatically allocate the vec and mat according to the number of cpu, why it does not work. and how to modify the parallel code.
[petsc-users] How to set the value in Ax=b.
Dear group: I have assembled the coefficients of A and b. My computation alogrithm need to specify a component of x to be a constant value. for example x[5]=3.14; then how to resolve this problem. Regards
[petsc-users] can i define a user defined residual function to determin the convergence of the kspsolve
i want to define a function for the computation of the equation residual in a special way. does petsc provide this capbility
[petsc-users] [2]PETSC ERROR: MatPermute not available for Mat type mpiaij!
i set up my matrix A with MatCreate(PETSC_COMM_WORLD,A); MatSetSizes(A,PMesh-LocalSize,PMesh-LocalSize,PETSC_DECIDE,PETSC_DECIDE); MatSetFromOptions(A); MatMPIAIJSetPreallocation(A,5,PETSC_NULL,5,PETSC_NULL); then which type should i use to support the matpermute.
Re: [petsc-users] [2]PETSC ERROR: MatPermute not available for Mat type mpiaij!
Daer Barry: Matrix A is the coeffcients not the mesh. I use the MatPermute following the ksp examples in dev version ex18. After the line 77, we declared a parallel matrix , at line 78, we declare a seq matrix. so what is this seq matrix for ? 77: MatMPIAIJSetPreallocation(A,5,NULL,5,NULL); 78: MatSeqAIJSetPreallocation(A,5,NULL); At 2013-09-17 00:19:39,Barry Smith bsm...@mcs.anl.gov wrote: I assume that his matrix A is suppose to represent the connections in the mesh. 1) You only want to reorder the mesh locally (assuming you have already partitioned the mesh in parallel for good load balancing and low number of cut eges) so each process will call MatCreate() with PETSC_COMM_SELF and each set a matrix associated only with the local part of the mesh. 2) You don't want to use MatPermute() rather you would use MatGetOrdering() which tells you how to reorder the unknowns on the mesh on each process. For the ordering I think you want to use MATORDERINGRCM. Now you just renumber the mesh nodes on each process and update the the ghost node information to reflect the new ordering. Barry On Sep 16, 2013, at 7:14 AM, 丁老师 ztdepya...@163.com wrote: i set up my matrix A with MatCreate(PETSC_COMM_WORLD,A); MatSetSizes(A,PMesh-LocalSize,PMesh-LocalSize,PETSC_DECIDE,PETSC_DECIDE); MatSetFromOptions(A); MatMPIAIJSetPreallocation(A,5,PETSC_NULL,5,PETSC_NULL); then which type should i use to support the matpermute. span title=neteasefooter
[petsc-users] Does the kspsolver used in the DMDA take the special structrue of the cartesian coordinate into consideration.
since in cartesian coordinate system, the matrix vector operation can be explicitly known. Does the kspsolver used in the DMDA take the special structrue of the cartesian coordinate into consideration.
[petsc-users] i use -pc_hypre_type euclid, but it does not work, the default preconditioner is still used. how to call the euclid preconditioner
At 2013-09-12 22:43:10,丁老师 ztdepya...@163.com wrote:
Re: [petsc-users] i use -pc_hypre_type euclid, but it does not work, the default preconditioner is still used. how to call the euclid preconditioner
thank you. i forgotten to use it. 在 2013-09-15 06:13:35,Barry Smith bsm...@mcs.anl.gov 写道: Did you also use -pc_type hypre ? That is also needed. On Sep 14, 2013, at 7:18 AM, 丁老师 ztdepya...@163.com wrote: At 2013-09-12 22:43:10,丁老师 ztdepya...@163.com wrote:
[petsc-users] how to simultaneously perform the partition of the unstructured mesh and reduction bandwidth of the resulting sparsematrix
Re: [petsc-users] how to simultaneously perform the partition of the unstructured mesh and reduction bandwidth of the resulting sparsematrix
i think bandwidth minimization will improve the convergence of the kspsolver, am i right? At 2013-09-13 01:59:59,Jed Brown jedbr...@mcs.anl.gov wrote: Matrix bandwidth minimization is an (imprecise) optimization to improve cache reuse. So just partition globally and then reorder locally.
Re: [petsc-users] how to simultaneously perform the partition of the unstructured mesh and reduction bandwidth of the resulting sparsematrix
which petsc function perform the reordering of the matrix At 2013-09-13 02:54:38,Barry Smith bsm...@mcs.anl.gov wrote: On Sep 12, 2013, at 12:59 PM, Jed Brown jedbr...@mcs.anl.gov wrote: Matrix bandwidth minimization is an (imprecise) optimization to improve cache reuse. So just partition globally and then reorder locally. The mesh, before you start the linear algebra.
[petsc-users] does kspsolve perform the reordering to reduce the bandwith of sparse matrix
[petsc-users] Could you please give me some advice for the following error
1] ***ASSERTION failed on line 243 of file /home/ztdep/Downloads/petsc-3.3-p6/externalpackages/parmetis-4.0.2-p3/libparmetis/match.c:k = firstvtx k lastvtx [ 1] 2562 5124 10 0 0 main: /home/ztdep/Downloads/petsc-3.3-p6/externalpackages/parmetis-4.0.2-p3/libparmetis/match.c:243: libparmetis__Match_Global: Assertion `k = firstvtx k lastvtx' failed.
Re: [petsc-users] Could you please give me some advice for the following error
the input parameter of this partation is the drow and dcol. could you please tell me how to resolve this problem. MatCreateMPIAdj(PETSC_COMM_WORLD,drow.size()-1,CellsNumber,drow[0],dcol[0],NULL,adj); 在 2013-09-04 23:25:38,Matthew Knepley knep...@gmail.com 写道: On Wed, Sep 4, 2013 at 10:23 AM, 丁老师 ztdepya...@163.com wrote: yes, i am computing convection diffusion problem with a triangle unstructured grid. the matrix coefficients is unsymemetric. but is it a necessary for the parmetis to do the work? The matrix can be nonsymmetric, but it has to be structurally symmetric. Matt 在 2013-09-04 23:20:47,Mark F. Adams mfad...@lbl.gov 写道: My guess is that your matrix is structurally unsymmetric. On Sep 4, 2013, at 11:16 AM, 丁老师 ztdepya...@163.com wrote: 1] ***ASSERTION failed on line 243 of file /home/ztdep/Downloads/petsc-3.3-p6/externalpackages/parmetis-4.0.2-p3/libparmetis/match.c:k = firstvtx k lastvtx [ 1] 2562 5124 10 0 0 main: /home/ztdep/Downloads/petsc-3.3-p6/externalpackages/parmetis-4.0.2-p3/libparmetis/match.c:243: libparmetis__Match_Global: Assertion `k = firstvtx k lastvtx' failed. -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
[petsc-users] can i set values of vec again after vecassemblebegin and vecassembleend.
[petsc-users] how to know the local size of the grid after partition
I partitioned the FVM Mesh into 4 parts. the isg and is contain the new goloba number and new process number of each local nodes. but could you please tell me how to know the local size of the grid and local range of the grid.
Re: [petsc-users] how to know the local size of the grid after partition
i read in my own unstructured grid system, i have vertices coodinate, and connection table. 在 2013-08-27 02:58:05,Jed Brown jedbr...@mcs.anl.gov 写道: 丁老师 ztdepya...@163.com writes: I partitioned the FVM Mesh into 4 parts. the isg and is contain the new goloba number and new process number of each local nodes. but could you please tell me how to know the local size of the grid and local range of the grid. You haven't given enough context to know what question you are asking. Are you using DMPlex or rolling your own grid, for example?
[petsc-users] how to use the Euclid preconditioner from Hypre in the petsc
I configured the petsc without the hypre download. i want to download and install the hypre seperately. could you please tell me how to use the euclid precontioner from hypre in petsc. Regards
Re: [petsc-users] use kspsolve repeately
thank you . but the matrix element has been changed in the third and fourth call. how to re calculate the preconditioner. 在 2013-08-24 18:18:17,Matthew Knepley knep...@gmail.com 写道: On Sat, Aug 24, 2013 at 4:57 AM, 丁老师 ztdepya...@163.com wrote: in my code, i need to use kspsolve in the following way KSP ksp; KSPCreate(PETSC_COMM_WORLD,ksp); KSPSetOperators(ksp,A,A,SAME_NONZERO_PATTERN); KSPSetOperators(ksp,A,A,SAME_PRECONDITIONER); KSPSetInitialGuessNonzero(ksp,PETSC_TRUE) KSPSetType(ksp,KSPBCGS); KSPSetFromOptions(ksp); set the matrix A value and right hand side bu and bv. kspsolve(A,bu); kspsolve(A,bv); change the value of matrix A and bu bv, kspsolve(A,bu); kspsolve(A,bv); the first and second call to the kspsolve use the same preconditioner. but which preconditoner does the third and fourth call to the kspsolve since the value of the matrix A has changed. The first call is redundant, and the subsequent solves use the same preconditioner, as you asked. 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
[petsc-users] how to reate an IS of size 0 on all the other processes and a seq Vec of the size zero on all other processes
[petsc-users] what is the meaning of matrix file output by matview.
Matrix Object: 1 MPI processes type: mpiaij 16 40 1 4 7 10 12 15 18 21 23 26 29 32 34 36 38 40 41 1 2 5 2 3 6 3 4 7 4 8 5 6 9 6 7 10 7 8 11 8 12 9 10 13 10 11 14 11 12 15 12 16 13 14 14 15 15 16 16 2.2915e+00 -1.1458e+00 -1.1458e+00 3.80208330e+00 -1.2500e+00 -1.40625000e+00 3.80208330e+00 -1.1458e+00 -1.40625000e+00 2.2915e+00 -1.1458e+00 3.80208330e+00 -1.40625000e+00 -1.2500e+00 5.9375e+00 -1.5625e+00 -1.5625e+00 5.9375e+00 -1.40625000e+00 -1.5625e+00 3.80208330e+00 -1.2500e+00 3.80208330e+00 -1.40625000e+00 -1.1458e+00 5.9375e+00 -1.5625e+00 -1.40625000e+00 5.9375e+00 -1.40625000e+00 -1.40625000e+00 3.80208330e+00 -1.1458e+00 2.2915e+00 -1.1458e+00 3.80208330e+00 -1.2500e+00 3.80208330e+00 -1.1458e+00 2.2915e+00
[petsc-users] I write the following program, it can converge with 4 processor, but can not converge with 2 , or 3 processor. Could you help me out
/* Program usage: mpiexec ex1 [-help] [all PETSc options] */ static char help[] = Basic vector routines.\n\n; #include petscksp.h #include petscvec.h int main(int argc,char **argv) { int N=16; int MyRank; Mat A; PC Pc; KSP ksp; Vec b,x; PetscInitialize(argc,argv,(char*)0,help); MPI_Comm_rank(MPI_COMM_WORLD,MyRank); MatCreate(PETSC_COMM_WORLD,A); MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N); MatSetFromOptions(A); MatMPIAIJSetPreallocation(A,5,PETSC_NULL,5,PETSC_NULL); VecCreate(PETSC_COMM_WORLD,b); VecSetSizes(b,PETSC_DECIDE,N); VecSetFromOptions(b); VecDuplicate(b,x); int row=0; int* col3; int* col4; int* col5; PetscMalloc(3*sizeof(PetscInt),col3); PetscMalloc(4*sizeof(PetscInt),col4); PetscMalloc(5*sizeof(PetscInt),col5); col3[0]=0; col3[1]=1; col3[2]=4; double value3[3]={2.2915e+00,-1.1458e+00,-1.1458e+00}; MatSetValues(A,1,row,3,col3,value3,INSERT_VALUES); row=1; col4[0]=0; col4[1]=1; col4[2]=2; col4[3]=5; double value4[4]={-1.1458e+00,3.80208330e+00,-1.2500e+00 ,-1.40625000e+00}; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=2; col4[0]=1; col4[1]=2; col4[2]=3; col4[3]=6; value4[0]=-1.2500e+00; value4[1]=3.80208330e+00; value4[2]=-1.1458e+00 ; value4[3]=-1.40625000e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=3; col3[0]=2; col3[1]=3; col3[2]=7; value3[0]=-1.1458e+00; value3[1]=2.2915e+00; value3[2]=-1.1458e+00; MatSetValues(A,1,row,3,col3,value3,INSERT_VALUES); row=4; col4[0]=0; col4[1]=4; col4[2]=5; col4[3]=8; value4[0]=-1.1458e+00; value4[1]=3.80208330e+00; value4[2]=-1.40625000e+00; value4[3]=-1.2500e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=5; col5[0]=1; col5[1]=4; col5[2]=5; col5[3]=6; col5[4]=9; double value5[5]; value5[0]=-1.40625000e+00; value5[1]=-1.40625000e+00; value5[2]=5.9375e+00; value5[3]=-1.5625e+00 ; value5[4]=-1.5625e+00 ; MatSetValues(A,1,row,5,col5,value5,INSERT_VALUES); row=6; col5[0]=2; col5[1]=5; col5[2]=6; col5[3]=7; col5[4]=10; value5[0]=-1.40625000e+00; value5[1]=-1.5625e+00; value5[2]=5.9375e+00; value5[3]=-1.40625000e+00 ; value5[4]=-1.5625e+00 ; MatSetValues(A,1,row,5,col5,value5,INSERT_VALUES); row=7; col4[0]=3; col4[1]=6; col4[2]=7; col4[3]=11; value4[0]=-1.1458e+00; value4[1]=-1.40625000e+00; value4[2]=3.80208330e+00; value4[3]=-1.2500e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=8; col4[0]=4; col4[1]=8; col4[2]=9; col4[3]=12; value4[0]=-1.2500e+00; value4[1]=3.80208330e+00; value4[2]=-1.40625000e+00; value4[3]=-1.1458e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=9; col5[0]=5; col5[1]=8; col5[2]=9; col5[3]=10; col5[4]=13; value5[0]=-1.5625e+00; value5[1]=-1.40625000e+00; value5[2]=5.9375e+00; value5[3]=-1.5625e+00 ; value5[4]= -1.40625000e+00; MatSetValues(A,1,row,5,col5,value5,INSERT_VALUES); row=10; col5[0]=6; col5[1]=9; col5[2]=10; col5[3]=11; col5[4]=14; value5[0]=-1.5625e+00; value5[1]=-1.5625e+00; value5[2]=5.9375e+00; value5[3]=-1.40625000e+00 ; value5[4]= -1.40625000e+00; MatSetValues(A,1,row,5,col5,value5,INSERT_VALUES); row=11; col4[0]=7; col4[1]=10; col4[2]=11; col4[3]=15; value4[0]=-1.2500e+00; value4[1]=-1.40625000e+00; value4[2]=3.80208330e+00; value4[3]=-1.1458e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=12; col3[0]=8; col3[1]=12; col3[2]=13; value3[0]=-1.1458e+00; value3[1]=2.2915e+00; value3[2]=-1.1458e+00; MatSetValues(A,1,row,3,col3,value3,INSERT_VALUES); row=13; col4[0]=9; col4[1]=12; col4[2]=13; col4[3]=14; value4[0]=-1.40625000e+00; value4[1]=-1.1458e+00; value4[2]=3.80208330e+00; value4[3]=-1.2500e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=14; col4[0]=10; col4[1]=13; col4[2]=14; col4[3]=15; value4[0]=-1.40625000e+00; value4[1]=-1.2500e+00; value4[2]=3.80208330e+00; value4[3]=-1.1458e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=15; col3[0]=11; col3[1]=14; col3[2]=15; value3[0]=-1.1458e+00; value3[1]=-1.1458e+00; value3[2]=2.2915e+00; MatSetValues(A,1,row,3,col3,value3,INSERT_VALUES); MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY);
Re: [petsc-users] I write the following program, it can converge with 4 processor, but can not converge with 2 , or 3 processor. Could you help me out
thank you very much! could you please suggest me a robust preconditioner which is independent of the number of processor. 在 2013-08-16 19:54:01,Matthew Knepley knep...@gmail.com 写道: On Fri, Aug 16, 2013 at 6:13 AM, 丁老师 ztdepya...@163.com wrote: Its common for iterative solvers to converge differently for different PC. You are using block Jacobi-ILU which is different for different numbers of processes. Matt /* Program usage: mpiexec ex1 [-help] [all PETSc options] */ static char help[] = Basic vector routines.\n\n; #include petscksp.h #include petscvec.h int main(int argc,char **argv) { int N=16; int MyRank; Mat A; PC Pc; KSP ksp; Vec b,x; PetscInitialize(argc,argv,(char*)0,help); MPI_Comm_rank(MPI_COMM_WORLD,MyRank); MatCreate(PETSC_COMM_WORLD,A); MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,N,N); MatSetFromOptions(A); MatMPIAIJSetPreallocation(A,5,PETSC_NULL,5,PETSC_NULL); VecCreate(PETSC_COMM_WORLD,b); VecSetSizes(b,PETSC_DECIDE,N); VecSetFromOptions(b); VecDuplicate(b,x); n bsp; int row=0; int* col3; int* col4; int* col5; PetscMalloc(3*sizeof(PetscInt),col3); PetscMalloc(4*sizeof(PetscInt),col4); PetscMalloc(5*sizeof(PetscInt),col5); col3[0]=0; col3[1]=1; col3[2]=4; double value3[3]={2.2915e+00,-1.1458e+00,-1.1458e+00}; MatSetValues(A,1,row,3,col3,value3,INSERT_VALUES); row=1; col4[0]=0; col4[1]=1; col4[2]=2; col4[3]=5; double value4[4]={-1.1458e+00,3.80208330e+00,-1.2500e+00 ,-1.40625000e+00}; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=2; col4[0]=1; col4[1]=2; col4[2]=3; col4[3]=6; value4[0]=-1.2500e+00; value4[1]=3.80208330e+00; value4[2]=-1.1458e+00 ; n bsp;value4[3]=-1.40625000e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=3; col3[0]=2; col3[1]=3; col3[2]=7; value3[0]=-1.1458e+00; value3[1]=2.2915e+00; value3[2]=-1.1458e+00; MatSetValues(A,1,row,3,col3,value3,INSERT_VALUES); row=4; col4[0]=0; col4[1]=4; col4[2]=5; col4[3]=8; value4[0]=-1.1458e+00; value4[1]=3.80208330e+00; value4[2]=-1.40625000e+00; value4[3]=-1.2500e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=5; col5[0]=1; col5[1]=4; col5[2]=5; col5[3]=6; col5[4]=9; double value5[5]; value5[0]=-1.40625000e+00; value5[1]=-1.40625000e+00; value5[2]=5 .9375e+00; value5[3]=-1.5625e+00 ; value5[4]=-1.5625e+00 ; MatSetValues(A,1,row,5,col5,value5,INSERT_VALUES); row=6; col5[0]=2; col5[1]=5; col5[2]=6; col5[3]=7; col5[4]=10; value5[0]=-1.40625000e+00; value5[1]=-1.5625e+00; value5[2]=5.9375e+00; value5[3]=-1.40625000e+00 ; value5[4]=-1.5625e+00 ; MatSetValues(A,1,row,5,col5,value5,INSERT_VALUES); row=7; col4[0]=3; col4[1]=6; col4[2]=7; col4[3]=11; value4[0]=-1.1458e+00; value4[1]=-1.40625000e+00; value4[2]=3.80208330e+00; value4[3]=-1.2500e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=8; col4[0]=4; col4[1]=8; col4[2]=9; col4[3]=12; value4[0]=-1.2500e+00; value4[1]=3.80208330e+00; value4[2]=-1.40625000e+00; value4[3]=-1.1458e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=9; col5[0]=5; col5[1]=8; col5[2]=9; col5[3]=10; col5[4]=13; value5[0]=-1.5625e+00; value5[1]=-1.40625000e+00; value5[2]=5.9375e+00; value5[3]=-1.5625e+00 ; value5[4]= -1.40625000e+00; MatSetValues(A,1,row,5,col5,value5,INSERT_VALUES); row=10; col5[0]=6; col5[1]=9; col5[2]=10; col5[3]=11; col5[4]=14; value5[0]=-1.5625e+00; value5[1]=-1.5625e+00; value5[2]=5.937500 00e+00; value5[3]=-1.40625000e+00 ; value5[4]= -1.40625000e+00; MatSetValues(A,1,row,5,col5,value5,INSERT_VALUES); row=11; col4[0]=7; col4[1]=10; col4[2]=11; col4[3]=15; value4[0]=-1.2500e+00; value4[1]=-1.40625000e+00; value4[2]=3.80208330e+00; value4[3]=-1.1458e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=12; col3[0]=8; col3[1]=12; col3[2]=13; value3[0]=-1.1458e+00; value3[1]=2.2915e+00; value3[2]=-1.1458e+00; MatSetValues(A,1,row,3,col3,value3,INSERT_VALUES); row=13; col4[0]=9; col4[1]=12; col4[2]=13; col4[3]= 14; value4[0]=-1.40625000e+00; value4[1]=-1.1458e+00; value4[2]=3.80208330e+00; value4[3]=-1.2500e+00; MatSetValues(A,1,row,4,col4,value4,INSERT_VALUES); row=14; col4[0]=10; col4[1]=13; col4[2]=14; col4[3]=15; value4[0]=-1.40625000e+00
[petsc-users] some problem with the VecCreateGhost.
I want to know 1. What is the relationship between Vhat and LocalVhat. Is the LocalVhat a copy of the Vhat plus the Ghost values. I think the LocalVhat will consume more memeory than the Vhat, am i right? 2. can i direct call VecGetArrary to the Vhat if i do not operate on the ghost value. Vec Vhat; Vec LocalVhat; double* VhatVec; VecCreateGhost(PETSC_COMM_WORLD,aMesh-Nx*aMesh-Ny/Commsize,PETSC_DECIDE,aMesh-nghosts,aMesh-ghosts[0],Vhat); VecGhostGetLocalForm(Vhat,LocalVhat); VecGhostUpdateBegin(Vhat,INSERT_VALUES,SCATTER_FORWARD); VecGhostUpdateEnd(Vhat,INSERT_VALUES,SCATTER_FORWARD);
Re: [petsc-users] some problem with the VecCreateGhost.
What the function of restore the local form, can i use VecDestroy to free the local form only; 在 2013-08-15 19:13:52,Jed Brown jedbr...@mcs.anl.gov 写道: 丁老师 ztdepya...@163.com writes: I want to know 1. What is the relationship between Vhat and LocalVhat. Is the LocalVhat a copy of the Vhat plus the Ghost values. I think the LocalVhat will consume more memeory than the Vhat, am i right? Logically, you should think of them as separate vectors. The global form contains only the global entries (non-overlapping partition) and the local form also contains the ghosted entries. If you want to operate strictly on the global entries, you can access the global form directly. Implementation-wise, the vectors share memory for the global part. This means that if you build a Krylov space with VecGhost, you have allocated storage for the ghosted entries for every Krylov vector, even though the algorithm will never use them. VecGhost is premature optimization (pessimization) in many cases, so consider just using a local work vector and performing a scatter from global to local. It's probably much cheaper than you think. 2. can i direct call VecGetArrary to the Vhat if i do not operate on the ghost value. Vec Vhat; Vec LocalVhat; double* VhatVec; VecCreateGhost(PETSC_COMM_WORLD,aMesh-Nx*aMesh-Ny/Commsize,PETSC_DECIDE,aMesh-nghosts,aMesh-ghosts[0],Vhat); VecGhostGetLocalForm(Vhat,LocalVhat); Update, _then_ get the local form. Remember to restore the local form when you are done with it. VecGhostUpdateBegin(Vhat,INSERT_VALUES,SCATTER_FORWARD); VecGhostUpdateEnd(Vhat,INSERT_VALUES,SCATTER_FORWARD);
[petsc-users] How to use jacobi or Gauss-seilder iteration to solve problem
KSPSetType(ksp,?);
[petsc-users] Does normal PC support --with-precision==_float128
Re: [petsc-users] Does normal PC support --with-precision==_float128
I use bicgstab solver. i think float128 means a float number with 128 bit. it is more accurate than normal double float number. At 2013-08-12 08:24:25,Barry Smith bsm...@mcs.anl.gov wrote: It supports all the standard built-in preconditioners in PETSc. It only does not support the external solvers which are not written to work with __float128. What solver do you want to use? Barry On Aug 11, 2013, at 7:22 PM, 丁老师 ztdepya...@163.com wrote:
[petsc-users] how to know the original global index after the partition.
In the ISPartitioningToNumbering(IS part,IS *is) is define thee index set that defines the global numbers on each part. but how to get the original global index.
[petsc-users] how to get the input value from the input command
i need to get the number of processor in the command line as the input of my function.for example, mpiexec -np 4 i need the 4 as the input number of my function. how to get it.
[petsc-users] confusion about VecGetArray on a sequential vec
I create a sequential vec seqx, and i get it value with VecGetArrary, since seqx is created only in process 0, why every process can output the value of the seqx. VecCreateSeq(PETSC_COMM_SELF,5,seqx); VecView(seqx,PETSC_VIEWER_STDOUT_WORLD); double *seqarry; VecGetArray(seqx,seqarry); for(int i=0;in;i++) coutMyRank seqarry seqarry[i]endl;
Re: [petsc-users] confusion about VecGetArray on a sequential vec
but when we use vecveiw to veiw the seqx, it gives value only with 1 process At 2013-08-01 18:36:09,Dave May dave.mayhe...@gmail.com wrote: When you called VecCreateSeq(PETSC_COMM_SELF,5,seqx); you created a sequential vector on each process - not just on rank 0. On 1 August 2013 12:11, 丁老师 ztdepya...@163.com wrote: I create a sequential vec seqx, and i get it value with VecGetArrary, since seqx is created only in process 0, why every process can output the value of the seqx. VecCreateSeq(PETSC_COMM_SELF,5,seqx); VecView(seqx,PETSC_VIEWER_STDOUT_WORLD); double *seqarry; VecGetArray(seqx,seqarry); for(int i=0;in;i++) coutMyRank seqarry s eqarry[i]endl;
Re: [petsc-users] Use kspsolve repeatly
I use the latest version PETSC, and the matrix has the same nonzero pattern during each outer iteration. I want to know does the kspsolve allocate memory for PC dring each call. 在 2013-08-01 20:46:36,Matthew Knepley knep...@gmail.com 写道: On Thu, Aug 1, 2013 at 12:58 PM, 丁老师 ztdepya...@163.com wrote: I need to use the kspsolve(A,b,x) repeatly in my code in the following style. but i have noticed from the system load monitor that during the code running, it allocate new memeory every step. I use the default setting for the PC. Could you please told me how to resolve this problem. 1) There is no enough here to give us an idea what you are doing 2) Are you using the latest release? If so, it prevents you from adding new nonzreos to the matrix, which is my first guess. Matt for (int i=0;imaxit;i++) { MatsetValues() kspsolve(A,b,x) } span title=neteasefooter -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
[petsc-users] Segmentatoin fault
I write a FVM code for the convection diffusion problem on a 2D cartesian grid. the code can run correctly with a grid of 720*720. and it use only 26% of the system memory(8G) during its running. but if i increase the grid to 800*800, it gives me the following error? could you please give me some information how to resolve it. mpiexec -np 4 ./main === = BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES = EXIT CODE: 11 = CLEANING UP REMAINING PROCESSES = YOU CAN IGNORE THE BELOW CLEANUP MESSAGES === YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault (signal 11) This typically refers to a problem with your application. Please see the FAQ page for debugging suggestions ztdep@linuxdell:~/Projects/CartesianPFlowingHeat2D-KDE/build mpiexec -np 4 ./main write the grid to Grid.cgns sucessfully
Re: [petsc-users] how to select values from certain positions of a vec from different process to process 0.
Does the function VecScatterCreateToZero resolve this problem? At 2013-07-31 09:08:26,Barry Smith bsm...@mcs.anl.gov wrote: create an IS with the global indices you want on process 0 and a seq Vec of the same size, create an IS of size 0 on all the other processes and a seq Vec of the size zero on all other processes create a VecScatter using these IS, the global Vec and the seq Vec. use VecScatterBegin/End to send over the values. Barry On Jul 30, 2013, at 6:37 PM, 丁老师 ztdepya...@163.com wrote:
Re: [petsc-users] Segmentatoin fault
i get the infor from the system load monitor 在 2013-07-31 23:36:38,Jed Brown jedbr...@mcs.anl.gov 写道: 丁老师 ztdepya...@163.com writes: I write a FVM code for the convection diffusion problem on a 2D cartesian grid. the code can run correctly with a grid of 720*720. and it use only 26% of the system memory(8G) during its running. How are you testing the total application memory usage? but if i increase the grid to 800*800, it gives me the following error? could you please give me some information how to resolve it. mpiexec -np 4 ./main === = BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES = EXIT CODE: 11 = CLEANING UP REMAINING PROCESSES = YOU CAN IGNORE THE BELOW CLEANUP MESSAGES === YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Segmentation fault (signal 11) This typically refers to a problem with your application. Please see the FAQ page for debugging suggestions ztdep@linuxdell:~/Projects/CartesianPFlowingHeat2D-KDE/build mpiexec -np 4 ./main write the grid to Grid.cgns sucessfully
[petsc-users] Use kspsolve repeatly
I need to use the kspsolve(A,b,x) repeatly in my code in the following style. but i have noticed from the system load monitor that during the code running, it allocate new memeory every step. I use the default setting for the PC. Could you please told me how to resolve this problem. for (int i=0;imaxit;i++) { MatsetValues() kspsolve(A,b,x) }
[petsc-users] how to scale the diagonal of a matrix
i want to implement the under-relaxation version of the equation. it nees to scale the diagonal value a matrix with the relaxation factor, could you please tell me how to achieve this goal.
[petsc-users] can i use the Vec created with VecCreateGhost in the kspsolve;
[petsc-users] which function return the L2 norm of the residual vector in ksp solver
[petsc-users] run examples with kdevelop
Dear friends: I want to runmy code the kdevelop4.4, but could you provide me a cmake file for it. i can run it smoothly with the make file. but how to translate it into a cmake filel include ${PETSC_DIR}/conf/variables include ${PETSC_DIR}/conf/rules ALL: main main: main.o chkopts -${CLINKER} -o main main.o ${PETSC_KSP_LIB} ${RM} main.o Regards.
Re: [petsc-users] run examples with kdevelop
but how to use it? 在 2013-06-21 20:17:46,Jed Brown jedbr...@mcs.anl.gov 写道: 丁老师 ztdepya...@163.com writes: Dear friends: I want to runmy code the kdevelop4.4, but could you provide me a cmake file for it. i can run it smoothly with the make file. but how to translate it into a cmake filel You can use FindPETSc.cmake from https://github.com/jedbrown/cmake-modules.
[petsc-users] How to get the matrix diagonal value A(i,i)
which function return the value at the diagonal of matrix A(i,i). Regards.
[petsc-users] confusion about MatSetValues(A, ,ADD_VALUES);
I write a simple c procedure to test the MatSetValues. the main body of procedure is like this int row=1; int col=10; double v=1.0; MatSetValues(A,1,row,1,col,v,INSERT_VALUES); MatSetValues(A,1,row,1,row,v,ADD_VALUES); MatSetValues(A,1,col,1,col,v,ADD_VALUES); MatAssemblyBegin(A,MAT_FINAL_ASSEMBLY); MatAssemblyEnd(A,MAT_FINAL_ASSEMBLY); I run with 4 cpus, when i view the matrix, the diagonal value is wrong ,it is 1 not 4.0. but if i delete the code MatSetValues(A,1,row,1,col,v,INSERT_VALUES), it can gives me the correct answer. could you please tell me the reason. Regards. thank you very much.
Re: [petsc-users] confusion about MatSetValues(A, ,ADD_VALUES);
in the user manual, it taks about the MAT_FLUSH_ASSEMbLY, and MAT_FINAL_ASSEMBLY, how to use the MAT_FLUSH_ASSEMBLY, if i want to mix the add value and insert value. 在 2013-06-01 00:30:45,Jed Brown jedbr...@mcs.anl.gov 写道: 丁老师 ztdepya...@163.com writes: I write a simple c procedure to test the MatSetValues. the main body of procedure is like this int row=1; int col=10; double v=1.0; MatSetValues(A,1,row,1,col,v,INSERT_VALUES); MatSetValues(A,1,row,1,row,v,ADD_VALUES); MatSetValues(A,1,col,1,col,v,ADD_VALUES); You can't mix INSERT_VALUES and ADD_VALUES. Please use debugging PETSc for development. It warns about this.
[petsc-users] PCILU does not work
My problem can be solved sucessfully with the default ksp setting, but if i change the pc with PCsetTye(pc,PCILU), it gives me the following error. Error mesage no supoort for the operation ofr this object type! matrix format mpiaij does not shave a build in PETSc ILU! Regards.
[petsc-users] VecGhostGetLocalForm(gx,lx)
in the VecGhostGetLocalForm(gx,lx), does the lx reduplicate the memory of global vector gx?
[petsc-users] some problem about VecCreateGhost
How to set different number of ghost points for different cpu.
[petsc-users] Some confusion about the vec tutorial ex8.c
In ex8.c, ISLocalToGlobalMappingCreate usd the ng as the number of local element. 'ng' is te local size plus 2 ghost positions. But we create the vector x with VecCreate, x does not has ghost points. how to explain this mapping.
[petsc-users] How to write the dmma mesh into tecplot format
I write a code for the solution of heat conduction problem with DMMA. i now want to write the output file in a tecplot format by the root cpu. how to gather the coordinate and field infor into the root process. Regards
[petsc-users] Does Petsc has diagonal preconditioner for Bicgstab algorithm
-- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130423/7b642ab9/attachment.html
[petsc-users] How to set a minimum iteration number for Bicgstab solver
-- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130423/6d41b396/attachment.html
[petsc-users] Does Petsc has Finite volume code example
Does Petsc has Finite volume code example with Ksp -- next part -- An HTML attachment was scrubbed... URL: http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130418/d08e72cc/attachment.html