I have a working code that solves a certain problem by using KSPSolve from Petsc (using gmres solver with ilu pre-conditioner). I wanted to call this code from MATLAB so I coded a mex-file. However, KSPSolve is crashing my mex file and MATLAB when it is called.
I used valgrind and it seems that the first error is in some sse2 code. If I remove the call to KSPSolve everything works fine. If I call the whole code outside MATLAB, it also works.
Anyone knows of possible compatibility issues between Petsc and MATLAB? Can this be resolved? Thanks,