Files
panic/run.sh
T
2026-06-23 15:07:55 +02:00

49 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
#---------------------------------------------------------------------------------------------------------------------------
# RUN CONFIGURATION
#---------------------------------------------------------------------------------------------------------------------------
# First argument chooses build mode:
# ./run.sh -> serial build
# ./run.sh omp -> OpenMP build
#
# Second argument chooses number of OpenMP threads:
# ./run.sh omp 4 -> OpenMP build using 4 threads
#
# If thread count is 0, OpenMP chooses the default number of threads.
BUILD_MODE=${1:-serial}
OMP_THREADS=${2:-0}
#---------------------------------------------------------------------------------------------------------------------------
# CMAKE CONFIGURATION
#---------------------------------------------------------------------------------------------------------------------------
if [ "$BUILD_MODE" = "omp" ]; then
echo "Configuring PANIC with OpenMP enabled..."
echo "OpenMP threads: $OMP_THREADS"
cmake -S . -B build \
-DPANIC_ENABLE_OPENMP=ON \
-DPANIC_OMP_NUM_THREADS="$OMP_THREADS"
else
echo "Configuring PANIC without OpenMP..."
cmake -S . -B build \
-DPANIC_ENABLE_OPENMP=OFF \
-DPANIC_OMP_NUM_THREADS=0
fi
#---------------------------------------------------------------------------------------------------------------------------
# BUILD
#---------------------------------------------------------------------------------------------------------------------------
cmake --build build
#---------------------------------------------------------------------------------------------------------------------------
# RUN
#---------------------------------------------------------------------------------------------------------------------------
./build/panic