Task Parallelism and Manager-Worker Parallelism Flashcards
(14 cards)
What do MPI_ANY_SOURCE
and MPI_ANY_TAG
do? What can they be used for?
-
MPI_ANY_SOURCE
allows receiving from an unspecified source -
MPI_ANY_TAG
allows receiving from an unspecified tag
In a manager/worker model, we don’t know which worker will request work next
Why define a new communicator instead of using MPI_COMM_WORLD
?
To limit communication to a subset of processes.
For example all the worker processes (but not the manager process)
What are the steps to create a new communicator?
- Get world group handle (
MPI_Comm_group
) - Create a new group (
MPI_Group_incl()
orMPI_Group_excl()
) - Create a communicator (
MPI_Comm_create()
) - Get rank in new communicator (
MPI_Comm_rank()
) - Perform communication
- Free the group and communicator (
MPI_Group_free()
,MPI_Comm_free()
)
What does MPI_Group_incl
do?
Creates a new group from an existing group including specific processes.
What does MPI_Group_excl
do?
Creates a new group from an existing group excluding specific processes.
What does MPI_Group_union
do?
Combines the union two groups members.
What does MPI_Group_intersection
do?
Creates a group containing only common members.
What does MPI_Group_difference
do?
Creates a group containing processes in the first group but not in the second.
How does the Manager-Worker model work in MPI?
- The manager assigns work to worker processes
- Workers request more work when finished
How do workers signal completion?
Workers send a request, receive a task, and exit if the received task is a special end flag.
What are two OpenMP work-sharing constructs besides parallel for
? When is each used?
-
sections
- When there are multiple, independent, blocks of code that can execute concurrently -
single
- Ensures that only thread executes a block of code inside a parallel region
How does OpenMP handle tasks?
One thread generates tasks, and other threads execute them.
What OpenMP directive ensures only one thread generates tasks?
#pragma omp single
When using a single
construct, which thread executes the code?
It can be any thread