Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2929_PrioritizedGrammarEnumeration/HeuristicLab.Algorithms.DataAnalysis.PGE/3.3/MultiTest.ps1 @ 16793

Last change on this file since 16793 was 16620, checked in by hmaislin, 6 years ago

#2929: Reorganized folder structure for make script, removed explicit marshalling, erased go-side logging

File size: 2.6 KB
Line 
1[cmdletbinding()]
2param(
3    [int] $WaitToStep = 200,
4    [int] $PeelCnt = 3,
5    [int] $EvalCnt = 3,
6    [ValidateSet("method1","method2", "method3")][string] $InitMethod = "method1",
7    [ValidateSet("method1","method2", "method3")][string] $GrowMethod = "method1",
8    [int] $MaxJobs = 3,
9    [switch] $NoClear,
10    [switch] $UseExisting
11)
12
13$BenchmarksPath = Resolve-Path -Relative "src\go-pge\data\benchmark"
14
15$env:GOGC="off"
16$env:GODEBUG="cgocheck=0"
17$env:CGO_ENABLED=1
18
19$BenchFiles = Get-ChildItem -Path $BenchmarksPath -File
20$ActiveJobs = @{}
21foreach($BenchName in $($BenchFiles | Select-Object -ExpandProperty BaseName -Unique)) {
22    $RunningCnt = ($ActiveJobs.Values | Where-Object { $_.State -eq "Running" }).Count
23    while ($RunningCnt -gt $MaxJobs) {
24        Start-Sleep -Seconds 1
25        $RunningCnt = ($ActiveJobs.Values | Where-Object { $_.State -eq "Running" }).Count
26    }
27    $ActiveJobs[$BenchName] = Start-Job -ScriptBlock {
28        param($PSPath, $WaitToStep, $BenchName, $PeelCnt, $EvalCnt, $InitMethod, $GrowMethod, $NoClear, $UseExisting)
29        Set-Location -Path $PSPath
30        ./TestResults -WaitToStep $WaitToStep -BenchName $BenchName -PeelCnt $PeelCnt -EvalCnt $EvalCnt -InitMethod $InitMethod -GrowMethod $GrowMethod -NoClear:$NoClear -UseExisting:$UseExisting *>&1
31        Write-Output "Gen-Return: $LASTEXITCODE"
32    } -ArgumentList $(Resolve-Path $PSScriptRoot), $WaitToStep, $BenchName, $PeelCnt, $EvalCnt, $InitMethod, $GrowMethod, $NoClear.IsPresent, $UseExisting.IsPresent
33    Write-Host "Started job for $BenchName"
34}
35
36$ActiveJobs.Values | Wait-Job | Out-Null
37foreach($BenchName in $ActiveJobs.Keys | Sort-Object) {
38    $Job = $ActiveJobs[$BenchName]
39    $Res = $Job | Receive-Job
40    $ReturnLine = $Res | Select-String -SimpleMatch "Gen-Return: "
41    if($ReturnLine -match "Gen-Return: (\d+)") {
42        if($Matches[0] -ne 0) {
43            Write-Error "$($BenchName): An error occurred! Return-Code $($Matches[0])"
44            continue
45        }
46    }
47    $Succeeded = ($Res | Select-String -Pattern "^[0-9]+\sOK").Count
48    $Failed = ($Res | Select-String -Pattern "^[0-9]+\sfailed!").Count
49    if($($Succeeded + $Failed) -ne $WaitToStep ) {
50        $Missing = $WaitToStep - ($Succeeded + $Failed)
51        Write-Error "$($BenchName): $Missing steps missing, or something went wrong!? Please check manuelly"
52    }
53    if($Succeeded -eq $WaitToStep) {
54        Write-Host "$($BenchName): $Succeeded / $WaitToStep `ttests succeeded"
55    } else {
56        Write-Warning "$($BenchName): $Failed / $WaitToStep `ttests failed!"
57    }
58}
59Get-Job | Remove-Job -Force | Out-Null
Note: See TracBrowser for help on using the repository browser.