Coursework repository for ECE415 — High-Performance Computing at the University of Thessaly. The labs start with CPU-side profiling and loop-level optimization, then move through OpenMP, CUDA kernels, CUDA streams, memory-hierarchy tuning, and multi-GPU execution.
| Area | What is included |
|---|---|
| CPU optimization | Sobel edge-detection optimization with loop transformations, strength reduction, inlining, and serial/OpenMP comparisons. |
| OpenMP parallelism | K-Means clustering experiments using OpenMP constructs, SIMD, atomics, critical sections, and timing comparisons. |
| CUDA kernels | 2D convolution and CLAHE implementations covering block sizing, memory access patterns, streams, events, and profiling. |
| Final application | A galaxy-style N-body simulator with CPU, OpenMP, CUDA, stream, shared-memory, coarsening, multi-GPU, and divergence-reduction versions. |
The strongest part of the repository is Lab 5, where the final assignment builds an N-body simulator for independent galaxy-style particle systems. The lab starts from a sequential gravitational simulation and grows into a full CPU/OpenMP/CUDA performance study with multiple GPU implementations and correctness comparisons.
Key pieces of the Lab 5 implementation include:
- CPU and OpenMP baselines: sequential and OpenMP implementations provide reference outputs and performance baselines for the GPU work.
- CUDA optimization ladder: the GPU versions explore naive kernels, streams, Structure-of-Arrays layout, shared-memory tiling, fast math/FMA variants, thread coarsening, launch-bound tuning, divergence-reduction variants, and multi-GPU execution.
- Measurement workflow: run logs and CSV summaries are used to compare implementations with throughput plots instead of only raw terminal timings.
- Extra visualizer work: beyond the base simulator, the repository includes a custom dataset generator and an animation of the simulation output.
Lab handouts are collected under docs/handouts/. Recovered reports for Labs 1–5 are collected under docs/reports/
| Path | Topic | Implementation summary |
|---|---|---|
Lab1/ |
Sobel CPU optimization | Serial C optimization passes for Sobel edge detection, including loop interchange, unrolling, fusion, inlining, common-subexpression elimination, strength reduction, and OpenMP comparison. |
Lab2/ |
OpenMP K-Means | Parallel K-Means clustering with OpenMP, SIMD/critical/atomic experiments, timing scripts, and report plots. |
Lab3/ |
CUDA convolution | CUDA 2D convolution kernels covering block sizing, precision behavior, image padding, divergence effects, and runtime comparisons. |
Lab4/ |
CUDA CLAHE | Contrast Limited Adaptive Histogram Equalization with multiple kernels, privatized histograms, scans, coalesced memory access, streams, events, and profiling plots. |
Lab5/ |
N-body simulation | CPU, OpenMP, CUDA, stream, shared-memory, coarsening, multi-GPU, and divergence-reduction versions of a galaxy N-body simulator. |
- Linux environment
gccandmake- Python 3 for data generation and plotting scripts
- OpenMP-capable GCC
- NVIDIA CUDA toolkit (
nvcc) for Labs 3–5 - NVIDIA GPU hardware for CUDA execution
- Optional: NVIDIA Nsight Systems / Nsight Compute for profiling
Python plotting scripts use packages such as numpy, pandas, matplotlib, and seaborn.
Each lab keeps its own scripts and Makefiles. Typical entry points are:
cd Lab1 && ./run.sh
cd Lab2 && ./run.sh
cd Lab3 && ./run.sh
cd Lab4 && ./run.sh
cd Lab5 && ./run.sh --helpLab 5 examples:
cd Lab5
./run.sh --iterations=10 --cpu=omp --gpu=on --file=06_coarsening_2.cu --input=galaxy_data.bin
./run.sh --iterations=5 --cpu=seq --gpu=off --input=galaxy_data.bin
python3 generate_custom_dataset.py 1 4096 galaxy_1x4096.bin
