Skip to content

Instantly share code, notes, and snippets.

@rajesh-s
Last active July 21, 2025 21:02
Show Gist options
  • Save rajesh-s/a61cdbd952e9d7fdb7340eb7eed207fa to your computer and use it in GitHub Desktop.
Save rajesh-s/a61cdbd952e9d7fdb7340eb7eed207fa to your computer and use it in GitHub Desktop.
run_stream
#!/bin/bash
# Thread counts to test
THREAD_COUNTS=(8 16 32 64 72)
# Clone STREAM repo if not already present
if [ ! -d "STREAM" ]; then
git clone https://github.com/rajesh-s/STREAM.git
fi
cd STREAM || exit 1
# Compile STREAM binary
gcc -O stream.c -o stream -O2 -mcmodel=large -fopenmp -fno-PIC \
-DSTREAM_ARRAY_SIZE=400000000 -DNTIMES=100 -DSTREAM_TYPE=double \
-mno-outline-atomics -mcpu=native
# Create a directory for logs
mkdir -p ../stream_logs
# Run STREAM for each thread count and save full output
for threads in "${THREAD_COUNTS[@]}"; do
echo "Running with OMP_NUM_THREADS=$threads..."
export OMP_SCHEDULE=static
export OMP_PROC_BIND=TRUE
export OMP_DYNAMIC=FALSE
export OMP_NUM_THREADS="$threads"
LOGFILE="../stream_logs/stream_output_${threads}.log"
./stream > "$LOGFILE" 2>&1
echo "Output saved to $LOGFILE"
done
echo "✅ All runs complete. Logs saved in ./stream_logs/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment