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.
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.