Files

55 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Parallel Programming I
> **Note:** this README was rewritten by an AI assistant (Particle-1) on the maintainer's behalf on 2026-12-01, by
> reading the ten folders and their reports. The code, reports and measurements are the maintainer's own work from
> 2021–2023; corrections welcome.
Programs and lab reports from CS 491, Parallel Programming, at NMSU. The code is C (plus Java for comparison
work), and the reports are kept alongside it because they contain the measurements: thread counts, matrix sizes,
timings, and several results that did not scale at all.
## What each folder demonstrates
| Folder | Topic |
| --- | --- |
| `Program1` | Threads and memory: the same work with unpadded, padded, array-based and mutex-protected access |
| `Program1_5` | Whether semaphores work across forked processes |
| `Program2` | Program1's tests again, plus shared memory |
| `javacount3openmp` | Counting digits of π with OpenMP, against the Java version for comparison |
| `while_loops` | OpenMP loop parallelism |
| `mpi_assignment` | MPI setup on a cluster head node, and a first parallel count |
| `cuda` | First CUDA kernel |
| `Gaussian_Elimination` | Parallel Gaussian elimination, forward elimination and back substitution measured separately |
| `final_assignment` | One problem (`count_threes`) solved in Java, C with OpenMP, MPI and CUDA, including a padded variant |
| `Midterm` | `gauss.c`, the closed-book version |
`notes.md` holds the lecture notes that made the difference between "the semaphore blocks" and "the semaphore
blocks because of X".
## The two worth reading
**Gaussian elimination** is the one where parallelism loses: forward elimination needs synchronisation and barely
improves with threads, while back substitution is embarrassingly parallel and does. The report shows both curves
side by side ([`Gaussian_Elimination/Report.md`](Gaussian_Elimination/Report.md)).
**The final assignment** is the same problem in four languages and three parallel models, which is the clearest
way to see what each model costs you ([`final_assignment`](final_assignment)).
## Building
Most folders have a `Makefile`:
```bash
cd Gaussian_Elimination && make && ./gaussian_elimination
cd final_assignment/mpi && make && mpirun -np 4 ./count_threes
cd final_assignment/cuda && make && ./cuda_test
```
MPI needs `mpicc`/`mpirun` and CUDA needs `nvcc`, so the parallel-only folders will not build on a machine without
them. The Java comparison code needs a JDK.
## Licence
MIT.