Lecture 7 Flashcards

1
Q

OpenMP?

A

An API for shared-memory parallel programming.
MP = multiprocessing

Designed for systems in which each thread or process can potentially have access to all available memory.

System is viewed as a collection of cores or CPU’s, all of which have access to main memory.

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

Pragmas?

A

Special preprocessor instructions.

Typically added to a system to allow behaviours that aren’t part of C.

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

What’s a team in OpenMP parlance?

A

A team is the collection of threads executing the parallel block- the original thread and the new threads.

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

What do master and slave mean in OpenMP parlance?

A

Master - original thread.

Slaves - additional threads.

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

pragma omp parallel?

A

Creates a parallel region of code. Instructs the compiler to parallelise the enclosed block of code, allowing multiple threads to execute the code concurrently.

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

pragma omp critical?

A

Used to define a critical section in the code. It ensures that only one thread at a time can execute the code within the critical section.

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

pragma omp single?

A

Designates a section of code that should be executed by only one thread in a parallel region.

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

Reduction operators?

A

Mathematical operations that are applied to a set of values in parallel. Always a binary operation.
A reduction is a computation that repeatedly applies the same reduction operator to a sequence of operands in order to get a single result.

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

pragma omp parallel for?

A

Allows a loop to be executed in parallel by multiple threads or processes. It divides iterations of a loop into smaller chunks and assigns them to different threads or processes for concurrent execution.

The expressions start, end, and incr must not change during execution of the loop.
During execution of the loop, the variable index can only be modified by the “increment expression” in the for statement.

There also cannot be any loop carried dependencies (the result of one iteration depends on the result of a previous iteration).

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