[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave + PetSc

From: Kai Torben Ohlhus
Subject: Re: Octave + PetSc
Date: Tue, 22 Apr 2014 22:08:27 +0200

On Tue, Apr 22, 2014 at 5:47 PM, Sudheer Kumar <address@hidden> 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.

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.


Hi Sudheer,

Octave provides an external code interface for oct- and mex-files, see [1]. The callable code should be compiled with 'mkoctfile', like described in the manual [1].


[1] https://www.gnu.org/software/octave/doc/interpreter/External-Code-Interface.html

reply via email to

[Prev in Thread] Current Thread [Next in Thread]