update script to use separate cache file for each test
@@ -9,13 +9,13 @@ $ErrorActionPreference = "Stop"
. "$PSScriptRoot\_flexci.ps1"
-$cupy_kernel_cache_file = "cupy_kernel_cache_windows.zip"
+$cache_gcs_dir = "gs://tmp-asia-pfn-public-ci/cupy-ci/cache"
-function DownloadCache {
+function DownloadCache([String]$cupy_kernel_cache_file) {
pushd $Env:USERPROFILE
echo "Downloading kernel cache..."
- gsutil -m -q cp gs://tmp-asia-pfn-public-ci/cupy-ci/$cupy_kernel_cache_file .
+ gsutil -m -q cp "$cache_gcs_dir/$cupy_kernel_cache_file" .
if (-not $?) {
echo "*** Kernel cache unavailable"
} else {
@@ -26,7 +26,7 @@ function DownloadCache {
popd
}
-function UploadCache {
+function UploadCache([String]$cupy_kernel_cache_file) {
# Maximum 1 GB
echo "Trimming kernel cache..."
RunOrDie python .pfnci\trim_cupy_kernel_cache.py --max-size 1000000000 --rm
@@ -37,7 +37,7 @@ function UploadCache {
echo "Compressing kernel cache..."
RunOrDie 7z a -tzip -mx=0 -mtc=on $cupy_kernel_cache_file .cupy
echo "Uploading kernel cache..."
- RunOrDie gsutil -m -q cp $cupy_kernel_cache_file gs://tmp-asia-pfn-public-ci/cupy-ci/
+ RunOrDie gsutil -m -q cp $cupy_kernel_cache_file $cache_gcs_dir/
popd
}
@@ -103,8 +103,11 @@ function Main {
$use_cache = ($Env:CUPY_CI_CACHE_KERNEL -eq "1")
$upload_cache = -Not (IsPullRequestTest)
+ $base_branch = (Get-Content .pfnci\BRANCH)
+ $cache_archive = "windows-cuda${cuda}-${base_branch}.zip"
+
if ($use_cache) {
- DownloadCache
+ DownloadCache "${cache_archive}"
}
if ($upload_cache) {
$Env:CUPY_TEST_FULL_COMBINATION = "1"
@@ -123,7 +126,7 @@ function Main {
popd
if ($use_cache -And $upload_cache) {
- UploadCache
+ UploadCache "${cache_archive}"
}
echo "Last 10 lines from the test output:"
