diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..edc46f3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or distribute this +software, either in source code form or as a compiled binary, for any purpose, +commercial or non-commercial, and by any means. + +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and to +the detriment of our heirs and successors. We intend this dedication to be an +overt act of relinquishment in perpetuity of all present and future rights to +this software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/README.md b/README.md index 0dd8fed..7e4268d 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,49 @@ # Parallel Programming I -These are the programs and lab reports i did for Cooper's Parallel Programming class. +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. -## Folders +## What each folder demonstrates -- Program1 - - First program demonstrating how threads behave depending on how they access the memory -- Program1_5 (Program 1.5) - - Small test to demonstrate if semaphores will work with forked processes. -- Program2 - - Has the same structure and tests ar program 1 but does it with shared memory as well. -- +| 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 + +Unlicense — it is coursework, do what you like with it.