Four parallel programs in C and C++, each using a different parallel model, all built and benchmarked on the Grace supercomputer at Texas A&M HPRC through SLURM. The main project is a CUDA Cholesky factorization on an NVIDIA A100.
| Project | Model | Hardware on Grace | Headline result |
|---|---|---|---|
| GPU Cholesky factorization | CUDA C++ | NVIDIA A100 (108 SMs) | 5,889× over a single-thread kernel at n = 4096 |
| Hypercube quicksort | MPI, C++ | 64 ranks across 16 nodes | 34.9× on 64 ranks; sorts 1.31 billion ints with 73% weak-scaling efficiency |
| Parallel merge sort | POSIX threads, C | 48-core node | 25×, sorting 268M ints in 38.7 s → 1.54 s |
| Strassen matrix multiply | OpenMP tasks, C++ | 48-core node | 23.4×, 16384² multiply in 22.5 min → 58 s |
Skills: C · C++ · CUDA · NVIDIA A100 (sm_80) · MPI (Intel MPI) · OpenMP · POSIX threads · SLURM · Lmod · Intel oneAPI (icx/icpx/mpiicpx) · nvcc · Linux · Bash · Python (pandas, matplotlib)
Course projects from CSCE 735 Parallel Computing, Texas A&M University (Spring 2026).
Factors a symmetric positive definite matrix A into an upper-triangular R such that A = Rᵀ·R. The factorization costs O(n³/3) flops and dominates the cost of solving Ax = b, which makes it a natural target for GPU acceleration.
The right-looking algorithm processes columns k = 0 … n-1 in order, because each step needs the pivot the previous step produced. Within one step, though, almost every element can be updated independently. Each step therefore runs as three kernels (cholesky_gpu.cu):
__global__ void cholesky_pivot(double *A, int k, int n) { // <<<1, 1>>>
A[k*n + k] = sqrt(A[k*n + k]);
}
__global__ void cholesky_scale_and_zero(double *A, int k, int n) { // 1D grid
int idx = k + 1 + blockIdx.x * blockDim.x + threadIdx.x;
if (idx >= n) return;
A[k*n + idx] /= A[k*n + k]; // scale row k by the pivot
A[idx*n + k] = 0.0; // zero column k below the diagonal
}
__global__ void cholesky_update(double *A, int k, int n) { // 2D grid of B×B blocks
int i = k + 1 + blockIdx.y * blockDim.y + threadIdx.y;
int j = k + 1 + blockIdx.x * blockDim.x + threadIdx.x;
if (i >= n || j >= n) return;
A[i*n + j] -= A[k*n + j] * A[k*n + i]; // rank-1 update, one thread per element
}- Stream ordering in place of a grid-wide barrier. The update kernel reads what the scale kernel just wrote, so the steps need a global barrier between them. CUDA has no grid-wide
__syncthreads()without cooperative groups and a special launch path. Launching the kernels in order on the default stream gives the same guarantee, because launchi+1starts only after launchifinishes. That costs3nlaunches in total, which is negligible forn ≳ 64. - Flat row-major device memory. The starter code kept a row-pointer array (
double**) on the device. Replacing it with one contiguouscudaMallocbuffer indexed asA[i*n + j]removes a dependent load per access and the kernel that used to build the pointer table. - 2D grid sized to the shrinking submatrix. Each step launches a
dim3grid ofceil((n-k-1)/B)²blocks. Forn = 4096,B = 16, the first step launches 65,536 blocks of 256 threads, enough to keep all 108 SMs busy. - CUDA runtime work in the host code. It allocates and copies with
cudaMalloc/cudaMemcpyand checks errors on every API call and after each launch (cudaGetLastError). It also queries the device (cudaGetDeviceProperties), times withcudaEventaround the kernel loop only so PCIe transfers are excluded, and runs a built-inRᵀ·R ≈ Acheck within1e-8. All 32 timed runs passed the check.
| n | single-thread kernel (ms) | parallel, B = 16 (ms) | speedup |
|---|---|---|---|
| 64 | 7.40 | 0.62 | 11.9× |
| 256 | 447.25 | 3.71 | 120.4× |
| 1024 | 25,836.68 | 18.99 | 1,360.5× |
| 2048 | 233,688.00 | 71.13 | 3,285.3× |
| 4096 | 2,343,337.00 | 397.91 | 5,889.1× |
Block size and warp occupancy (n = 4096):
| B (block = B×B threads) | 2 (4) | 4 (16) | 8 (64) | 16 (256) | 32 (1024) |
|---|---|---|---|---|---|
| time (ms) | 4,378 | 1,181 | 400 | 380 | 337 |
The elbow sits at B = 8. With B < 8 the block width is under 32 threads, so each row of the block fills only part of a warp and most SIMT lanes sit idle. Past that point the gains level off.
About the baseline: the reference is one GPU thread (
<<<1,1>>>) in the same binary on the same GPU. The speedups measure how well the work is parallelized, not how this code compares with cuSOLVERpotrf.
Next steps: a tiled version that stages B×B tiles in __shared__ memory, coalesced loads of row k, capturing the loop in a CUDA Graph to cut launch overhead, and a benchmark against cusolverDnDpotrf.
Raw data: cholesky_gpu.csv · job log: cholesky_gpu.out · write-up: report.pdf
Parallel quicksort on a d-dimensional hypercube of MPI ranks. In each of the d rounds, every rank in a subcube computes the same pivot, the mean of the local medians, with MPI_Allreduce on a sub-hypercube communicator. Every rank then partitions its local list and swaps one half with its neighbor across dimension k (my_id ^ (1 << (k-1))), using MPI_Send/MPI_Recv. When all rounds finish, the list is globally sorted across ranks in rank order.
What I did:
- Descending-order variant (
qsort_hypercube_descending.cpp): reversed the partition predicate and the merge comparator, and swapped which half each neighbor keeps. I also rewrote the distributed correctness check, which passes each rank's boundary element down the chain (INT_MAXsentinel in place of-1) so the global order can be verified. - Scaling study on up to 16 Grace nodes:
--nodes=16 --ntasks-per-node=4, built with Intel MPI (mpiicpx), with every run appending to a CSV (run_qsort.sbatch).
| Ranks | 1 | 2 | 4 | 8 | 16 | 32 | 64 |
|---|---|---|---|---|---|---|---|
| Strong scaling: 20.48M ints total (s) | 1.637 | 0.825 | 0.432 | 0.220 | 0.120 | 0.074 | 0.047 |
| speedup | 1.0× | 2.0× | 3.8× | 7.4× | 13.6× | 22.2× | 34.9× |
| Weak scaling: 20.48M ints per rank (s) | 1.636 | 1.697 | 1.813 | 1.913 | 2.026 | 2.117 | 2.240 |
In the weak-scaling run the problem grows 64× (to 1.31 billion integers) while runtime grows only 37%, which is 73% efficiency. Time rises by about the same amount each time the rank count doubles, which matches the log p communication rounds of the hypercube.
Turned a serial iterative merge sort into a shared-memory parallel sort with POSIX threads (sort_list.c):
- Local sort phase: each of the
p = 2^qthreads runsqsorton its ownn/pslice. - Parallel merge phase: at each of the
qmerge levels, a thread finds each of its elements' final position by binary search into the partner block (binary_search_lt/_le, which break ties so equal keys never collide), then scatters the element straight into the output buffer. No thread has to wait for a single serial merge. - Synchronization: a
pthread_barrier_tseparates local sort from merging, and scatter from copy-back at every level, with no locks on the data itself.
Results with n = 2²⁸ (268,435,456 ints) on a 48-core Grace node, built with icx -O3 -lpthread:
| Threads | 1 | 2 | 4 | 16 | 64 | 256 | 1024 |
|---|---|---|---|---|---|---|---|
| time (s) | 38.66 | 20.50 | 10.53 | 3.01 | 1.54 | 1.76 | 1.82 |
| speedup | 1.0× | 1.9× | 3.7× | 12.8× | 25.1× | 22.0× | 21.3× |
Scaling is nearly linear up to 16 threads. It peaks at 64 threads, just above the node's 48 physical cores. Beyond that, oversubscription, barrier cost and memory bandwidth start to dominate. For small inputs (n = 2¹²), threading is slower than serial because thread creation and barriers cost more than the work.
Parallelized recursive Strassen multiplication by running its 7 sub-products as OpenMP tasks (strassen_omp_202611.cpp):
#pragma omp task shared(M1, M1a, M1b) if(n > TASK_CUTOFF)
M1 = Matrix::strassens_product(M1a, M1b);
// ... M2 … M7 likewise ...
#pragma omp taskwait- A single thread starts the recursion (
#pragma omp parallel+#pragma omp single). The task tree then expands to 7, 49, 343 … tasks, which the OpenMP runtime spreads over the thread pool. - The
if(n > TASK_CUTOFF)clause (cutoff 512) runs small subproblems inline, which stops task-creation overhead from swamping the work near the leaves. - The leaf size
2^q, where recursion switches to standard multiplication, was swept as a tuning knob alongside thread count. Results are checked against standardO(n³)multiplication.
Results with n = 2¹⁴ (16384 × 16384) on a 48-core Grace node, built with icpx -qopenmp:
| Threads | 1 | 4 | 16 | 48 |
|---|---|---|---|---|
| time (s), leaf 32×32 (q = 5) | 1,351.97 | 366.41 | 108.18 | 57.71 |
| speedup | 1.0× | 3.7× | 12.5× | 23.4× |
The leaf size matters as much as the thread count. On one thread, an 8×8 leaf took 2,653 s, while a 32×32 leaf took 1,352 s. Recursing too deep pays for allocation and matrix additions without saving any multiplications.
Every experiment runs as one reproducible sbatch job that compiles on the compute node, sweeps the parameters, and writes a CSV keyed on $SLURM_JOB_ID.
| Project | Toolchain (Lmod) | SLURM resources | Job script |
|---|---|---|---|
| CUDA Cholesky | module load intel CUDA, nvcc -O3 -gencode … sm_80 |
--gres=gpu:a100:1 --exclusive |
run_cholesky.sbatch |
| MPI quicksort | module load intel, mpiicpx |
--nodes=16 --ntasks-per-node=4 --exclusive |
run_qsort.sbatch |
| pthreads merge sort | module load intel, icx -O3 -lpthread |
--cpus-per-task=48 |
grace_job.hw2_all.sbatch |
| OpenMP Strassen | module load intel, icpx -qopenmp |
--cpus-per-task=48, OMP_NUM_THREADS sweep |
run_strassen.sbatch |
Practices common to all four jobs:
- Exclusive nodes for timing, so other jobs on the node can't distort the measurements.
- Code built for several GPU architectures (
sm_75andsm_80machine code pluscompute_80PTX). This avoids "no kernel image" and PTX-JIT failures when a job lands on a different GPU, or on a node whose driver is older than the login node's toolkit. - Experiments ordered around the wall-clock limit. Fast sweeps run first, and long serial baselines run last, so a timeout never loses finished results.
- A correctness check on every timed run. Failed runs are written to the CSV as
FAILand never mixed in with real timings.
# CUDA locally
nvcc -O3 -arch=sm_80 -o cholesky_gpu major-project/cholesky_gpu.cu && ./cholesky_gpu 2048 16 parallel
# Any project on Grace
sbatch major-project/run_cholesky.sbatchAlso in this repo: miniproject/, an architecture comparison of El Capitan (AMD MI300A APUs) and Fugaku (Fujitsu A64FX, ARM) from the TOP500 list.







