Skip to content

Commit 7ffff5b

Browse files
Add CI workflow...
1 parent 33e13ef commit 7ffff5b

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed

.github/workflows/ci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
name: Build and Test on Ubuntu 24.04
13+
runs-on: ubuntu-24.04
14+
15+
env:
16+
OMP_NUM_THREADS: 2
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Install System Dependencies
23+
run: |
24+
sudo apt-get update
25+
sudo apt-get install -y \
26+
build-essential \
27+
cmake \
28+
g++-14 \
29+
libopenblas-dev \
30+
liblapack-dev \
31+
liblapacke-dev \
32+
libopenmpi-dev \
33+
openmpi-bin \
34+
libgtest-dev \
35+
libbenchmark-dev
36+
37+
- name: Configure CMake (Step 1 - Build HPTT)
38+
run: |
39+
mkdir build
40+
cd build
41+
cmake .. \
42+
-DCMAKE_CXX_COMPILER=g++-14 \
43+
-DCMAKE_BUILD_TYPE=Debug \
44+
-DHP_NUMERIC_USE_OPENBLAS=ON \
45+
-DQLTEN_COMPILE_HPTT_LIB=ON \
46+
-DQLTEN_BUILD_UNITTEST=OFF \
47+
-DQLTEN_BUILD_EXAMPLES=OFF
48+
49+
- name: Build HPTT
50+
run: |
51+
cd build
52+
make -j4
53+
54+
- name: Configure CMake (Step 2 - Enable Unit Tests)
55+
run: |
56+
cd build
57+
cmake .. \
58+
-DCMAKE_CXX_COMPILER=g++-14 \
59+
-DCMAKE_BUILD_TYPE=Debug \
60+
-DHP_NUMERIC_USE_OPENBLAS=ON \
61+
-DCMAKE_CXX_STANDARD_LIBRARIES="-llapacke" \
62+
-DQLTEN_COMPILE_HPTT_LIB=ON \
63+
-DQLTEN_BUILD_UNITTEST=ON \
64+
-DQLTEN_BUILD_EXAMPLES=OFF
65+
# explicily link lapacke because ubuntu splits openblas and lapacke
66+
- name: Build Project and Tests
67+
run: |
68+
cd build
69+
make -j4
70+
71+
- name: Run Tests
72+
run: |
73+
cd build
74+
export OMPI_MCA_rmaps_base_oversubscribe=1
75+
ctest --output-on-failure
76+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ while HPTT only requires a basic C++ compiler and CMake.
2929
To build test cases or develop programs like *TRG*, *DMRG* or *TDVP* based on TensorToolkit, the following are required:
3030

3131
- **C++ Compiler:** C++17 or later
32-
- **Build System:** CMake 3.12 or newer
32+
- **Build System:** CMake 3.27 or newer
3333
- **Math Libraries:** BLAS and LAPACK
3434
- **Parallelization:** MPI
3535
- **GPU Acceleration (optional):** CUDA compiler, CUDA toolkit (cuBLAS, cuSolver, cuTensor2)

cmake/Modules/MathBackend.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ elseif (HP_NUMERIC_USE_OPENBLAS)
7979
set(LAPACK_ROOT "/opt/homebrew/opt/lapack")
8080
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${OpenBLAS_ROOT} ${LAPACK_ROOT})
8181
set(BLAS_INCLUDE_DIRS "${OpenBLAS_ROOT}/include" CACHE STRING "" FORCE)
82+
elseif (UNIX AND NOT APPLE) # use for github action
83+
# On Linux (e.g. Ubuntu), OpenBLAS headers are usually in /usr/include/openblas or /usr/include
84+
if (EXISTS "/usr/include/openblas/cblas.h")
85+
set(BLAS_INCLUDE_DIRS "/usr/include/openblas" CACHE STRING "" FORCE)
86+
elseif (EXISTS "/usr/include/cblas.h")
87+
set(BLAS_INCLUDE_DIRS "/usr/include" CACHE STRING "" FORCE)
88+
endif()
8289
endif ()
8390
endif ()
8491

0 commit comments

Comments
 (0)