Skip to content

Commit

Permalink
[skip-tests] Add ci scripts for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Jul 21, 2023
1 parent 25b7a06 commit cbbd1ab
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 0 deletions.
67 changes: 67 additions & 0 deletions ci/windows/build_common.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

param ($CXX_STANDARD,
$GPU_ARCHS)

# We need the full path to cl because otherwise cmake will replace CMAKE_CXX_COMPILER with the full path
# and keep CMAKE_CUDA_HOST_COMPILER at "cl" which breaks our cmake script
$script:HOST_COMPILER = (Get-Command "cl").source -replace '\\','/'
$script:PARALLEL_LEVEL = (Get-WmiObject -class Win32_processor).NumberOfLogicalProcessors

If($null -eq $DEVCONTAINER_NAME) {
$script:BUILD_DIR="../build/local"
} else {
$script:BUILD_DIR="../build/$DEVCONTAINER_NAME"
}

If(!(test-path -PathType container "../build")) {
New-Item -ItemType Directory -Path "../build"
}

# The most recent build will always be symlinked to cccl/build/latest
New-Item -ItemType Directory -Path "$BUILD_DIR" -Force

$script:COMMON_CMAKE_OPTIONS= @(
"-S .."
"-B $BUILD_DIR"
"-G Ninja"
"-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_CXX_STANDARD=$CXX_STANDARD"
"-DCMAKE_CUDA_STANDARD=$CXX_STANDARD"
"-DCMAKE_CXX_COMPILER=$HOST_COMPILER"
"-DCMAKE_CUDA_HOST_COMPILER=$HOST_COMPILER"
"-DCMAKE_CUDA_ARCHITECTURES=$GPU_ARCHS"
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
)

Write-Host "========================================"
Write-Host "Begin build"
Write-Host "pwd=$pwd"
Write-Host "HOST_COMPILER=$HOST_COMPILER"
Write-Host "CXX_STANDARD=$CXX_STANDARD"
Write-Host "GPU_ARCHS=$GPU_ARCHS"
Write-Host "PARALLEL_LEVEL=$PARALLEL_LEVEL"
Write-Host "BUILD_DIR=$BUILD_DIR"
Write-Host "========================================"

function configure {
param ($CMAKE_OPTIONS)
$FULL_CMAKE_OPTIONS = $COMMON_CMAKE_OPTIONS + $CMAKE_OPTIONS
Start-Process cmake -Wait -NoNewWindow -ArgumentList $FULL_CMAKE_OPTIONS
}

function build {
param ($BUILD_NAME)
## source "./sccache_stats.sh" start
Start-Process cmake -Wait -NoNewWindow -ArgumentList "--build $BUILD_DIR --parallel $PARALLEL_LEVEL"
echo "${BUILD_NAME} build complete"
## source "./sccache_stats.sh" end
}

function configure_and_build {
param ($BUILD_NAME, $CMAKE_OPTIONS)
configure -CMAKE_OPTIONS $CMAKE_OPTIONS
build -BUILD_NAME $BUILD_NAME
}

Export-ModuleMember -Function configure, build, configure_and_build
Export-ModuleMember -Variable BUILD_DIR
36 changes: 36 additions & 0 deletions ci/windows/build_cub.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

param ($CXX_STANDARD = 17,
$GPU_ARCHS = "70")

$CURRENT_PATH = Split-Path $pwd -leaf
If($CURRENT_PATH -ne "ci") {
Write-Host "Moving to ci folder"
pushd "$PSScriptRoot/.."
}

Remove-Module -Name build_common
Import-Module $PSScriptRoot/build_common.psm1 -ArgumentList $CXX_STANDARD, $GPU_ARCHS

$ENABLE_DIALECT_CPP11 = If ($CXX_STANDARD -ne 11) {"OFF"} Else {"ON"}
$ENABLE_DIALECT_CPP14 = If ($CXX_STANDARD -ne 14) {"OFF"} Else {"ON"}
$ENABLE_DIALECT_CPP17 = If ($CXX_STANDARD -ne 17) {"OFF"} Else {"ON"}
$ENABLE_DIALECT_CPP20 = If ($CXX_STANDARD -ne 20) {"OFF"} Else {"ON"}

$CMAKE_OPTIONS = @(
"-DCCCL_ENABLE_THRUST=OFF"
"-DCCCL_ENABLE_LIBCUDACXX=OFF"
"-DCCCL_ENABLE_CUB=ON"
"-DCCCL_ENABLE_TESTING=OFF"
"-DCUB_ENABLE_DIALECT_CPP11=$ENABLE_DIALECT_CPP11"
"-DCUB_ENABLE_DIALECT_CPP14=$ENABLE_DIALECT_CPP14"
"-DCUB_ENABLE_DIALECT_CPP17=$ENABLE_DIALECT_CPP17"
"-DCUB_ENABLE_DIALECT_CPP20=$ENABLE_DIALECT_CPP20"
"-DTHRUST_IGNORE_DEPRECATED_CPP_DIALECT=ON"
"-DCUB_IGNORE_DEPRECATED_CPP_DIALECT=ON"
)

configure_and_build "CUB" $CMAKE_OPTIONS

If($CURRENT_PATH -ne "ci") {
popd
}
39 changes: 39 additions & 0 deletions ci/windows/build_libcudacxx.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

param ($CXX_STANDARD = 17,
$GPU_ARCHS = "70")

$CURRENT_PATH = Split-Path $pwd -leaf
If($CURRENT_PATH -ne "ci") {
Write-Host "Moving to ci folder"
pushd "$PSScriptRoot/.."
}

Remove-Module -Name build_common
Import-Module $PSScriptRoot/build_common.psm1 -ArgumentList $CXX_STANDARD, $GPU_ARCHS

$CMAKE_OPTIONS = @(
"-DCCCL_ENABLE_THRUST=OFF"
"-DCCCL_ENABLE_LIBCUDACXX=ON"
"-DCCCL_ENABLE_CUB=OFF"
"-DCCCL_ENABLE_TESTING=OFF"
"-DLIBCUDACXX_ENABLE_LIBCUDACXX_TESTS=ON"
)

$LIT_OPTIONS = @(
"-v"
"--no-progress-bar"
"-Dexecutor=""NoopExecutor()"""
"-Dcompute_archs=$GPU_ARCHS"
"-Dstd=c++$CXX_STANDARD"
"$BUILD_DIR/libcudacxx/test"
)

configure $CMAKE_OPTIONS

#source "./sccache_stats.sh" "start"
Start-Process lit -Wait -NoNewWindow -ArgumentList $LIT_OPTIONS
#source "./sccache_stats.sh" "stop"

If($CURRENT_PATH -ne "ci") {
popd
}
37 changes: 37 additions & 0 deletions ci/windows/build_thrust.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

param ($CXX_STANDARD = 17,
$GPU_ARCHS = "70")

$CURRENT_PATH = Split-Path $pwd -leaf
If($CURRENT_PATH -ne "ci") {
Write-Host "Moving to ci folder"
pushd "$PSScriptRoot/.."
}

Remove-Module -Name build_common
Import-Module $PSScriptRoot/build_common.psm1 -ArgumentList $CXX_STANDARD, $GPU_ARCHS

$ENABLE_DIALECT_CPP11 = If ($CXX_STANDARD -ne 11) {"OFF"} Else {"ON"}
$ENABLE_DIALECT_CPP14 = If ($CXX_STANDARD -ne 14) {"OFF"} Else {"ON"}
$ENABLE_DIALECT_CPP17 = If ($CXX_STANDARD -ne 17) {"OFF"} Else {"ON"}
$ENABLE_DIALECT_CPP20 = If ($CXX_STANDARD -ne 20) {"OFF"} Else {"ON"}

$CMAKE_OPTIONS = @(
"-DCCCL_ENABLE_THRUST=ON"
"-DCCCL_ENABLE_LIBCUDACXX=OFF"
"-DCCCL_ENABLE_CUB=OFF"
"-DCCCL_ENABLE_TESTING=OFF"
"-DTHRUST_ENABLE_MULTICONFIG=ON"
"-DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP11=$ENABLE_DIALECT_CPP11"
"-DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP14=$ENABLE_DIALECT_CPP14"
"-DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP17=$ENABLE_DIALECT_CPP17"
"-DTHRUST_MULTICONFIG_ENABLE_DIALECT_CPP20=$ENABLE_DIALECT_CPP20"
"-DTHRUST_IGNORE_DEPRECATED_CPP_DIALECT=ON"
"-DCUB_IGNORE_DEPRECATED_CPP_DIALECT=ON"
)

configure_and_build "Thrust" $CMAKE_OPTIONS

If($CURRENT_PATH -ne "ci") {
popd
}

0 comments on commit cbbd1ab

Please sign in to comment.