Skip to content

Commit

Permalink
Merge pull request #559 from mmuetzel/ci
Browse files Browse the repository at this point in the history
CI: Add runner using MSVC with CUDA
  • Loading branch information
DrTimothyAldenDavis authored Dec 1, 2023
2 parents 833495e + 9e81579 commit c051663
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 38 deletions.
33 changes: 29 additions & 4 deletions .github/workflows/root-cmakelists.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ jobs:
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: windows-latest

name: msvc (${{ matrix.openmp }} OpenMP)
name: msvc (${{ matrix.openmp }} OpenMP ${{ matrix.cuda }} CUDA)

defaults:
run:
Expand All @@ -225,9 +225,15 @@ jobs:

matrix:
openmp: [with, without]
cuda: [without]
include:
- openmp: without
openmp-cmake-flags: "-DNOPENMP=ON"
- openmp: with
cuda: with
cuda-cmake-flags:
-DENABLE_CUDA=ON
-DCMAKE_CUDA_COMPILER_LAUNCHER="ccache"

env:
CHERE_INVOKING: 1
Expand Down Expand Up @@ -283,6 +289,18 @@ jobs:
msystem: UCRT64

- uses: Jimver/[email protected]
name: install CUDA toolkit
if: matrix.cuda == 'with'
id: cuda-toolkit
with:
cuda: '12.2.0'
#See https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#install-the-cuda-software
method: 'local'
# Do not cache the installer (~3 GiB). It doesn't speed up the
# installation significantly. And we need the space for ccache.
use-github-cache: 'false'

- name: setup build environment
# get packages from MSYS2
# Copy only relevant parts to avoid picking up headers and libraries
Expand Down Expand Up @@ -311,7 +329,7 @@ jobs:
shell: msys2 {0}
run: |
echo "ccachedir=$(cygpath -m $(${CCACHE} -k cache_dir))" >> $GITHUB_OUTPUT
echo "key=ccache:msvc:root:${{ matrix.openmp }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
echo "key=ccache:msvc:root:${{ matrix.openmp }}:${{ matrix.cuda }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
- name: restore ccache
# Setup the GitHub cache used to maintain the ccache from one job to the next
Expand All @@ -321,8 +339,8 @@ jobs:
key: ${{ steps.ccache-prepare.outputs.key }}
# Prefer caches from the same branch. Fall back to caches from the dev branch.
restore-keys: |
ccache:msvc:root:${{ matrix.openmp }}:${{ github.ref }}
ccache:msvc:root:${{ matrix.openmp }}:
ccache:msvc:root:${{ matrix.openmp }}:${{ matrix.cuda }}:${{ github.ref }}
ccache:msvc:root:${{ matrix.openmp }}:${{ matrix.cuda }}:
- name: configure ccache
# Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota.
Expand All @@ -338,6 +356,11 @@ jobs:

- name: configure
run: |
declare -a _extra_config
if [ ${{ matrix.cuda }} = 'with' ]; then
_extra_config+=(-DCUDAToolkit_ROOT="$(cygpath -m "${{ steps.cuda-toolkit.outputs.CUDA_PATH }}")")
_extra_config+=(-DCMAKE_CUDA_COMPILER="$(cygpath -m "${{ steps.cuda-toolkit.outputs.CUDA_PATH }}")/bin/nvcc.exe")
fi
mkdir -p ${GITHUB_WORKSPACE}/build && cd ${GITHUB_WORKSPACE}/build
cmake -G"Ninja Multi-Config" \
-DCMAKE_BUILD_TYPE="Release" \
Expand All @@ -350,6 +373,8 @@ jobs:
-DBLA_VENDOR="All" \
-DPython_EXECUTABLE="C:/msys64/ucrt64/bin/python.exe" \
${{ matrix.openmp-cmake-flags }} \
${{ matrix.cuda-cmake-flags }} \
"${_extra_config[@]}" \
..
- name: build libraries
Expand Down
2 changes: 1 addition & 1 deletion CHOLMOD/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ add_test ( NAME CHOLMOD_int64_single_supernodal
if ( WIN32 AND BUILD_SHARED_LIBS )
# Set PATH to pick up the necessary libraries for all tests

set ( CHOLMOD_CTEST_NAMES
set ( CHOLMOD_CTEST_NAMES
CHOLMOD_int32_double_bcsstk01 CHOLMOD_int64_double_bcsstk01 CHOLMOD_int32_single_bcsstk01 CHOLMOD_int64_single_bcsstk01
CHOLMOD_int32_double_lp_afiro CHOLMOD_int64_double_lp_afiro CHOLMOD_int32_single_lp_afiro CHOLMOD_int64_single_lp_afiro
CHOLMOD_int32_double_can24 CHOLMOD_int64_double_can24 CHOLMOD_int32_single_can24 CHOLMOD_int64_single_can24
Expand Down
7 changes: 6 additions & 1 deletion GraphBLAS/CUDA/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ set_target_properties(GraphBLAS_CUDA PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
# FIXME: use SUITESPARSE_CUDA_ARCHITECTURES
set_target_properties(GraphBLAS_CUDA PROPERTIES CUDA_ARCHITECTURES "52;75;80" )

target_link_libraries(GraphBLAS_CUDA CUDA::nvrtc CUDA::cudart_static CUDA::cuda_driver CUDA::nvToolsExt )
target_link_libraries ( GraphBLAS_CUDA CUDA::nvrtc CUDA::cudart_static CUDA::cuda_driver )

if ( TARGET CUDA::nvtx3 )
target_link_libraries ( GraphBLAS_CUDA CUDA::nvtx3 )
target_compile_definitions ( GraphBLAS_CUDA PRIVATE GBNVTX )
endif ( )

target_compile_definitions ( GraphBLAS_CUDA PUBLIC "SUITESPARSE_CUDA" )

Expand Down
10 changes: 5 additions & 5 deletions GraphBLAS/cmake_modules/SuiteSparsePolicy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -254,30 +254,30 @@ if ( ENABLE_CUDA )
# with CUDA:
message ( STATUS "Find CUDA tool kit:" )
# FindCUDAToolKit needs to have C or CXX enabled first (see above)
include ( FindCUDAToolkit )
find_package ( CUDAToolkit )
message ( STATUS "CUDA toolkit found: " ${CUDAToolkit_FOUND} )
message ( STATUS "CUDA toolkit version: " ${CUDAToolkit_VERSION} )
message ( STATUS "CUDA toolkit include: " ${CUDAToolkit_INCLUDE_DIRS} )
message ( STATUS "CUDA toolkit lib dir: " ${CUDAToolkit_LIBRARY_DIR} )
if ( CUDAToolkit_VERSION VERSION_LESS "11.2" )
# CUDA is present but too old
message ( STATUS "CUDA: not enabled (CUDA 11.2 or later required)" )
set ( SUITESPARSE_CUDA off )
set ( SUITESPARSE_CUDA OFF )
else ( )
# CUDA 11.2 or later present
enable_language ( CUDA )
set ( SUITESPARSE_CUDA on )
set ( SUITESPARSE_CUDA ON )
endif ( )
else ( )
# without CUDA:
message ( STATUS "CUDA: not found" )
set ( SUITESPARSE_CUDA off )
set ( SUITESPARSE_CUDA OFF )
endif ( )

else ( )

# CUDA is disabled
set ( SUITESPARSE_CUDA off )
set ( SUITESPARSE_CUDA OFF )

endif ( )

Expand Down
4 changes: 2 additions & 2 deletions SPQR/Demo/qrdemo_gpu2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main (int argc, char **argv)
m = A->nrow ;
n = A->ncol ;

long ordering = (argc < 3 ? SPQR_ORDERING_DEFAULT : atoi(argv[2]));
int ordering = (argc < 3 ? SPQR_ORDERING_DEFAULT : atoi(argv[2]));

printf ("Matrix %6ld-by-%-6ld nnz: %6ld\n",
m, n, cholmod_l_nnz (A, cc)) ;
Expand All @@ -70,7 +70,7 @@ int main (int argc, char **argv)
B = cholmod_l_ones (m, 1, A->xtype, cc) ;

double tol = SPQR_NO_TOL ;
long econ = 0 ;
int64_t econ = 0 ;

// [Q,R,E] = qr (A), but discard Q
// SuiteSparseQR <double> (ordering, tol, econ, A, &R, &E, cc) ;
Expand Down
4 changes: 2 additions & 2 deletions SPQR/Demo/qrdemo_gpu3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int main (int argc, char **argv)
m = A->nrow ;
n = A->ncol ;

long ordering = (argc < 3 ? SPQR_ORDERING_DEFAULT : atoi(argv[2]));
int ordering = (argc < 3 ? SPQR_ORDERING_DEFAULT : atoi(argv[2]));

printf ("Matrix %6ld-by-%-6ld nnz: %6ld\n",
m, n, cholmod_l_nnz (A, cc)) ;
Expand All @@ -72,7 +72,7 @@ int main (int argc, char **argv)
B = cholmod_l_ones (m, 1, A->xtype, cc) ;

double tol = SPQR_NO_TOL ;
long econ = 0 ;
int64_t econ = 0 ;

// [Q,R,E] = qr (A), but discard Q
// SuiteSparseQR <double> (ordering, tol, econ, A, &R, &E, cc) ;
Expand Down
21 changes: 14 additions & 7 deletions SPQR/GPUQREngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ message ( STATUS "Building SPQR/GPUQRENGINE version: v"
# define the project
#-------------------------------------------------------------------------------

project ( gpuqrengine
project ( gpuqrengine
VERSION "${SPQR_VERSION_MAJOR}.${SPQR_VERSION_MINOR}.${SPQR_VERSION_SUB}"
LANGUAGES CXX CUDA )

Expand Down Expand Up @@ -90,9 +90,10 @@ if ( BUILD_SHARED_LIBS )
WINDOWS_EXPORT_ALL_SYMBOLS ON )

target_include_directories ( GPUQREngine PRIVATE
${GPUQRENGINE_INCLUDES}
"$<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES>"
"$<TARGET_PROPERTY:GPURuntime,INTERFACE_INCLUDE_DIRECTORIES>" )
${GPUQRENGINE_INCLUDES} )

target_link_libraries ( GPUQREngine PRIVATE
GPURuntime SuiteSparse::SuiteSparseConfig )

set_target_properties ( GPUQREngine PROPERTIES
POSITION_INDEPENDENT_CODE ON
Expand Down Expand Up @@ -128,9 +129,15 @@ if ( BUILD_STATIC_LIBS )

target_include_directories ( GPUQREngine_static PRIVATE
${CUDAToolkit_INCLUDE_DIRS}
${GPUQRENGINE_INCLUDES}
$<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:GPURuntime_static,INTERFACE_INCLUDE_DIRECTORIES> )
${GPUQRENGINE_INCLUDES} )

target_link_libraries ( GPUQREngine_static PUBLIC GPURuntime_static )

if ( TARGET SuiteSparse::SuiteSparseConfig_static )
target_link_libraries ( GPUQREngine_static PUBLIC SuiteSparse::SuiteSparseConfig_static )
else ( )
target_link_libraries ( GPUQREngine_static PUBLIC SuiteSparse::SuiteSparseConfig )
endif ( )

set_target_properties ( GPUQREngine_static PROPERTIES
POSITION_INDEPENDENT_CODE ON
Expand Down
4 changes: 3 additions & 1 deletion SPQR/GPUQREngine/Include/GPUQREngine_BucketList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#ifndef GPUQRENGINE_BUCKETLIST_HPP
#define GPUQRENGINE_BUCKETLIST_HPP

#include <cstddef>

#include "GPUQREngine_Common.hpp"
#include "GPUQREngine_TaskDescriptor.hpp"
#include "GPUQREngine_LLBundle.hpp"
Expand Down Expand Up @@ -72,7 +74,7 @@ template <typename Int = int64_t> class BucketList
int VThead; // Index of the first available entry in VTlist

// Constructors
void *operator new(size_t, BucketList <Int>* p)
void *operator new(std::size_t, BucketList <Int>* p)
{
return p;
}
Expand Down
4 changes: 3 additions & 1 deletion SPQR/GPUQREngine/Include/GPUQREngine_Front.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#ifndef GPUQRENGINE_FRONT_HPP
#define GPUQRENGINE_FRONT_HPP

#include <cstddef>

#include "GPUQREngine_Common.hpp"
#include "GPUQREngine_SparseMeta.hpp"
#include "GPUQREngine_FrontState.hpp"
Expand Down Expand Up @@ -53,7 +55,7 @@ template <typename Int = int64_t> class Front
/* Debug Fields */
bool printMe;

void* operator new(size_t reqMem, Front* ptr){ return ptr; }
void* operator new(std::size_t reqMem, Front* ptr){ return ptr; }

Front(
Int fids_arg, // the front identifier
Expand Down
4 changes: 3 additions & 1 deletion SPQR/GPUQREngine/Include/GPUQREngine_LLBundle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#ifndef GPUQRENGINE_LLBUNDLE_HPP
#define GPUQRENGINE_LLBUNDLE_HPP

#include <cstddef>

#include "GPUQREngine_Common.hpp"
#include "GPUQREngine_TaskDescriptor.hpp"

Expand Down Expand Up @@ -76,7 +78,7 @@ template <typename Int = int64_t> class LLBundle

TaskType CurrentTask;

void *operator new(size_t, LLBundle <Int>* p){ return p; }
void *operator new(std::size_t, LLBundle <Int>* p){ return p; }
//------------------------------------------------------------------------------
//
// This file contains the constructor and destructor for the LLBundle class.
Expand Down
4 changes: 3 additions & 1 deletion SPQR/GPUQREngine/Include/GPUQREngine_Scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#ifndef GPUQRENGINE_SCHEDULER_HPP
#define GPUQRENGINE_SCHEDULER_HPP

#include <cstddef>

#include "GPUQREngine_Common.hpp"
#include "GPUQREngine_FrontState.hpp"
#include "GPUQREngine_TaskDescriptor.hpp"
Expand Down Expand Up @@ -97,7 +99,7 @@ class Scheduler
cudaStream_t memoryStreamD2H;

/* Scheduler.cpp */
void *operator new(size_t, Scheduler <Int>* p){ return p; }
void *operator new(std::size_t, Scheduler <Int>* p){ return p; }
Scheduler(Front <Int> *fronts, Int numFronts, size_t gpuMemorySize);
~Scheduler();

Expand Down
20 changes: 13 additions & 7 deletions SPQR/GPURuntime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ message ( STATUS "Building SPQR/GPURUNTIME version: v"
# define the project
#-------------------------------------------------------------------------------

project ( suitesparse_gpuruntime
project ( suitesparse_gpuruntime
VERSION "${SPQR_VERSION_MAJOR}.${SPQR_VERSION_MINOR}.${SPQR_VERSION_SUB}"
LANGUAGES C CXX CUDA )

Expand Down Expand Up @@ -70,8 +70,9 @@ if ( BUILD_SHARED_LIBS )

target_include_directories ( GPURuntime PRIVATE
${CUDAToolkit_INCLUDE_DIRS}
${SUITESPARSE_GPURUNTIME_INCLUDES}
$<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES> )
${SUITESPARSE_GPURUNTIME_INCLUDES} )

target_link_libraries ( GPURuntime PRIVATE SuiteSparse::SuiteSparseConfig )

set_target_properties ( GPURuntime PROPERTIES
POSITION_INDEPENDENT_CODE ON
Expand All @@ -81,7 +82,7 @@ if ( BUILD_SHARED_LIBS )
CUDA::nvrtc CUDA::cudart_static CUDA::cublas )
target_compile_definitions ( GPURuntime PRIVATE "SUITESPARSE_CUDA" )

target_include_directories ( GPURuntime
target_include_directories ( GPURuntime
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Include>
$<INSTALL_INTERFACE:${SUITESPARSE_INCLUDEDIR}> )
endif ( )
Expand All @@ -106,8 +107,13 @@ if ( BUILD_STATIC_LIBS )

target_include_directories ( GPURuntime_static PRIVATE
${CUDAToolkit_INCLUDE_DIRS}
${SUITESPARSE_GPURUNTIME_INCLUDES}
$<TARGET_PROPERTY:SuiteSparse::SuiteSparseConfig,INTERFACE_INCLUDE_DIRECTORIES> )
${SUITESPARSE_GPURUNTIME_INCLUDES} )

if ( TARGET SuiteSparse::SuiteSparseConfig_static )
target_link_libraries ( GPURuntime_static PUBLIC SuiteSparse::SuiteSparseConfig_static )
else ( )
target_link_libraries ( GPURuntime_static PUBLIC SuiteSparse::SuiteSparseConfig )
endif ( )

set_target_properties ( GPURuntime_static PROPERTIES
POSITION_INDEPENDENT_CODE ON
Expand All @@ -117,7 +123,7 @@ if ( BUILD_STATIC_LIBS )
CUDA::nvrtc CUDA::cudart_static CUDA::cublas )
target_compile_definitions ( GPURuntime_static PRIVATE "SUITESPARSE_CUDA" )

target_include_directories ( GPURuntime_static
target_include_directories ( GPURuntime_static
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Include>
$<INSTALL_INTERFACE:${SUITESPARSE_INCLUDEDIR}> )
endif ( )
Expand Down
10 changes: 5 additions & 5 deletions SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -255,30 +255,30 @@ if ( ENABLE_CUDA )
# with CUDA:
message ( STATUS "Find CUDA tool kit:" )
# FindCUDAToolKit needs to have C or CXX enabled first (see above)
include ( FindCUDAToolkit )
find_package ( CUDAToolkit )
message ( STATUS "CUDA toolkit found: " ${CUDAToolkit_FOUND} )
message ( STATUS "CUDA toolkit version: " ${CUDAToolkit_VERSION} )
message ( STATUS "CUDA toolkit include: " ${CUDAToolkit_INCLUDE_DIRS} )
message ( STATUS "CUDA toolkit lib dir: " ${CUDAToolkit_LIBRARY_DIR} )
if ( CUDAToolkit_VERSION VERSION_LESS "11.2" )
# CUDA is present but too old
message ( STATUS "CUDA: not enabled (CUDA 11.2 or later required)" )
set ( SUITESPARSE_CUDA off )
set ( SUITESPARSE_CUDA OFF )
else ( )
# CUDA 11.2 or later present
enable_language ( CUDA )
set ( SUITESPARSE_CUDA on )
set ( SUITESPARSE_CUDA ON )
endif ( )
else ( )
# without CUDA:
message ( STATUS "CUDA: not found" )
set ( SUITESPARSE_CUDA off )
set ( SUITESPARSE_CUDA OFF )
endif ( )

else ( )

# CUDA is disabled
set ( SUITESPARSE_CUDA off )
set ( SUITESPARSE_CUDA OFF )

endif ( )

Expand Down

0 comments on commit c051663

Please sign in to comment.