Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
leofang committed Nov 25, 2024
1 parent bd8be7c commit bc35384
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 29 deletions.
30 changes: 16 additions & 14 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,20 @@ jobs:
with:
submodules: recursive

- name: Install gh cli
# for some reason the GPU runner image does not have gh pre-installed...
env:
# doesn't seem there's an easy way to avoid hard-coding it?
GH_MSI_URL: https://github.com/cli/cli/releases/download/v2.62.0/gh_2.62.0_windows_amd64.msi
run: |
Invoke-WebRequest -Uri "$env:GH_MSI_URL" -OutFile "gh_installer.msi"
Start-Process msiexec.exe -Wait -Verbose -ArgumentList '/i "gh_installer.msi" /qn'
$env:GH_POSSIBLE_PATHS = "C:\\Program Files\\GitHub CLI;C:\\Program Files (x86)\\GitHub CLI"
echo "GH_POSSIBLE_PATHS=$env:GH_POSSIBLE_PATHS" >> $env:GITHUB_ENV
$env:Path += ";$env:GH_POSSIBLE_PATHS"
gh --version
# - name: Install gh cli
# # for some reason the GPU runner image does not have gh pre-installed...
# env:
# # doesn't seem there's an easy way to avoid hard-coding it?
# GH_MSI_URL: https://github.com/cli/cli/releases/download/v2.62.0/gh_2.62.0_windows_amd64.msi
# run: |
# Invoke-WebRequest -Uri "$env:GH_MSI_URL" -OutFile "gh_installer.msi"
# Start-Process msiexec.exe -Wait -Verbose -ArgumentList '/i "gh_installer.msi" /qn'
# $GH_POSSIBLE_PATHS = "C:\\Program Files\\GitHub CLI", "C:\\Program Files (x86)\\GitHub CLI"
# foreach ($p in $GH_POSSIBLE_PATHS) {
# echo "$p" >> $env:GITHUB_PATH
# $env:Path += ";$p"
# }
# gh --version

- name: Check system
run: |
Expand Down Expand Up @@ -115,7 +117,7 @@ jobs:
# FIXME: get the version strings from a test matrix. Right now, we have
# to hard code the values to what're pre-installed in the CI image.
.pfnci\windows\GHA-test.ps1 -stage setup -python 3.12 -cuda 11.4
.pfnci\windows\GHA-test.ps1 -stage build
#.pfnci\windows\GHA-test.ps1 -stage build
.pfnci\windows\GHA-test.ps1 -stage test
- name: Prepare cache
Expand All @@ -139,7 +141,7 @@ jobs:
# TODO: this is dangerous because we're overwriting the global GHA cache!
# We should have another workflow that updates the global cache upon PR merge.
$env:Path += ";$env:GH_POSSIBLE_PATHS"
#$env:Path += ";$env:GH_POSSIBLE_PATHS"
if ((gh cache list | Select-String -Pattern ${{ env.CACHE_KEY }}).Count -eq 1) {
gh cache delete ${{ env.CACHE_KEY }}
}
Expand Down
30 changes: 19 additions & 11 deletions .pfnci/windows/GHA-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,19 @@ function FindAndCheckMSVC {
-requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 `
-property installationPath
$clPath = Join-Path $vsPath "VC\Tools\MSVC\*\bin\Hostx64\x64\cl.exe"
$clPath = Get-ChildItem $clPath

$CL_VERSION_STRING = & $clPath /?
if ($CL_VERSION_STRING -match "Version (\d+\.\d+)\.\d+") {
$CL_VERSION = [version]$matches[1]
echo "getting full name"
$clPath = (Get-ChildItem $clPath).FullName
echo "execute?"
"$clPath"
echo "get stderr"
Start-Process -NoNewWindow -RedirectStandardError cl.out -FilePath "$clPath"
$CL_VERSION_STRING = & type cl.out
echo "output: $CL_VERSION_STRING"
if (($CL_VERSION_STRING -join " ") -match "Version (\d+\.\d+)\.\d+") {
$CL_VERSION = $matches[1]
echo "Detected cl.exe version: $CL_VERSION"
} else {
echo "no match...? $CL_VERSION_STRING"
}
}

Expand All @@ -47,8 +54,9 @@ function Main {
ActivatePython $python
echo "Setting up test environment"
RunOrDie python -V
RunOrDie python -m pip install -U pip setuptools wheel
RunOrDie python -m pip freeze
# TODO: this is tentatively disabled as it seems slow
#RunOrDie python -m pip install -U pip setuptools wheel
#RunOrDie python -m pip freeze

# Check MSVC version
# TODO: we might want to be able to choose MSVC version in the future
Expand Down Expand Up @@ -102,12 +110,12 @@ function Main {
# InstallZLIB

pushd tests
echo "CuPy Configuration:"
RunOrDie python -c "import cupy; print(cupy); cupy.show_config()"
#echo "CuPy Configuration:"
#RunOrDie python -c "import cupy; print(cupy); cupy.show_config()"
echo "Running test..."
$pytest_tests = "cupy_tests/core_tests/test*.py" # TODO: remove me
$pytest_tests = @("cupy_tests/core_tests/test*.py") # TODO: remove me
# TODO: pass timeout as a function argument?
$test_retval = RunWithTimeout -timeout 18000 -- python -m pytest -rfEX @pytest_opts @pytest_tests
$test_retval = RunWithTimeout -timeout 18000 -output "" -- python -m pytest -rfEX @pytest_opts --maxfail=10 @pytest_tests
popd

if ($test_retval -ne 0) {
Expand Down
17 changes: 13 additions & 4 deletions .pfnci/windows/_error_handler.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,27 @@ function RunWithTimeout {
param(
[Parameter(Mandatory=$true)]
[int]$timeout,
[Parameter(Mandatory=$false)]
[Parameter(Mandatory=$true)]
[AllowEmptyString()]
[string]$output,
[Parameter(Mandatory=$true)]
[string]$command,
[Parameter(Mandatory=$true, ValueFromRemainingArguments=$true)]
[string[]]$params
)
if ($PSBoundParameters.ContainsKey('output')) {
$process = Start-Process -PassThru -NoNewWindow -RedirectStandardOutput $output -FilePath $command -ArgumentList $params
if ($output) {
Write-Host "debug: $timeout"
Write-Host "debug: $output"
Write-Host "debug: $command"
Write-Host "debug: $params"
#$process = Start-Process -PassThru -NoNewWindow -RedirectStandardOutput $output -FilePath $command -ArgumentList $params
} else {
$process = Start-Process -PassThru -NoNewWindow -FilePath $command -ArgumentList $params
Write-Host "debug: $timeout"
Write-Host "debug: $command"
Write-Host "debug: $params"
#$process = Start-Process -PassThru -NoNewWindow -FilePath $command -ArgumentList $params
}
return -1
try {
$process | Wait-Process -Timeout $timeout
} catch [TimeoutException] {
Expand Down

0 comments on commit bc35384

Please sign in to comment.