[petsc-dev] Matlab interface

Barry Smith bsmith at mcs.anl.gov
Fri Apr 5 16:16:27 CDT 2013


On Apr 5, 2013, at 10:52 AM, Jose E. Roman <jroman at dsic.upv.es> wrote:

> Has anyone tried the Matlab interface with petsc-dev?

   I ran classes/examples/tests/ex2.c and had similar behavior as you report. I suspect something gotten broken with regard to PetscInitialize()/Finalize() being reentrant (that is callable multiple times) because of the thread kernel code. I'll try to debug through it. Don't know when I'll have any luck.

  Barry

> 
> If I run exKSP.m three consecutive times, the first time it runs ok, the second time I see a memory leak (see below) and after that I get an error (with exKSP or any other one). This was not happening in 3.3.
> 
> Also, some scripts are out-of-date. It is necessary to add mat.SetUp() and other minor fixes.
> 
> Jose
> 
>>> exKSP
> Vector Object: 1 MPI processes
>  type: seq
> 12.5
> 14.5
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> 10
> Matrix Object: 1 MPI processes
>  type: seqaij
> row 0: (0, 10) 
> row 1: (1, 10) 
> row 2: (2, 10) 
> row 3: (3, 10) 
> row 4: (4, 10) 
> row 5: (5, 10) 
> row 6: (6, 10) 
> row 7: (7, 10) 
> row 8: (8, 10) 
> row 9: (9, 10) 
>  0 KSP Residual norm 2.732215218463e+00 
>  1 KSP Residual norm 1.516684121884e-16 
> Vector Object: 1 MPI processes
>  type: seq
> 1.25
> 1.45
> 0.3
> 0.4
> 0.5
> 0.6
> 0.7
> 0.8
> 0.9
> 1
> KSP Object: 1 MPI processes
>  type: gmres
>    GMRES: restart=30, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
>    GMRES: happy breakdown tolerance 1e-30
>  maximum iterations=10000, initial guess is zero
>  tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
>  left preconditioning
>  using PRECONDITIONED norm type for convergence test
> PC Object: 1 MPI processes
>  type: ilu
>    ILU: out-of-place factorization
>    0 levels of fill
>    tolerance for zero pivot 2.22045e-14
>    using diagonal shift on blocks to prevent zero pivot
>    matrix ordering: natural
>    factor fill ratio given 1, needed 1
>      Factored matrix follows:
>        Matrix Object:         1 MPI processes
>          type: seqaij
>          rows=10, cols=10
>          package used to perform factorization: petsc
>          total: nonzeros=10, allocated nonzeros=10
>          total number of mallocs used during MatSetValues calls =0
>            not using I-node routines
>  linear system matrix = precond matrix:
>  Matrix Object:   1 MPI processes
>    type: seqaij
>    rows=10, cols=10
>    total: nonzeros=10, allocated nonzeros=50
>    total number of mallocs used during MatSetValues calls =0
>      not using I-node routines
> [0]Total space allocated 4880 bytes
> [ 0]16 bytes PetscThreadCommReductionCreate() line 448 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcommred.c
>      [0]  PetscThreadCommReductionCreate() line 448 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcommred.c
>      [0]  PetscThreadCommWorldInitialize() line 1251 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscGetThreadCommWorld() line 80 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommGetThreadComm() line 114 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommDuplicate() line 139 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscHeaderCreate_Private() line 31 in /Users/jroman/soft/petsc/src/sys/objects/inherit.c
>      [0]  VecCreate() line 32 in /Users/jroman/soft/petsc/src/vec/vec/interface/veccreate.c
> [ 0]512 bytes PetscThreadCommReductionCreate() line 440 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcommred.c
>      [0]  PetscThreadCommReductionCreate() line 440 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcommred.c
>      [0]  PetscThreadCommWorldInitialize() line 1251 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscGetThreadCommWorld() line 80 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommGetThreadComm() line 114 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommDuplicate() line 139 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscHeaderCreate_Private() line 31 in /Users/jroman/soft/petsc/src/sys/objects/inherit.c
>      [0]  VecCreate() line 32 in /Users/jroman/soft/petsc/src/vec/vec/interface/veccreate.c
> [ 0]128 bytes PetscThreadCommReductionCreate() line 436 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcommred.c
>      [0]  PetscThreadCommReductionCreate() line 436 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcommred.c
>      [0]  PetscThreadCommWorldInitialize() line 1251 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscGetThreadCommWorld() line 80 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommGetThreadComm() line 114 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommDuplicate() line 139 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscHeaderCreate_Private() line 31 in /Users/jroman/soft/petsc/src/sys/objects/inherit.c
>      [0]  VecCreate() line 32 in /Users/jroman/soft/petsc/src/vec/vec/interface/veccreate.c
> [ 0]1280 bytes PetscThreadCommReductionCreate() line 435 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcommred.c
>      [0]  PetscThreadCommReductionCreate() line 435 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcommred.c
>      [0]  PetscThreadCommWorldInitialize() line 1251 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscGetThreadCommWorld() line 80 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommGetThreadComm() line 114 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommDuplicate() line 139 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscHeaderCreate_Private() line 31 in /Users/jroman/soft/petsc/src/sys/objects/inherit.c
>      [0]  VecCreate() line 32 in /Users/jroman/soft/petsc/src/vec/vec/interface/veccreate.c
> [ 0]32 bytes PetscThreadCommReductionCreate() line 432 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcommred.c
>      [0]  PetscThreadCommReductionCreate() line 432 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcommred.c
>      [0]  PetscThreadCommWorldInitialize() line 1251 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscGetThreadCommWorld() line 80 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommGetThreadComm() line 114 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommDuplicate() line 139 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscHeaderCreate_Private() line 31 in /Users/jroman/soft/petsc/src/sys/objects/inherit.c
>      [0]  VecCreate() line 32 in /Users/jroman/soft/petsc/src/vec/vec/interface/veccreate.c
> [ 0]64 bytes PetscThreadCommWorldInitialize() line 1265 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscThreadCommWorldInitialize() line 1265 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscGetThreadCommWorld() line 80 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommGetThreadComm() line 114 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommDuplicate() line 139 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscHeaderCreate_Private() line 31 in /Users/jroman/soft/petsc/src/sys/objects/inherit.c
>      [0]  VecCreate() line 32 in /Users/jroman/soft/petsc/src/vec/vec/interface/veccreate.c
> [ 0]2432 bytes PetscThreadCommWorldInitialize() line 1264 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscThreadCommWorldInitialize() line 1264 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscGetThreadCommWorld() line 80 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommGetThreadComm() line 114 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommDuplicate() line 139 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscHeaderCreate_Private() line 31 in /Users/jroman/soft/petsc/src/sys/objects/inherit.c
>      [0]  VecCreate() line 32 in /Users/jroman/soft/petsc/src/vec/vec/interface/veccreate.c
> [ 0]16 bytes PetscThreadCommWorldInitialize() line 1256 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscThreadCommWorldInitialize() line 1256 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscGetThreadCommWorld() line 80 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommGetThreadComm() line 114 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommDuplicate() line 139 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscHeaderCreate_Private() line 31 in /Users/jroman/soft/petsc/src/sys/objects/inherit.c
>      [0]  VecCreate() line 32 in /Users/jroman/soft/petsc/src/vec/vec/interface/veccreate.c
> [ 0]16 bytes PetscThreadCommSetAffinities() line 423 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscThreadCommSetAffinities() line 423 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscThreadCommWorldInitialize() line 1251 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscGetThreadCommWorld() line 80 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommGetThreadComm() line 114 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommDuplicate() line 139 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscHeaderCreate_Private() line 31 in /Users/jroman/soft/petsc/src/sys/objects/inherit.c
>      [0]  VecCreate() line 32 in /Users/jroman/soft/petsc/src/vec/vec/interface/veccreate.c
> [ 0]48 bytes PetscThreadCommCreate() line 150 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscThreadCommCreate() line 150 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscThreadCommWorldInitialize() line 1251 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscGetThreadCommWorld() line 80 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommGetThreadComm() line 114 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommDuplicate() line 139 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscHeaderCreate_Private() line 31 in /Users/jroman/soft/petsc/src/sys/objects/inherit.c
>      [0]  VecCreate() line 32 in /Users/jroman/soft/petsc/src/vec/vec/interface/veccreate.c
> [ 0]320 bytes PetscThreadCommCreate() line 146 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscThreadCommCreate() line 146 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscThreadCommWorldInitialize() line 1251 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscGetThreadCommWorld() line 80 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommGetThreadComm() line 114 in /Users/jroman/soft/petsc/src/sys/threadcomm/interface/threadcomm.c
>      [0]  PetscCommDuplicate() line 139 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscHeaderCreate_Private() line 31 in /Users/jroman/soft/petsc/src/sys/objects/inherit.c
>      [0]  VecCreate() line 32 in /Users/jroman/soft/petsc/src/vec/vec/interface/veccreate.c
> [ 0]16 bytes PetscCommDuplicate() line 151 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscCommDuplicate() line 151 in /Users/jroman/soft/petsc/src/sys/objects/tagm.c
>      [0]  PetscHeaderCreate_Private() line 31 in /Users/jroman/soft/petsc/src/sys/objects/inherit.c
>      [0]  VecCreate() line 32 in /Users/jroman/soft/petsc/src/vec/vec/interface/veccreate.c
>>> exKSP
> [0]PETSC ERROR: --------------------- Error Message ------------------------------------
> [0]PETSC ERROR: Invalid argument!
> [0]PETSC ERROR: Wrong type of object: Parameter # 2!
> [0]PETSC ERROR: ------------------------------------------------------------------------
> [0]PETSC ERROR: Petsc Development GIT revision: 854e096b3f56ee49eddbdee02830d60adb46893b  GIT Date: 2013-04-03 20:53:18 -0500
> [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> [0]PETSC ERROR: See docs/index.html for manual pages.
> [0]PETSC ERROR: ------------------------------------------------------------------------
> [0]PETSC ERROR: matlab on a arch-darwin-c-debug-matlab named pptp243-73.vpns.upv.es by jroman Fri Apr  5 17:49:20 2013
> [0]PETSC ERROR: Libraries linked from /Users/jroman/soft/petsc/arch-darwin-c-debug-matlab/lib
> [0]PETSC ERROR: Configure run at Fri Apr  5 17:31:03 2013
> [0]PETSC ERROR: Configure options --with-matlab --with-matlab-engine --with-mpi=0
> [0]PETSC ERROR: ------------------------------------------------------------------------
> [0]PETSC ERROR: VecView() line 682 in /Users/jroman/soft/petsc/src/vec/vec/interface/vector.c
> ??? Error using ==> PetscCHKERRQ at 3
> Errors generated on calling Petsc library function
> 
> Error in ==> PetscVec>PetscVec.View at 106
>        err = calllib('libpetsc', 'VecView', obj.pobj,0);PetscCHKERRQ(err);
> 
> Error in ==> PetscVec>PetscVec.subsref at 123
>        [varargout{1:nargout}] = builtin('subsref', obj, S);
> 
> Error in ==> exKSP at 18
> b.View;
> 
> 




More information about the petsc-dev mailing list