Task Parallelism and Manager-Worker Parallelism Flashcards

1
Q

What is the purpose of MPI_ANY_SOURCE and MPI_ANY_TAG?

A
  • MPI_ANY_SOURCE allows receiving from an unspecified source
  • MPI_ANY_TAG allows receiving from an unspecified tag
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why define a new communicator instead of using MPI_COMM_WORLD?

A

To limit communication to a subset of processes.

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

What are the steps to create a new communicator?

A
  1. Get world group handle (MPI_Comm_group)
  2. Create a new group (MPI_Group_incl or MPI_Group_excl)
  3. Create a communicator (MPI_Comm_create)
  4. Get rank in new communicator (MPI_Comm_rank)
  5. Perform communication
  6. Free the group and communicator (MPI_Group_free, MPI_Comm_free)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does MPI_Group_incl do?

A

Creates a new group including specific processes.

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

What does MPI_Group_excl do?

A

Creates a new group excluding specific processes.

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

What does MPI_Group_union do?

A

Combines two groups, keeping all unique members.

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

What does MPI_Group_intersection do?

A

Creates a group containing only common members.

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

What does MPI_Group_difference do?

A

Creates a group containing processes in the first group but not in the second.

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

How does the Manager-Worker model work in MPI?

A
  1. The manager assigns work to worker processes 2. Workers request more work when finished
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What function is used to request work in the Mandelbrot Manager-Worker model?

A
MPI_Recv(&nextProc, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do workers signal completion?

A

Workers send a request, receive a task, and exit if the received task is a special end flag.

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

What are two OpenMP work-sharing constructs besides parallel for? When is each used?

A
  1. sections - When there are multiple, independent, tasks that can execute concurrently
  2. single - Ensures that only thread executes a block of code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

When are OpenMP tasks useful?

A

For recursive algorithms and traversing linked lists.

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

How does OpenMP handle tasks?

A

One thread generates tasks, and other threads execute them.

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

What OpenMP directive ensures only one thread generates tasks?

A

#pragma omp single

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

When using a single construct, which thread executes the code?

A

It can be any thread