[petsc-users] MATLAB and PetSc
Barry Smith
bsmith at mcs.anl.gov
Tue Apr 22 11:11:46 CDT 2014
On Apr 22, 2014, at 10:44 AM, Sudheer Kumar <sudheer3 at gmail.com> wrote:
> I request for advice on the following:
>
> I have a MATLAB code that uses some Linear algebra (LA) and Linear equation solver (LS) routines. I have to speed up this MATLAB code by using the i) MKL routines for LA calls and ii) Petsc routines for LS calls.
>
> I was able to achieve the step (i) using the following commands
>
> icc -c -I/work/apps/matlab/2013a/extern/include -I/work/apps/matlab/2013a/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_64 -O -DNDEBUG "matrixMultiply.c"
>
> icc -O -pthread -shared -Wl,--version-script,/work/apps/matlab/2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "matrixMultiply.mexa64" matrixMultiply.o -Wl,-rpath-link,/work/apps/matlab/2013a/bin/glnxa64 -L/work/apps/matlab/2013a/bin/glnxa64 -lmx -lmex -lmat -mkl -lm -lstdc++
>
>
>
> The code with dgemm call runs fine. However, how to achieve the step (ii), i.e., calling the PetSc routing from MATLAB executables compiled with mex. Please provide if you are aware of any sample codes.
This is a great deal of work and probably not worth it. Note that MATLAB already uses MKL internally. How much Matlab code do you have that computes the Jacobian and functions and is it parallel? Recommend just starting from scratch with a parallel PETSc code in C or FORTRAN than you can run problems as big as any machine you can access.
Barry
>
>
>
> I wish to eventually achieve all the above functionality for the Octave code as well. I thought of trying first with MATLAB as I thought the interface and support for external library support is better with it. Please do let me know your suggestions. Thanks.
>
> Regards
> Sudheer
More information about the petsc-users
mailing list