From c468789762dc6ad73a2138664e6224e0b1cf5b06 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Thu, 14 Nov 2024 10:35:56 -0500 Subject: [PATCH 1/4] Add workflow for building TTG with CUDA support Signed-off-by: Joseph Schuchart --- .github/workflows/cmake.yml | 20 +++++++++++++++++--- CMakeLists.txt | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 155d5107a..89af5a447 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -11,6 +11,7 @@ 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 @@ -18,8 +19,11 @@ jobs: - 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 }} @@ -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-12.6/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 @@ -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/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 @@ -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. @@ -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: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 63b0d2bfa..03d4105eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) From 55c13f55494cc31ccfbf045ca47c303444cccaa1 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Thu, 14 Nov 2024 22:52:35 -0500 Subject: [PATCH 2/4] Update cmake.yml use gcc for CMAKE_CUDA_HOST_COMPILER --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 89af5a447..3b1debd64 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -69,7 +69,7 @@ jobs: 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-12.6/bin/nvcc" >> $GITHUB_ENV + echo "CUDA_BUILD_OPTS=-DENABLE_CUDA=ON -DTTG_ENABLE_CUDA=ON -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 From 74cbfc18fbe89f8f45b34cf805a37547b88b0035 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Thu, 14 Nov 2024 23:11:07 -0500 Subject: [PATCH 3/4] Update cmake.yml set CUDA_TOOLKIT_ROOT_DIR explicitly to help out Umpire/BLT --- .github/workflows/cmake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 3b1debd64..bc3e4c650 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -69,7 +69,7 @@ jobs: 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-12.6/bin/nvcc -DCMAKE_CUDA_HOST_COMPILER=${{ matrix.cxx }}" >> $GITHUB_ENV + 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 From 6f12c3abb9d8e3d458b5a3481ff2de1febcde5cc Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Fri, 15 Nov 2024 08:14:49 -0500 Subject: [PATCH 4/4] [ci] try building cuda examples --- .github/workflows/cmake.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index bc3e4c650..20d8960a9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -109,14 +109,21 @@ jobs: # Execute the build. You can specify a specific target with "--target " 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 " + 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