This repository contains the scripts used to reproduce the performance benchmarks and (with access to the large CSZ dataset) the greedy sensor-selection application described in paper: "Sensor Placement for Tsunami Early Warning via Large-Scale Bayesian Optimal Experimental Design."
create_test_mat.py: create a synthetic 2D-chunked HDF5 matrix for scaling benchmarks.single_gpu_benchmark.py: single-GPU benchmark for naive vs Schur-update formulations.scaling_benchmark.py: multi-GPU benchmark with overlapped POSIX I/O + compute.run_scaling.sh: Slurm wrapper to run both strong + weak scaling.select_sensors.py: MPI greedy selection on an HDF5-backed CSZ (K) matrix (real dataset required).oed_hist.py: generate random-configuration baselines and (optionally) plot the histogram.d_opt_certificate.py/scripts/certify_d_optimality.py: a-posteriori optimality certificates for existing regular D-optimal designs.tests/test_certify_d_optimality.py: small CPU synthetic certificate tests.
Create an environment and install dependencies:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtFor parallel file systems, it is recommended to disable HDF5 file locking:
export HDF5_USE_FILE_LOCKING=FALSEpython create_test_mat.py --file dummy_data.h5 --total_candidates 600 --Nt 420 --precision doublepython single_gpu_benchmark.py --max_budget 400 --Nt 420 --file ablation_results_420_single.csvThe output CSV contains peak memory and time-per-iteration for:
- Naive formulation (out-of-place / in-place)
- Schur-update formulation (out-of-place / strict in-place)
This script assumes Slurm and srun. Provide the HDF5 file and the maximum rank count to test.
bash run_scaling.sh --data dummy_data.h5 --max-ranks 512Outputs are written under scaling_results/ by default (both strong and weak scaling CSVs).
To download the dataset, visit the HuggingFace repo and follow the instructions there.
With the real HDF5 (K) matrix available on a parallel filesystem, run the greedy selection via MPI. Example:
srun -n 16 python select_sensors.py cascadia_K_matrix.h5 175 \
--r_sq 1.0 \
--checkpoint_file cascadia_optimal_results.txtGenerate random baseline scores (MPI-capable; produces a single-column checkpoint file). This run skips plotting:
python oed_hist.py \
--h5_store_K cascadia_K_matrix.h5 \
--total_samples 100 \
--budget 175 \
--checkpoint_file random_results.txt \
--no_plotPlot histogram comparing random baselines to the greedy optimum:
python oed_hist.py \
--plot_only \
--checkpoint_file random_results.txt \
--optimal_file cascadia_optimal_results.txt \
--budget 175Given an existing ordered regular D-optimal selection (e.g. from Task 4) and the same HDF5 signal covariance, certify how close the design is to the globally optimal (k)-sensor design without enumerating all designs.
Noise convention matches select_sensors.py: the HDF5 file stores the signal
covariance (C), and the working data covariance is the isotropic model
[ K = r^2 C + I. ]
Reported values use the normalized expected information gain
(f(S)=0.5\log\det(K_S)) (since (R=I)). This is not the unnormalized
logdet column written in greedy checkpoint files, and it is not a posterior
trace / A-optimality metric.
Cheap certificate (default checkpoints (0) and (k)):
python scripts/certify_d_optimality.py cascadia_K_matrix.h5 \
--selection cascadia_optimal_results.txt \
--r_sq 1.0 \
--output_prefix certificates/cascadia_k175More expensive multi-checkpoint analysis (rescans remaining candidates at each prefix; dense schedules can approach the cost of re-running greedy):
python scripts/certify_d_optimality.py cascadia_K_matrix.h5 \
--selection cascadia_optimal_results.txt \
--r_sq 1.0 \
--checkpoint_stride 25 \
--output_prefix certificates/cascadia_stride25Outputs:
<prefix>_checkpoints.csv— per-checkpoint (f(S)), top-(k) remaining marginal sum, (U(S)), and running (U_{\mathrm{best}}).<prefix>_summary.json— machine-readable summary including certified ratio (f(S_{\mathrm{final}})/U_{\mathrm{best}}) and absolute gap bound.
Small CPU synthetic tests (no production dataset required):
python -m unittest tests.test_certify_d_optimality -vScope: regular D-optimality with independent isotropic sensor-noise blocks only.
Goal-oriented D-optimality and cross-sensor-correlated noise are rejected.
--r_sq is required and must match the value used to produce the selection.
- Large datasets (e.g., the CSZ (K) matrix) are intentionally not included in this repository.
- All scripts accept file paths via CLI arguments.