Gedaechtnis-Laeufe: keine Fenster (CREATE_NO_WINDOW, Speicher ueber GlobalMemoryStatusEx statt powershell), Ergebnisse nie ueberschreiben (Abbruch bei vorhandenem LBR-JSON, Protokoll anhaengen, auswertung.txt ueber tmp+rename), Start ab 10 GB RAM

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-28 08:38:33 +01:00
co-authored by Claude Opus 5.5
parent 98cc23e805
commit 3f050eefdd
3 changed files with 33 additions and 14 deletions
@@ -2,7 +2,7 @@
python decke_nacht.py <saat> <deals> schreibt lbr-<saat>-<deals>.json und .log
Kopie von pluribus.exe als pokerbench-gedaechtnis-decke-lbr.exe, 4 Threads, BelowNormal, EcoQoS aus. Startet erst bei >= 24 GB RAM
Kopie von pluribus.exe als pokerbench-gedaechtnis-decke-lbr.exe, Threads aus FAEDEN (Default 4), BelowNormal, EcoQoS aus. Startet erst bei >= 10 GB RAM
und >= 3 GB auf D: frei. Name endet auf nacht.py: der Waechter von pruef6 haelt den Lauf an, wenn Speicher fehlt oder ein Laeufer spielt.
"""
import ctypes
@@ -18,9 +18,13 @@ EXE = os.path.join(HIER, "pokerbench-gedaechtnis-decke-lbr.exe")
def frei():
o = subprocess.run(["powershell", "-NoProfile", "-c", "[int]((Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory/1MB);"
"[int]((Get-PSDrive D).Free/1GB)"], capture_output=True, text=True).stdout.split()
return int(o[0]), int(o[1])
"""RAM und D: frei in GB, ohne Unterprozess (kein Fenster)."""
class M(ctypes.Structure):
_fields_ = [("l", ctypes.c_ulong), ("last", ctypes.c_ulong)] + [(x, ctypes.c_ulonglong) for x in ("tp", "ap", "tf", "af", "tv", "av", "ave")]
m = M()
m.l = ctypes.sizeof(M)
ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(m))
return int(m.ap / 2**30), int(shutil.disk_usage("D:/").free / 2**30)
def main():
@@ -31,17 +35,19 @@ def main():
shutil.copy2(F + "/code/target/serve/pluribus.exe", EXE)
while True:
r, d = frei()
if r >= 24 and d >= 3:
if r >= 10 and d >= 3:
break
print(time.strftime("%H:%M"), "warte: RAM %d GB, D: %d GB frei" % (r, d), flush=True)
time.sleep(120)
name = os.path.join(HIER, "lbr-%s-%s" % (saat, deals))
if os.path.exists(name + ".json") and os.path.getsize(name + ".json") > 0:
sys.exit("Ergebnis %s.json liegt schon vor: nicht ueberschreiben (Regel 28.11.)" % name)
cmd = [EXE, "exploit-compact", "--target", F + "/weights/B-local-2e10.plcp", "--sizing", "local", "--buckets", F + "/data/buckets-200",
"--players", "6", "--iters", "0", "--threads", "4", "--mem-gb", "0.001", "--learner-sizing", "adversarial", "--eval-deals", "1",
"--players", "6", "--iters", "0", "--threads", os.environ.get("FAEDEN", "4"), "--mem-gb", "0.001", "--learner-sizing", "adversarial", "--eval-deals", "1",
"--seed", saat, "--lbr-deals", deals, "--out", name + ".json"]
t = time.time()
with open(name + ".log", "w", encoding="utf-8") as log:
p = subprocess.Popen(cmd, stdout=log, stderr=subprocess.STDOUT, creationflags=0x4000, cwd=F + "/code")
with open(name + ".log", "a", encoding="utf-8") as log:
p = subprocess.Popen(cmd, stdout=log, stderr=subprocess.STDOUT, creationflags=0x08000000 | 0x4000, cwd=F + "/code")
class Q(ctypes.Structure):
_fields_ = [(x, ctypes.c_ulong) for x in "VCM"]
+3 -1
View File
@@ -71,8 +71,10 @@ def main():
stopp = schutz_alle or schutz_lern or greift_nicht
z.append("Abbruch: %s" % ("ja (" + ("Schutz verletzt" if schutz_alle or schutz_lern else "Gedaechtnis greift nicht") + ")" if stopp else "nein"))
t = "\n".join(z)
with open(os.path.join(o, "auswertung.txt"), "w", encoding="utf-8", newline="\n") as f:
ziel = os.path.join(o, "auswertung.txt")
with open(ziel + ".tmp", "w", encoding="utf-8", newline="\n") as f: # Regel 28.11.: nie leeren, erst schreiben, dann umbenennen
f.write(t + "\n")
os.replace(ziel + ".tmp", ziel)
sys.stdout.reconfigure(encoding="utf-8")
print(t)
if "--abbruch" in sys.argv and stopp:
+16 -5
View File
@@ -10,6 +10,7 @@ Ausgabe je Arm wie tisch6 (an.jsonl, aus.jsonl), Auswertung und Abbruch alle `ta
Der Name endet auf nacht.py: der Waechter von pruef6 haelt den Lauf an, wenn Speicher fehlt oder ein Laeufer spielt.
"""
import argparse
import ctypes
import json
import os
import random
@@ -34,10 +35,19 @@ BOT = "5348415249000001" # feste Kennung des Bots (16 Hex, wie vw im L
SPEC = ("sechs100", "2000-600-400", "200", "sechs100-v2.bin", "genau")
def frei():
"""RAM und D: frei in GB, ohne Unterprozess (kein Fenster)."""
class M(ctypes.Structure):
_fields_ = [("l", ctypes.c_ulong), ("last", ctypes.c_ulong)] + [(x, ctypes.c_ulonglong) for x in ("tp", "ap", "tf", "af", "tv", "av", "ave")]
m = M()
m.l = ctypes.sizeof(M)
ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(m))
return int(m.ap / 2**30), int(shutil.disk_usage("D:/").free / 2**30)
def frei_gb():
o = subprocess.run(["powershell", "-NoProfile", "-c", "[int]((Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory/1MB)"],
capture_output=True, text=True).stdout.strip()
return int(o or 0)
r, d = frei()
return r if d >= 3 else 0
def daten_an(ordner):
@@ -71,7 +81,7 @@ def motor(ordner, arm, exe):
env.update(MOTOR_GEDAECHTNIS2="0", MOTOR_GEDAECHTNIS="0")
spiel, k2, km, datei, genau = SPEC
p = subprocess.Popen([ziel, "dienst", spiel, d, k2, km, os.path.join(d, datei), genau], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
env=env, text=True, encoding="utf-8", bufsize=1, creationflags=0x4000)
env=env, text=True, encoding="utf-8", bufsize=1, creationflags=0x08000000 | 0x4000)
T.ohne_eco(p)
return p
@@ -173,7 +183,8 @@ def main():
json.dump(zb, f)
os.replace(tmp, zpfad)
if (b + 1) % a.takt == 0:
r = subprocess.run([sys.executable, os.path.join(HIER, "auswertung.py"), o, "--abbruch"], capture_output=True, text=True, encoding="utf-8")
r = subprocess.run([sys.executable, os.path.join(HIER, "auswertung.py"), o, "--abbruch"], capture_output=True, text=True, encoding="utf-8",
creationflags=0x08000000)
print(time.strftime("%H:%M"), "Blatt", b + 1, r.stdout.strip().splitlines()[-1] if r.stdout.strip() else r.stderr[-200:], flush=True)
if r.returncode == 3:
print("Abbruch nach Karte", flush=True)