#!/bin/bash # All runs of q3_check for IIS-Q-0003 from one binary: phase 1 (the tables and the structured cases) # and phase 2 (random matrices and local search). run_third.sh runs the third-party solvers # (phase 3) with the same binary. Clean environment: lean_env.sh sets the variables and removes # the variables that can hold a secret. # usage (from the root of the workspace): /bin/bash -c '. work/lean_env.sh && bash work/capset/q0003/run_all.sh' W=$(cd "$(dirname "$0")/../../.." && pwd) # the root of the workspace; this script is in work/capset/q0003 D=$W/work/capset/q0003 Q=$D/q3_check L=$D/logs mkdir -p "$L" IDENTITY=100000010000001000000100000010000001 run() { # name, command... local name=$1; shift { echo "start $(date -u +%Y-%m-%dT%H:%M:%SZ)"; /usr/bin/time -p "$@"; echo "exit $?"; echo "end $(date -u +%Y-%m-%dT%H:%M:%SZ)"; } > "$L/$name.log" 2>&1 } { echo "start $(date -u +%Y-%m-%dT%H:%M:%SZ)" echo "source sha256 $(shasum -a 256 "$D/q3_check.c" | cut -d' ' -f1)" echo "binary sha256 $(shasum -a 256 "$Q" | cut -d' ' -f1)" "$Q" dump236 > "$L/q3_dump236.txt" echo "dump236 sha256 $(shasum -a 256 "$L/q3_dump236.txt" | cut -d' ' -f1)" if cmp -s "$L/q3_dump236.txt" "$W/work/capset/cap236.txt"; then echo "dump236 is identical to work/capset/cap236.txt"; else echo "dump236 DIFFERS from work/capset/cap236.txt"; fi } > "$L/q3_all_run.log" 2>&1 # phase 1 : the tables (12 processes), the signed permutations, the facts and the structured cases bash "$D/run_tables.sh" & TP=$! run q3_mono_L0 "$Q" mono 0 & run q3_mono_L1 "$Q" mono 1 & run q3_facts /bin/bash -c "$Q facts 0; $Q facts 1" for LAYER in 0 1; do run "q3_cross_L$LAYER" "$Q" cross "$LAYER" run "q3_one_identity_L$LAYER" "$Q" one "$LAYER" "$IDENTITY" 0 2000 M0=$("$Q" mono "$LAYER" 0) run "q3_one_overlap0_L$LAYER" "$Q" one "$LAYER" "$M0" 0 2000 done wait "$TP" python3 -I "$D/collect_tables.py" "$L" > "$L/q3_tables_collected.log" 2>&1 echo "phase 1 complete $(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$L/q3_all_run.log" # phase 2 : the local search, 3 million random matrices for each layer, the samples with candidates for LAYER in 0 1; do run "q3_climb_L$LAYER" "$Q" climb "$LAYER" 11 400 20000 & for SEED in 5 6 7; do run "q3_pairs_L${LAYER}_S$SEED" "$Q" pairs "$LAYER" "$SEED" 500000 & done run "q3_hunt_L$LAYER" "$Q" pairs "$LAYER" 41 1000000 0 2 2000 1 & done wait for LAYER in 0 1; do python3 -I "$D/q3_crosscheck.py" "$L/q3_hunt_L$LAYER.log" "$LAYER" > "$L/q3_crosscheck_L$LAYER.log" 2>&1 & done wait { echo "phase 2 complete $(date -u +%Y-%m-%dT%H:%M:%SZ)"; echo "end $(date -u +%Y-%m-%dT%H:%M:%SZ)"; } >> "$L/q3_all_run.log"