arrayfire / arrayfire/arrayfire

More robust CBLAS / LAPACKE detection

未关闭
#1,579 12 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
build
主要语言
C++
星标
4.9k
派生
555
平均合并
1 小时 24 分钟
30 天内合并 PR
1

描述

As discussed privately with @pavanky, detection of CBLAS and LAPACKE could get some love. I tried a few things but getting something generic enough proved to be quite tricky. I am opening this issue as a thread to explore the use cases and possible scenarii that the detection should cover.

CMake already has detection for the `BLAS` and `LAPACK` but lacks CBLAS / LAPACKE. The following blog [post](http://nicolas.limare.net/pro/notes/2014/10/31_cblas_clapack_lapacke/) provides some background as to how they all relate to each other. In a nutshell, one should absolutely use the `CBLAS` wrapper specific to the desired BLAS vendor, but this restriction is relaxed for `LAPACKE` (which not all vendor provides btw).

Another thing to consider is the way distributions handle multiple vendors of `BLAS` / `LAPACK`. Debian uses a set of symlinks to switch between different `BLAS` vendors at runtime and uses netlib's LAPACKE regardless, whilst other distros have separated or mutually exclusive install paths for each vendor. Finally, some vendors (`mkl`, `openblas`) can bundle everything (`BLAS` / `CBLAS`, `LAPACK`/`LAPACKE`) in a single binary as opposed to separate ones for `BLAS` and `LAPACK`.

I can see 3 use-cases possible:
1. Detection of a custom installation of BLAS (all patforms).
2. Detection of a system-installed version via `pkg-config` (like `arch-linux` provides).
3. Detection of a system-installed version without `pkg-config` (symlinks ala `Debian`).

For (1), we can roll our own (bad), or use find_package(`BLAS`) and find_package(`LAPACK`) with the `BLA_VENDOR` parameter and existing support for lookup in `LIB` (Windows), `DYLD_LIBRARY_PATH` (Apple) and `LD_LIBRARY_PATH` (Linux). Then, we can look for the location of the vendor specific headers based on the path to the libraries and the value of `BLA_VENDOR`.
For (2), just use the `pkg-config` results directly (like we currently do).
For (3), use find_package(`BLAS`) and find_package(`LAPACK`) and look for the path to `cblas.h` and `lapacke.h` as in (1).

Thoughts?

贡献指南

打开贡献指南

调研方向

Start by examining the existing find_package(BLAS) and find_package(LAPACK) detection and the current pkg-config handling. Compare the three proposed use cases: custom installations, pkg-config system installations, and Debian-style symlink installations. Done means CBLAS and LAPACKE detection handles the relevant vendor-specific headers, libraries, and installation layouts.

由索引模型根据 Issue 内容生成。

评估

技术栈
cmake
领域
build-system
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。