Shared Memory System
What is lock on synchonrization?
A lock implies a memory fence of all thread-visible variables Prevents Race Condition
Distribution of Work on Sections
Barrier is implemented automatically after each section, however, you can ignore it by adding nowait at the end
What is Cache Coherence?
Cache Coherence is when two processor access same memroy and operate read and write. The overlap will occur and replacing the value with something different than intended.
Distribution of Work on Parallel for
Distributes iterations among threads and statement must be provided in canonical shape
What is False Sharing?
False Sharing happens due to cache line length. It is not producing false result it means retreving data again. This can be solved by applying padding to variable that fits cache line.
Process of Tiling
First divide the work in tiles, operate each tile seperately and combine it.
What are low-level Synchornization?
Flush and Lock
What is Reduce Pattern?
It allows combining data, pairwise operation. Associativity must hold, but commutative doesn't have to hold.
What is Tiling?
It is like Serial algorith, but doing tree-like reduction to reduce communication costs
What are different types of processor syncrhonization?
Mutual Exclusion and Barrier Synchronization. Mutual exclusion is only one processor can access where as Barrier Synchornization is when all processor must reach the barrier sequence for any processor can proceed
What are two protocol that can avoid cache coherence?
Snooping and Directory Protocol. Snooping uses advantage of buses where there is a changes. It uses Write and invalidate protocol however, it does not scale well. On the Other hand Directory protocol is when single directory conatins sharing information of every block to invlidate when there is a chnage. it is suiteable for NUMA
What is Flush on synchronization?
The flush directive makes thread's temporary view of shared data consistent with the value in memory
Why static is default on parallel for schedule?
The static scheduling type is appropriate when all iterations have the same computational cost. Dynamic scheduling has high overhead
What is Threads?
Thread shares heap, static variable and code segment however, each thread has their' own program counter, stack, stack pointer and register
Tell me about OpenMP Variables
Threads share global variable but do not share variable declared in parallel sections, variables of functions called from parallel section
What is Atomic in OpenMP?
atomic is faster, but only for limited scope of commands
What is Parallel For?
divides independent iterations among threads
What is Parallel section?
divides sections of code to execute in parallel
What is Critical in OpenMP
ensures that only a single thread enters a section
What is Single or Master in OpenMP?
only one thread (master) executes a part of a code
What are important directives for OpenMP
parallel, parallel for, parallel section, critical, atomic, single, master
Distribution of Work on parallel for schedule(type, number)
useful when workload significantly differs from iteration to iteration.
What are high level Synchornization?
◦ critical ◦ atomic ◦ barrier ◦ ordered ◦ master ◦ Single
what is parallel in OpenMP?
◦ issues many threads which execute in paralle