This repository contains a suite of programs for histogram analysis that demonstrate the use of parallel computing techniques in C++. The parallel implementations are derived from a sequential version provided by a parallel computing course and are designed to showcase different synchronization strategies.
Saleh Elkaza
The original sequential version of the histogram (histogram.cpp) was supplied by the course. The parallel versions created from this base include atomic operations, mutexes, and a hybrid approach for thread-safe updates to a shared histogram during large dataset processing.
The following versions are available in this repository:
histogram-atomic.cpphistogram-best.cpphistogram-mutex-per-bucket.cpphistogram-mutex.cpphistogram.cpp(Sequential baseline provided by the course)
To run any version of the histogram program, compile it using:
g++ -std=c++11 -pthread -o histogram <version>.cppAnd then execute it with appropriate arguments. For example:
./histogram --num-threads 32 --N 1000 --sample-size 30000000 --print-level 1The run-test.sh script facilitates automated testing across all versions for different histogram sizes. It measures and logs the performance of each version:
chmod +x run-test.sh
./run-test.shThis will output the execution times to performance_for_all_versions_results.csv for further analysis.