#!/bin/bash set -e # Go to project root (directory of this script) SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" # === 1. Configure + build in ./build === if [ ! -d build ]; then mkdir build fi cd build # Configure (safe to re-run; does nothing if already configured) cmake .. # Build tests target (incremental; only recompiles changed files) cmake --build . --target tests cd "$SCRIPT_DIR" # === 2. Load OpenMP config from omp.cfg === if [ -f omp.cfg ]; then # Export all non-comment, non-empty lines as env vars export $(grep -v '^[[:space:]]*#' omp.cfg | grep -v '^[[:space:]]*$' | xargs) fi # Optional: show what we're using echo ">>> Using OpenMP settings:" echo " OMP_PROC_BIND=${OMP_PROC_BIND}" echo " OMP_PLACES=${OMP_PLACES}" echo " OMP_MAX_ACTIVE_LEVELS=${OMP_MAX_ACTIVE_LEVELS}" echo " OMP_NUM_THREADS=${OMP_NUM_THREADS}" echo " OMP_DYNAMIC=${OMP_DYNAMIC}" echo " OMP_SCHEDULE=${OMP_SCHEDULE}" echo " OMP_DISPLAY_ENV=${OMP_DISPLAY_ENV}" # === 3. Run tests === ./build/tests "$@"