[petsc-dev] calling petsc from a mex file
Smith, Barry F.
bsmith at mcs.anl.gov
Wed May 9 01:55:33 CDT 2018
Huh
$ matlab -nodisplay
< M A T L A B (R) >
Copyright 1984-2018 The MathWorks, Inc.
R2018a (9.4.0.813654) 64-bit (maci64)
February 23, 2018
Warning: Name is nonexistent or not a directory: /Users/barrysmith/Src/nodal-dg/Codes1.1
Warning: Name is nonexistent or not a directory: /Users/barrysmith/Src/nodal-dg/Codes1.1/CFD2D
Warning: Name is nonexistent or not a directory: /Users/barrysmith/Src/nodal-dg/Codes1.1
To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
>> taopounders()
>> exit
~/Src/petsc/src/tao/leastsquares/examples/matlab (tmunson/tao-pounders-matlab-interface=) arch-matlab
> On May 8, 2018, at 2:30 PM, Munson, Todd <tmunson at mcs.anl.gov> wrote:
>
>
> Its in tmunson/tao-pounders-matlab-interface
>
> Most of the code is commented out or otherwise inactive. There is a hacked
> command in src/tao/leastsquares/examples/matlab that I use to compile the
> mex file.
>
> To test, you should be able to start matlab and say "taopounders(); exit".
>
> Todd.
>
>> On May 8, 2018, at 2:21 PM, Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
>>
>>
>> Push the branch that does this or send me the code and I'll debug it. I now have some vague memory about this behavior.
>>
>> Barry
>>
>>
>>> On May 8, 2018, at 1:53 PM, Munson, Todd <tmunson at mcs.anl.gov> wrote:
>>>
>>>
>>>
>>>> On May 8, 2018, at 1:02 PM, Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
>>>>
>>>>
>>>>
>>>>> On May 8, 2018, at 12:30 PM, Munson, Todd <tmunson at mcs.anl.gov> wrote:
>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I wonder if anyone has experience calling petsc from matlab using mex. I have the
>>>>> simplest possible mexFunction that just calls PetscInitialize() and
>>>>> PetscFinalize(). That part seems to work fine, but when I exit
>>>>> from matlab I get a segmentation violation and a petsc error
>>>>> message.
>>>>
>>>> What are all the error messages? Cut and paste. I've done this in the past but not for years.
>>>
>>> Below is the matlab session and error message. I do note that if I issue PetscFinalize() and
>>> that command completes, the Petsc signal handlers remain installed/active. If I do a
>>> PetscPopSignalHandler() immediately after PetscInitialize(), I do not get the error
>>> message, but a "Segmentation fault: 11" output at the end.
>>>
>>> Because petsc is being loaded as a dynamic library, are there possibly uninitialized global
>>> variables or state?
>>>
>>> Thanks, Todd.
>>>
>>> [0]PETSC ERROR: ------------------------------------------------------------------------
>>> [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
>>> [0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
>>> [0]PETSC ERROR: or see http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
>>> [0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to find memory corruption errors
>>> [0]PETSC ERROR: likely location of problem given in stack below
>>> [0]PETSC ERROR: --------------------- Stack Frames ------------------------------------
>>> [0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,
>>> [0]PETSC ERROR: INSTEAD the line number of the start of the function
>>> [0]PETSC ERROR: is given.
>>> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
>>> [0]PETSC ERROR: Signal received
>>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
>>> [0]PETSC ERROR: Petsc Development GIT revision: v3.9.1-409-gf553c6556e GIT Date: 2018-05-07 17:17:17 -0500
>>> [0]PETSC ERROR: Unknown Name on a arch-darwin-c-debug named eduroam062-089.wl.anl-external.org by tmunson Tue May 8 12:04:45 2018
>>> [0]PETSC ERROR: Configure options --download-mpich CC=/usr/bin/clang CXX=/usr/bin/clang++ FC=/opt/local/bin/gfortran
>>> [0]PETSC ERROR: #1 User provided function() line 0 in unknown file
>>> application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0
>>> [unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=59
>>> :
>>> system msg for write_line failure : Bad file descriptor
>>
>
More information about the petsc-dev
mailing list