Introduction to OpenMP Flashcards

(21 cards)

1
Q

What is OpenMP?

A

A specification for shared memory parallel programming with C, C++, or Fortran

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How is OpenMP used?

A

OpenMP provides extensions to specify where parallelism should be added and how to add it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the three types of OpenMP extension?

A
  1. Compiler Directives
  2. Environment Variables
  3. Runtime library routines
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What execution model does OpenMP use?

A

Fork-Join Execution model

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How are OpenMP directives designated?

A

pragma

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What compiler flag is used for OpenMP?

A

-fopenmp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is OMP_NUM_THREADS used for?

A

It controls the number of threads forked in a parallel region

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What routines are included in the OpenMP runtime library?

A
  1. Routines to control and query the execution environment
  2. Timing Routines
  3. Device memory routines for managing memory and pointers on accelerators
  4. Locking routines to synchronise access to data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How are OpenMP functions made available?

A

Including the omp.h header file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the C pre-processor do?

A

It processes source code before it is passed to the compiler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How is conditional compilation defined?

A

Using the #ifdef preprocessor directive to only compile a section if a macro is defined.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How is work load distributed between threads?

A

By parallelising for loops inside a parallel region this enables different threads to carry out different iterations of the loop.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a data race?

A

When multiple threads try to update the same variable at the same time, causing the updates to the variable to be corrupted.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is reduction?

A

Combining results from multiple threads into a single value using a reduction operator.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a data dependency?

A

if one statement reads from or writes to a memory location AND another statement reads from or writes to a memory location AND one or both of these accesses are writes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a loop carried dependency?

A

When there is a dependence between statements executed by different iterations of a loop.

17
Q

What are three types of loop-carried dependencys?

A
  1. Flow Dependency
  2. Anti-dependency
  3. Output Dependency
18
Q

What is a flow dependency?

A

Known as a read-after-write dependency, or a true dependency, it is not possible to resolve this dependency in parallel.

19
Q

What is an anti-dependency?

A

Also known as a write after read dependency, an iteration of a loop requires the next element when it has not been updated. This is resolved using a different array to ensure iterations are independent.

20
Q

What is an output dependency?

A

When two statements write to the same memory location there is an output dependency. Corrected by using a lastprivate variable.

21
Q

What are the issues with data dependencies?

A

If a loop is parallelised, then data dependencies will result in incorrect behaviour.