diff --git a/examples/cuda-fanout/gpu-worker.lsp b/examples/cuda-fanout/gpu-worker.lsp index 541f23a..1236a00 100644 --- a/examples/cuda-fanout/gpu-worker.lsp +++ b/examples/cuda-fanout/gpu-worker.lsp @@ -419,9 +419,7 @@ (if (file-exists? out-path) (delete-file out-path)) (list 'error (list 'daemon-failed (cdr status)))) (else - (let* ((sample (read-binary-file-prefix out-path 76)) ; 4+4+4 hdr + 64 first pt - (sample-hex (sample-x-hex sample)) - (gpu-sec (/ gpu-ms 1000.0)) + (let* ((gpu-sec (/ gpu-ms 1000.0)) (gpu-rate (cond ((> gpu-sec 0) (/ count gpu-sec 1000000.0)) (else 0))) (cpu-rate *cpu-secp256k1-rate-mkeys-per-sec*) @@ -443,53 +441,7 @@ (list 'gpu-mkeys-per-sec gpu-rate) (list 'cpu-rate-mkeys-per-sec cpu-rate) (list 'cpu-est-sec cpu-est-sec) - (list 'speedup-est speedup) - (list 'sample-x sample-hex))))))))))))) - -;; read first N bytes of file as a binary string. Used to peek at the -;; BSCR header + first output point without slurping the whole result -;; file (which is 64 * count bytes for large counts). -(define (read-binary-file-prefix path n) - (let* ((port (open-input-file path)) - (acc (read-string-bytes port n))) - (close-port port) - acc)) - -;; read up to n bytes from input port — falls back through read-char -;; on tiers where bulk read isn't a primitive. Returns a string of -;; whatever was available (may be shorter than n at EOF). -(define (read-string-bytes port n) - (let loop ((i 0) (acc '())) - (cond - ((>= i n) (apply string-append (reverse acc))) - (else - (let ((c (read-char port))) - (cond - ((eof-object? c) (apply string-append (reverse acc))) - (else (loop (+ i 1) (cons (string c) acc))))))))) - -;; Extract the X coordinate of the first output point from a BSCR -;; prefix as a 64-char hex string. BSCR layout: "BSCR"(4) status(4) -;; n(4) point0_x(32) point0_y(32) ... — so x bytes are at offset 12. -;; Returns "(unavailable)" if the prefix is too short. -(define (sample-x-hex bytes) - (cond - ((< (string-length bytes) 44) "(unavailable)") - (else - (let loop ((i 12) (end 44) (acc '())) - (cond - ((>= i end) (apply string-append (reverse acc))) - (else - (let* ((b (char->integer (string-ref bytes i))) - (hi (quotient b 16)) - (lo (remainder b 16))) - (loop (+ i 1) end - (cons (string (hex-digit hi) (hex-digit lo)) acc))))))))) - -(define (hex-digit n) - (cond - ((< n 10) (integer->char (+ n (char->integer #\0)))) - (else (integer->char (+ (- n 10) (char->integer #\a)))))) + (list 'speedup-est speedup))))))))))))) ;;; -- op handler -- health -------------------------------------- ;;;