wellposed / hblas

haskell bindings for blas and lapack
www.wellposed.com
BSD 3-Clause "New" or "Revised" License
49 stars 19 forks source link

cblas vs blas #22

Closed sdiehl closed 10 years ago

sdiehl commented 10 years ago

Test suite requires -lcblas library to link on Arch Linux.

thinkpad% cabal test                                                                                                                             
Building hblas-0.3.0.1...
Preprocessing library hblas-0.3.0.1...
In-place registering hblas-0.3.0.1...
Preprocessing test suite 'unit-testsuite' for hblas-0.3.0.1...
Linking dist/build/unit-testsuite/unit-testsuite ...
/home/stephen/Git/hblas/dist/build/libHShblas-0.3.0.1.a(FFI.o): In function `rkxx_info':
(.text+0x111): undefined reference to `cblas_sdsdot'
/home/stephen/Git/hblas/dist/build/libHShblas-0.3.0.1.a(FFI.o): In function `slT4_info':
(.text+0x381): undefined reference to `cblas_dsdot'
/home/stephen/Git/hblas/dist/build/libHShblas-0.3.0.1.a(FFI.o): In function `slV5_info':
collect2: error: ld returned 1 exit status

Relevant information:

thinkpad% cabal --version                                                                                                                   
cabal-install version 1.18.0.1
using version 1.18.0 of the Cabal library 
thinkpad% ghc --version                                                                                                                    
The Glorious Glasgow Haskell Compilation System, version 7.6.3
thinkpad% ldconfig -p | grep blas                                                                                                                          
    libgslcblas.so.0 (libc6,x86-64) => /usr/lib/libgslcblas.so.0
    libgslcblas.so (libc6,x86-64) => /usr/lib/libgslcblas.so
    libcublas.so.5.0 (libc6,x86-64) => /opt/cuda/lib64/libcublas.so.5.0
    libcublas.so.5.0 (libc6) => /opt/cuda/lib/libcublas.so.5.0
    libcublas.so (libc6,x86-64) => /opt/cuda/lib64/libcublas.so
    libcublas.so (libc6) => /opt/cuda/lib/libcublas.so
    libcblas.so (libc6,x86-64) => /usr/lib/libcblas.so
    libblas.so (libc6,x86-64) => /usr/lib/libblas.so
thinkpad% ldconfig -p | grep cblas                                                                                                          
    libgslcblas.so.0 (libc6,x86-64) => /usr/lib/libgslcblas.so.0
    libgslcblas.so (libc6,x86-64) => /usr/lib/libgslcblas.so
    libcblas.so (libc6,x86-64) => /usr/lib/libcblas.so

This is the providing package should be blas 3.5.0-1:

https://www.archlinux.org/packages/extra/x86_64/blas/

cartazio commented 10 years ago

i'll get cracking on fixing this up. I think the "right" solution is for me to change how the ffi calls for blas work to use the fortran ABI.

sdiehl commented 10 years ago

I think this is just an issue with the provenance of the blas libraries that ship with OSX and Debian differ from the netlib versions, which is the one that Arch Linux uses. I wouldn't read too much into it.

cartazio commented 10 years ago

would me adding an -fArchLinux flag to .cabal be a satisfactory near term solution? (especially since hackage now shows the list of available flags)

cartazio commented 10 years ago

I really really want the basic lib to work zero config out of the box on as wide a range of platforms as I can while having not configure logic

cartazio commented 10 years ago

alternatively, is there a way I could have setup.hs detect that its on archlinux?

cartazio commented 10 years ago

possibly using something like uname -s

cartazio commented 10 years ago

added an -fCBLAS flag for handling this. Not the ideal solution, but a simple one thats usable today.