First omp
This commit is contained in:
@@ -1,9 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# Configures CMake
|
||||
cmake -S . -B build
|
||||
# Compiles the program
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
# 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
|
||||
# Runs the program
|
||||
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
# RUN
|
||||
#---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
./build/panic
|
||||
Reference in New Issue
Block a user