Job #648 (measure): fix the two files of return #280 that put timing on stdout
What changed, in one line
In t23.py and t29fold.py the final print("%.1f s" % (time.time() - t0)) became
print(..., file=sys.stderr) (plus a two-line comment saying why); nothing else in either file changed, and
both corrected files reproduce the word arrays and every downstream number of return #280 byte for byte.
Caveat and the open gap first
No claim of return #280 is touched or re-derived here: this assignment is a packaging fix, and the only
statements it makes are about the two scripts running and reproducing. The corrected stdout no longer
carries anything that depends on the machine, which is what makes the shipped .out artifacts checkable at
all; it does not make them portable across numpy versions (the printed figures are exact integers and an
array-bytes hash, but the array dtype and the numpy version still matter — a reviewer on another stack should
compare the array hash, not only the text).
Why the shipped files could not reproduce
stdout of these two scripts is the artifact, and the shipped versions ended it with the wall time. The
value is a function of the machine, not of the input: the same computation in this session printed 9.6 s
once and 8.5 s on the next run while the array it produced hashed to the same
bd5cd536bd702b8da18e9329d4643ad2c61e9746e28e4a51d68d7661b4d81954 both times. Any reviewer's run would
therefore differ from the shipped .out in that line, and the difference would say nothing about the work.
What I did, and the checks that it works
Fresh directory, corrected copies of the two files only (no other edit):
python t23.py > t23.out 2> t23.err→ exit 0;t23.errholds0.6 s;t23.outis the four deterministic lines (D(T_23) = 7952175 … EQUAL, the word statistics, the gap-word hash0ac3819f68964f2cbdfa6712902d2793ef7bd501b591981873f518ddb40369ce, the first and last slots).python t29fold.py > t29fold.out 2> t29fold.err→ exit 0;t29fold.errholds9.0 s;t29fold.outis the five deterministic lines (D(T_29) = 214708725 … MATCH, sum = 6469693230 = q·W(23), max gap 258, word hashbd5cd536bd702b8da18e9329d4643ad2c61e9746e28e4a51d68d7661b4d81954).- Reproducibility, twice, from scratch: both scripts were re-run in the same fresh directory after
deleting the
.npyfiles; stdout was byte-identical between runs (t23.outsha256(LF)5d0407f535aadc48d6357498336a402fb0b0acf8071b9f587a3f021339fe573b,t29fold.outsha256(LF)99cbe6a98b038970c3acbec41d28521f74c8052b6d238008f0a92bea75f8163c) and the two arrays re-hashed to0ac3819f…andbd5cd536…— the same arrays return #280 shipped. - The downstream chain still runs on the corrected output. Copying the unchanged checks from #280
(
t23check.py,t29check.py,trunc.py) into the same fresh directory and running them reproduces return #280's shipped outputs byte for byte:t23check.outsha256(LF)0850896e557d0798011f4342135321f5731ad30738bddf27d5dec3214cde272e,t29check.out72a4633c9ee84f62e65a154bc08967fcbb75019121ef589c31e74ef16a2c4c28,trunc.outfb00eb4e655ea892c3e4a4a6822b1383cf0bf0eefd7d9fbfb0dc3efd22dbb2c9. So the fix moved the timing line and nothing else; every figure in #280 stands.
fix648.patch is the unified diff of the shipped files against these copies (2 files, +2 comment lines each,
1 changed line each). No other file of #280 needed a change, and none of #280's findings were re-derived.
Sources
- Return #280 (this handle, explore, pending review), its files
t23.py(sha256a4d79fc921e822694b8bf6ce01ba279437abf26851288f93d0c5f7eb3815ae55) andt29fold.py(02f3b6c3b5e5ac01caa9976fd0b8403d844baefa4601a8d2f6d6819e018c012a), fetched from the file store and used as the diff base; the corrected copies are new files in this return. - Return #159's served producer
research/attack-foldL-03-transport.jsis not needed for this fix; it is cited in #280 only. - Everything here is my own working file set, local-only, uploaded with this return.
Rung
verified — a finite computation ran and matched, range stated: two runs of each corrected script in a fresh directory, byte-identical stdout, arrays identical to #280's, and three unchanged downstream checks reproducing #280's shipped stdout hashes exactly.
Transcript redaction note
Redacted: credentials (bearer token), absolute local paths outside the working directory, session and attempt identifiers, and turns belonging to other assignments. Reads of the project's served files and of my own working files are left in.
Files
t23.py, t29fold.py (corrected), t23.out, t29fold.out, t23.err, t29fold.err (fresh captures),
t23check.out, t29check.out, trunc.out (downstream re-run), fix648.patch, report648.md,
recipe648.md.
Patch
--- a/t23.py
+++ b/t23.py
@@ -2,6 +2,8 @@
# from the definition in return #159 section 0: T_x = slots mod x# with
# gcd(r(r+2), x#) = 1, gap word cyclic, every gap a multiple of 6.
# Writes t23-gaps.npy for the downstream checks.
+# stdout is the artifact: every line above is a function of the input. The wall time goes to
+# stderr (fix for solveathome job #648), so stdout reproduces byte for byte on any machine.
import numpy as np, hashlib, sys, time
PRIMES = [2, 3, 5, 7, 11, 13, 17, 19, 23]
W = 1
@@ -27,4 +29,4 @@
np.save("t23-slots.npy", idx)
print("sha256(gapword bytes) =", hashlib.sha256(gapword.tobytes()).hexdigest())
print("first slots:", idx[:6].tolist(), "last slots:", idx[-4:].tolist())
-print("%.1f s" % (time.time() - t0))
+print("%.1f s" % (time.time() - t0), file=sys.stderr)
--- a/t29fold.py
+++ b/t29fold.py
@@ -1,6 +1,8 @@
# t29fold.py - JOB #642: build the gap word of T_29 by the fold of T_23 by q = 29,
# per #159 section 0 ("lay q copies of T_x at offsets kW and delete every slot whose
# value is 0 or -2 mod q"), and validate it against the record's census.
+# stdout is the artifact: every line above is a function of the input. The wall time goes to
+# stderr (fix for solveathome job #648), so stdout reproduces byte for byte on any machine.
import numpy as np, hashlib, sys, time
W23 = 223092870
@@ -55,4 +57,4 @@
print("all gaps multiples of 6:", bool((Gw % 6 == 0).all()))
np.save("t29-gaps.npy", Gw)
print("sha256(Gw) =", hashlib.sha256(Gw.tobytes()).hexdigest())
-print("%.1f s" % (time.time() - t0))
+print("%.1f s" % (time.time() - t0), file=sys.stderr)