Mathe-Pruefung: am Mac lauffaehig (Pfade per Umgebung, Speicher, Prioritaet)
MATHE_LIVE / MATHE_DATEN / MATHE_POKERKIT ersetzen die festen D:-Pfade; freier Speicher auf macOS aus memory_pressure, nice 10 statt BelowNormal, EcoQoS nur unter Windows. Zeile a am Mac: a1 0,00007 bb (wie Windows), a2 20.000 Haende 0 Abweichungen gegen PokerKit 0.7.8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,10 +26,12 @@ import time
|
||||
|
||||
HIER = os.path.dirname(os.path.abspath(__file__))
|
||||
WURZEL = os.path.abspath(os.path.join(HIER, "..", "..", ".."))
|
||||
LIVE = r"D:\Projects\pokerfreak\.claude\worktrees\engine-lecks-angreifen-de7b88"
|
||||
DATEN = r"D:/Projects/pokerfreak/daten/grundstrategie/motor"
|
||||
POKERKIT = r"D:\Projects\fremd\pokerkit-dl\src\pokerkit-0.7.8"
|
||||
NO_WINDOW, BELOW = 0x08000000, 0x4000
|
||||
# Pfade fuer andere Rechner (Mac) per Umgebung: MATHE_LIVE, MATHE_DATEN, MATHE_POKERKIT
|
||||
LIVE = os.environ.get("MATHE_LIVE", r"D:\Projects\pokerfreak\.claude\worktrees\engine-lecks-angreifen-de7b88")
|
||||
DATEN = os.environ.get("MATHE_DATEN", r"D:/Projects/pokerfreak/daten/grundstrategie/motor")
|
||||
POKERKIT = os.environ.get("MATHE_POKERKIT", r"D:\Projects\fremd\pokerkit-dl\src\pokerkit-0.7.8")
|
||||
WINDOWS = os.name == "nt"
|
||||
NO_WINDOW, BELOW = (0x08000000, 0x4000) if WINDOWS else (0, 0)
|
||||
MOTOR_GB, FREI_GB = 9.7, 24.0
|
||||
|
||||
# Schwellen: VOR dem ersten Lauf festgelegt (Karte, Feld tor). Nicht nach einem Ergebnis verschieben.
|
||||
@@ -47,6 +49,11 @@ LBR_V2_27_11 = (22.63, 21.15, 24.11)
|
||||
|
||||
|
||||
def speicher_frei_gb():
|
||||
if not WINDOWS: # macOS: "System-wide memory free percentage" (memory_pressure) mal Gesamtspeicher, wie "verfuegbar" unter Windows
|
||||
t = subprocess.run(["memory_pressure"], capture_output=True, text=True).stdout
|
||||
prozent = int(t.rsplit("free percentage:", 1)[1].split("%")[0])
|
||||
gesamt = int(subprocess.run(["sysctl", "-n", "hw.memsize"], capture_output=True, text=True).stdout)
|
||||
return prozent / 100 * gesamt / 2 ** 30
|
||||
import ctypes
|
||||
|
||||
class M(ctypes.Structure):
|
||||
@@ -67,6 +74,8 @@ def spielt():
|
||||
|
||||
|
||||
def ohne_eco(p):
|
||||
if not WINDOWS:
|
||||
return
|
||||
import ctypes
|
||||
|
||||
class Q(ctypes.Structure):
|
||||
@@ -115,6 +124,8 @@ def motor_env(schalter, extra=None):
|
||||
|
||||
def start(cmd, env, log, **kw):
|
||||
f = open(log, "ab")
|
||||
if not WINDOWS:
|
||||
kw.setdefault("preexec_fn", lambda: os.nice(10)) # entspricht BelowNormal
|
||||
p = subprocess.Popen(cmd, env=env, stdout=f, stderr=subprocess.STDOUT, creationflags=NO_WINDOW | BELOW, **kw)
|
||||
ohne_eco(p)
|
||||
return p, f
|
||||
|
||||
Reference in New Issue
Block a user