Skip to content

Commit

Permalink
Add workflow for building TTG with CUDA support
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Schuchart <[email protected]>
  • Loading branch information
devreal committed Nov 14, 2024
1 parent 3636049 commit c771133
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
20 changes: 17 additions & 3 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 -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc" >> $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,7 +101,7 @@ 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/CMakeOutput.log && cat CMakeFiles/CMakeError.log)
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $BUILD_CONFIG $CUDA_BUILD_OPTS || (cat CMakeFiles/CMakeOutput.log && cat CMakeFiles/CMakeError.log)
- name: Build
working-directory: ${{github.workspace}}/build
Expand All @@ -97,6 +110,7 @@ jobs:
run: ccache -p && ccache -z && cmake --build . && ccache -s

- name: Test
if: ${{ matrix.device == 'host' }}
working-directory: ${{github.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
Expand Down Expand Up @@ -134,7 +148,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 native
if (NOT CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES native)
endif (CMAKE_CUDA_ARCHITECTURES)
include(CheckLanguage)
check_language(CUDA)
if(CMAKE_CUDA_COMPILER)
Expand Down

0 comments on commit c771133

Please sign in to comment.