
Parallel Performance Analysis with OpenMP
Overview
In this research, I used OpenMP on a Linux system to assess the scalability of two parallel applications, Knapsack Parallel and Scale. The Scale program is a highly parallel benchmark that assesses how well work may be divided among several processor cores with minimal inter-thread dependencies. The Knapsack Parallel program is a parallel implementation of the traditional 0/1 Knapsack optimization problem, which aims to find the most useful set of things that can fit in a certain space. The knapsack approach has sequential dependencies that make it more challenging to parallelize effectively than the Scale benchmark.
Tools and Technologies Used
-
C++
-
OpenMP
-
GCC Compiler
-
Linux
-
Brooks Computing Cluster
-
Performance Benchmarking
-
Speedup Analysis
-
Amdahl's Law
-
Data Visualization
Measuring the impact of increasing the number of threads on program performance and comparing the observed speedup to optimal linear scalability were the goals. I examined how workload characteristics affect parallel efficiency by gathering execution durations, computing speedup, making performance graphs, and using Amdahl's Law. My knowledge of parallel programming, performance benchmarking, scalability analysis, and multi-threaded computing has improved as a result of this project.
Speedup
The primary metric used to measure parallel performance was speedup, which compares the execution time of a single-threaded program to the execution time using multiple threads.

Where:
T₁ = execution time using one thread
Tₙ = execution time using n threads
Parallel Efficiency
Efficiency measures how effectively the available processor threads are being utilized.

Amdahl's Law
Amdahl's Law predicts the maximum theoretical speedup that can be achieved based on the portion of a program that can be executed in parallel.

Where:
S(N) = theoretical speedup
P = parallel portion of the program
N = number of processor thread
Key Steps
1. Compile and Execute the Parallel Programs
I began by using GCC with OpenMP support to compile the Scale and Knapsack Parallel programs. I used thread counts varying from 1 to 256 to run each program several times after it was built. This gave me the information I needed to assess how effectively each program scaled when more CPU cores were employed and enabled me to gather execution times for every configuration.

2. Calculate Speedup and Compare to Ideal Scalability
I used the Speedup equation to determine the speedup for each thread count after gathering the execution timings. The ideal scalability line, which states that twice the number of threads should ideally double performance, was then compared to my measured results.
I was able to see how effectively each application used more processing cores by plotting both the observed and ideal speedup curves. This comparison made it simpler to determine when algorithmic or hardware limits caused performance advances to plateau.


3. Analyze the Performance of the Scale Benchmark
I examined the Scale benchmark's scalability after figuring out the speedup numbers. As more threads were added, the software demonstrated outstanding scalability due to the highly parallel workload. Up until about 128 threads, performance kept getting better, and the program reached a speedup of roughly 57.49×. However, performance dropped when the number of threads was raised to 256 because the complexity associated with thread management outweighed the advantages of having more parallel workers.
4. Analyze the Performance of the Knapsack Parallel Program
I conducted the same analysis on the Knapsack Parallel program after assessing the Scale benchmark. The knapsack algorithm has parts that must run sequentially and cannot be fully parallelized, in contrast to the Scale benchmark.With about 32 threads, the program reached its maximum speedup of about 11.33×. After this, performance steadily declined as more threads yielded diminishing returns. Because synchronization expense outweighed the advantages of parallel execution, the parallel implementation became slower than the single-threaded version at 256 threads.This comparison illustrated the difficulties in parallelizing optimization issues with sequential dependencies and showed how method choice directly impacts scalability.


Results, Analysis, and Further Reading
This project showed that performance is not always improved by increasing the number of processor threads. Because the majority of the Scale benchmark's workload could be carried out independently across several processor cores, it demonstrated exceptional scalability. On the other hand, because parts of the algorithm remained sequential and required thread synchronization, the Knapsack Parallel program encountered decreasing returns.
I was able to better grasp how workload characteristics, algorithm design, and hardware constraints affect parallel performance by calculating speedup, comparing measured performance with ideal scalability, and using Amdahl's Law. My abilities in OpenMP programming, performance analysis, benchmarking, and assessing the scalability of multi-threaded programs have all improved as a result of this project.