#!/bin/sh set -eu cd "$(dirname "$0")" export OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 MKL_NUM_THREADS=1 NUMEXPR_NUM_THREADS=1 export VECLIB_MAXIMUM_THREADS=1 BLIS_NUM_THREADS=1 PYTHONDONTWRITEBYTECODE=1 cc -std=c11 -O3 -Wall -Wextra -shared -fPIC -o nttconv.so nttconv.c python3 - <<'PY' from fractions import Fraction from pathlib import Path import subprocess import sys cases = ( ('m15_C32_N8k', '3.2311635', 'v2_m15_C32_N8k_M320k_final.out'), ('m1525_C337', '3.4017432', 'v2_m1525_C337_M320k.out'), ('m155_C39_N8k', '3.9331625', 'v2_m155_C39_N8k_M320k_final.out'), ) for name, outward, original in cases: result = subprocess.run([sys.executable, 'rverify2.py', name+'.json', '320000', outward], text=True, stdout=subprocess.PIPE, check=True) print(result.stdout, end='', flush=True) fraction_line = next(s for s in result.stdout.splitlines() if s.startswith('exact cap bound ')) archived = (Path('receipts')/original).read_text().splitlines() if fraction_line not in archived: raise RuntimeError('Exact cap changed for '+name) if not (Fraction(fraction_line.split()[-1]) < Fraction(outward) and any('PASS(cap<' in s and s.endswith('=True') for s in result.stdout.splitlines())): raise RuntimeError('Positivity or outward cap failed for '+name) PY