Skip to content

Commit 84c3973

Browse files
author
Mikołaj Zuzek
committed
ci: test both native and kokkos builds
1 parent 4b4b634 commit 84c3973

File tree

4 files changed

+184
-153
lines changed

4 files changed

+184
-153
lines changed

.github/workflows/cmake.yml

Lines changed: 84 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -3,165 +3,96 @@ name: CMake
33
on: [push, pull_request]
44

55
env:
6-
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
7-
BUILD_TYPE: RelWithDebInfo
6+
# Note: need gcc 10 (or newer) to avoid TBB errors
7+
# Note: g++-11 fails with "sorry, unimplemented: unexpected AST of kind nontype_argument_pack"
8+
CXX: g++-10
9+
CC: gcc-10
10+
CXX_STANDARD: 17
11+
KOKKOS_VERSION: 3.6.00 # develop
12+
KK_VERSION: 3.6.00 # develop
13+
SHARED_LIBS: ON
814

915
jobs:
10-
build-mdspan:
16+
stdblas:
17+
name: Test stdBLAS
1118
runs-on: ubuntu-latest
12-
container:
13-
image: amklinv/stdblas:latest
1419
defaults:
1520
run:
1621
shell: bash
1722

18-
steps:
23+
strategy:
24+
matrix:
25+
implementation: [Native, Kokkos]
26+
cmake_build_type: [Release, Debug] # RelWithDebInfo
27+
28+
env:
29+
BUILD_TYPE: ${{ matrix.cmake_build_type }}
30+
INSTALL_PATH: ${{ github.workspace }}/install
31+
UTILS_PATH: ${{ github.workspace }}/src/stdblas/.github/workflows/utils
32+
KOKKOS_BACKEND: Serial # TODO: ${{ matrix.kokkos_backend }} ?
33+
# FIXME OpenMP fails tests with: "Kokkos::OpenMP parallel_reduce ERROR: in parallel or not initialized"
34+
# FIXME Threads fails tests with: "ThreadsExec::start FAILED : Threads not initialized."
1935

20-
- id: get-sha
21-
run: echo ::set-output name=sha::$( curl https://api.github.com/repos/kokkos/mdspan/git/ref/heads/stable | jq .object.sha | tr -d '"' )
22-
23-
- name: Determine whether mdspan needs to be rebuilt
24-
id: cache-mdspan
25-
uses: actions/cache@v2
26-
with:
27-
path: mdspan-install
28-
key: mdspan-${{ steps.get-sha.outputs.sha }}
29-
30-
- name: Create Build Environment
31-
if: steps.cache-mdspan.outputs.cache-hit != 'true'
32-
run: cmake -E make_directory mdspan-build
33-
34-
- name: Check Out
35-
if: steps.cache-mdspan.outputs.cache-hit != 'true'
36-
uses: actions/checkout@v2
37-
with:
38-
repository: kokkos/mdspan
39-
path: mdspan-src
40-
41-
- name: Configure CMake
42-
if: steps.cache-mdspan.outputs.cache-hit != 'true'
43-
working-directory: mdspan-build
44-
run: cmake $GITHUB_WORKSPACE/mdspan-src -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/mdspan-install
45-
46-
- name: Build
47-
if: steps.cache-mdspan.outputs.cache-hit != 'true'
48-
working-directory: mdspan-build
49-
run: make
50-
51-
- name: Install
52-
if: steps.cache-mdspan.outputs.cache-hit != 'true'
53-
working-directory: mdspan-build
54-
run: make install
55-
56-
- name: Upload
57-
uses: actions/upload-artifact@v2
58-
with:
59-
name: mdspan
60-
path: mdspan-install
61-
62-
configure-stdblas:
63-
runs-on: ubuntu-latest
64-
container:
65-
image: amklinv/mdspan-dependencies:latest
66-
needs: build-mdspan
67-
68-
steps:
69-
- name: Download mdspan
70-
uses: actions/download-artifact@v2
71-
with:
72-
name: mdspan
73-
path: mdspan-install
74-
75-
- name: Create Build Environment
76-
run: cmake -E make_directory stdblas-build
77-
78-
- name: Check Out
79-
uses: actions/checkout@v2
80-
with:
81-
path: stdblas-src
82-
83-
- name: Configure CMake
84-
shell: bash
85-
working-directory: stdblas-build
86-
run: cmake $GITHUB_WORKSPACE/stdblas-src -Dmdspan_DIR=$GITHUB_WORKSPACE/mdspan-install/lib/cmake/mdspan -DLINALG_ENABLE_TESTS=On -DLINALG_ENABLE_EXAMPLES=On -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/stdblas-install
87-
88-
- name: Upload workspace
89-
uses: actions/upload-artifact@v2
90-
with:
91-
name: workspace
92-
path: .
93-
94-
build-stdblas:
95-
runs-on: ubuntu-latest
96-
container:
97-
image: amklinv/mdspan-dependencies:latest
98-
needs: configure-stdblas
99-
100-
steps:
101-
102-
- name: Download workspace
103-
uses: actions/download-artifact@v2
104-
with:
105-
name: workspace
106-
path: .
107-
108-
- name: Build
109-
working-directory: stdblas-build
110-
shell: bash
111-
run: make
112-
113-
- name: Tar files
114-
shell: bash
115-
run: tar -cvf stdblas.tar *
116-
117-
- name: Upload workspace
118-
uses: actions/upload-artifact@v2
119-
with:
120-
name: stdblas
121-
path: stdblas.tar
122-
123-
test-stdBLAS:
124-
runs-on: ubuntu-latest
125-
container:
126-
image: amklinv/mdspan-dependencies:latest
127-
needs: build-stdblas
128-
129-
steps:
130-
131-
- name: Download workspace
132-
uses: actions/download-artifact@v2
133-
with:
134-
name: stdblas
135-
path: .
136-
137-
- name: Untar files
138-
shell: bash
139-
run: tar -xvf stdblas.tar
140-
141-
- name: Test
142-
working-directory: stdblas-build
143-
shell: bash
144-
run: ctest --output-on-failure
145-
146-
install-stdBLAS:
147-
runs-on: ubuntu-latest
148-
container:
149-
image: amklinv/mdspan-dependencies:latest
150-
needs: build-stdblas
151-
15236
steps:
153-
154-
- name: Download workspace
155-
uses: actions/download-artifact@v2
156-
with:
157-
name: stdblas
158-
path: .
159-
160-
- name: Untar files
161-
shell: bash
162-
run: tar -xvf stdblas.tar
163-
164-
- name: Install
165-
working-directory: stdblas-build
166-
shell: bash
167-
run: make install
37+
38+
- name: Check out stdBLAS
39+
uses: actions/checkout@v2
40+
with:
41+
path: src/stdblas
42+
43+
- name: Check out mdspan
44+
uses: actions/checkout@v2
45+
with:
46+
repository: kokkos/mdspan
47+
path: src/mdspan
48+
49+
- name: Build and install mdspan
50+
run: $UTILS_PATH/build_mdspan.sh
51+
52+
- name: Check out Kokkos
53+
if: matrix.implementation == 'Kokkos'
54+
uses: actions/checkout@v2
55+
with:
56+
repository: kokkos/kokkos
57+
path: src/kokkos
58+
ref: ${{ env.KOKKOS_VERSION }}
59+
60+
- name: Build and install Kokkos
61+
if: matrix.implementation == 'Kokkos'
62+
run: $UTILS_PATH/build_kokkos.sh
63+
64+
- name: Check out Kokkos-Kernels
65+
if: matrix.implementation == 'Kokkos'
66+
uses: actions/checkout@v2
67+
with:
68+
repository: kokkos/kokkos-kernels
69+
path: src/kokkos-kernels
70+
ref: ${{ env.KK_VERSION }}
71+
72+
- name: Build and install Kokkos-Kernels
73+
if: matrix.implementation == 'Kokkos'
74+
run: $UTILS_PATH/build_kokkos-kernels.sh
75+
76+
- name: Configure stdBLAS
77+
run: |
78+
[[ ${{ matrix.implementation }} == "Kokkos" ]] && ENABLE_KOKKOS=ON
79+
cmake \
80+
-S $GITHUB_WORKSPACE/src/stdblas \
81+
-B $GITHUB_WORKSPACE/build/stdblas \
82+
-DCMAKE_BUILD_TYPE:STRING=${{ matrix.cmake_build_type }} \
83+
-DCMAKE_INSTALL_PREFIX:FILEPATH=$GITHUB_WORKSPACE/install \
84+
-DBUILD_SHARED_LIBS=$SHARED_LIBS \
85+
-DCMAKE_CXX_STANDARD:STRING=$CXX_STANDARD \
86+
-DLINALG_ENABLE_TESTS:BOOL=ON \
87+
-DLINALG_ENABLE_EXAMPLES:BOOL=On \
88+
-DLINALG_ENABLE_CONCEPTS:BOOL=ON \
89+
-DLINALG_ENABLE_KOKKOS:BOOL=$ENABLE_KOKKOS \
90+
-DLINALG_ENABLE_KOKKOS_DEFAULT:BOOL=$ENABLE_KOKKOS
91+
92+
- name: Build stdBLAS
93+
run: |
94+
cmake --build $GITHUB_WORKSPACE/build/stdblas -j $(nproc)
95+
96+
# - name: Test stdBLAS
97+
# working-directory: build/stdblas
98+
# run: ctest -j $(nproc) --timeout 60 --output-on-failure
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/bash
2+
3+
SRC_PATH=$GITHUB_WORKSPACE/src/kokkos-kernels
4+
BUILD_PATH=$GITHUB_WORKSPACE/build/kokkos-kernels
5+
6+
ENABLE_KK_ETI=OFF
7+
8+
# Configure Kokkos-Kernels
9+
cmake \
10+
-S $SRC_PATH \
11+
-B $BUILD_PATH \
12+
-DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
13+
-DCMAKE_INSTALL_PREFIX:FILEPATH=$INSTALL_PATH \
14+
-DBUILD_SHARED_LIBS=$SHARED_LIBS \
15+
-DKokkosKernels_ENABLE_TESTS:BOOL=OFF \
16+
-DKokkosKernels_ENABLE_DOCS:BOOL=OFF \
17+
-DKokkosKernels_ENABLE_TESTS_AND_PERFSUITE:BOOL=OFF \
18+
-DKokkosKernels_ENABLE_EXPERIMENTAL:BOOL=ON \
19+
-DKokkosKernels_INST_DOUBLE:BOOL=$ENABLE_KK_ETI \
20+
-DKokkosKernels_INST_FLOAT:BOOL=OFF \
21+
-DKokkosKernels_INST_COMPLEX_FLOAT:BOOL=OFF \
22+
-DKokkosKernels_INST_COMPLEX_DOUBLE:BOOL=OFF \
23+
-DKokkosKernels_INST_ORDINAL_INT:BOOL=$ENABLE_KK_ETI \
24+
-DKokkosKernels_INST_ORDINAL_INT64_T:BOOL=OFF \
25+
-DKokkosKernels_INST_OFFSET_INT:BOOL=$ENABLE_KK_ETI \
26+
-DKokkosKernels_INST_OFFSET_SIZE_T:BOOL=OFF \
27+
-DKokkosKernels_INST_LAYOUTLEFT:BOOL=$ENABLE_KK_ETI \
28+
-DKokkosKernels_INST_LAYOUTRIGHT:BOOL=OFF
29+
[[ $? -ne 0 ]] && exit 1
30+
31+
32+
# Build Kokkos-Kernels
33+
cmake --build $GITHUB_WORKSPACE/build/kokkos-kernels -j $(nproc)
34+
35+
[[ $? -ne 0 ]] && exit 1
36+
37+
# Install Kokkos-Kernels
38+
cmake --install $GITHUB_WORKSPACE/build/kokkos-kernels
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/bash
2+
3+
SRC_PATH=$GITHUB_WORKSPACE/src/kokkos
4+
BUILD_PATH=$GITHUB_WORKSPACE/build/kokkos
5+
6+
# Note: enabling parallel backend, like OpenMP
7+
# gives a chance to detect threading issues, e.g. races
8+
ENABLE_SERIAL=OFF
9+
[ $KOKKOS_BACKEND == 'Serial' ] && ENABLE_SERIAL=ON
10+
ENABLE_OPENMP=OFF
11+
[ $KOKKOS_BACKEND == 'OpenMP' ] && ENABLE_OPENMP=ON
12+
ENABLE_THREADS=OFF
13+
[ $KOKKOS_BACKEND == 'Threads' ] && ENABLE_THREADS=ON
14+
15+
# Configure Kokkos
16+
cmake \
17+
-S $SRC_PATH \
18+
-B $BUILD_PATH \
19+
-DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
20+
-DCMAKE_INSTALL_PREFIX:FILEPATH=$INSTALL_PATH \
21+
-DBUILD_SHARED_LIBS=$SHARED_LIBS \
22+
-DCMAKE_CXX_FLAGS:STRING=-Werror \
23+
-DKokkos_CXX_STANDARD:STRING=$CXX_STANDARD \
24+
-DKokkos_ENABLE_COMPLEX_ALIGN:BOOL=OFF \
25+
-DKokkos_ENABLE_COMPILER_WARNINGS:BOOL=ON \
26+
-DKokkos_ENABLE_DEPRECATED_CODE_3:BOOL=OFF \
27+
-DKokkos_ENABLE_TESTS:BOOL=OFF \
28+
-DKokkos_ENABLE_SERIAL:BOOL=$ENABLE_SERIAL \
29+
-DKokkos_ENABLE_OPENMP:BOOL=$ENABLE_OPENMP \
30+
-DKokkos_ENABLE_THREADS:BOOL=$ENABLE_THREADS
31+
32+
[[ $? -ne 0 ]] && exit 2
33+
34+
# Build mdspan
35+
cmake --build $BUILD_PATH -j $(nproc)
36+
37+
[[ $? -ne 0 ]] && exit 1
38+
39+
# Install mdspan
40+
cmake --install $BUILD_PATH
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/bash
2+
3+
SRC_PATH=$GITHUB_WORKSPACE/src/mdspan
4+
BUILD_PATH=$GITHUB_WORKSPACE/build/mdspan
5+
6+
# Configure mdspan
7+
cmake \
8+
-S $SRC_PATH \
9+
-B $BUILD_PATH \
10+
-DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
11+
-DCMAKE_INSTALL_PREFIX:FILEPATH=$INSTALL_PATH \
12+
-DBUILD_SHARED_LIBS=$SHARED_LIBS
13+
14+
[[ $? -ne 0 ]] && exit 1
15+
16+
# Build mdspan
17+
cmake --build $BUILD_PATH -j $(nproc)
18+
19+
[[ $? -ne 0 ]] && exit 1
20+
21+
# Install mdspan
22+
cmake --install $BUILD_PATH

0 commit comments

Comments
 (0)