|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| param(
|
| [int]$NumClients = 3,
|
| [int]$FederationRounds = 1
|
| )
|
|
|
| $ErrorActionPreference = "Stop"
|
|
|
| Write-Host "==================================================" -ForegroundColor Cyan
|
| Write-Host " FusionNet - Federated Learning Round (Windows) " -ForegroundColor Cyan
|
| Write-Host "==================================================" -ForegroundColor Cyan
|
| Write-Host ""
|
| Write-Host " Clients : $NumClients" -ForegroundColor White
|
| Write-Host " FL Rounds : $FederationRounds" -ForegroundColor White
|
| Write-Host ""
|
|
|
|
|
| $repoRoot = Split-Path -Parent $PSScriptRoot
|
| $clientDir = Join-Path $repoRoot "fusionnet-client"
|
| $mainScript = Join-Path $clientDir "main.py"
|
|
|
| if (-not (Test-Path $mainScript)) {
|
| Write-Error "Cannot find fusionnet-client\main.py at: $mainScript"
|
| exit 1
|
| }
|
|
|
|
|
| $jobs = @()
|
| for ($round = 1; $round -le $FederationRounds; $round++) {
|
| Write-Host "--- FL Round $round / $FederationRounds ---" -ForegroundColor Magenta
|
|
|
| for ($id = 0; $id -lt $NumClients; $id++) {
|
| Write-Host " Spawning client $id / $NumClients ..." -ForegroundColor Yellow
|
|
|
| $job = Start-Job -ScriptBlock {
|
| param($clientDir, $mainScript, $clientId, $numClients, $round)
|
| Set-Location $clientDir
|
| $output = python $mainScript --client-id $clientId --num-clients $numClients 2>&1
|
| [PSCustomObject]@{
|
| ClientId = $clientId
|
| Round = $round
|
| Output = $output -join "`n"
|
| }
|
| } -ArgumentList $clientDir, $mainScript, $id, $NumClients, $round
|
|
|
| $jobs += $job
|
| }
|
|
|
|
|
| Write-Host "`n Waiting for all $NumClients clients to finish round $round ..." -ForegroundColor Cyan
|
| $results = $jobs | Wait-Job | Receive-Job
|
|
|
|
|
| foreach ($result in $results) {
|
| Write-Host "`n ========== Client $($result.ClientId) | Round $($result.Round) ==========" -ForegroundColor Green
|
| Write-Host $result.Output
|
| }
|
|
|
|
|
| $jobs | Remove-Job -Force
|
| $jobs = @()
|
|
|
| Write-Host "`n [Round $round complete]" -ForegroundColor Green
|
| Write-Host ""
|
| }
|
|
|
| Write-Host "==================================================" -ForegroundColor Cyan
|
| Write-Host " All $FederationRounds FL round(s) finished! " -ForegroundColor Cyan
|
| Write-Host "==================================================" -ForegroundColor Cyan
|
| Write-Host ""
|
| Write-Host "Next steps:" -ForegroundColor Yellow
|
| Write-Host " - Inspect adapter checkpoints in: fusionnet-client\checkpoints\" -ForegroundColor White
|
| Write-Host " - Run example_federated_round.py to simulate coordinator aggregation" -ForegroundColor White
|
| Write-Host " - See README.md for full deployment guide" -ForegroundColor White
|
|
|