okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
150c2394f
main
1#!/bin/bash 2# The noise generator's proofs on a Linux box (TEST-ONLY). 3# run_linux.sh <repo root> <dir holding core/rng_philox.hpp> <tag> [seeds] [--make-table] 4# <repo root> holds tools/image/gate/noise (the proof programs) and tools/image/sdcpp_noise (the generator). Work files 5# go to ./noise-work-<tag>. Steps: apply.py --prepare writes the generator's files and the compiled-in table source; 6# --make-table (x86 glibc box only) first builds without the table (-DSTRATA_NOISE_NO_SIN_EXC), lists where glibc's sin 7# is not correctly rounded (check_domain glibc) and makes strata_sin_exc.bin from it. Then (always): build plain (-O3, 8# as sd.cpp's x86 build) and -march=native -ffp-contract=fast variants WITH the table, run the domain check and the 9# seed comparison. 10set -e 11ROOT =$( cd " $ 1 " && pwd ) ;REF =$ 2 ;TAG =$ 3 ;NS =${ 4 :-1000} 12GATE =$ ROOT /tools/image/gate/noise;PROD =$ ROOT /tools/image/sdcpp_noise 13W =$ PWD /noise-work-$ TAG 14mkdir -p " $ W /out" ;cd " $ W " 15g++ --version | head -1 ;uname -m 16CXX ="g++ -std=c++20 -O3 -DNDEBUG -pthread" 17python3 -I -B " $ PROD /apply.py" --prepare " $ W /inc" 18if [" $ 5 " ="--make-table" ];then 19echo "== pass 1: no table, the exhaustive list of glibc sin values that are not correctly rounded" 20$ CXX -DSTRATA_NOISE_NO_SIN_EXC -I " $ W /inc" " $ GATE /check_domain.cpp" -o out/check_notable 21time out/check_notable glibc 22python3 -I -B " $ GATE /make_sin_exceptions.py" exc_sin.txt 23python3 -I -B " $ PROD /apply.py" --prepare " $ W /inc" 24fi 25sha256sum " $ PROD /strata_sin_exc.bin" 26$ CXX -I " $ W /inc" " $ GATE /check_domain.cpp" -o out/check_plain 27$ CXX -march=native -ffp-contract=fast -I " $ W /inc" " $ GATE /check_domain.cpp" -o out/check_native 28$ CXX -DWITH_REF -I " $ W /inc" -I " $ REF " " $ GATE /seeds.cpp" -o out/seeds_plain 29$ CXX -march=native -ffp-contract=fast -I " $ W /inc" " $ GATE /seeds.cpp" -o out/seeds_native 30if [" $( uname -m ) " = x86_64 ];then 31echo "== domain, plain build with the table, against glibc" ;time out/check_plain glibc 32else 33echo "== domain, plain build with the table, hash only (this glibc is not the reference)" ;time out/check_plain hash 34fi 35echo "== domain, -march=native -ffp-contract=fast build, hash only" ;time out/check_native hash 36echo "== seeds 0..$(( NS -1)) + 5 edge seeds, n=262144, plain build (ref column = sd.cpp's header with plain flags ON THIS BOX)" 37time out/seeds_plain 0$ NS 262144> out/seeds_plain_$ TAG .txt;tail -1 out/seeds_plain_$ TAG .txt 38echo "== the same, -march=native -ffp-contract=fast build, ours only" 39time out/seeds_native 0$ NS 262144> out/seeds_native_$ TAG .txt;tail -1 out/seeds_native_$ TAG .txt 40echo "ours plain vs ours native, per-seed hashes equal: $( paste -d ' ' <( cut -d ' ' -f1,2 out/seeds_plain_ $ TAG .txt) <( cut -d ' ' -f2 out/seeds_native_ $ TAG .txt) | awk '$2==$3' | wc -l ) of $( wc -l < out/seeds_plain_ $ TAG .txt) " 41echo NOISE-OK