Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mhoemmen authored and Mikołaj Zuzek committed May 24, 2022
1 parent 82a010c commit 2cf1bad
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 145 deletions.
220 changes: 75 additions & 145 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,165 +3,95 @@ name: CMake
on: [push, pull_request]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
CXX: g++-11
KOKKOS_VERSION: 3.6.00
KK_VERSION: develop

jobs:
build-mdspan:
stdblas:
name: Test stdBLAS
runs-on: ubuntu-latest
container:
image: amklinv/stdblas:latest
#container: # TODO: build new image - needs newer cmake
# image: amklinv/stdblas:latest
defaults:
run:
shell: bash

strategy:
matrix:
cmake_build_type: [RelWithDebInfo] # , Release, Debug
# TODO: use include to replace "on/off" with "Kokkos/Serial"
enable_kokkos: [OFF] # , ON

env:
BUILD_TYPE: $${{ matrix.cmake_build_type }}
INSTALL_PATH: $GITHUB_WORKSPACE/install
# UTILS_PATH: $GITHUB_WORKSPACE/src/stdblas/.github/workflows/utils

steps:

- id: get-sha
run: echo ::set-output name=sha::$( curl https://api.github.com/repos/kokkos/mdspan/git/ref/heads/stable | jq .object.sha | tr -d '"' )

- name: Determine whether mdspan needs to be rebuilt
id: cache-mdspan
uses: actions/cache@v2
- name: Install prerequisites
run: |
sudo apt update
sudo apt install -y cmake g++-11 libtbb-dev
- name: Check out stdBLAS
uses: actions/checkout@v2
with:
path: mdspan-install
key: mdspan-${{ steps.get-sha.outputs.sha }}

- name: Create Build Environment
if: steps.cache-mdspan.outputs.cache-hit != 'true'
run: cmake -E make_directory mdspan-build

- name: Check Out
if: steps.cache-mdspan.outputs.cache-hit != 'true'
path: src/stdblas

- name: Check out mdspan
uses: actions/checkout@v2
with:
repository: kokkos/mdspan
path: mdspan-src

- name: Configure CMake
if: steps.cache-mdspan.outputs.cache-hit != 'true'
working-directory: mdspan-build
run: cmake $GITHUB_WORKSPACE/mdspan-src -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/mdspan-install

- name: Build
if: steps.cache-mdspan.outputs.cache-hit != 'true'
working-directory: mdspan-build
run: make

- name: Install
if: steps.cache-mdspan.outputs.cache-hit != 'true'
working-directory: mdspan-build
run: make install

- name: Upload
uses: actions/upload-artifact@v2
with:
name: mdspan
path: mdspan-install
path: src/mdspan

configure-stdblas:
runs-on: ubuntu-latest
container:
image: amklinv/mdspan-dependencies:latest
needs: build-mdspan

steps:
- name: Download mdspan
uses: actions/download-artifact@v2
with:
name: mdspan
path: mdspan-install

- name: Create Build Environment
run: cmake -E make_directory stdblas-build

- name: Check Out
- name: Checkout Kokkos
if: matrix.enable_kokkos == 'ON'
uses: actions/checkout@v2
with:
path: stdblas-src

- name: Configure CMake
shell: bash
working-directory: stdblas-build
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

- name: Upload workspace
uses: actions/upload-artifact@v2
with:
name: workspace
path: .

build-stdblas:
runs-on: ubuntu-latest
container:
image: amklinv/mdspan-dependencies:latest
needs: configure-stdblas

steps:

- name: Download workspace
uses: actions/download-artifact@v2
with:
name: workspace
path: .

- name: Build
working-directory: stdblas-build
shell: bash
run: make

- name: Tar files
shell: bash
run: tar -cvf stdblas.tar *

- name: Upload workspace
uses: actions/upload-artifact@v2
with:
name: stdblas
path: stdblas.tar

test-stdBLAS:
runs-on: ubuntu-latest
container:
image: amklinv/mdspan-dependencies:latest
needs: build-stdblas

steps:

- name: Download workspace
uses: actions/download-artifact@v2
with:
name: stdblas
path: .

- name: Untar files
shell: bash
run: tar -xvf stdblas.tar

- name: Test
working-directory: stdblas-build
shell: bash
run: ctest --output-on-failure

install-stdBLAS:
runs-on: ubuntu-latest
container:
image: amklinv/mdspan-dependencies:latest
needs: build-stdblas

steps:

- name: Download workspace
uses: actions/download-artifact@v2
repository: kokkos/kokkos
path: src/kokkos
ref: $KOKKOS_VERSION

- name: Checkout Kokkos-Kernels
if: matrix.enable_kokkos == 'ON'
uses: actions/checkout@v2
with:
name: stdblas
path: .

- name: Untar files
shell: bash
run: tar -xvf stdblas.tar

- name: Install
working-directory: stdblas-build
shell: bash
run: make install
repository: kokkos/kokkos-kernels
path: src/kokkos-kernels
ref: $KK_VERSION

- name: Build and install mdspan
run: $GITHUB_WORKSPACE/src/stdblas/.github/workflows/utils/build_mdspan.sh

# Note: enabling parallel backend, like OpenMP
# gives a chance to detect threading issues, e.g. races
- name: Build and install Kokkos
if: matrix.enable_kokkos == 'ON'
run: $GITHUB_WORKSPACE/src/stdblas/.github/workflows/utils/build_kokkos.sh

- name: Build and install Kokkos-Kernels
if: matrix.enable_kokkos == 'ON'
run: $GITHUB_WORKSPACE/src/stdblas/.github/workflows/utils/build_kokkos-kernels.sh

- name: Configure stdBLAS
run: |
cmake \
-S $GITHUB_WORKSPACE/src/stdblas \
-B $GITHUB_WORKSPACE/build/stdblas \
-DCMAKE_BUILD_TYPE:STRING=$${{ matrix.cmake_build_type }} \
-DCMAKE_INSTALL_PREFIX:FILEPATH=$GITHUB_WORKSPACE/install \
-DCMAKE_CXX_STANDARD:STRING=17 \
-DLINALG_ENABLE_TESTS:BOOL=ON \
-DLINALG_ENABLE_EXAMPLES:BOOL=On \
-DLINALG_ENABLE_CONCEPTS:BOOL=ON \
-DLINALG_ENABLE_KOKKOS:BOOL=$${{ matrix.enable_kokkos }} \
-DLINALG_ENABLE_KOKKOS_DEFAULT:BOOL=$${{ matrix.enable_kokkos }}
- name: Build stdBLAS
run: cmake --build $GITHUB_WORKSPACE/build/stdblas -j $(nproc)

- name: Test stdBLAS
working-directory: build/stdblas
run: ctest -j $(nproc) --output-on-failure
38 changes: 38 additions & 0 deletions .github/workflows/utils/build_kokkos-kernels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/bash

SRC_PATH=$GITHUB_WORKSPACE/src/kokkos-kernels
BUILD_PATH=$GITHUB_WORKSPACE/build/kokkos-kernels

ENABLE_KK_ETI=OFF

# Configure Kokkos-Kernels
cmake \
-S $SRC_PATH \
-B $BUILD_PATH \
-DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX:FILEPATH=$INSTALL_PATH
"-DCMAKE_CXX_FLAGS:STRING=-Werror -Wall -pedantic -Wshadow -Wsign-compare -Wtype-limits -Wignored-qualifiers -Wempty-body -Wuninitialized" \
-DKokkosKernels_ENABLE_TESTS:BOOL=OFF \
-DKokkosKernels_ENABLE_DOCS:BOOL=OFF \
-DKokkosKernels_ENABLE_TESTS_AND_PERFSUITE:BOOL=OFF \
-DKokkosKernels_ENABLE_EXPERIMENTAL:BOOL=ON \
-DKokkosKernels_INST_DOUBLE:BOOL=$ENABLE_KK_ETI \
-DKokkosKernels_INST_FLOAT:BOOL=OFF \
-DKokkosKernels_INST_COMPLEX_FLOAT:BOOL=OFF \
-DKokkosKernels_INST_COMPLEX_DOUBLE:BOOL=OFF \
-DKokkosKernels_INST_ORDINAL_INT:BOOL=$ENABLE_KK_ETI \
-DKokkosKernels_INST_ORDINAL_INT64_T:BOOL=OFF \
-DKokkosKernels_INST_OFFSET_INT:BOOL=$ENABLE_KK_ETI \
-DKokkosKernels_INST_OFFSET_SIZE_T:BOOL=OFF \
-DKokkosKernels_INST_LAYOUTLEFT:BOOL=$ENABLE_KK_ETI \
-DKokkosKernels_INST_LAYOUTRIGHT:BOOL=OFF
[[ $? -ne 0 ]] && exit 1


# Build Kokkos-Kernels
cmake --build $GITHUB_WORKSPACE/build/kokkos-kernels -j $(nproc)

[[ $? -ne 0 ]] && exit 1

# Install Kokkos-Kernels
cmake --install $GITHUB_WORKSPACE/build/kokkos-kernels
29 changes: 29 additions & 0 deletions .github/workflows/utils/build_kokkos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/bash

SRC_PATH=$GITHUB_WORKSPACE/src/kokkos
BUILD_PATH=$GITHUB_WORKSPACE/build/kokkos

# Configure Kokkos
cmake \
-S $SRC_PATH \
-B $BUILD_PATH \
-DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX:FILEPATH=$INSTALL_PATH
-DCMAKE_CXX_FLAGS:STRING=-Werror \
-DKokkos_CXX_STANDARD:STRING=17 \
-DKokkos_ENABLE_COMPLEX_ALIGN:BOOL=OFF \
-DKokkos_ENABLE_COMPILER_WARNINGS:BOOL=ON \
-DKokkos_ENABLE_DEPRECATED_CODE_3:BOOL=OFF \
-DKokkos_ENABLE_TESTS:BOOL=OFF \
-DKokkos_ENABLE_SERIAL:BOOL=OFF \
-DKokkos_ENABLE_OPENMP:BOOL=ON

[[ $? -ne 0 ]] && exit 2

# Build mdspan
cmake --build $BUILD_PATH -j $(nproc)

[[ $? -ne 0 ]] && exit 1

# Install mdspan
cmake --install $BUILD_PATH
21 changes: 21 additions & 0 deletions .github/workflows/utils/build_mdspan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/bash

SRC_PATH=$GITHUB_WORKSPACE/src/mdspan
BUILD_PATH=$GITHUB_WORKSPACE/build/mdspan

# Configure mdspan
cmake \
-S $SRC_PATH \
-B $BUILD_PATH \
-DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX:FILEPATH=$INSTALL_PATH

[[ $? -ne 0 ]] && exit 1

# Build mdspan
cmake --build $BUILD_PATH -j $(nproc)

[[ $? -ne 0 ]] && exit 1

# Install mdspan
cmake --install $BUILD_PATH

0 comments on commit 2cf1bad

Please sign in to comment.