Skip to content

Commit

Permalink
Merge pull request #306 from devreal/add-cuda-workflow
Browse files Browse the repository at this point in the history
Add workflow for building TTG with CUDA support
  • Loading branch information
evaleev authored Nov 15, 2024
2 parents fc6a493 + 6f12c3a commit b180cac
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
31 changes: 26 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@ jobs:
matrix:
build_type : [ Release, Debug ]
os : [ macos-latest, ubuntu-22.04 ]
device : [host, cuda]
include:
- os: ubuntu-22.04
cc: /usr/bin/gcc-12
cxx: /usr/bin/g++-12
- os: macos-latest
cc: clang
cxx: clang++
exclude:
- os: macos-latest
device: cuda

name: "${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.build_type }}"
name: "${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.device }} ${{ matrix.build_type }}"
runs-on: ${{ matrix.os }}
env:
CXX : ${{ matrix.cxx }}
Expand Down Expand Up @@ -58,6 +62,15 @@ jobs:
sudo apt-get -y install ninja-build g++-12 liblapack-dev libboost-dev libboost-serialization-dev libboost-random-dev libeigen3-dev openmpi-bin libopenmpi-dev libtbb-dev ccache flex bison cmake doxygen
echo "MPIEXEC=/usr/bin/mpiexec" >> $GITHUB_ENV
- name: Install extra dependencies
if: ${{ matrix.device == 'cuda'}}
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update
sudo apt install -y cuda-toolkit
echo "CUDA_BUILD_OPTS=-DENABLE_CUDA=ON -DTTG_ENABLE_CUDA=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-12.6 -DCMAKE_CUDA_COMPILER=/usr/local/cuda-12.6/bin/nvcc -DCMAKE_CUDA_HOST_COMPILER=${{ matrix.cxx }}" >> $GITHUB_ENV
- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
Expand Down Expand Up @@ -88,21 +101,29 @@ jobs:
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: |
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG || (cat CMakeFiles/CMakeConfigureLog.yaml)
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG $CUDA_BUILD_OPTS || (cat CMakeFiles/CMakeConfigureLog.yaml)
- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: ccache -p && ccache -z && cmake --build . && ccache -s

- name: Test
- name: Build [cuda]
if: ${{ matrix.device == 'cuda' }}
working-directory: ${{github.workspace}}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: ccache -p && ccache -z && cmake --build . --target bspmm-cuda-parsec testing_dpotrf_cuda-parsec chain-ttg-cuda-parsec && ccache -s

- name: Test [host]
if: ${{ matrix.device == 'host' }}
working-directory: ${{github.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# run: ctest -C $BUILD_TYPE
run: cmake --build . --target check-ttg
run: ccache -p && ccache -z && cmake --build . --target check-ttg && ccache -s

- name: Install
working-directory: ${{github.workspace}}/build
Expand Down Expand Up @@ -134,7 +155,7 @@ jobs:
cmake --build test_install_userexamples/build
- name: Build+Deploy Dox
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.build_type == 'Release' && github.ref == 'refs/heads/master' }}
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.build_type == 'Release' && matrix.device == 'host' && github.ref == 'refs/heads/master' }}
working-directory: ${{github.workspace}}/build
shell: bash
run: |
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ endif(TTG_ENABLE_COROUTINES)
#### CUDA: must come before PaRSEC
##########################
if (TTG_ENABLE_CUDA)
# default to CUDA arch 5.2
if (NOT CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES 52)
endif (NOT CMAKE_CUDA_ARCHITECTURES)
include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER)
Expand Down

0 comments on commit b180cac

Please sign in to comment.