@@ -232,14 +232,20 @@ jobs:
232232 name : Tests (GPU)
233233 runs-on : [self-hosted, Windows, X64]
234234 needs : [tests-cpu]
235+ env :
236+ # كاش ثابت داخل مساحة العمل لتفادي مشاكل LOCALAPPDATA على الـ self-hosted
237+ PIP_CACHE_DIR : ${{ github.workspace }}\_pip_cache
235238 steps :
236239 - name : Checkout
237240 uses : actions/checkout@v4
238241
239242 - name : Ensure pip cache dir
240- run : New-Item -ItemType Directory -Force -Path $env:PIP_CACHE_DIR | Out-Null
243+ shell : pwsh
244+ run : |
245+ New-Item -ItemType Directory -Force -Path $env:PIP_CACHE_DIR | Out-Null
241246
242247 - name : Discover & use Python 3.12
248+ shell : pwsh
243249 run : |
244250 $candidates = @()
245251 if ($env:PY_DIR) { $candidates += $env:PY_DIR }
@@ -283,7 +289,6 @@ jobs:
283289 & "$py" --version
284290 & "$py" -m pip --version
285291
286-
287292 - name : Cache pip
288293 uses : actions/cache@v4
289294 with :
@@ -293,6 +298,7 @@ jobs:
293298 pip-
294299
295300 - name : Install deps
301+ shell : pwsh
296302 run : |
297303 python -m ensurepip --upgrade
298304 python -m pip install -U pip wheel setuptools --cache-dir $env:PIP_CACHE_DIR
@@ -302,6 +308,7 @@ jobs:
302308
303309 - name : Show NVIDIA GPU
304310 id : nvsmi
311+ shell : pwsh
305312 continue-on-error : true
306313 run : |
307314 $exists = Get-Command nvidia-smi -ErrorAction SilentlyContinue
@@ -314,20 +321,33 @@ jobs:
314321 }
315322
316323 - name : Torch CUDA availability
324+ shell : pwsh
317325 continue-on-error : true
318326 run : |
319- python - << 'PY'
320- try:
321- import torch
322- print("Torch:", torch.__version__)
323- print("CUDA available:", torch.cuda.is_available())
324- if torch.cuda.is_available():
325- print("CUDA devices:", torch.cuda.device_count())
326- except Exception as e:
327- print("Torch not installed:", e)
328- PY
327+ $code = @'
328+ import sys, platform
329+ print("Python:", platform.python_version())
330+ try:
331+ import torch
332+ print("Torch:", torch.__version__)
333+ has_cuda = torch.cuda.is_available()
334+ print("CUDA available:", has_cuda)
335+ cnt = torch.cuda.device_count() if has_cuda else 0
336+ print("CUDA device count:", cnt)
337+ if has_cuda and cnt > 0:
338+ i = torch.cuda.current_device()
339+ print("Current device index:", i)
340+ print("Device name:", torch.cuda.get_device_name(i))
341+ except Exception as e:
342+ print("Torch probe failed:", e)'@
343+ '@
344+
345+
346+ $code | python -
329347
330348 - name : Run pytest (GPU markers)
331349 if : steps.nvsmi.outputs.has_gpu == 'true'
350+ shell : pwsh
332351 run : |
333352 pytest -q -m "gpu or gpu_cuda or gpu_mps" --maxfail=1 --disable-warnings --log-cli-level=INFO
353+
0 commit comments