CS 452 Exam 1 — MPI and Parallel Algorithms Vocabulary

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/61

flashcard set

Earn XP

Description and Tags

62 cards: vocabulary, MPI argument examples, and high-yield exam practice on choosing collectives, tracing ranks, and tree time/work.

Last updated 1:35 PM on 10/8/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

62 Terms

1
New cards

Process rank

A process's unique ID within a communicator, numbered 0 through p-1. Use it to choose that process's work.

2
New cards

Process count p

The number of MPI processes in the communicator. MPI_Comm_size stores it in p.

3
New cards

MPI_COMM_WORLD

The communicator containing all processes launched for the program.

4
New cards

Root process

The designated process for a collective operation; often rank 0. It may own the input or receive the answer.

5
New cards

MPI_Init

Starts the MPI environment. Call it before other MPI operations.

6
New cards

MPI_Finalize

Ends the MPI environment after the parallel work is done.

7
New cards

MPI_Comm_rank

Writes this process's rank into the supplied integer variable.

8
New cards

MPI_Comm_size

Writes the number of processes into the supplied integer variable.

9
New cards

MPI_Send

Sends a specified buffer to one destination rank with a tag.

10
New cards

MPI_Recv

Receives a message from a specified source and tag; it waits for a matching message.

11
New cards

Message tag

An integer label used to distinguish messages. A receive must match the intended send's tag.

12
New cards

Blocking receive

An MPI_Recv call that cannot return until its receive buffer contains a matching message.

13
New cards

Deadlock

Processes wait in a cycle or for messages that will never arrive, so the program cannot progress.

14
New cards

Collective operation

An MPI operation involving every process in a communicator. All participating ranks must call it compatibly.

15
New cards

MPI_Bcast

Broadcasts a value from one root process to every process in the communicator.

16
New cards

MPI_Scatter

Distributes equal-sized consecutive chunks of a root array among all processes.

17
New cards

MPI_Gather

Collects equal-sized chunks from all processes into an array on the root.

18
New cards

MPI_Reduce

Combines one value or array from every process using an operation such as sum, max, or min; the result is at the root.

19
New cards

MPI_Allreduce

Like MPI_Reduce, but every process receives the combined result.

20
New cards

MPI_SUM / MPI_MAX / MPI_MIN

Predefined reduction operations for sum, maximum, and minimum. Choose the one that matches the required answer.

21
New cards

Blocking data allocation

Give each process a consecutive chunk of the input, such as indices 0-3 to rank 0 and 4-7 to rank 1.

22
New cards

Striping

Give rank r indices r, r+p, r+2p, and so on. It can balance uneven work but may hurt data locality.

23
New cards

Load balancing

Distributing work so processes finish at roughly the same time instead of leaving some idle.

24
New cards

Data locality

Keeping a process's data near or contiguous to its other data, reducing costly access and transfer.

25
New cards

Distributed memory

Each process has its own memory; processes exchange data explicitly using messages such as MPI sends and receives.

26
New cards

Shared memory

Processes or threads can access a common memory space; coordination is needed to avoid conflicting access.

27
New cards

Parallel overhead

Extra time spent dividing work, communicating, synchronizing, and combining results.

28
New cards

Speedup

Sequential running time divided by parallel running time. Overhead and serial work limit it.

29
New cards

Work W(n)

The total number of operations performed across all processors and rounds in the work-depth model.

30
New cards

Depth T(n)

The number of sequential parallel rounds on the longest dependency path in the work-depth model.

31
New cards

Parallel reduction

Combine values up a balanced tree to get one answer; for n values, depth O(log n) and work O(n).

32
New cards

Prefix computation / scan

Compute one cumulative answer for every prefix; tree up-sweep and down-sweep give depth O(log n) and work O(n).

33
New cards

Associative operation

An operation where grouping does not change the result, such as sum, min, or max. This lets a tree combine subproblems safely.

34
New cards
MPI_Init and MPI_Finalize: what arguments?
Start with MPI_Init(&argc, &argv); end with MPI_Finalize(); Init gets addresses of main's argument count and argument vector. Finalize takes no arguments.
35
New cards
MPI_Comm_rank: fill the arguments
MPI_Comm_rank(MPI_COMM_WORLD, &rank); The communicator comes first; &rank is where MPI writes this process's ID.
36
New cards
MPI_Comm_size: fill the arguments
MPI_Comm_size(MPI_COMM_WORLD, &p); The communicator comes first; &p is where MPI writes the process count.
37
New cards
MPI_Send: fill the arguments
MPI_Send(&x, 1, MPI_INT, dest, tag, MPI_COMM_WORLD); Send x: address, element count, type, destination rank, message tag, communicator.
38
New cards
MPI_Recv: fill the arguments
MPI_Recv(&x, 1, MPI_INT, source, tag, MPI_COMM_WORLD, &status); Receive into x: address, max count, type, source rank, matching tag, communicator, status output.
39
New cards
MPI_Bcast: fill the arguments
MPI_Bcast(&x, 1, MPI_INT, 0, MPI_COMM_WORLD); Every rank calls it with a buffer. Rank 0 supplies x; all ranks receive x. The 0 is the root rank.
40
New cards
MPI_Scatter: fill the arguments
MPI_Scatter(a.data(), n/p, MPI_INT, local.data(), n/p, MPI_INT, 0, MPI_COMM_WORLD); Root sends n/p ints to each rank. Every rank receives n/p ints into local.
41
New cards
MPI_Gather: fill the arguments
MPI_Gather(local.data(), n/p, MPI_INT, result.data(), n/p, MPI_INT, 0, MPI_COMM_WORLD); Each rank sends n/p ints. Root collects all chunks into result of length n.
42
New cards
MPI_Reduce: fill the arguments
MPI_Reduce(&local, &total, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD); Every rank contributes one int; MPI sums them; only root 0 receives total.
43
New cards
MPI_Allreduce: fill the arguments
MPI_Allreduce(&local, &total, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); Every rank contributes one int and every rank receives total. There is no root argument.
44
New cards
MPI_Allgather: fill the arguments
MPI_Allgather(local.data(), n/p, MPI_INT, result.data(), n/p, MPI_INT, MPI_COMM_WORLD); Every rank sends a chunk; every rank receives all chunks. There is no root.
45
New cards
MPI_Barrier: fill the arguments
MPI_Barrier(MPI_COMM_WORLD); Every rank in the communicator calls it and waits until all have reached the barrier.
46
New cards
What does count mean in MPI_Scatter?
Sendcount and recvcount are elements PER RANK, usually n/p. They are not byte counts and the root sendcount is not the whole array length n.
47
New cards
What does count mean in MPI_Reduce?
Count is how many elements EACH rank contributes. For one local sum, count is 1 even if the original array has n elements.
48
New cards
Scalar buffer versus vector buffer
Use &x for one scalar x; use a.data() for a vector a. MPI needs a memory address, not the scalar's value.
49
New cards
Root argument: what number goes there?
Usually 0 when rank 0 owns the input or should receive the result. Every rank passes the same root value for that collective call.
50
New cards
Datatype argument: what goes there?
Match the C++ element type: int -> MPI_INT; long -> MPI_LONG; double -> MPI_DOUBLE. Send and receive datatypes must match.
51
New cards
Send and receive: what must match?
The send destination must be the receiving rank; receive source must be the sending rank; tags and communicator must match; counts and datatypes must be compatible.
52
New cards
MPI_Scan versus MPI_Exscan arguments
MPI_Scan(&local, &prefix, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD) includes this rank. MPI_Exscan has the same arguments but excludes this rank; rank 0 has no prefix result.
53
New cards
One final sum on rank 0: which MPI call?
MPI_Reduce(&local, &total, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD). Every rank contributes local; only rank 0 receives total.
54
New cards
Same final sum on every rank: which MPI call?
MPI_Allreduce(&local, &total, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD). It has no root argument because every rank gets total.
55
New cards
Root has an array; each rank needs one equal chunk: which call?
MPI_Scatter. For n values and p ranks, each rank receives n/p values when p divides n.
56
New cards
Rank 0 needs all ranks' chunks in order: which call?
MPI_Gather. Each rank sends its local chunk; rank 0 receives the assembled array.
57
New cards
For n=12 and p=4, what are Scatter's counts?
3 elements per rank. Use sendcount=3 and recvcount=3 when each element has the same MPI datatype.
58
New cards
Reduction of 8 values: rounds and total additions?
3 parallel rounds because log2(8)=3; 7 total additions because n-1=7. Time O(log n), work O(n).
59
New cards
Reduction versus prefix scan: what differs?
Reduction gives one final answer. Prefix scan gives an answer for every prefix. A work-efficient balanced-tree scan has O(log n) time and O(n) work.
60
New cards
Nearest 1 strictly to the left: which prefix idea?
At index i store i if A[i]=1, else -1. Use an EXCLUSIVE prefix maximum; the largest earlier 1-index is the nearest 1 on the left.
61
New cards
Rank 2 sends one int x to rank 0 with tag 7: calls?
On rank 2: MPI_Send(&x, 1, MPI_INT, 0, 7, MPI_COMM_WORLD). On rank 0: MPI_Recv(&x, 1, MPI_INT, 2, 7, MPI_COMM_WORLD, &status).
62
New cards
Handwritten MPI program: what order should you draft?
MPI_Init; Comm_rank and Comm_size; root sets input; distribute data; each rank computes local work; combine results; MPI_Finalize. Check every collective is called by all ranks.