[petsc-dev] calling petsc from a mex file

Munson, Todd tmunson at mcs.anl.gov
Tue May 8 12:30:27 CDT 2018


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

I have tried compiling both with --download-mpich and --with-mpi=0 with the
same outcome.

Maybe I am missing something flags I need to set when configuring petsc?

Any help would be appreciated.

My backup plan is to rewrite the matlab code that wants to invoke a petsc solver so 
that I can make it work using a PetscMatlabEngine instead.

Thanks, Todd.

More information about the petsc-dev mailing list