Refactor cmake
I create this issue to document information needed to refactor cmake related material.
Minimum requirements to build cytnx. Here is the incomplete list.
For C++
- boost
- blas/lapack. Effectively, we only support MKL and OpenBLAS. Maybe we only officially support these two.
For python wrapper
- python
- pybind11
For GPU support
- CUDA
- cuTENSOR
- cuQuantum
For OpenMP
Some references
- https://cliutils.gitlab.io/modern-cmake/README.html
CMP0167 https://cmake.org/cmake/help/latest/policy/CMP0167.html
The FindBoost module is removed in cmake 3.30.
find_package(Boost CONFIG) finds the upstream package directly, without the find module.
Examples
- https://cliutils.gitlab.io/modern-cmake/chapters/packages/Boost.html
CMP0146 https://cmake.org/cmake/help/latest/policy/CMP0146.html
The FindCUDA module is removed in cmake 3.27.
Examples
- https://cliutils.gitlab.io/modern-cmake/chapters/packages/CUDA.html
OpenMP examples
- https://cliutils.gitlab.io/modern-cmake/chapters/packages/OpenMP.html
CUDA Quantum and CMake¶
OpenBLAS
If libopenblas is installed in /opt/OpenBLAS/
On Linux, after setting
export C_INCLUDE_PATH=/opt/OpenBLAS/include
export CPLUS_INCLUDE_PATH=/opt/OpenBLAS/include
export LD_LIBRARY_PATH=/opt/OpenBLAS/lib
cmake can find OpenBLAS and one can compile cytnx.
On MacOS (Apple silicon), still cmake cannot find OpenBLAS.
On Linux and MacOS, one can use CMAKE_PREFIX_PATH.
CMAKE_PREFIX_PATH=/opt/OpenBLAS cmake ..
then cmake can find OpenBLAS. But it will fail to compile because it cannot find lapacke.h.
One still have to set the include_path as above. Then it will compile OK.
==> Next thing is to try to use submodules to handle OpenBLAS.