-
Notifications
You must be signed in to change notification settings - Fork 106
Add Windows support #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mfranzrebsal
wants to merge
21
commits into
NVIDIA:main
Choose a base branch
from
mfranzrebsal:windows-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add Windows support #354
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
23b445a
Add Windows support
mfranzrebsal 787e435
Windows support: revert CI specific changes
mfranzrebsal 78b674b
Re- Enable NVBench Windows build job
oleksandr-pavlyk 460e14f
Install CUDA Profiler API into toolkit
oleksandr-pavlyk c6cd097
Add intall_cuda_profiler_api.ps1
oleksandr-pavlyk f8c0554
Inform MSVC that static library export main
oleksandr-pavlyk f402b57
Review feedback to PowerShell script
oleksandr-pavlyk 71eacdc
Fix how CMAKE_CUDA_HOST_COMPILER is set in call to cmake
oleksandr-pavlyk cc209bb
Filter out empty directories LD_LIBRARY_PATH/PATH
oleksandr-pavlyk d980c2a
Check that cudaVersion and :CUDA_PATH are consistent
oleksandr-pavlyk 6c44ec6
Do not overwrite ENVIRONMENT property with empty values
oleksandr-pavlyk 7f2a6dc
Implement retry logic in downloading of CUDA Profiler API
oleksandr-pavlyk 287d041
Strengthen publisher verification of downloaded artifact
oleksandr-pavlyk 9f8bf81
Prepend new folders to LD_LIBRARY_PATH, do not overwrite
oleksandr-pavlyk adabe4a
Implement timeout, fail on 40x HTTP response code
oleksandr-pavlyk a5b3e97
USE ENVIRONMENT_MODIFICATION property, not ENVIRONMENT
oleksandr-pavlyk c6347b5
escape environment modification values
oleksandr-pavlyk 919468f
Fix cmake script error breaking the build
oleksandr-pavlyk 177c7b0
Added recommented timeout to Invoke-WebRequest
oleksandr-pavlyk f83429a
Set cmake_minimum_required version to 3.30.4, consistent with main pr…
oleksandr-pavlyk ccfa1b5
Pass NVBENCH environment variables through docker for Windows build
oleksandr-pavlyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,181 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| Param( | ||
| [Parameter(Mandatory = $false)] | ||
| [Alias("cudaVersion")] | ||
| [string]$CUDA_VERSION = "" | ||
| ) | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| function Get-CudaVersionFromPath { | ||
| Param( | ||
| [Parameter(Mandatory = $false)] | ||
| [string]$Path = "" | ||
| ) | ||
|
|
||
| if ($Path -and $Path -match "v(?<version>\d+\.\d+)[\\/]?$") { | ||
| return $Matches.version | ||
| } | ||
|
|
||
| return "" | ||
| } | ||
|
|
||
| function Assert-NvidiaAuthenticodeSignature { | ||
| Param( | ||
| [Parameter(Mandatory = $true)] | ||
| [ValidateNotNullOrEmpty()] | ||
| [string]$Path | ||
| ) | ||
|
|
||
| $signature = Get-AuthenticodeSignature -FilePath $Path | ||
| if ($signature.Status -ne "Valid") { | ||
| throw "Invalid Authenticode signature for '$Path': $($signature.Status) $($signature.StatusMessage)" | ||
| } | ||
|
|
||
| $expectedPublisher = "NVIDIA Corporation" | ||
| $publisher = $signature.SignerCertificate.GetNameInfo( | ||
| [System.Security.Cryptography.X509Certificates.X509NameType]::SimpleName, | ||
| $false | ||
| ) | ||
| if ($publisher -ne $expectedPublisher) { | ||
| throw "Unexpected signer for '$Path': $publisher" | ||
| } | ||
|
|
||
| Write-Host "Validated Authenticode signature for '$Path': $publisher" | ||
| } | ||
|
|
||
| function Get-HttpStatusCodeFromError { | ||
| Param( | ||
| [Parameter(Mandatory = $true)] | ||
| $ErrorRecord | ||
| ) | ||
|
|
||
| $responseProperty = $ErrorRecord.Exception.PSObject.Properties["Response"] | ||
| if (-not $responseProperty) { | ||
| return $null | ||
| } | ||
|
|
||
| $response = $responseProperty.Value | ||
| if ($null -eq $response) { | ||
| return $null | ||
| } | ||
|
|
||
| $statusCodeProperty = $response.PSObject.Properties["StatusCode"] | ||
| if (-not $statusCodeProperty) { | ||
| return $null | ||
| } | ||
|
|
||
| return [int]$statusCodeProperty.Value | ||
| } | ||
|
|
||
| function Invoke-WebRequestWithRetry { | ||
| Param( | ||
| [Parameter(Mandatory = $true)] | ||
| [ValidateNotNullOrEmpty()] | ||
| [string]$Uri, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [ValidateNotNullOrEmpty()] | ||
| [string]$OutFile, | ||
|
|
||
| [Parameter(Mandatory = $false)] | ||
| [ValidateRange(1, 10)] | ||
| [int]$MaxAttempts = 3 | ||
| ) | ||
|
|
||
| for ($attempt = 1; $attempt -le $MaxAttempts; $attempt++) { | ||
| try { | ||
| Remove-Item $OutFile -ErrorAction SilentlyContinue | ||
| Invoke-WebRequest -Uri $Uri -OutFile $OutFile -UseBasicParsing -TimeoutSec 300 | ||
| return | ||
| } catch { | ||
| $statusCode = Get-HttpStatusCodeFromError -ErrorRecord $_ | ||
| if ($statusCode -ge 400 -and $statusCode -lt 500) { | ||
| throw "Download failed with non-retryable HTTP status $statusCode from '$Uri'. $_" | ||
| } | ||
|
|
||
| if ($attempt -eq $MaxAttempts) { | ||
| throw | ||
| } | ||
|
|
||
| $delaySeconds = 5 * $attempt | ||
| Write-Warning "Download failed on attempt $attempt of $MaxAttempts. Retrying in $delaySeconds seconds. $_" | ||
| Start-Sleep -Seconds $delaySeconds | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (-not $CUDA_VERSION) { | ||
| $CUDA_VERSION = Get-CudaVersionFromPath -Path $env:CUDA_PATH | ||
| if (-not $CUDA_VERSION) { | ||
| throw "Could not determine CUDA version. Provide -cudaVersion or set CUDA_PATH to a path ending in v<major>.<minor>." | ||
| } | ||
| } | ||
|
|
||
| $version = [Version]$CUDA_VERSION | ||
| $major = $version.Major | ||
| $minor = $version.Minor | ||
| $build = $version.Build | ||
|
|
||
| if ($build -lt 0) { | ||
| $build = 0 | ||
| } | ||
|
|
||
| $mmbVersionTag = "${major}.${minor}.${build}" | ||
| $mmVersionTag = "${major}.${minor}" | ||
|
|
||
| if ($env:CUDA_PATH) { | ||
| $cudaPathVersion = Get-CudaVersionFromPath -Path $env:CUDA_PATH | ||
| if (-not $cudaPathVersion) { | ||
| throw "CUDA_PATH is set but does not end in v<major>.<minor>: $env:CUDA_PATH" | ||
| } | ||
| if ($cudaPathVersion -ne $mmVersionTag) { | ||
| throw "CUDA_PATH points to CUDA $cudaPathVersion, but CUDA $mmVersionTag was requested." | ||
| } | ||
| $cudaRoot = $env:CUDA_PATH | ||
| } else { | ||
| $cudaRoot = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$mmVersionTag" | ||
| } | ||
| $profilerHeader = "$cudaRoot\include\cuda_profiler_api.h" | ||
|
|
||
| if (Test-Path $profilerHeader) { | ||
| Write-Host "CUDA Profiler API is already installed: $profilerHeader" | ||
| return | ||
| } | ||
|
|
||
| $component = "cuda_profiler_api_$mmVersionTag" | ||
| $cudaMajorUri = "${mmbVersionTag}/network_installers/cuda_${mmbVersionTag}_windows_network.exe" | ||
| $cudaVersionUrl = "https://developer.download.nvidia.com/compute/cuda/$cudaMajorUri" | ||
| $installer = Join-Path $env:TEMP "cuda_${mmbVersionTag}_windows_network.exe" | ||
|
|
||
| Write-Host "Installing CUDA component: $component" | ||
| Write-Host "Downloading CUDA network installer: $cudaVersionUrl" | ||
| Invoke-WebRequestWithRetry -Uri $cudaVersionUrl -OutFile $installer | ||
| Assert-NvidiaAuthenticodeSignature -Path $installer | ||
|
|
||
| $installerTimeoutSeconds = 900 | ||
| $process = $null | ||
| try { | ||
| $process = Start-Process -PassThru -FilePath $installer -ArgumentList @("-s", $component) | ||
| if (-not $process.WaitForExit($installerTimeoutSeconds * 1000)) { | ||
| Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue | ||
| throw "CUDA network installer timed out after $installerTimeoutSeconds seconds." | ||
| } | ||
|
|
||
| if ($process.ExitCode -ne 0) { | ||
| throw "CUDA network installer failed with exit code $($process.ExitCode)." | ||
| } | ||
| } finally { | ||
| if ($process) { | ||
| $process.Dispose() | ||
| } | ||
| Remove-Item $installer -ErrorAction SilentlyContinue | ||
| } | ||
|
|
||
| if (-not (Test-Path $profilerHeader)) { | ||
| throw "CUDA Profiler API installation completed, but header was not found: $profilerHeader" | ||
| } | ||
|
|
||
| Write-Host "CUDA Profiler API installed: $profilerHeader" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.