Cytnx-dev / Cytnx

Project Cytnx, A Cross-section of Python & C++,Tensor network library
Apache License 2.0
35 stars 14 forks source link

Refactor cmake #473

Open pcchen opened 2 months ago

pcchen commented 2 months ago

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++

For python wrapper

For GPU support

For OpenMP

Some references

pcchen commented 2 months ago

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

pcchen commented 2 months ago

CMP0146 https://cmake.org/cmake/help/latest/policy/CMP0146.html

The FindCUDA module is removed in cmake 3.27.

Examples

pcchen commented 2 months ago

OpenMP examples

pcchen commented 2 months ago

CUDA Quantum and CMake

pcchen commented 2 months ago

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.