1

我正在从源代码构建 Octave 以包含 ATLAS 库。我是否正确包含它们?我不知道对 Octave 配置脚本有什么期望。我发现“-llapack”可疑地通用。

./configure --with-lapack=/usr/local/atlas

  Source directory:            .
  Installation prefix:         /usr/local
  C compiler:                  gcc   -Wall -W -Wshadow -Wformat -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wcast-align -Wcast-qual -g -O2 -pthread
  C++ compiler:                g++   -Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual -g -O2 -pthread
  Fortran compiler:            gfortran -O
  Fortran libraries:            -L/usr/lib/gcc/x86_64-linux-gnu/4.8 -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.. -lgfortran -lm -lquadmath
  Lex libraries:               
  LIBS:                        -lutil -lm  
  ...
  HDF5 libraries:              -lhdf5
  Java home:                   /usr/lib/jvm/java-7-openjdk-amd64
  Java JVM path:               /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server
  Java CPPFLAGS:               -I/usr/lib/jvm/java-7-openjdk-amd64/include -I/usr/lib/jvm/java-7-openjdk-amd64/include/linux
  Java libraries:              
  LAPACK libraries:            -llapack
  LLVM CPPFLAGS:               
  LLVM LDFLAGS:                
  LLVM libraries:              
  Magick++ CPPFLAGS:           -I/usr/include/GraphicsMagick  
  Magick++ LDFLAGS:             
  Magick++ libraries:          -lGraphicsMagick++ -lGraphicsMagick  
  ...

allusers@vbubuntu:~/Downloads/octave-3.8.1$ ll -R /usr/local/atlas/

/usr/local/atlas/:
total 16
drwxr-xr-x  4 root root 4096 May 25 23:01 ./
drwxr-xr-x 13 root root 4096 May 25 23:01 ../
drwxr-xr-x  3 root root 4096 May 25 23:01 include/
drwxr-xr-x  2 root root 4096 May 25 23:01 lib/

/usr/local/atlas/include:
total 60
drwxr-xr-x 3 root root  4096 May 25 23:01 ./
drwxr-xr-x 4 root root  4096 May 25 23:01 ../
drwxr-xr-x 2 root root  4096 May 25 23:01 atlas/
-rw-r--r-- 1 root root 33962 May 25 23:06 cblas.h
-rw-r--r-- 1 root root  9708 May 25 23:06 clapack.h

/usr/local/atlas/include/atlas:
total 604
drwxr-xr-x 2 root root  4096 May 25 23:01 ./
drwxr-xr-x 3 root root  4096 May 25 23:01 ../
-rw-r--r-- 1 root root  2089 May 25 23:06 atlas_buildinfo.h
-rw-r--r-- 1 root root    90 May 25 23:06 atlas_cacheedge.h
...
-rw-r--r-- 1 root root  2716 May 25 23:06 zmm.h
-rw-r--r-- 1 root root   552 May 25 23:06 zXover.h

/usr/local/atlas/lib:
total 26548
drwxr-xr-x 2 root root     4096 May 25 23:01 ./
drwxr-xr-x 4 root root     4096 May 25 23:01 ../
-rw-r--r-- 1 root root 14165306 May 25 23:06 libatlas.a
-rw-r--r-- 1 root root   455844 May 25 23:06 libcblas.a
-rw-r--r-- 1 root root   572392 May 25 23:06 libf77blas.a
-rw-r--r-- 1 root root 10942494 May 25 23:06 liblapack.a
-rw-r--r-- 1 root root   456426 May 25 23:06 libptcblas.a
-rw-r--r-- 1 root root   572788 May 25 23:06 libptf77blas.a
allusers@vbubuntu:~/Downloads/octave-3.8.1$ 

附加信息:

在配置文件中发送垃圾邮件回显语句后,我注意到以下内容:

这一行:

$as_echo "$as_me:${as_lineno-$LINENO}: checking for $cheev in $LAPACK_LIBS" >&5

里面有正确的 $LAPACK_LIBS 变量(我传入的那个)。正是这一行似乎是在我告诉它的 lapack 库中找不到某些东西的第一个失败:

if ac_fn_c_try_link "$LINENO"; then :

就在那一行之前,我看到配置文件定义了一些我相信它正在运行的 c 代码,以确定是否在库中找到了“cheeve”。

checking for cheev_ in /usr/local/atlas/lib/... no
checking for cheev_... no
checking for cheev_ in -llapack... yes

配置脚本

cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char $cheev ();
#ifdef F77_DUMMY_MAIN

#  ifdef __cplusplus
     extern "C"
#  endif
   int F77_DUMMY_MAIN() { return 1; }

#endif
int
main ()
{
return $cheev ();
  ;
  return 0;
}
_ACEOF

此时C代码已经超出了我的理解水平。似乎与是否调用了 F77 编译器(编译器翻译器??)有关。

4

2 回答 2

3

好吧,我想我在马拉松式的调试会议之后解决了这个问题。

Octave 似乎无法识别图集库,除非它们采用共享格式(.so 文件而不是默认生成的 .a 文件)。

当我使用添加的选项构建 ATLAS--shared并引用 ATLAS 生成的 .so 文件时,Octave 配置脚本会接受它们。注意:确保使用 libtatlas.so,而不是 libsatlas.so,假设您需要多线程库。

参考资料:

ATLAS ./configure 参数:

../configure --shared -b 64 -D c -DPentiumCPS=3000 --with-netlib-lapack-tarfile=/home/allusers/Downloads/lapack-3.5.0.tgz

八度 ./configure 参数:

./configure --with-lapack=/usr/local/atlas/lib/libtatlas.so --with-blas=/usr/local/atlas/lib/libtatlas.so

预期的八度./configure输出:

...
BLAS libraries:              /usr/local/atlas/lib/libtatlas.so
...
LAPACK libraries:            /usr/local/atlas/lib/libtatlas.so
...

八度./configure输出不正确:

...
BLAS libraries:              -lblas
...
LAPACK libraries:            -llapack
...

我对 ATLAS 和 Octave 的完整构建过程:

ATLAS setup:
    bunzip2 -c atlas3.10.x.tar.bz2 | tar xfm -
    mv ATLAS atlas3.10.1
    cd atlas3.10.1
    mkdir build_vbubuntu
    cd build_vbubuntu
    sudo apt-get install gfortran f2c libcnf-dev            # ???
    ../configure --shared -b 64 -D c -DPentiumCPS=3000 --with-netlib-lapack-tarfile=/home/allusers/Downloads/lapack-3.5.0.tgz
    make build
    make check      # test serial routines
    make ptcheck    # check parallel routines
    make time
    sudo make install

Octave setup:
    sudo apt-get build-dep octave
    ./configure --with-lapack=/usr/local/atlas/lib/libtatlas.so --with-blas=/usr/local/atlas/lib/libtatlas.so
    sudo make install

全面披露:虽然我写了这个答案,因为我有八度承认存在图谱库(我不想忘记稍后再写),但最终结果仍然无法正常工作,大规模矩阵乘法不使用多个核心。因此,如果该问题的原因是相关的,我将来可能会回来编辑此答案。

于 2014-05-28T17:35:58.560 回答
0

我成功尝试在 CENTOS 上编译 octave(3.8.2),包括 atlas:(确保删除 blas-devel 和 lapack-devel,以防万一)

> yum install atlas-sse3.x86_64
> setenv LDFLAGS -L/usr/lib64/atlas-sse3
>./configure --with-lapack=-latlas --with-blas=-latlas --enable-jit
> make -j20
(as root)> make install

After configure you should see:
    BLAS libraries:              -lcblas -lf77blas -latlas
    LAPACK libraries:            -llapack
于 2015-04-15T10:07:30.623 回答