[petsc-users] Computing condition number

2016-09-20 Thread Florian Lindner
Hello, to compute / approximate the condition number of a MATSBAIJ, I put -ksp_view # Conditon number estimate -pc_type none -ksp_type gmres -ksp_monitor_singular_value -ksp_gmres_restart 1000 in my .petscrc Output is like: [...] 566 KSP Residual norm 1.241765807317e-07 % max 7.020130499234e+

[petsc-users] Write binary to matrix

2016-09-22 Thread Florian Lindner
Hello, I want to write a MATSBAIJ to a file in binary, so that I can load it later using MatLoad. However, I keep getting the error: [5]PETSC ERROR: No support for this operation for this object type! [5]PETSC ERROR: Cannot get subcomm viewer for binary files or sockets unless SubViewer contai

Re: [petsc-users] Write binary to matrix

2016-09-22 Thread Florian Lindner
Am 22.09.2016 um 12:53 schrieb Dave May: > > > On Thursday, 22 September 2016, Florian Lindner > wrote: > > Hello, > > I want to write a MATSBAIJ to a file in binary, so that I can load it > later using MatLoad. > > However, I keep getting the e

Re: [petsc-users] Write binary to matrix

2016-09-22 Thread Florian Lindner
- Thanks, Florian Am 22.09.2016 um 13:32 schrieb Matthew Knepley: > On Thu, Sep 22, 2016 at 5:42 AM, Florian Lindner <mailto:mailingli...@xgm.de>> wrote: > > Hello, > > I want to write a MATSBAIJ to a file in binary, so that I can load it > lat

Re: [petsc-users] Write binary to matrix

2016-09-23 Thread Florian Lindner
] > [neon:113111] [11] > /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x7feed8943f45] > [neon:113111] [12] ./a.out() [0x4009e9] > [neon:113111] *** End of error message *** > ---------- > mpirun noticed that process rank 1 with PID 113111 on node

Re: [petsc-users] Write binary to matrix

2016-09-25 Thread Florian Lindner
h/lindnefn/software/petsc/arch-linux2-c-debug/lib/libpetsc.so.3.7(MatView+0x12b6) > > [0x7feed971c08f] > > [neon:113111] [10] ./a.out() [0x400b8b] > > [neon:113111] [11] > /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) > [0x7feed8943f45] >

[petsc-users] How to view draw a matrix?

2016-11-04 Thread Florian Lindner
Hello, I want to print the sparsity structure of a matrix of type MPISBAIJ and try to use this code: PetscErrorCode ierr = 0; PetscViewer viewer; PetscDraw draw; ierr = PetscViewerCreate(communicator, &viewer); CHKERRV(ierr); ierr = PetscViewerSetType(viewer, PETSCVIEWERDRAW); CHKERRV(

Re: [petsc-users] How to view draw a matrix?

2016-11-04 Thread Florian Lindner
Hey, Am 04.11.2016 um 15:21 schrieb Matthew Knepley: > On Fri, Nov 4, 2016 at 9:14 AM, Florian Lindner <mailto:mailingli...@xgm.de>> wrote: > > Hello, > > I want to print the sparsity structure of a matrix of type MPISBAIJ and > try to use this code: > &

[petsc-users] Seeking help for analyzing non-convergence (KSP)

2016-11-04 Thread Florian Lindner
Hello, I have a matrix C that is the result of an RBF interpolation. It is constructured like that: c_ij = phi( |x_i - x_j| ) x are supporting points. phi is the radial basis functions, here it is a Gaussian: phi(r) = exp( -(1.5*r)^2 ). The system is augmented by a global polynomial, which re

Re: [petsc-users] Seeking help for analyzing non-convergence (KSP)

2016-11-07 Thread Florian Lindner
maint branch. make PETSC_DIR=/data/scratch/lindnefn/software/petsc PETSC_ARCH=arch-linux2-c-debug test reported no errors. Best Thanks, Florian > > Barry > >> On Nov 4, 2016, at 10:44 AM, Florian Lindner wrote: >> >> Hello, >> >> I have a matrix C

Re: [petsc-users] How to dump and load a petsc object in python?

2016-11-08 Thread Florian Lindner
Hey, Am 08.11.2016 um 09:57 schrieb Ji Zhang: > Dear all, > > I'm a petsc and petsc4py user. I want to save some petsc matrices and vectors > after calculation, and reload them later. > However, it is difficult for me. I think one of the following two ways may > have the potential to perform w

[petsc-users] How to compute y = y - A*b

2016-12-22 Thread Florian Lindner
Hello, what is the best / most efficient way to compute: y = y - A * b with vectors b, y and matrix A: * VecAXPY: I need to compute A*b first MatMult(A, b, r); VecAXPY(y, -1, r); * VecWAXPY: Same case, but I don't reuse y MatMult(A, b, r); VecWAXPY(w, -1, r, y); * VecAYPX: Don't work, becau

[petsc-users] Call multiple error handler

2017-01-10 Thread Florian Lindner
Hello, I really enjoy the verbosity (line number) of the default PetscTraceBackErrorHandler. However, I want my application to be aborted with the PetscMPIAbortErrorHandler when an error occures. Can I instruct PETSc to call first one handler, then another one? Thanks, Florian

Re: [petsc-users] Call multiple error handler

2017-01-11 Thread Florian Lindner
not recommend this, better to use > CHKERRQ() in your code and get error > tracebacks for PETSc code and your code. Ok, I'll keep that option in mind... Best, Florian >> On Jan 10, 2017, at 6:42 AM, Florian Lindner wrote: >> >> Hello, >> >> I really e

Re: [petsc-users] Building petsc4py / mpi4py

2017-01-23 Thread Florian Lindner
Am 23.01.2017 um 13:59 schrieb Matthew Knepley: > On Mon, Jan 23, 2017 at 6:38 AM, Florian Lindner <mailto:mailingli...@xgm.de>> wrote: > > Hello, > > I try to build petsc from the maint branch together with petsc4py and > mpi4py > > python2

Re: [petsc-users] Building petsc4py / mpi4py

2017-01-23 Thread Florian Lindner
Am 23.01.2017 um 14:24 schrieb Matthew Knepley: > On Mon, Jan 23, 2017 at 7:05 AM, Florian Lindner <mailto:mailingli...@xgm.de>> wrote: > > > > Am 23.01.2017 um 13:59 schrieb Matthew Knepley: > > On Mon, Jan 23, 2017 at 6:38 AM, Florian Lindne

Re: [petsc-users] Building petsc4py / mpi4py

2017-01-24 Thread Florian Lindner
all external python packages? > [petsc configure is limited to python2 - but petsc4py works with python3] > How about other externalpackages that use python? [scientificpython.py etc.. I think it's fine the way it is. Best, Florian > > Satish > > On Mon, 23 Jan 2017, Florian L

[petsc-users] Where to restrict MPI Communicator

2017-02-07 Thread Florian Lindner
Hello, so far we have happily set PETSC_COMM_WORLD anywhere in our code and we were not having trouble with that. However http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PETSC_COMM_WORLD.html states that: "Notes: By default PETSC_COMM_WORLD and MPI_COMM_WORLD are identical unl

[petsc-users] Symmetric matrix: Setting entries below diagonal

2017-04-07 Thread Florian Lindner
Hello, two questions about symmetric (MATSBAIJ) matrices. + Entries set with MatSetValue below the main diagonal are ignored. Is that by design? I rather expected setting A_ij to have the same effect as setting A_ji. + Has MatSetOption to MAT_SYMMETRIC and MAT_SYMMETRIC_ETERNAL any gain on MAT

[petsc-users] Understanding preallocation for MPI

2017-07-07 Thread Florian Lindner
Hello, I'm having some struggle understanding the preallocation for MPIAIJ matrices, especially when a value is in off-diagonal vs. diagonal block. The small example program is at https://pastebin.com/67dXnGm3 In general it should be parallel, but right now I just run it in serial. According t

Re: [petsc-users] Understanding preallocation for MPI

2017-07-10 Thread Florian Lindner
GlobalMappingGetSize(ISmapping, &mapSize); const PetscInt *mapIndizes; ISLocalToGlobalMappingGetIndices(ISmapping, &mapIndizes); Thanks, Florian Am 07.07.2017 um 17:31 schrieb Florian Lindner: > Hello, > > I'm having some struggle understanding the preallocation for M

Re: [petsc-users] Understanding preallocation for MPI

2017-07-10 Thread Florian Lindner
lt; col_range_end) { d_nnz[relative_row]++; } else { o_nnz[relative_row]++; } } } } ierr = MatMPIAIJSetPreallocation(A, 0, d_nnz, 0, o_nnz); CHKERRQ(ierr); Best, Florian > > Stefano > > Il 10 Lug 2017 10:23 AM, "Florian Lindner&qu

Re: [petsc-users] Understanding preallocation for MPI

2017-07-16 Thread Florian Lindner
ic which helps exchanging that array? If the answer lies within MatPreallocate* routines, I failed to see :-/ Best Thanks, Florian >> On Jul 10, 2017, at 3:22 AM, Florian Lindner wrote: >> >> Hey, >> >> one more question about preallocation: >> >&g

Re: [petsc-users] Understanding preallocation for MPI

2017-07-16 Thread Florian Lindner
n rank 0. Is that correct? Best, Florian > >Barry > >> On Jul 16, 2017, at 9:26 PM, Florian Lindner wrote: >> >> Hello, >> >> Am 11.07.2017 um 02:45 schrieb Barry Smith: >>> >>> You might consider using >>> http://www.m

[petsc-users] KSP and matrix-free matrix (shell)

2018-10-18 Thread 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, (

Re: [petsc-users] KSP and matrix-free matrix (shell)

2018-10-19 Thread Florian Lindner
n 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; &g

[petsc-users] Mat/Vec with empty ranks

2017-10-02 Thread Florian Lindner
Hello, I have a matrix and vector that live on 4 ranks, but only rank 2 and 3 have values: e.g. Vec Object: 4 MPI processes type: mpi Process [0] Process [1] 1.1 2.5 3. 4. Process [2] 5. 6. 7. 8. Process [3] Doing a simple LSQR solve does not converge. However, when the values are distribu

Re: [petsc-users] Mat/Vec with empty ranks

2017-10-02 Thread Florian Lindner
Am 02.10.2017 um 21:04 schrieb Matthew Knepley: > On Mon, Oct 2, 2017 at 6:21 AM, Florian Lindner <mailto:mailingli...@xgm.de>> wrote: > > Hello, > > I have a matrix and vector that live on 4 ranks, but only rank 2 and 3 > have values: > > D

Re: [petsc-users] Mat/Vec with empty ranks

2017-10-03 Thread Florian Lindner
Am 03.10.2017 um 16:05 schrieb Matthew Knepley: > On Mon, Oct 2, 2017 at 10:11 PM, Florian Lindner <mailto:mailingli...@xgm.de>> wrote: > > > > Am 02.10.2017 um 21:04 schrieb Matthew Knepley: > > On Mon, Oct 2, 2017 at 6:21 AM, Florian Lindne

Re: [petsc-users] Mat/Vec with empty ranks

2017-10-04 Thread Florian Lindner
Am 04.10.2017 um 18:08 schrieb Matthew Knepley: > I don't know if that is right. However, the sequential and parallel > algorithms agree on both the initial residual (so > that parallel > matrix and rhs appear correct) and the first iterate. Divergence of the > second iterate could still be a bu

[petsc-users] Hang with Internal Error: Ring ids do not match

2014-12-15 Thread Florian Lindner
Hello, since our application has two possible entry paths, petsc could be initialized at different positions. When used as a library (in contrast to a standalone executable), the code looks like: PetscErrorCode ierr; std::cout << "Petsc before PetscInitializeNoArguments()" << std::endl

[petsc-users] Why is PETSC_COMM_WORLD changed?

2014-12-19 Thread Florian Lindner
Hello, I have a piece of code that looks like that: // PETSC_COMM_WORLD = MPI_COMM_WORLD; PetscBool petscIsInitialized; PetscInitialized(&petscIsInitialized); if (not petscIsInitialized) { PetscErrorCode ierr; std::cout << "PETSC == WORLD: " << (PETSC_COMM_WORLD == MPI_COMM_

[petsc-users] petsc4py: Passing command line switches

2015-03-25 Thread Florian Lindner
Hello, I'm using the petsc4py. It works fine after some hurdling with missing documentation. (were not able to find API doc anywhere, I generated it myself now). I try to use the switches like -ksp_monitor like that: import petsc4py from petsc4py import PETSc petsc4py.init(sys.argv) but no r

Re: [petsc-users] petsc4py: Passing command line switches

2015-03-25 Thread Florian Lindner
Am Mittwoch, 25. März 2015, 10:17:45 schrieb Matthew Knepley: > On Wed, Mar 25, 2015 at 10:13 AM, Florian Lindner > wrote: > > > Hello, > > > > I'm using the petsc4py. It works fine after some hurdling with missing > > documentation. (were not able to

Re: [petsc-users] petsc4py: Passing command line switches

2015-03-26 Thread Florian Lindner
Am Donnerstag, 26. März 2015, 13:59:33 schrieb Lisandro Dalcin: > On 25 March 2015 at 18:34, Matthew Knepley wrote: > > That file is obviously old and was removed. > > > > After installing petsc4py, you can do "make docs" in the top level > source tree, and the docs/ directory will be populated.

[petsc-users] Understanding MatCreate bsize parameter

2015-03-26 Thread Florian Lindner
Hello, I'm using petsc with petsc4py. A matrix is created like that MPIrank = MPI.COMM_WORLD.Get_rank() MPIsize = MPI.COMM_WORLD.Get_size() print("MPI Rank = ", MPIrank) print("MPI Size = ", MPIsize) parts = partitions() print("Dimension= ", nSupport + dimension, "bs

Re: [petsc-users] Understanding MatCreate bsize parameter

2015-03-27 Thread Florian Lindner
Am Donnerstag, 26. März 2015, 07:34:27 schrieb Jed Brown: > Florian Lindner writes: > > > Hello, > > > > I'm using petsc with petsc4py. > > > > A matrix is created like that > > > > MPIrank = MPI.COMM_WORLD.Get_rank() > >

Re: [petsc-users] Understanding MatCreate bsize parameter

2015-03-27 Thread Florian Lindner
Am Freitag, 27. März 2015, 07:26:11 schrieb Matthew Knepley: > On Fri, Mar 27, 2015 at 4:28 AM, Florian Lindner > wrote: > > > Am Donnerstag, 26. März 2015, 07:34:27 schrieb Jed Brown: > > > Florian Lindner writes: > > > > > > > Hello,

Re: [petsc-users] Understanding MatCreate bsize parameter

2015-03-30 Thread Florian Lindner
Am Freitag, 27. März 2015, 07:34:56 schrieb Matthew Knepley: > On Fri, Mar 27, 2015 at 7:31 AM, Florian Lindner > wrote: > > > > Am Freitag, 27. März 2015, 07:26:11 schrieb Matthew Knepley: > > > On Fri, Mar 27, 2015 at 4:28 AM, Florian Lindner > > > wr

[petsc-users] Distribution of columns on mutliple ranks

2015-04-14 Thread Florian Lindner
Hello, given I have this piece of python code: rank = MPI.COMM_WORLD.Get_rank() sizes = [ 4, 5] n = sizes[rank] A = PETSc.Mat() A.create() A.setSizes( ((n, PETSc.DETERMINE), (n, PETSc.DETERMINE)) ) # sets the local size, let petsc determine global size A.setFromOptions(); A.setUp() print("Glob

[petsc-users] Create identity IS

2015-04-20 Thread Florian Lindner
Hello, I use an index set for a row mapping but don't want to use one for the column mapping. I try to create an idenitity index set to supply to ISLocalToGlobalMappingCreateIS and MatSetLocalToGlobalMapping: IS is; ISCreate(PETSC_COMM_WORLD, &is); ISSetIdentity(is); but I get an segmen

Re: [petsc-users] Create identity IS

2015-04-20 Thread Florian Lindner
Am Montag, 20. April 2015, 14:57:58 schrieb Lisandro Dalcin: > On 20 April 2015 at 14:35, Florian Lindner wrote: > > Hello, > > > > I use an index set for a row mapping but don't want to use one for the > > column mapping. > > > > I try t

[petsc-users] SBAIJ: Distribution of rows

2015-04-27 Thread Florian Lindner
Hello, just to make sure I don't get something wrong: An SBAIJ (especially MPISBAIJ) matrix just stores the uper triangle. When I invoke MatSetSizes with the global dimension set (and local to PETSC_DECIDE) petsc tries to evenly distribute rows amoung ranks. Same when I set local dimensions to

[petsc-users] PETSc was configured with one OpenMPI version but now appears to be compiling using a different OpenMPI

2015-06-11 Thread Florian Lindner
Hello, I try to setup petsc on my Arch Linux box. Download it using git -b maint. % python2 configure works fine: [...] Compilers:

Re: [petsc-users] PETSc was configured with one OpenMPI version but now appears to be compiling using a different OpenMPI

2015-06-12 Thread Florian Lindner
can confirm it fixes compilation on maint with a plain "python2 configure". Thanks a lot! Florian > Satish > > On Thu, 11 Jun 2015, Matthew Knepley wrote: > > > On Thu, Jun 11, 2015 at 7:04 AM, Florian Lindner > > wrote: > > > > >

[petsc-users] Double free in KSPDestroy

2015-07-13 Thread Florian Lindner
Hello, our petsc application suffers from a memory error (double free or corruption). Situation is a like that: A KSP is private member of a C++ class. In its constructor I call KSPCreate. Inbetween it may haben that I call KSPREset. In the class' destructor I call KSPDestroy. That's where the

Re: [petsc-users] Double free in KSPDestroy

2015-07-14 Thread Florian Lindner
f any problem with the build occurs. Florian > > > On Jul 13, 2015, at 10:56 AM, Florian Lindner wrote: > > > > Hello, > > > > our petsc application suffers from a memory error (double free or > > corruption). > > > > Situation is a like th

Re: [petsc-users] Double free in KSPDestroy

2015-07-23 Thread Florian Lindner
Am Mittwoch, 22. Juli 2015, 13:05:57 schrieben Sie: > > > On Jul 22, 2015, at 11:33 AM, Florian Lindner wrote: > > > > Am Dienstag, 21. Juli 2015, 18:32:02 schrieben Sie: > >> > >> Try putting a breakpoint in KSPSetUp_GMRES and check the values of all

[petsc-users] *****SPAM*****Create vector with evenly spaced values

2014-08-28 Thread Florian Lindner
Hello, is there a way to create a vector with evenly spaced values in an interval, like the numpy.arange function? http://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html or the linspace function? Thanks, Florian

Re: [petsc-users] *****SPAM*****Create vector with evenly spaced values

2014-08-29 Thread Florian Lindner
Am 27.08.2014 14:12, schrieb Florian Lindner: Hello, is there a way to create a vector with evenly spaced values in an interval, like the numpy.arange function? http://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html or the linspace function? Ok, I gave it as try. Do I need the

Re: [petsc-users] *****SPAM*****Create vector with evenly spaced values

2014-08-30 Thread Florian Lindner
Am Freitag, 29. August 2014, 09:29:21 schrieben Sie: > Florian : > >> > >> is there a way to create a vector with evenly spaced values in an > >> interval, like the numpy.arange function? > >> http://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html > >> or the linspace function? > > >

[petsc-users] Set matrix column to vector

2014-09-01 Thread Florian Lindner
Hello, I want to set the entire column of a N x M matrix to a N vector. What is the best way to do that? My first guess would be to VecGetArray and use that array for MatSetValuesLocal with nrow = VecGetLocalSize. What is the best to say MatSetValuesLocal that I want to set all rows continue

Re: [petsc-users] Set matrix column to vector

2014-09-01 Thread Florian Lindner
Am 01.09.2014 12:45, schrieb Matthew Knepley: On Mon, Sep 1, 2014 at 4:10 AM, Florian Lindner wrote: Hello, I want to set the entire column of a N x M matrix to a N vector. What is the best way to do that? My first guess would be to VecGetArray and use that array for MatSetValuesLocal

Re: [petsc-users] Set matrix column to vector

2014-09-01 Thread Florian Lindner
Am 01.09.2014 15:44, schrieb Florian Lindner: Am 01.09.2014 12:45, schrieb Matthew Knepley: On Mon, Sep 1, 2014 at 4:10 AM, Florian Lindner wrote: Hello, I want to set the entire column of a N x M matrix to a N vector. What is the best way to do that? My first guess would be to

Re: [petsc-users] Set matrix column to vector

2014-09-02 Thread Florian Lindner
Am 01.09.2014 16:11, schrieb Matthew Knepley: I recommend running using the debugger so you can get a stack trace, and perhaps see exactly what the problem is. You can also run under valgrind as the error says. This of course I tried, but had no real success. It crashes in ISLocalToGlobalM

[petsc-users] Putting petsc in a namespace

2014-09-05 Thread Florian Lindner
Hello, This may be rather a C/C++ question, but ... I encapsulate some petsc functions into c++ classes. Since I don't want to pull all petsc symbols into the global namespace for anyone using my classes I try to put petsc into it's own namespace: Header petsc.h: namespace petsc { #include

Re: [petsc-users] Putting petsc in a namespace

2014-09-08 Thread Florian Lindner
Hi there, ... Am 05.09.2014 18:00, schrieb Jed Brown: Florian Lindner writes: Hello, This may be rather a C/C++ question, but ... I encapsulate some petsc functions into c++ classes. Since I don't want to pull all petsc symbols into the global namespace for anyone using my classes

Re: [petsc-users] Putting petsc in a namespace

2014-09-09 Thread Florian Lindner
Am Montag, 8. September 2014, 10:53:27 schrieb Barry Smith: > > On Sep 8, 2014, at 2:19 AM, Florian Lindner wrote: > > > > > I want to offer an interface that uses some Petsc types (like Vec and Mat) > > but I do not want to import all petsc symbols into the globa

Re: [petsc-users] Putting petsc in a namespace

2014-09-12 Thread Florian Lindner
Jed Brown: > Florian Lindner writes: > > > If a user of my class library does an #include "mypetsc.h" he should not > > get all the petsc symbols in his global namespace, e.g. > > > > #include "mypetsc.h" > > > > Vector v; // is an object o

[petsc-users] Setting entries of symmetric matrix

2014-09-12 Thread Florian Lindner
Hello, I have a matrix that have the option set MAT_SYMMETRY_ETERNAL and set some values in the upper triangular. When reading values I was expecting that Petsc makes it a symmetric matrix, but the lower triangular is empty like it was initialized. Thanks, Florian Example code: #include #i

[petsc-users] Force running petsc sequentially

2014-09-16 Thread Florian Lindner
Hello, I'm currently replacing an RBF implementation with petsc linear algebra. The program itself runs parallel using MPI but the piece of code I work on runs strictly sequentially without making any use of MPI, just the same code on every node. Right now we're more interessted in patsc sparse

[petsc-users] Matrix missing diagonal entry

2014-10-07 Thread Florian Lindner
Hello, when I try to KSPSolve my matrix petsc prints out that a diagonal entry is missing: KSPSetOperators(solver, _matCLU.matrix, _matCLU.matrix ); KSPSolve(solver, vin.vector, vp.vector); And petsc is perfectly right about that specific entry being zero. So this may be more of a mathematic

Re: [petsc-users] Matrix missing diagonal entry

2014-10-14 Thread Florian Lindner
hould select -pc_type > cholesky > > >Barry > > On Oct 7, 2014, at 8:14 AM, Florian Lindner wrote: > > > Hello, > > > > when I try to KSPSolve my matrix petsc prints out that a diagonal entry is > > missing: > > > > KSPSetOperators(solver

[petsc-users] MatCreate() or MatCreateFoobar()

2014-10-23 Thread Florian Lindner
Hello, the petsc user doc says: One should use the matrix creation routines for particular data structures, such as MatCreateSeqAIJ() and MatCreateAIJ() for compressed, sparse row formats, instead of the generic MatCreate() routine. (13.4.1, p. 172) However online doc says: It is recommended t

[petsc-users] Handling dense matrices in RBF interpolation

2014-10-24 Thread Florian Lindner
Hello, I am redoing an radial basis function interpolation algorithm using petsc in our software. Using basis function with compact carrier is blazingly fast. These basis function result in sparse matrices. ierr = MatSetType(matrixC, MATSBAIJ); CHKERRV(ierr); // create symmetric, block spar

[petsc-users] Problem with Preallocating

2014-10-29 Thread Florian Lindner
Hello, I try to preallocate a sparse matrix like it was recommended in another posting, but get an error which kind of surprises me. Somehow I think it might be related to the order of assembly calls... My code creates the matrix: MatSetType(_matrixC.matrix, MATSBAIJ); MatSetSizes(_matrixC

Re: [petsc-users] Problem with Preallocating

2014-10-30 Thread Florian Lindner
ssemblyBegin(matrix, MAT_FINAL_ASSEMBLY); CHKERRQ(ierr); ierr = MatAssemblyEnd(matrix, MAT_FINAL_ASSEMBLY); CHKERRQ(ierr); ierr = MatView(matrix, PETSC_VIEWER_STDOUT_WORLD); CHKERRQ(ierr); MatDestroy(&matrix); PetscFinalize(); return 0; } > > Barry > > >

Re: [petsc-users] Problem with Preallocating

2014-10-31 Thread Florian Lindner
Am Donnerstag, 30. Oktober 2014, 09:19:38 schrieb Matthew Knepley: > On Thu, Oct 30, 2014 at 7:25 AM, Barry Smith wrote: > > > > > On Oct 30, 2014, at 3:36 AM, Florian Lindner > > wrote: > > > > > > Am Mittwoch, 29. Oktober 2014, 13:00:17 schrie

[petsc-users] Speed up KSPSolve of dense matrix

2014-11-04 Thread Florian Lindner
Hello, I have a fulll matrix of size e.g. 603x603 of which I'm very disappointed with the runtime, compared to a naive LU / forward / backward solution. My petsc solution takes about 14s, while the old one takes just 0.5s. (when you're looking at sparse matrices the figures are almost inversed)

Re: [petsc-users] Speed up KSPSolve of dense matrix

2014-11-05 Thread Florian Lindner
Am Dienstag, 4. November 2014, 19:14:58 schrieb Jed Brown: > Barry Smith writes: > >> I've tried to use a direct solver like suggested on pp 72, but: > >> > >> ./petBench 600 1 -ksp_type preonly -pc_type lu > > > > You cannot use LU with SBAIJ format. Only Cholesky. So use -pc_type > > cholesk

Re: [petsc-users] Speed up KSPSolve of dense matrix

2014-11-05 Thread Florian Lindner
Am Dienstag, 4. November 2014, 10:08:27 schrieb Barry Smith: > >There are a lot of questions here. Yes, thanks for replying! > > On Nov 4, 2014, at 328 AM, Florian Lindner wrote: > > > > Hello, > > > > I have a fulll matrix of size e.g. 603x603 of w

Re: [petsc-users] Speed up KSPSolve of dense matrix

2014-11-07 Thread Florian Lindner
tand the source > and and control of the ill-conditioning. > > What is your end goal in trying to use iterative methods? > > Barry > > > > On Nov 5, 2014, at 3:41 AM, Florian Lindner wrote: > > > > Am Dienstag, 4. November 2014, 10:08:27 schrieb Barry

[petsc-users] PetscBool in PETSc 3.1? (Ubuntu Precice)

2015-10-25 Thread Florian Lindner
Hello, our build system Travis uses the old Ubuntu Precice Pangolin version that comes with PETSc 3.1. While trying to activate petsc for our CI tests, I get the message that the type PetscBool wasn't found. I downloaded http://packages.ubuntu.com/precise/libpetsc3.1-dev and grepped for PetscB

[petsc-users] Different results with different distribution of rows

2016-02-09 Thread Florian Lindner
Hello, I use PETSc with 4 MPI processes and I experience different results when using different distribution of rows amoung ranks. The code looks like that: KSPSetOperators(_solver, _matrixC.matrix, _matrixC.matrix); // _solverRtol = 1e-9 KSPSetTolerances(_solver, _solverRtol, PETSC_DEFAULT, PET

Re: [petsc-users] Different results with different distribution of rows

2016-02-09 Thread Florian Lindner
] KSPConvergedDefault(): Linear solver has converged. Residual norm 7.959757133341e-08 is less than relative tolerance 1.e-09 times initial right hand side norm 1.731788191624e+02 at iteration 9 Best, Florian On Tue, 9 Feb 2016 14:06:01 +0100 Florian Lindner wrote: > Hello, > &

[petsc-users] Viewer Draw just flickers

2016-02-12 Thread Florian Lindner
Hello, I have this code to draw the structure of a matrix: PetscErrorCode ierr; PetscViewer viewer; ierr = PetscViewerCreate(communicator, &viewer); CHKERRV(ierr); ierr = PetscViewerSetType(viewer, PETSCVIEWERDRAW); CHKERRV(ierr); ierr = MatView(matrix, viewer); CHKERRV(ierr); ierr =

[petsc-users] Inverse local to global mapping?

2016-02-16 Thread Florian Lindner
Hello, I want to build a global vector (and matrix) from local data. The local data has a global index, which can be non-contiguous i.e. global index (0, 5, 2) is on rank 0, (1, 4, 3) is on rank 1. To keep all local data on the local part of vector I need a mapping: Application -> PETSc (0, 5,

[petsc-users] When to destroy an IS?

2016-02-24 Thread Florian Lindner
Hello, I create a couple of index sets: ISLocalToGlobalMapping _ISmapping; IS ISlocal, ISlocalInv, ISglobal, ISidentity, ISidentityGlobal; ISLocalToGlobalMapping ISidentityMapping; // Create an index set which maps myIndizes to continous chunks of matrix rows. ierr = ISCreateGeneral(P

[petsc-users] Prelloc: Get coordinates of local diagonal submatrix

2016-04-06 Thread Florian Lindner
Hello, in order to preallocate I have to know whether a non-zero will be in the local diagonal submatrix or not. http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMPIAIJSetPreallocation.html says: The DIAGONAL portion of the local submatrix of a processor can be defined as th

Re: [petsc-users] Prelloc: Get coordinates of local diagonal submatrix

2016-04-07 Thread Florian Lindner
ordering of rows and not application ordering? Best Thanks, Florian Am Mittwoch, 6. April 2016, 10:19:23 CEST schrieben Sie: > On Wed, Apr 6, 2016 at 10:12 AM, Florian Lindner > wrote: > > > Hello, > > > > in order to preallocate I have to know whether a non-zer

[petsc-users] Preallocation: Allocate more than the local column

2016-04-18 Thread Florian Lindner
Hello, I create a MATAIJ on 4 processors using local sizes (0) Set matrix A to local size 2 x 5 (1) Set matrix A to local size 2 x 2 (2) Set matrix A to local size 2 x 2 (3) Set matrix A to local size 2 x 2 which results in a global size of 8 x 11. Afaik the local size given is not relevant for

[petsc-users] Condition number of matrix

2016-08-30 Thread Florian Lindner
Hello, there is a FAQ and a Stackoverflow article about getting the condition number of a petsc matrix: http://www.mcs.anl.gov/petsc/documentation/faq.html#conditionnumber http://scicomp.stackexchange.com/questions/34/how-can-i-estimate-the-condition-number-of-a-large-sparse-matrix-using-petsc

Re: [petsc-users] Condition number of matrix

2016-08-30 Thread Florian Lindner
157e-04 max/min 2.829815526858e+06 for each iteration. Sorry about my mathematical illerateness, but where can I see the condition number of the matrix? Thanks, Florian > > > >> On Aug 30, 2016, at 7:01 AM, Florian Lindner wrote: >> >> Hello, >> >> the

Re: [petsc-users] Condition number of matrix

2016-08-30 Thread Florian Lindner
Thanks everybody, just to be sure, it's max/min of the last iteration? Florian Am 30.08.2016 um 16:10 schrieb Matthew Knepley: > On Tue, Aug 30, 2016 at 9:03 AM, Florian Lindner <mailto:mailingli...@xgm.de>> wrote: > > Hi, > > Am 30.08.2016

[petsc-users] IS Invert Not Permutation

2018-11-27 Thread Florian Lindner via petsc-users
Hello, I have a range of local input data indices that I want to use for row indexing, say { 3, 4, 6}. For that, I create a matrix with a local number of rows of 3 and map the indices {3, 4, 5} to these rows. I create an index set: ISCreateGeneral(comm, myIndizes.size(), myIndizes.data(), PET

[petsc-users] IS Invert Not Permutation

2018-11-28 Thread Florian Lindner via petsc-users
r. Any comments from your side are appreciated! Of course, I should set as much values as possible using MatSetValues... Best, Florian Am 27.11.18 um 16:33 schrieb Matthew Knepley: > On Tue, Nov 27, 2018 at 10:17 AM Florian Lindner via petsc-users > mailto:petsc-users@mcs.anl.gov>> wrote:

Re: [petsc-users] IS Invert Not Permutation

2018-11-29 Thread Florian Lindner via petsc-users
Am 28.11.18 um 18:12 schrieb Matthew Knepley: > On Wed, Nov 28, 2018 at 12:06 PM Florian Lindner <mailto:mailingli...@xgm.de>> wrote: > > Hey, > > thanks for your quick reply! > > As far as I understand how MatSetLocalToGlobalMapping works, there

[petsc-users] Check vector for zeros

2019-01-03 Thread Florian Lindner via petsc-users
Hello, Happy New Year Everybody! I get a vector from a linear solve and is used a divisor in VecPointwiseDivide. Clearly, I must check for zero entries before doing the division. What is the best way to do so, especially performance wise? The only way I come up with so far, is to VecCopy, VecA