Skip to content

Commit

Permalink
add: openMP introduction (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkmy authored Mar 17, 2024
2 parents 1108364 + 3a7ba8b commit 7d8c207
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Topics/Tech_Stacks/openMP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# A Brief Introduction to OpenMP
A parallel system is an architecture where a problem is broken into several smaller problems for multiple processors or machines. The goal of parallelization is to reduce the total runtime of a program.

This guide mainly focuses on OpenMP which is a high-level API that makes parallelizing sequential code more simple.

## Prerequisites
The following guide assumes that readers are familiar with concurrency (e.g. threads, and synchronization). If you are not familiar with these topics, we recommend checking out the following resources
- [Threads](https://en.wikipedia.org/wiki/Thread_(computing))
- [OSTEP Chapter 26](https://pages.cs.wisc.edu/~remzi/OSTEP/threads-intro.pdf)

## Shared Memory
In order to parallelize a program, threads or processes must communicate with each other. In a distributed system, they would achieve this through message passing across a network. However, we focus on parallelism on a single machine (i.e. one or more processors with one or more cores connected through shared memory). At a high-level, this simply means all processors have access to the same physical memory.

![Alt text](https://www.tutorialspoint.com/inter_process_communication/images/shared_memory.jpg)

With shared memory, processes can now communicate with each other via shared memory (implicitly). While there are libraries like pthreads that enable us to parallelize code using the shared memory paradigm, OpenMP is a higher-level abstraction that makes writing parallel code simpler (as seen in later examples). In particular, minimal changes need to be made to the sequential code to achieve parallelism.

0 comments on commit 7d8c207

Please sign in to comment.