File size: 3,712 Bytes
2072243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# setup_cuda.ps1 β€” FusionNet NVIDIA CUDA setup for Windows
# Requires: NVIDIA driver >= 560 for CUDA 12.8
# Compatible: RTX 50xx (Blackwell), RTX 40xx (Ada), RTX 30xx (Ampere)
#
# Usage (run from repo root in PowerShell):
#   .\scripts\setup_cuda.ps1
#
# If you get an execution policy error, run first:
#   Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

$ErrorActionPreference = "Stop"

Write-Host "==================================================" -ForegroundColor Cyan
Write-Host "  FusionNet β€” NVIDIA CUDA Setup (Windows)         " -ForegroundColor Cyan
Write-Host "==================================================" -ForegroundColor Cyan

# ── 1. Check Python is available ─────────────────────────────────────────────
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
    Write-Error "Python not found. Install Python 3.10+ from https://python.org and add it to PATH."
    exit 1
}
$pyVersion = python --version
Write-Host "`nPython : $pyVersion" -ForegroundColor Green

# ── 2. Upgrade pip ────────────────────────────────────────────────────────────
Write-Host "`nUpgrading pip..." -ForegroundColor Yellow
python -m pip install --upgrade pip

# ── 3. Install PyTorch cu128 (CUDA 12.8) ─────────────────────────────────────
# First stable wheel set supporting Blackwell (sm_100) via cu128.
Write-Host "`nInstalling PyTorch cu128 (CUDA 12.8)..." -ForegroundColor Yellow
pip install torch==2.11.0+cu128 torchvision==0.26.0+cu128 torchaudio==2.11.0+cu128 `
    --index-url https://download.pytorch.org/whl/cu128

# ── 4. Install remaining project dependencies ─────────────────────────────────
Write-Host "`nInstalling project dependencies..." -ForegroundColor Yellow
pip install -r "$PSScriptRoot\..\requirements.txt"

# ── 5. Install fusionnet-client dependencies ──────────────────────────────────
Write-Host "`nInstalling fusionnet-client dependencies..." -ForegroundColor Yellow
pip install -r "$PSScriptRoot\..\fusionnet-client\requirements.txt"

# ── 6. Verify environment ─────────────────────────────────────────────────────
Write-Host "`n--------------------------------------------------" -ForegroundColor Cyan
Write-Host "  Environment Verification" -ForegroundColor Cyan
Write-Host "--------------------------------------------------" -ForegroundColor Cyan

python -c @"

import os, sys

# CUDA DLLs on Windows require System32 in search path

if sys.platform == 'win32':

    os.add_dll_directory(r'C:\Windows\System32')

import torch

print(f'PyTorch  : {torch.__version__}')

print(f'CUDA     : {torch.cuda.is_available()}')

if torch.cuda.is_available():

    p = torch.cuda.get_device_properties(0)

    print(f'GPU      : {p.name} ({p.total_memory / 1024**3:.1f} GB)')

    print(f'CUDA ver : {torch.version.cuda}')

else:

    print('WARNING  : No CUDA GPU detected. Check your NVIDIA driver (>= 560 required).')

"@

Write-Host "`n[OK] Setup complete. Run the client with:" -ForegroundColor Green
Write-Host "     cd fusionnet-client" -ForegroundColor White
Write-Host "     python main.py --client-id 0 --num-clients 4" -ForegroundColor White