Baum-Kernel 560-620 GB/s, Blatt-Kernel (lange Kette) 17-82 GB/s = Engpass; Fassung 'quer' 1,5-7x schneller. Rust 2 Faeden Windows: 93,7 (klein) / 32,0 (motor) Lagen/s, ruhig geschaetzt 172 / 67,7. Ganzer Loeser (alter Blatt-Kernel): klein 910, motor 699 Lagen/s bei B=4096; Pruefung und Vorbereitung auf dem Wirt bremsen. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
54 lines
1.8 KiB
Python
54 lines
1.8 KiB
Python
"""Fremdlast auf der RTX 5080 erkennen und abwarten (der Rechner gehoert dem Owner: nichts beenden, nur warten).
|
|
|
|
pokerbench-gpu-probe.exe lauf.py gpu_ruhe.py [--sek 30] -> Auslastung alle 2 s und die Rechenprozesse auf der GPU
|
|
|
|
warte_ruhig(max_s, schwelle): wartet in Python, bis die Auslastung dreimal hintereinander unter der Schwelle liegt.
|
|
"""
|
|
import subprocess
|
|
import sys
|
|
import time
|
|
|
|
KEIN_FENSTER = (0x08000000 | 0x4000) if sys.platform == "win32" else 0
|
|
|
|
|
|
def _smi(*args):
|
|
return subprocess.run(["nvidia-smi", *args], capture_output=True, text=True, creationflags=KEIN_FENSTER, timeout=30).stdout
|
|
|
|
|
|
def auslastung():
|
|
"""(Auslastung in %, belegter Speicher in MiB) der GPU."""
|
|
u, m = _smi("--query-gpu=utilization.gpu,memory.used", "--format=csv,noheader,nounits").strip().split(",")
|
|
return float(u), float(m)
|
|
|
|
|
|
def rechenprozesse():
|
|
"""[(pid, Typ, sm-Auslastung, Name)] aus `nvidia-smi pmon` mit sm > 0."""
|
|
aus = []
|
|
for z in _smi("pmon", "-c", "1").splitlines():
|
|
t = z.split()
|
|
if len(t) >= 9 and t[0].isdigit() and t[3] not in ("-", "0"):
|
|
aus.append((int(t[1]), t[2], int(t[3]), t[-1]))
|
|
return aus
|
|
|
|
|
|
def warte_ruhig(max_s=600, schwelle=20.0, pause=2.0):
|
|
"""Gibt (ruhig, gewartete Sekunden, letzte Auslastung) zurueck."""
|
|
t0 = time.time()
|
|
folge = 0
|
|
u = None
|
|
while time.time() - t0 < max_s:
|
|
u, _ = auslastung()
|
|
folge = folge + 1 if u < schwelle else 0
|
|
if folge >= 3:
|
|
return True, time.time() - t0, u
|
|
time.sleep(pause)
|
|
return False, time.time() - t0, u
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sek = int(sys.argv[sys.argv.index("--sek") + 1]) if "--sek" in sys.argv else 30
|
|
t0 = time.time()
|
|
while time.time() - t0 < sek:
|
|
print(time.strftime("%H:%M:%S"), auslastung(), rechenprozesse(), flush=True)
|
|
time.sleep(2)
|