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 10, 2026 at 21:46] – 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 type of software engineering where you use parallelism (more threads, more cores, more computers) to increase the amount of computation power against a given task. There are essentially three spheres of parallel computing: 1. CPU parallelism ([[openmp|OpenMP]]), | ||
| - | Generally speaking, the potential speed up you'd get by parallelizing increasing $N$ cores is governed by Amdahl' | + | **[Parallel computing](https:// |
| - | $$S(\text{N}) = \frac{1}{(1 - P) + \frac{P}{N}}$$ | + | |
| - | ## List of parallel computing | + | [[amdahls-law|Amdahl' |
| + | |||
| + | ## Example | ||
| + | |||
| + | This example shows a simple | ||
| + | |||
| + | ```c | ||
| + | // compile: gcc -fopenmp -o parallel parallel.c | ||
| + | // run: ./ | ||
| + | // 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; | ||
| + | } | ||
| + | ``` | ||
| - | - [[openmp]] | ||
| - | - [[mpi]] | ||
| - | - [[cuda]] | ||
parallel-computing.1781127984.md.gz · Last modified: by Ivan Janevski
