简体   繁体   English

犰狳 C++ 配置检查

[英]Armadillo C++ configuration Check

Is there a way to check the configuration of armadillo from a c++ program?有没有办法从 c++ 程序检查犰狳的配置? I just want to make sure armadillo has been compiled with 'atlas' or 'openblas'我只是想确保犰狳是用“atlas”或“openblas”编译的

I found arma::arma_config cfg;我找到了arma::arma_config cfg; but I have no idea what cfg contains.但我不知道 cfg 包含什么。 I've done some testing and found blas and atlas but openblas does not seem to be an option.我做了一些测试,发现blasatlas ,但 openblas 似乎不是一个选择。 Is there anywhere I can find a complete list of what cfg contains?有没有什么地方可以找到 cfg 包含的完整列表?

That is common misunderstanding.这是常见的误解。 Armadillo uses the LAPACK/BLAS interface and you can switch the libraries out at will. Armadillo 使用 LAPACK/BLAS接口,您可以随意切换库。

edd@rob:/tmp$ g++ -o armadillo_example armadillo_example.cpp -larmadillo
edd@rob:/tmp$ ./armadillo_example 
A*trans(B) =
  -0.3111  -0.3320  -0.8700  -0.8698
   0.1312  -0.7760  -0.2394  -0.6150
  -0.2320  -1.2993  -0.6748  -1.3584
  -0.1677  -1.9175   0.6289  -0.5619

edd@rob:/tmp$ ldd armadillo_example
        linux-vdso.so.1 (0x00007fff92b5b000)
        libarmadillo.so.9 => /usr/lib/libarmadillo.so.9 (0x00007fe598ea5000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe598cc4000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe598b75000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe598b5a000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe598970000)
        libblas.so.3 => /usr/lib/x86_64-linux-gnu/libblas.so.3 (0x00007fe598910000)
        liblapack.so.3 => /usr/lib/x86_64-linux-gnu/liblapack.so.3 (0x00007fe598271000)
        libarpack.so.2 => /usr/lib/x86_64-linux-gnu/libarpack.so.2 (0x00007fe598229000)
        libsuperlu.so.5 => /usr/lib/x86_64-linux-gnu/libsuperlu.so.5 (0x00007fe5981b9000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe598ef1000)
        libopenblas.so.0 => /usr/lib/x86_64-linux-gnu/libopenblas.so.0 (0x00007fe596025000)
        libgfortran.so.5 => /usr/lib/x86_64-linux-gnu/libgfortran.so.5 (0x00007fe595d5d000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe595d39000)
        libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007fe595cef000)
edd@rob:/tmp$ 

The armadillo shared library has similar links:犰狳共享库有类似的链接:

edd@rob:/tmp$ ldd /usr/lib/libarmadillo.so.9
        linux-vdso.so.1 (0x00007ffc98853000)
        libblas.so.3 => /usr/lib/x86_64-linux-gnu/libblas.so.3 (0x00007f6043563000)
        liblapack.so.3 => /usr/lib/x86_64-linux-gnu/liblapack.so.3 (0x00007f6042ec6000)
        libarpack.so.2 => /usr/lib/x86_64-linux-gnu/libarpack.so.2 (0x00007f6042e7e000)
        libsuperlu.so.5 => /usr/lib/x86_64-linux-gnu/libsuperlu.so.5 (0x00007f6042e0e000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6042c2d000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6042ade000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6042ac1000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f60428d7000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f60435ff000)
        libopenblas.so.0 => /usr/lib/x86_64-linux-gnu/libopenblas.so.0 (0x00007f6040743000)
        libgfortran.so.5 => /usr/lib/x86_64-linux-gnu/libgfortran.so.5 (0x00007f604047b000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6040459000)
        libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f604040d000)
edd@rob:/tmp$ 

On my Ubuntu system /usr/lib/x86_64-linux-gnu/libblas.so.3 is a softlink that gets updated when another BLAS/LAPACK package is installed allowing you to easil switch (which I use e.g. in this GitHub repo to show how to easily install MKL . On my Ubuntu system /usr/lib/x86_64-linux-gnu/libblas.so.3 is a softlink that gets updated when another BLAS/LAPACK package is installed allowing you to easil switch (which I use e.g. in this GitHub repo to show如何轻松安装 MKL

The structure of arma_config can be found in /usr/include/armadillo_bits/arma_config.hpp or wherever locate arma_config finds the file. arma_config 的结构可以在/usr/include/armadillo_bits/arma_config.hpp或在任何位置locate arma_config找到该文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM