how to compile lapack so that it can be used correctly during installation of octave?

后端 未结 2 1035
野趣味
野趣味 2021-01-02 15:23

I\'m trying to install the latest octave 3.8.1 from source in a cluster running redhat+IBM LSF. I don\'t have write access to anywhere else except my own home dir, that\'s w

相关标签:
2条回答
  • 2021-01-02 15:42

    I would suggest using OpenBLAS.

    > git clone https://github.com/xianyi/OpenBLAS.git
    > make
    > make make --PREFIX=INSTALL_DIR install
    

    move the librabries from OpenBLAS to /usr/lib64

    > cp /path/to/OpenBLAS/lib/* /usr/lib64/
    

    then go to the octave installation path and run

    > "your specific flags" ./configure "your specific arguments" --with-blas="-lopenblas"
    
    0 讨论(0)
  • 2021-01-02 15:56

    Just compiled the lapack shared lib on my boss's beast... Here's a link which almost did it right. I made some changes:

    (1) Adding -fPIC to

    OPTS & NOOPT in make.inc
    

    (2) Change the names in make.inc to .so

    BLASLIB = ../../libblas.so
    
    LAPACKLIB = ../liblapack.so
    

    (3) In ./SRC, change the Makefile from

    ../$(LAPACKLIB): $(ALLOBJ)
        $(ARCH) $(ARCHFLAGS) $@ $(ALLOBJ)
        $(RANLIB) $@
    

    to

    ../$(LAPACKLIB): $(ALLOBJ)
        $(LOADER) $(LOADOPTS) -shared -Wl,-soname,liblapack.so -o $@ $(ALLOBJ) ../libblas.so
    

    Cuz lapack is calling blas, if you miss the very last part, your liblapack.so will fail! You need to LINK liblapack.so against libblas.so ( libatlas.so is also OK). You can use "ldd liblapack.so" to check its dependency. If you see libblas.so in there, pretty much you did it right.

    (4) In ./BLAS/SRC, change the Makefile from

    $(BLASLIB): $(ALLOBJ)
    $(ARCH) $(ARCHFLAGS) $@ $(ALLOBJ)
    $(RANLIB) $@
    

    to

    $(BLASLIB): $(ALLOBJ)
    $(LOADER) $(LOADOPTS) -z muldefs -shared -Wl,-soname,libblas.so -o $@ $(ALLOBJ)
    

    (5) I don't need libtmg.so so that I didn't change it... Run

    make blaslib 
    

    Then

    make lapacklib
    

    You will have both of them compiled. I check the liblapack.so with building a numpy on it and Python ctypes.cdll loading. All work for me to solve eigenvalues and eigenvectors... So it should be fine...

    (6) YOU MAY NEED TO SET UP LD_LIBRARY_PATH to where you keep your library files. google it... If not set by admin, then

    export LD_LIBRARY_PATH=path-to-lib
    

    If already set, then

    export LD_LIBRARY_PATH=path-to-lib:$LD_LIBRARY_PATH
    

    to overwrite your default libs.

    So that you won't have ld linking errors. Good luck!!

    In lapack-3.7.0, there are redundant lines in the SRC/Makefile. Simply deleting them will solve your error.

    0 讨论(0)
提交回复
热议问题