Files
VoxelForge/Standalone/Research/WorldAssemblerM3/Linux2/MeasureProcess.py
T
Fr0zkaandClaude Opus 5.5 303b7b9f24 wip(assembler): round L2 -- the cross-platform hash check can fail; FP contraction changes the world
Clang -ffp-contract=on/fast and GCC's default (fast) all change the density hash on the L1 view;
contraction off reproduces L1 (= Windows S13) at W1/W12. Seed sweep: 48 FloatingIslands seeds and
14 effective SurfaceWorld seeds (34 of 48 fell on a seed-independent cube) match across Clang/GCC
and W1/W12. Standalone gains --seed/--recipe/--render-distance-chunks (viewer + headless) and a
Windows replay script. Linux standalone workers get 32 MiB pthread stacks (TLS is 17.3 MiB/thread),
so no external stack limit is needed. No Core or world-output change; MSVC compile unverified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 18:18:34 +02:00

35 lines
1.4 KiB
Python

#!/usr/bin/env python3
"""Run one child and print its wait4 peak RSS under the Linux2 process limits."""
import os
import resource
import sys
import time
if len(sys.argv) < 2:
raise SystemExit("usage: MeasureProcess.py executable [arguments ...]")
address_limit, _ = resource.getrlimit(resource.RLIMIT_AS)
stack_limit, _ = resource.getrlimit(resource.RLIMIT_STACK)
if address_limit in (resource.RLIM_INFINITY, -1) or address_limit > 6 * 1024**3:
raise SystemExit("run under prlimit --as=6442450944")
if stack_limit in (resource.RLIM_INFINITY, -1) or stack_limit < 8 * 1024**2:
raise SystemExit("run with the ordinary process stack limit of at least 8 MiB")
if not os.sched_getaffinity(0).issubset(set(range(12))):
raise SystemExit("run under taskset -c 0-11")
print(f"[ProcessLimits] address_limit={address_limit} stack_limit={stack_limit} affinity={sorted(os.sched_getaffinity(0))}", flush=True)
started = time.monotonic()
pid = os.fork()
if pid == 0:
try:
os.execvp(sys.argv[1], sys.argv[1:])
except OSError as error:
print(f"MeasureProcess: exec failed: {error}", file=sys.stderr, flush=True)
os._exit(127)
_, status, usage = os.wait4(pid, 0)
wall = time.monotonic() - started
exit_code = os.waitstatus_to_exitcode(status)
print(f"[ProcessResources] exit_code={exit_code} wall_s={wall:.6f} peak_rss_kib={usage.ru_maxrss}")
raise SystemExit(exit_code)