parallel-computing
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| parallel-computing [June 15, 2026 at 09:32] – Ivan Janevski | parallel-computing [August 22, 2026 at 15:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| # Parallel computing | # Parallel computing | ||
| - | **Parallel computing** is a style of programming where a computation is broken into parts that run simultaneously across multiple processors, cores, or machines. The motivation is straightforward: | ||
| - | Not every program benefits equally. [[amdahls-law|Amdahl' | + | **[Parallel computing](https:// |
| - | ## Map of parallel computing | + | [[amdahls-law|Amdahl' |
| + | ## Example | ||
| - | 1. [[amdahls-law|Amdahl' | + | This example shows a simple parallel computation using OpenMP. |
| - | 2. [[gustafsons-law|Gustafson' | + | |
| - | 3. [[roofline-model|Roofline model]] | + | |
| - | 4. [[openmp|OpenMP]] | + | |
| - | 5. [[mpi|MPI]] | + | |
| - | 6. [[saxpy|SAXPY]] | + | |
| - | 7. [[semaphore|Semaphore]] | + | |
| - | 8. [[lock-free-queue|Lock-free queue]] | + | |
| - | 9. [[aba-problem|ABA problem]] | + | |
| - | 10. [[trace-monoid|Trace monoid]] | + | |
| - | 11. [[numbers-every-programmer-should-know|Numbers every programmer should know]] | + | |
| + | ```c | ||
| + | // compile: gcc -fopenmp -o parallel parallel.c | ||
| + | // run: ./parallel | ||
| + | // description: | ||
| + | |||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | int main() { | ||
| + | int arr[100]; | ||
| + | for (int i = 0; i < 100; i++) arr[i] = i; | ||
| + | | ||
| + | int sum = 0; | ||
| + | #pragma omp parallel for reduction(+: | ||
| + | for (int i = 0; i < 100; i++) { | ||
| + | sum += arr[i]; | ||
| + | } | ||
| + | | ||
| + | printf(" | ||
| + | return 0; | ||
| + | } | ||
| + | ``` | ||
parallel-computing.1781515969.md.gz · Last modified: by Ivan Janevski
