[petsc-users] Segmentation fault when using matlab interface

Barry Smith bsmith at mcs.anl.gov
Fri Aug 17 15:39:56 CDT 2012


On Aug 17, 2012, at 10:50 AM, Satish Balay <balay at mcs.anl.gov> wrote:

> one issue with linking to 64bit matlab is: it internally links in with
> 64int mlk/blas [packaged in matlab]. So I think we have to use this
> mkl with petsc [along with -known-64-bit-blas-indices=1 option]
> 
> But there should be no calls to blas with just petscinitialize/finalize.
> 
> Perhaps its possible to run this in a debugger to determine the exact reason for SEGV?

   You can actually run MATLAB in the debugger (command line version). Look in script that starts up matlab to see what executable it actually uses and just start that up in the debugger.  When it crashes you will be left in the debugger, now MATLAB uses lots of threads so you will need to switch between the threads (need to figure out/know a little bit of gdb to do this) until you find the thread that crashed and then you can see what call it was in.

    Similarly you could run the executable under valgrind to see if it is memory corruption causing the grief. 

    It could be as simple as you are using the 64 bit version of MATLAB (which always uses 64 bit integers), did you build PETSc with the --with-64-bit-indices option? If not it will cause this crash; Send configure.log to petsc-maint at mcs.anl.gov

  Barry



> 
> Satish
> 
> 
> On Fri, 17 Aug 2012, De Groof, Vincent wrote:
> 
>> Well, basically the simplest program I have the problem with is initializing and finalizing petsc.
>> 
>> % Set environment variables.
>> setenv('PETSC_DIR', '/usr/local/petsc-3.3-p2/')
>> setenv('PETSC_ARCH','arch-linux2-c-debug')
>> 
>> % Call PETSc.
>> PetscInitialize();
>> PetscFinalize();
>> 
>> 
>> thanks.
>> ________________________________
>> Von: De Groof, Vincent
>> Gesendet: Freitag, 17. August 2012 10:25
>> An: petsc-users at mcs.anl.gov
>> Betreff: Segmentation fault when using matlab interface
>> 
>> Hello,
>> 
>> I'm trying to use the Petsc objects directly from Matlab. However, when testing the examples in the /bin/matlab/classes/examples/tutorials-directory, I get a segmentation fault (core dump) error. Unfortunately, I don't get more information then this. After running some different situations, I know the following:
>> I ran matlab both with and without desktop. The only error message I get is the segmentation fault. Sometimes it doesn't give the segmentation error after running the example. If so, it will cause a segmentation fault upon entering the next command in the matlab shell. If I quit matlab immediately after running an example without segmentation fault, my unix shell will hang.
>> 
>> 
>> I know it's kind of vague, but this is all I know now. Any suggestions to look at to solve this problem?
>> 
>> 
>> thanks.
>> 
> 



More information about the petsc-users mailing list