Introduction
In High-Performance Computing (HPC), the common assumption that "more threads equals better performance" often leads to inefficiencies. Over-provisioning threads in OpenMP regions can cause resource contention, while under-provisioning leaves hardware idle. While Machine Learning (ML) can automate thread tuning, it is frequently hampered by imbalanced datasets. This research, published in Computing (2023), proposes a methodology to build representative datasets of OpenMP code patterns and addresses the "natural imbalance" inherent in performance prediction.
Methodology: Building a Representative Pattern Collection
To overcome dataset redundancy, the authors developed a systematic approach to filter code kernels. Each candidate kernel is characterized by a "signature" of 18 hardware performance counters, including cache misses and branch instructions.
As shown in the workflow above, new kernels are compared against an existing collection using Spearman’s rank correlation and Kendall’s tau. If a kernel is highly correlated with existing patterns, it is discarded; otherwise, it is added to the collection to ensure diversity in the training set.
Addressing Natural Imbalance in HPC
Even with a balanced set of code patterns, the "best" thread count for a given kernel is often skewed toward specific values. This "natural imbalance" is a direct result of the underlying hardware architecture.
For instance, in the architecture depicted above, certain configurations (like utilizing all 12 cores) might be optimal for a large percentage of code regions, while others are rarely ideal. To handle this, the researchers evaluated several strategies, including SMOTE, cost-sensitive learning, and ensemble methods.
Key Insights and Results
The study yielded several critical findings:
- The Failure of SMOTE: Synthetic data generation (SMOTE) actually decreased accuracy, suggesting that the precise boundaries required for HPC tuning are blurred by artificial samples.
- One-Against-All Classification: The most effective model was a Random Forest using a "one-against-all" binary classification approach. This method treats each possible thread count as an independent binary question.
- High Accuracy: The pattern classification model achieved 98.93% accuracy. For thread prediction, the Random Forest binary classifier reached up to 96% accuracy for matrix multiplication and over 70% for most other classes.
Conclusion
By focusing on dataset balance at the pattern level and employing specialized classification strategies for imbalanced targets, this research provides a robust framework for OpenMP optimization. Future work will expand this methodology to include thread affinity and scheduling policies, further refining the automation of HPC performance tuning.
Summary updated