[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mex file linking
From: |
Matyas Sustik |
Subject: |
Re: mex file linking |
Date: |
Wed, 14 Dec 2011 11:45:07 -0600 |
I think I am doing it correctly now using LD_LIBRARY_PATH pointing to
the lapack/blas libs (the naming could have been messed up earlier)
but the results still do not exactly match. Maybe some other
"settings" effect floating point results and so what I am trying to
do, simply cannot be done.
So in short: never mind.
-Matyas
On Wed, Dec 14, 2011 at 10:50 AM, Matyas Sustik <address@hidden> wrote:
> I think I need to clarify my questions; I am admittedly a bit confused
> about the use of libraries in octave. Comments would be appreciated.
>
> The way I understand this now is that octave has lapackgf-3 compiled
> into it (this is a university CS machine and I do not know the install
> details yet). I suspect that when my C++/MEX code calls an LAPACK
> function it will use a version available from this LAPACK that was
> specified by the admins at install time.
>
> It is confusing that mkoctfile -v indicates that linking is explicitly
> done with -llapackgf-3, however if I just use the link command
> directly and remove that library, I still get working code; so the
> LAPACK functions come from a library from within octave or such. Say,
> if LAPACK is upgraded on that machine I am not sure what version of
> LAPACK will be used.
>
> Furthermore, it seems that I am not able to specify an *alternate*
> library to be used for the LAPACK functions. I tried to specify
> -lmwlapack (before -loctave) hoping that I could get the same version
> as Matlab uses (used -L... etc.) but that does not appear to work.
>
> I do not know whether and/or why the LAPACK would be different for
> Matlab and Octave on this machine. (Would not make much sense I
> think.) I need to release the code for Matlab, because that is still
> somewhat expected, however I would prefer to use Octave and it would
> be nice if I could exactly reproduce a Matlab run on Octave.
>
> I also plan to make a new version of some LAPACK functions. I do not
> intend though to recompile the whole LAPACK library. Can I just
> replace some selected functions?
>
> Thanks in advance.
> -Matyas
>
> On Tue, Dec 13, 2011 at 10:36 PM, Matyas Sustik <address@hidden> wrote:
>> Hi All,
>>
>> I am linking a mex file (for octave) with:
>>
>> g++ $^ -o $@ -shared -Wl,-Bsymbolic $(OCTAVE_LIBS) -loctave -lcruft
>> -llapackgf-3 -lblas-3gf -lfftw3 -lfftw3f -lreadline -lncurses -ldl
>> -lhdf5 -lz -lm -lgfortranbegin -lgfortran -lasm -L.
>> (OCTAVE_LIBS = $(shell mkoctfile -p LFLAGS)
>>
>> (I am not sure whether all the libraries are needed, but mkoctfile -v had
>> them.)
>>
>> I definitely need blas and lapack in my code. However, if I link
>> without them I still get working code!! How is that possible?? Does
>> octave provide the blas and lapack functions by default?
>>
>> Thanks!
>> -Matyas