Files
nvbench/ci/windows/build_common.psm1
Allison Piper e8c8877d36 Squashed commit of the following:
commit 4b309e6ad8
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Sat Apr 6 13:19:14 2024 +0000

    Minor cleanups

commit 476ed2ceae
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Sat Apr 6 12:53:37 2024 +0000

    WAR compiler ice in nlohmann json.

    Only seeing this on GCC 9 + CTK 11.1. Seems to be
    having trouble with the `[[no_unique_address]]` optimization.

commit a9bf1d3e42
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Sat Apr 6 00:24:47 2024 +0000

    Bump nlohmann json.

commit 80980fe373
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Sat Apr 6 00:22:07 2024 +0000

    Fix llvm filesystem support

commit f6099e6311
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 23:18:44 2024 +0000

    Drop MSVC 2017 testing.

commit 5ae50a8ef5
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 23:02:32 2024 +0000

    Add mroe missing headers.

commit b2a9ae04d9
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 22:37:56 2024 +0000

    Remove old CUDA+MSVC builds and make windows build-only.

commit 5b18c26a28
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 22:37:07 2024 +0000

    Fix header for std::min/max.

    Why do I always think it's utility instead of algorithm....

commit 6a409efa2d
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 22:18:18 2024 +0000

    Temporarily disable CUPTI on all windows builds.

commit f432f88866
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 21:42:52 2024 +0000

    Fix warnings on MSVC.

commit 829787649b
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 21:03:16 2024 +0000

    More flailing about in powershell.

commit 21742e6bea
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 20:36:08 2024 +0000

    Cleanup filesystem header handling.

commit de3d202635
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 20:09:00 2024 +0000

    Windows CI debugging.

commit a4151667ff
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 19:45:40 2024 +0000

    Quotation mark madness

commit dd04f3befe
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 19:27:27 2024 +0000

    Temporarily disable NVML on windows CI until new containers are ready.

commit f3952848c4
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 19:25:22 2024 +0000

    WAR issues on gcc-7.

commit 198986875e
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 19:25:04 2024 +0000

    More matrix/devcontainer updates.

commit b9712f8696
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 18:30:35 2024 +0000

    Fix windows build scripts.

commit 943f268280
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 18:18:33 2024 +0000

    Fix warnings with clang host compiler.

commit 7063e1d60a
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 18:14:28 2024 +0000

    More devcontainer hijinks.

commit 06532fde81
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 17:51:25 2024 +0000

    More matrix updates.

commit 78a265ea55
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 17:34:00 2024 +0000

    Support CLI CMake options for windows ci scripts.

commit 670895c867
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 17:31:59 2024 +0000

    Add missing devcontainers.

commit b121823e74
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 17:22:54 2024 +0000

    Build for `all-major` architectures in presets.

    We can get away with this because we require CMake 3.23.1.
    This was added in 3.23.

commit fccfd44685
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 17:22:08 2024 +0000

    Update matrix file.

commit e7d43ba90e
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 16:23:48 2024 +0000

    Consolidate build/test jobs.

commit c4044056ec
Author: Allison Piper <alliepiper16@gmail.com>
Date:   Fri Apr 5 16:04:11 2024 +0000

    Add missing build script.
2024-04-06 13:56:10 +00:00

208 lines
6.5 KiB
PowerShell

Param(
[Parameter(Mandatory = $true)]
[Alias("std")]
[ValidateNotNullOrEmpty()]
[ValidateSet(17)]
[int]$CXX_STANDARD = 17
)
# 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
# Extract the CL version for export to build scripts:
$script:CL_VERSION_STRING = & cl.exe /?
if ($script:CL_VERSION_STRING -match "Version (\d+\.\d+)\.\d+") {
$CL_VERSION = [version]$matches[1]
Write-Host "Detected cl.exe version: $CL_VERSION"
}
if (-not $env:CCCL_BUILD_INFIX) {
$env:CCCL_BUILD_INFIX = ""
}
# Presets will be configured in this directory:
$BUILD_DIR = "../build/$env:CCCL_BUILD_INFIX"
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
# Prepare environment for CMake:
$env:CMAKE_BUILD_PARALLEL_LEVEL = $PARALLEL_LEVEL
$env:CTEST_PARALLEL_LEVEL = 1
$env:CUDAHOSTCXX = $HOST_COMPILER.FullName
$env:CXX = $HOST_COMPILER.FullName
Write-Host "========================================"
Write-Host "Begin build"
Write-Host "pwd=$pwd"
Write-Host "BUILD_DIR=$BUILD_DIR"
Write-Host "CXX_STANDARD=$CXX_STANDARD"
Write-Host "CXX=$env:CXX"
Write-Host "CUDACXX=$env:CUDACXX"
Write-Host "CUDAHOSTCXX=$env:CUDAHOSTCXX"
Write-Host "NVCC_VERSION=$NVCC_VERSION"
Write-Host "CMAKE_BUILD_PARALLEL_LEVEL=$env:CMAKE_BUILD_PARALLEL_LEVEL"
Write-Host "CTEST_PARALLEL_LEVEL=$env:CTEST_PARALLEL_LEVEL"
Write-Host "CCCL_BUILD_INFIX=$env:CCCL_BUILD_INFIX"
Write-Host "Current commit is:"
Write-Host "$(git log -1)"
Write-Host "========================================"
function configure_preset {
Param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$BUILD_NAME,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$PRESET,
[Parameter(Mandatory = $true)]
[AllowEmptyString()]
[string]$CMAKE_OPTIONS
)
$step = "$BUILD_NAME (configure)"
# CMake must be invoked in the same directory as the presets file:
pushd ".."
$cmake_command = "cmake --preset $PRESET $CMAKE_OPTIONS --log-level VERBOSE"
echo "$cmake_command"
Invoke-Expression $cmake_command
$test_result = $LastExitCode
If ($test_result -ne 0) {
throw "$step Failed"
}
popd
Write-Host "$step complete."
}
function build_preset {
Param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$BUILD_NAME,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$PRESET
)
$step = "$BUILD_NAME (build)"
# CMake must be invoked in the same directory as the presets file:
pushd ".."
sccache_stats('Start')
cmake --build --preset $PRESET -v
$test_result = $LastExitCode
sccache_stats('Stop')
echo "$step complete"
If ($test_result -ne 0) {
throw "$step Failed"
}
popd
}
function test_preset {
Param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$BUILD_NAME,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$PRESET
)
$step = "$BUILD_NAME (test)"
# CTest must be invoked in the same directory as the presets file:
pushd ".."
sccache_stats('Start')
ctest --preset $PRESET
$test_result = $LastExitCode
sccache_stats('Stop')
echo "$step complete"
If ($test_result -ne 0) {
throw "$step Failed"
}
popd
}
function configure_and_build_preset {
Param(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$BUILD_NAME,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string]$PRESET,
[Parameter(Mandatory = $true)]
[AllowEmptyString()]
[string]$CMAKE_OPTIONS
)
configure_preset "$BUILD_NAME" "$PRESET" "$CMAKE_OPTIONS"
build_preset "$BUILD_NAME" "$PRESET"
}
function sccache_stats {
Param (
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[ValidateSet('Start','Stop')]
[string]$MODE
)
$sccache_stats = sccache -s
If($MODE -eq 'Start') {
[int]$script:sccache_compile_requests = ($sccache_stats[0] -replace '[^\d]+')
[int]$script:sccache_cache_hits_cpp = ($sccache_stats[2] -replace '[^\d]+')
[int]$script:sccache_cache_hits_cuda = ($sccache_stats[3] -replace '[^\d]+')
[int]$script:sccache_cache_miss_cpp = ($sccache_stats[5] -replace '[^\d]+')
[int]$script:sccache_cache_miss_cuda = ($sccache_stats[6] -replace '[^\d]+')
} else {
[int]$final_sccache_compile_requests = ($sccache_stats[0] -replace '[^\d]+')
[int]$final_sccache_cache_hits_cpp = ($sccache_stats[2] -replace '[^\d]+')
[int]$final_sccache_cache_hits_cuda = ($sccache_stats[3] -replace '[^\d]+')
[int]$final_sccache_cache_miss_cpp = ($sccache_stats[5] -replace '[^\d]+')
[int]$final_sccache_cache_miss_cuda = ($sccache_stats[6] -replace '[^\d]+')
[int]$total_requests = $final_sccache_compile_requests - $script:sccache_compile_requests
[int]$total_hits_cpp = $final_sccache_cache_hits_cpp - $script:sccache_cache_hits_cpp
[int]$total_hits_cuda = $final_sccache_cache_hits_cuda - $script:sccache_cache_hits_cuda
[int]$total_miss_cpp = $final_sccache_cache_miss_cpp - $script:sccache_cache_miss_cpp
[int]$total_miss_cuda = $final_sccache_cache_miss_cuda - $script:sccache_cache_miss_cuda
If ( $total_requests -gt 0 ) {
[int]$hit_rate_cpp = $total_hits_cpp / $total_requests * 100;
[int]$hit_rate_cuda = $total_hits_cuda / $total_requests * 100;
echo "sccache hits cpp: $total_hits_cpp `t| misses: $total_miss_cpp `t| hit rate: $hit_rate_cpp%"
echo "sccache hits cuda: $total_hits_cuda `t| misses: $total_miss_cuda `t| hit rate: $hit_rate_cuda%"
} else {
echo "sccache stats: N/A No new compilation requests"
}
}
}
Export-ModuleMember -Function configure_preset, build_preset, test_preset, configure_and_build_preset, sccache_stats
Export-ModuleMember -Variable BUILD_DIR, CL_VERSION