Volle Kraft (Owner 03.12.): Duplikat sofort mit Scherben je Fassung, Platz fuer Fassung d, Zusage-Pruefung je Tisch; Flop-Faelle sofort mit GPU-RUHE (nacht15); gepaarte Duplikat-Auswertung nach letzter Strasse und Topfart
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,19 +2,28 @@
|
||||
# NL2-Tisch, Rake, jedes Blatt auf allen sechs Plaetzen): (a) Live-Exe 331206FA ohne Schalter, (b) 0212m-Exe mit der basis-plus-Zeile,
|
||||
# (c) 0212m-Exe mit der vollen 0212m-B-Zeile ohne MOTOR_GPU*. Je Fassung ein Tisch (1 Motor + 1 Fremdmotor), Neustart nach Abbruch mit
|
||||
# TISCH_FORTSETZEN=1 (nur anhaengen). Ende spaetestens um -Bis Uhr; Auswertung gepaart (Doppelzeilen je Blatt/Platz: die letzte gilt).
|
||||
param([int]$Blaetter = 4000, [string]$Bis = '06:30', [int]$Saat = 2026120301)
|
||||
param([int]$Blaetter = 4000, [string]$Bis = '06:30', [int]$Saat = 2026120301, [int]$Scherben = 3, [switch]$Sofort)
|
||||
$f = 'D:\Projects\pf-batterie\messung\farm'; $o = "$f\duplikat-0312"; New-Item -ItemType Directory -Force $o | Out-Null; $log = "$o\kette.log"
|
||||
function Log($x) { Add-Content -Path $log -Value ((Get-Date -Format 'HH:mm:ss') + ' ' + $x) -Encoding UTF8 }
|
||||
function Spielt { (Test-Path 'D:\Projects\pokerfreak\.claude\worktrees\engine-lecks-angreifen-de7b88\betrieb\scratch\laeufer.pid') -or (Test-Path 'D:\Projects\pokerfreak\scratch\laeufer.pid') } # ohne WMI
|
||||
function WarteFrei { $r = 0; while ($r -lt 2) { if (Spielt) { $r = 0 } else { $r++ }; Start-Sleep 15 } }
|
||||
Add-Type -Namespace FarmD -Name Sp -MemberDefinition @'
|
||||
[StructLayout(LayoutKind.Sequential)] public struct MS { public uint l; public uint last; public ulong phys, physfrei, zusage, zusagefrei, virt, virtfrei, x; }
|
||||
[DllImport("kernel32.dll")] public static extern bool GlobalMemoryStatusEx(ref MS m);
|
||||
public static double FreiGB() { MS m = new MS(); m.l = (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(MS)); GlobalMemoryStatusEx(ref m); return m.zusagefrei / 1073741824.0; }
|
||||
'@
|
||||
function ZielGB { 40 + $(if (Get-Process pokerbench-gpukern-* -EA 0) { 12 } else { 0 }) + 10 } # 40 (+12 gpu-kern) + ein Tisch (Motor ~7,5 + Fremdmotor)
|
||||
function Rot($t) { Log "ROT: $t"; Log '=== FERTIG duplikat (ROT)'; exit 1 }
|
||||
$py = (Get-Command python).Source; $pruef = 'D:\Projects\pf-batterie\messung\pruef'
|
||||
$D = 'D:/Projects/pokerfreak/daten/grundstrategie/motor'
|
||||
$live = "$f\nacht-0112\bin\pokerbench-farm-live.exe"; $mexe = 'D:\Projects\pokerfreak\entscheiden\motor\target\pokerbench-motor-alles0212m-2c6ca45f.exe'
|
||||
Log 'wartet auf basis-plus 01.12. (nacht12)'
|
||||
while (-not (Select-String -Path "$f\basis-plus\kette.log" -Pattern '=== FERTIG basis-plus 01.12.' -Quiet -EA 0)) { Start-Sleep 60 }
|
||||
# 03.12. 12:3x (Owner: "so schnell wie moeglich", Hauptsession): -Sofort startet ohne Warten; -Scherben Tische je Fassung mit Saat+0..n-1
|
||||
# (dieselben Scherben fuer alle Fassungen, also dieselben Blaetter). Vierte Fassung d: Zeile in <o>\d-zeile.txt (wird beim Erscheinen gestartet).
|
||||
if (-not $Sofort) { Log 'wartet auf basis-plus 01.12. (nacht12)'
|
||||
while (-not (Select-String -Path "$f\basis-plus\kette.log" -Pattern '=== FERTIG basis-plus 01.12.' -Quiet -EA 0)) { Start-Sleep 60 } }
|
||||
foreach ($x in @(@($live, '331206FAD0BBF883'), @($mexe, 'D1D3EBA68C9F7A02'))) { $h = (Get-FileHash $x[0]).Hash; Log "$($x[0]) $h"; if (-not $h.StartsWith($x[1])) { Rot "SHA $($x[0])" } }
|
||||
$sd = Get-ChildItem "$f\fassung-alles0212m\kern_schalter-*.txt" -EA 0 | Select-Object -First 1; if (-not $sd) { Rot '0212m-Schalterdatei fehlt' }
|
||||
$sd = Get-Item 'D:\Projects\pokerfreak\.claude\worktrees\engine-lecks-angreifen-de7b88\betrieb\kern_schalter.txt.vor-gegen2611' -EA 0 # die 0212m-Datei, wie sie bis 03.12. 02:20 live war (nur lesen)
|
||||
if (-not $sd -or -not (Select-String -Path $sd.FullName -Pattern '^AB_SPOT=ALLES0212M$' -Quiet)) { Rot '0212m-Schalterdatei fehlt oder ist nicht ALLES0212M' }
|
||||
$voll = ((Select-String -Path $sd.FullName -Pattern '^AB_SPOT_B=(.*)$' | Select-Object -First 1).Matches[0].Groups[1].Value -split ';' | ? { $_ -match '=' -and $_ -notmatch '^MOTOR_GPU' }) -join ';'
|
||||
$bplus = 'MOTOR_PREIS_LINIE=1;MOTOR_ALLIN_ECHT=1;MOTOR_ALLIN_GEGEN_ALLIN=1;MOTOR_STRADDLE=1;MOTOR_STAPEL_PREIS=0.5;MOTOR_STAPEL_PREIS_TAFEL=D:/Projects/pokerfreak-daten/einsatzstaerke/einsatzstaerke-v2.txt;MOTOR_STAPEL_PREIS_AB=0.5;MOTOR_STAPEL_PREIS_EQ=1'
|
||||
$fremd = 'py:D:/Projects/pf-batterie/messung/pruef/fremd6.py D:/Projects/fremd/deepcfr6-target/release/examples/nplayer_serve.exe D:/Projects/fremd/k50 D:/Projects/fremd/six/p.gz ec0c9361fdbc4e6bbabd1e42561535990473a503407099946d4f272329e113e6'
|
||||
@@ -26,21 +35,25 @@ $ende = [datetime]::Today.Add([timespan]$Bis); if ($ende -lt (Get-Date)) { $ende
|
||||
while ((Get-Date) -lt $ende) {
|
||||
WarteFrei
|
||||
$offen = 0
|
||||
foreach ($k in $fass.Keys) {
|
||||
$p = $laeufe[$k]; if ($p -and -not $p.HasExited) { $offen++; continue }
|
||||
$aus = "$o\$k.jsonl"; $fertig = 0; if (Test-Path $aus) { $fertig = @(Get-Content $aus | Select-String '"platz":5,').Count }
|
||||
if (-not $fass.Contains('d') -and (Test-Path "$o\d-zeile.txt")) { $fass['d'] = @($mexe, "$(Get-Content "$o\d-zeile.txt" | Select-Object -First 1)".Trim()); Log "Fassung d : $($fass['d'][1])" }
|
||||
foreach ($k in @($fass.Keys)) { for ($sc = 0; $sc -lt $Scherben; $sc++) {
|
||||
$t = "$k-s$sc"; $p = $laeufe[$t]; if ($p -and -not $p.HasExited) { $offen++; continue }
|
||||
$aus = "$o\$t.jsonl"; $fertig = 0; if (Test-Path $aus) { $fertig = @(Get-Content $aus | Select-String '"platz":5,').Count }
|
||||
if ($fertig -ge $Blaetter) { continue }
|
||||
if ($p) { Log "Fassung $k beendet (Rueckgabe $($p.ExitCode)), etwa $fertig Blaetter; Neustart mit Fortsetzen" }
|
||||
if ([FarmD.Sp]::FreiGB() -lt (ZielGB)) { if (-not $script:zusageGemeldet) { Log ("warte auf Zusage: frei {0:N1} GB < {1} GB" -f [FarmD.Sp]::FreiGB(), (ZielGB)); $script:zusageGemeldet = $true }; $offen++; continue }
|
||||
$script:zusageGemeldet = $false
|
||||
if ($p) { Log "Tisch $t beendet (Rueckgabe $($p.ExitCode)), etwa $fertig Blaetter; Neustart mit Fortsetzen" }
|
||||
foreach ($kv in ($fass[$k][1] -split ';' | ? { $_ -match '=' })) { $n, $v = $kv -split '=', 2; Set-Item "env:$n" $v }
|
||||
$env:TISCH_FORTSETZEN = '1'; $env:RAYON_NUM_THREADS = '8'; $env:TISCH_DATEN = $D
|
||||
$laeufe[$k] = Start-Process $py -ArgumentList '-X', 'utf8', "$pruef\tisch6.py", $Blaetter, $Saat, $aus, "`"cmd:$($fass[$k][0]) $motor`"", "`"$fremd`"" -WorkingDirectory $pruef -PassThru -WindowStyle Hidden -RedirectStandardError "$o\$k.err"
|
||||
$null = $laeufe[$k].Handle
|
||||
$env:TISCH_FORTSETZEN = '1'; $env:RAYON_NUM_THREADS = '4'; $env:TISCH_DATEN = $D
|
||||
$laeufe[$t] = Start-Process $py -ArgumentList '-X', 'utf8', "$pruef\tisch6.py", $Blaetter, ($Saat + $sc), $aus, "`"cmd:$($fass[$k][0]) $motor`"", "`"$fremd`"" -WorkingDirectory $pruef -PassThru -WindowStyle Hidden -RedirectStandardError "$o\$t.err"
|
||||
$null = $laeufe[$t].Handle
|
||||
Get-ChildItem env: | ? { $_.Name -like 'MOTOR_*' } | % { Remove-Item "env:$($_.Name)" }
|
||||
Log "Fassung $k gestartet (PID $($laeufe[$k].Id)), fertig bisher $fertig"; $offen++
|
||||
}
|
||||
Log "Tisch $t gestartet (PID $($laeufe[$t].Id)), fertig bisher $fertig"; $offen++
|
||||
Start-Sleep 20 # Ladezeit, damit die Zusage-Lage stimmt
|
||||
} }
|
||||
if (-not $offen) { break }
|
||||
Start-Sleep 30
|
||||
}
|
||||
foreach ($k in $fass.Keys) { $p = $laeufe[$k]; if ($p -and -not $p.HasExited) { & taskkill /T /F /PID $p.Id | Out-Null; Log "Fassung $k zur Endzeit beendet (samt Motor und Fremdmotor)" } }
|
||||
foreach ($k in $fass.Keys) { Log ("Fassung {0}: {1} Blaetter vollstaendig" -f $k, @(Get-Content "$o\$k.jsonl" -EA 0 | Select-String '"platz":5,').Count) }
|
||||
foreach ($t in @($laeufe.Keys)) { $p = $laeufe[$t]; if ($p -and -not $p.HasExited) { & taskkill /T /F /PID $p.Id | Out-Null; Log "Tisch $t zur Endzeit beendet (samt Motor und Fremdmotor)" } }
|
||||
Get-ChildItem "$o\*.jsonl" | % { Log ("{0}: {1} Blaetter vollstaendig" -f $_.Name, @(Get-Content $_.FullName | Select-String '"platz":5,').Count) }
|
||||
Log '=== FERTIG duplikat'
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# Flop-Pruefaelle sofort (Hauptsession 03.12. 12:3x, parallel zu Duplikat und basis-plus): GPU-RUHE fuer die Dauer der drei Laeufe (die Fabrik pausiert),
|
||||
# dann farm-flop-job.ps1, danach GPU-RUHE weg. Ersetzt den Weg ueber farm-nacht13 (dessen ruhiges Fenster haette alles andere angehalten).
|
||||
$f = 'D:\Projects\pf-batterie\messung\farm'; $o = "$f\flop-i30"; New-Item -ItemType Directory -Force $o | Out-Null; $log = "$o\kette.log"
|
||||
function Log($x) { Add-Content -Path $log -Value ((Get-Date -Format 'HH:mm:ss') + ' ' + $x) -Encoding UTF8 }
|
||||
Set-Location D:\Projects\pf-basis-fd2437df
|
||||
git fetch -q D:\Projects\pokerfreak\scratch\flop.bundle +refs/remotes/origin/claude/flop-sperre:refs/farm/flop
|
||||
Log ('Start sofort; flop ' + (git rev-parse --short=8 refs/farm/flop))
|
||||
$ruhe = "$f\GPU-RUHE"; $vonUns = -not (Test-Path $ruhe)
|
||||
if ($vonUns) { Set-Content $ruhe 'farm: Flop-Prueffaelle'; Log 'GPU-RUHE gelegt, 20 s fuer die Fabrik'; Start-Sleep 20 }
|
||||
try { & powershell -NoProfile -ExecutionPolicy Bypass -File D:\Projects\pokerfreak\scratch\farm-flop-job.ps1 -O $o }
|
||||
finally { if ($vonUns) { Remove-Item $ruhe -EA 0; Log 'GPU-RUHE entfernt' } }
|
||||
Get-Content "$o\job.log" -EA 0 | Select-String 'ROT|START|ENDE|FERTIG|Exe' | % { Log $_.Line }
|
||||
Log '=== FERTIG flop'
|
||||
@@ -0,0 +1,75 @@
|
||||
# Duplikat gegen CFR-NLHE-6max (farm-nacht14): je Fassung bb/100 mit 95-%-Intervall und gepaarte Differenzen zu a (Live-Basis) auf denselben
|
||||
# Blaettern (Scherbe, Blatt; nur Blaetter, die in beiden Fassungen vollstaendig sind), dazu aufgeteilt nach letzter Strasse und Topfart der Hand
|
||||
# (Einteilung aus Fassung a, damit die Paare gleich eingeteilt sind). Doppelte Zeilen je (Blatt, Platz) nach einem Neustart: die letzte gilt.
|
||||
# python3 farm_duplikat_auswertung.py <ordner mit a-s0.jsonl ...>
|
||||
import sys; sys.dont_write_bytecode = True
|
||||
import collections, glob, json, math, os, re
|
||||
|
||||
STRASSEN = ("PREFLOP", "FLOP", "TURN", "RIVER")
|
||||
|
||||
|
||||
def lade(ordner):
|
||||
"""{fassung: {(scherbe, blatt): {platz: zeile}}}"""
|
||||
d = collections.defaultdict(lambda: collections.defaultdict(dict))
|
||||
for p in glob.glob(os.path.join(ordner, "*-s*.jsonl")):
|
||||
m = re.match(r"(\w+)-s(\d+)\.jsonl$", os.path.basename(p))
|
||||
if not m:
|
||||
continue
|
||||
with open(p, encoding="utf-8") as f:
|
||||
for z in f:
|
||||
try:
|
||||
r = json.loads(z)
|
||||
except ValueError:
|
||||
continue # halbe letzte Zeile eines laufenden Tisches
|
||||
d[m.group(1)][(int(m.group(2)), r["blatt"])][r["platz"]] = r
|
||||
return d
|
||||
|
||||
|
||||
def einteilung(r):
|
||||
"""(letzte Strasse der Hand, Topfart): Topfart = Zahl der Spieler am Flop (HU / Mehrweg) oder 'vorflop entschieden'."""
|
||||
alle = r.get("alle") or []
|
||||
letzte = max((STRASSEN.index(a[1]) for a in alle if a[1] in STRASSEN), default=0)
|
||||
raus = {a[0] for a in alle if a[1] == "PREFLOP" and a[2] == "FOLD"}
|
||||
am_flop = 6 - len(raus)
|
||||
art = "vorflop entschieden" if letzte == 0 else ("HU" if am_flop == 2 else "Mehrweg")
|
||||
return STRASSEN[letzte], art
|
||||
|
||||
|
||||
def mittel_intervall(werte):
|
||||
n = len(werte)
|
||||
if n < 2:
|
||||
return None, None
|
||||
m = sum(werte) / n
|
||||
s = math.sqrt(sum((x - m) ** 2 for x in werte) / (n - 1))
|
||||
return m, 1.96 * s / math.sqrt(n)
|
||||
|
||||
|
||||
def bb100(werte_je_blatt):
|
||||
"""Ergebnis je Blatt (Summe ueber 6 Plaetze in bb) -> bb/100 Haende mit 95-%-Halbbreite."""
|
||||
m, h = mittel_intervall(werte_je_blatt)
|
||||
return (None, None) if m is None else (round(m / 6 * 100, 1), round(h / 6 * 100, 1))
|
||||
|
||||
|
||||
def auswertung(d, basis="a"):
|
||||
voll = {k: {b: pl for b, pl in v.items() if len(pl) == 6} for k, v in d.items()}
|
||||
aus = {"fassungen": {}, "paare": {}}
|
||||
for k, v in sorted(voll.items()):
|
||||
w = [sum(r["erg"] for r in pl.values()) for pl in v.values()]
|
||||
aus["fassungen"][k] = {"blaetter": len(w), "bb100": bb100(w)}
|
||||
for k in sorted(voll):
|
||||
if k == basis or basis not in voll:
|
||||
continue
|
||||
gemein = sorted(set(voll[k]) & set(voll[basis]))
|
||||
diff = [sum(voll[k][b][p]["erg"] for p in range(6)) - sum(voll[basis][b][p]["erg"] for p in range(6)) for b in gemein]
|
||||
teile = collections.defaultdict(list)
|
||||
for b in gemein:
|
||||
for p in range(6):
|
||||
teile[einteilung(voll[basis][b][p])].append(voll[k][b][p]["erg"] - voll[basis][b][p]["erg"])
|
||||
aus["paare"]["%s-%s" % (k, basis)] = {"blaetter": len(gemein), "bb100": bb100(diff),
|
||||
"je_teil": {"%s / %s" % t: {"haende": len(x), "bb100_je_hand": (lambda mi: (None if mi[0] is None else round(mi[0] * 100, 1), None if mi[1] is None else round(mi[1] * 100, 1)))(mittel_intervall(x))}
|
||||
for t, x in sorted(teile.items())}}
|
||||
return aus
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(json.dumps(auswertung(lade(sys.argv[1])), indent=1, ensure_ascii=False))
|
||||
@@ -0,0 +1,38 @@
|
||||
# Spezifikation von farm_duplikat_auswertung. python3 tests/farm_duplikat_auswertung_spec.py
|
||||
import sys; sys.dont_write_bytecode = True
|
||||
import json, os, tempfile, unittest
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "messung", "farm", "nacht-0112", "werkzeuge"))
|
||||
import farm_duplikat_auswertung as A # noqa: E402
|
||||
|
||||
|
||||
def zeile(blatt, platz, erg, alle):
|
||||
return json.dumps({"blatt": blatt, "platz": platz, "erg": erg, "alle": alle}) + "\n"
|
||||
|
||||
|
||||
class Duplikat(unittest.TestCase):
|
||||
def test_paare_nur_vollstaendige_blaetter_letzte_zeile_gilt(self):
|
||||
d = tempfile.mkdtemp()
|
||||
vor = [[0, "PREFLOP", "RAISE", 0.06], [1, "PREFLOP", "FOLD", None], [2, "PREFLOP", "FOLD", None], [3, "PREFLOP", "FOLD", None],
|
||||
[4, "PREFLOP", "FOLD", None], [5, "PREFLOP", "FOLD", None]]
|
||||
hu = [[0, "PREFLOP", "RAISE", 0.06], [1, "PREFLOP", "CALL", None], [2, "PREFLOP", "FOLD", None], [3, "PREFLOP", "FOLD", None],
|
||||
[4, "PREFLOP", "FOLD", None], [5, "PREFLOP", "FOLD", None], [0, "FLOP", "BET", 0.05], [1, "FLOP", "FOLD", None]]
|
||||
with open(os.path.join(d, "a-s0.jsonl"), "w") as f:
|
||||
for b in range(3):
|
||||
for p in range(6):
|
||||
f.write(zeile(b, p, 0.0, vor if p % 2 else hu))
|
||||
with open(os.path.join(d, "b-s0.jsonl"), "w") as f:
|
||||
for b in range(3):
|
||||
for p in range(6 if b < 2 else 3): # Blatt 2 unvollstaendig
|
||||
f.write(zeile(b, p, 9.9 if (b, p) == (0, 0) else 0.1, hu))
|
||||
f.write(zeile(0, 0, 0.1, hu)) # Neustart: Blatt 0 Platz 0 noch einmal, gilt
|
||||
a = A.auswertung(A.lade(d))
|
||||
self.assertEqual(a["fassungen"]["b"]["blaetter"], 2)
|
||||
pa = a["paare"]["b-a"]
|
||||
self.assertEqual(pa["blaetter"], 2)
|
||||
self.assertAlmostEqual(pa["bb100"][0], 0.6 / 6 * 100, places=1) # +0,1 bb je Hand
|
||||
self.assertEqual(sorted(pa["je_teil"]), ["FLOP / HU", "PREFLOP / vorflop entschieden"])
|
||||
self.assertEqual(pa["je_teil"]["FLOP / HU"]["haende"], 6)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user