[petsc-users] MATLAB and PetSc

Barry Smith bsmith at mcs.anl.gov
Wed Apr 23 13:59:13 CDT 2014


On Apr 23, 2014, at 7:36 AM, Sudheer Kumar <sudheer3 at gmail.com> wrote:

> Hi Barry,
> 
> I have looked at code in bin/matlab/classes. It is not clear to me how to use the code.

    Examples are in the examples/tutorials subdirectory of that directory. 
> Great if you could help me how to use these codes. So, with these codes can we run the parallel version of Petsc code from MATLAB. Is mex interface involved in compiling the Petsc code to MATLAB executable dynamic library. 

   No mex is not used; instead the MATLAB function calllib() is used which is a million times easier than messing with mex. To use PETSc from Matlab you need to ./configure PETSc with the option —with-matlab    It does not work currently in parallel.  If you put the classes directory in your matlab path than you can do help Petsc etc to see help for classes or just look in the top of those files. You will have to be proactive at using this stuff and figuring it out I cannot walk you through every little step.


   Barry

Note that octave does not support calllib() or at least did not in the past. 
> 
> 
> 
> 
> Regards
> Sudheer
> 
> 
> On Tue, Apr 22, 2014 at 11:19 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
>   PETSc does have a MATLAB interface in bin/matlab/classes that provides most of PETSc’s functionality directly to Matlab. Unfortunately we do not have the resources to maintain it, so it is a bit broken. If you are familiar with MATLAB and interfacing with C then git it a try and we can provide a small amount of support to help you use it, but as I said we cannot make it perfect ourselves.
> 
>    Barry
> 
> 
> On Apr 22, 2014, at 12:19 PM, Sudheer Kumar <sudheer3 at gmail.com> wrote:
> 
> >
> > On Tue, Apr 22, 2014 at 9:41 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> > How much Matlab code do you have that computes the Jacobian and functions and is it parallel?
> >
> > How much Matlab code do you have that computes the Jacobian and functions and is it parallel?
> >
> > The MATLAB code that I am working with is of 1000s lines of code (reservoir simulator, http://www.sintef.no/Projectweb/MRST/). The 90% of the time taken by the code on benchmarks is for linear solvers. And that's the reason to look for PetSc to speedup the entire code.
> >
> > >> This is a great deal of work and probably not worth it.
> > Ok, unfortunately here I guess I need to attempt to do that work. Do let me know your suggestions. Thanks.
> >
> >
> > Regards
> > Sudheer
> 
> 



More information about the petsc-users mailing list