Counted from the questions in the past papers listed on this site. Repeated = how many times the topic came in those papers.
High Performance Computing important questions with answers
Each answer starts with the short answer. Then come the points to write, a diagram and an exam tip. The questions under each topic are copied from the RGPV papers.
Q1. Block diagram of a cache based microprocessor
Asked 1 time in 2022 · Unit 1
From the papers
“Q1 a) Draw the block diagram of a typical cache-based microprocessor.” (May 2022)
The short answer
A cache based microprocessor has execution units fed by registers and by a small, fast cache hierarchy (L1, L2, L3) between the core and slow main memory. The caches hide the memory delay by keeping recently used data close.
Write these points
Blocks of a typical core
Registers and the ALU and floating point unit do the arithmetic.
Instruction fetch and decode with a pipeline, branch predictor and scheduler.
Load and store units move data between registers and the L1 data cache.
L1 (separate instruction and data cache), L2 and a shared L3 cache.
Memory controller and the link to main memory (DRAM).
A TLB speeds up address translation.
Why caches work
Temporal locality: data used now is used again soon.
Spatial locality: data next to it is used soon, so memory moves in whole cache lines (often 64 bytes).
Average memory access time.
L1 hit time 1 ns, L1 miss rate 5 percent, miss penalty 100 ns.
Average time = 1 + 0.05 x 100 = 6 ns.
If the miss rate drops to 1 percent the average falls to 1 + 0.01 x 100 = 2 ns.
Real-life example
A student keeps the notebook she uses daily on her desk, the course books on a shelf and the rest in the library. The desk is the cache and the library is main memory. Reading from the desk is quick, so good habits of reuse make her study fast. A cache based processor works the same way.
Figure: block diagram of a cache based microprocessor
Same or opposite: cache and main memory
Point
Cache
Main memory
Same or opposite
Size
Small
Large
Opposite
Speed
Very fast
Slower
Opposite
Holds copies of program data
Yes
Yes
Same
Managed by
Hardware
Operating system and programs
Opposite
Exam tip. Draw the block diagram as a stack: registers, L1, L2, L3, memory, with the execution units on top. Label spatial and temporal locality. The average access time sum adds marks.
Q2. Multi-core, multithreaded and vector processors
Asked 1 time in 2022 · Unit 1
From the papers
“Q1 b) Differentiate Multi-core, Multithreaded and Vector processors.” (May 2022)
The short answer
A multi-core chip holds several full cores. A multithreaded core shares its units among threads, while a vector processor applies one instruction to many data items.
Write these points
Differences
Point
Multi-core
Multithreaded
Vector
Idea
Many cores on a chip
Several threads share one core
One instruction, many data
Parallelism
Thread or process level
Hides stalls of one core
Data level (SIMD)
Gain
More total work done
Better use of idle units
Faster loops on arrays
Needs from programmer
Threads or MPI
Enough threads
Regular loops that vectorise
A multi-core chip adds hardware. A multithreaded core adds only a second set of registers per thread.
A vector unit works best on long, simple loops with stride one access.
All three can be combined in one modern CPU.
Choose by the problem: many tasks, many data items or both.
Adding two arrays of 8 doubles.
Scalar code: 8 add instructions.
A 4 wide vector unit: 8 / 4 = 2 vector adds.
On 2 cores the work can be split, 4 elements each. Each core can use its vector unit.
Real-life example
A restaurant can add more cooks, which is multi-core. One cook can switch to chopping while the oven heats, which is multithreading. A cook who chops four onions with one cut of a wide knife is the vector unit. The kitchen is faster in each case, for a different reason.
Figure: multi-core, multithreaded and vector processors
Same or opposite: multi-core and vector processors
Point
Multi-core
Vector
Same or opposite
Parallel unit
Whole core
Wide data path
Opposite
Same instruction on many data
Not required
Required
Opposite
Raises throughput
Yes
Yes
Same
Programming
Threads, MPI
Compiler vectorisation
Opposite
Exam tip. Answer with a three column table and one example. State the idea of each kind in a single line before the table.
“Q2) What is Parallelism? Discuss the different variants of parallelism with the help of an example in each case.” (May 2022)
The short answer
Parallelism means doing several operations at the same time to finish a job faster. Its main variants are data parallelism, functional (task) parallelism, instruction level parallelism and thread level parallelism.
Write these points
Variants with examples
Variant
Meaning
Example
Data parallelism
Same operation on different data
Add two arrays, one chunk per worker
Functional parallelism
Different operations at once
One thread reads input while another computes
Instruction level
Several instructions in flight in one core
Pipelining and superscalar issue
Thread level
Independent threads on several cores
Web server handling many requests
Data parallelism scales with the data size. It is the main source of speed in scientific codes.
Functional parallelism is limited by the number of different tasks.
Two further kinds are pipeline parallelism (stages work on a stream) and SIMD.
Real programs mix several variants.
Summing 1,000 numbers on 4 workers.
Each worker adds 250 numbers. The 4 partial sums are added in a last step.
Ideal time = 250 + 3 = 253 additions instead of 999.
The speedup is about 999 / 253 = 3.9, close to 4.
Real-life example
A school gets 1,000 answer sheets to check. Four teachers each take 250 sheets, which is data parallelism. In another school one teacher checks while another enters marks, which is functional parallelism. The first way grows easily if more teachers join.
Figure: variants of parallelism
Same or opposite: data parallelism and functional parallelism
Point
Data parallelism
Functional parallelism
Same or opposite
Splits
The data
The tasks
Opposite
Operations in each worker
Same
Different
Opposite
Aim is to cut run time
Yes
Yes
Same
Scales with
Data size
Number of tasks
Opposite
Exam tip. Name the four variants, give one example each in a table and add a number example. The question asks for an example in each case, so do not skip any row.
C++ optimisation means writing C++ that the compiler and hardware run fast. The main rules are to avoid copies, dynamic memory and virtual calls in hot loops and to inline small functions.
Write these points
Common optimisations
Temporary objects: pass big objects by const reference, not by value. Avoid operators that create hidden temporaries.
Dynamic memory: allocate once outside the loop and reuse. Use reserve for vectors.
Inlining: small functions inlined remove call cost. The compiler needs the body visible.
Virtual functions: avoid in the innermost loop. Use templates for compile time choice.
Loop kernels: hoist constants out of loops and keep data contiguous.
Compiler flags: use -O2 or -O3 and enable architecture options.
double dot(const std::vector<double>& a, const std::vector<double>& b) { // by const reference
double s = 0.0;
for (size_t i = 0; i < a.size(); ++i) s += a[i] * b[i];
return s;
}
Remember. The code is a short sketch and was not compiled here.
Cost of passing by value.
A vector of 1,000,000 doubles is 8 MB. Passing it by value copies 8 MB each call.
1,000 calls copy 8,000 MB, which is 8 GB, only to pass an argument.
Passing by const reference copies nothing.
Real-life example
A clerk keeps photocopying a 100 page file every time someone wants to read it. The office wastes paper and time. A better way is to hand over the original file with a note not to write on it. Passing by reference is that note.
Figure: slow and fast C++ in a hot loop
Same or opposite: passing by value and by const reference
Point
By value
By const reference
Same or opposite
Copies the data
Yes
No
Opposite
Original can be changed
No
No
Same
Time for large objects
High
Almost none
Opposite
Typical use
Small types such as int
Large objects
Opposite
Exam tip. List five optimisations, one line each, with the reason. Add a short code sketch and one number that shows the cost of copying.
“Q3 b) What do you mean by scalar profiling? Explain function and line-based profiling.” (May 2022)
The short answer
Scalar profiling finds where a serial program spends its time. Function based profiling reports time per function, while line based profiling reports time per source line.
Write these points
Function based profiling
Compile with profiling on (gprof uses -pg), run the program and read the report.
The flat profile shows the time and call count of each function. The call graph shows who calls whom.
Good for finding which function to look at first.
Line based profiling
Shows the cost of each source line or loop, so the exact statement is found.
Tools: gprof with line option, perf, Valgrind callgrind or vendor profilers.
Needs debug information. Costs more run time.
How to use it
Profile with a realistic input.
Find the biggest function.
Go down to the line level inside it.
Optimise and measure again.
Where to optimise first.
A run takes 50 s. Function f takes 30 s, which is 60 percent.
If f is made 3 times faster it takes 10 s. New total = 20 + 10 = 30 s.
Speedup = 50 / 30 = 1.67. Tuning a function that takes 5 percent could give at most 1.05.
Real-life example
A shopkeeper who wants to cut costs first checks which bill is the largest: rent, power or salary. Only then does he look at details inside that bill. A function profile is the list of bills. A line profile is the detail inside the largest bill.
Figure: profiling workflow
Same or opposite: function based and line based profiling
Point
Function based
Line based
Same or opposite
Detail
Per function
Per source line
Opposite
Overhead
Lower
Higher
Opposite
Finds hot spots in a serial program
Yes
Yes
Same
Best used
First
After the hot function is known
Opposite
Exam tip. Define scalar profiling first. Then write one short list for each kind. The worked sum on how much a speedup is possible shows why profiling comes before tuning.
Q6. Blocking and rolling with a sparse matrix vector product
Asked 1 time in 2022 · Unit 2
From the papers
“Q4) Explain the blocking and rolling strategies with the help of multiplication of a sparse matrix with a vector.” (May 2022)
The short answer
For a sparse product y = A x, blocking works in small blocks so data stays in registers or cache. Rolling (read here as loop unrolling) repeats several iterations per pass to cut loop cost.
Write these points
The kernel (CRS format)
Only non zero values are stored. val holds the values, col their column numbers and row_ptr where each row starts.
For each row i: y[i] = sum of val[j] x[col[j]] for j from row_ptr[i] to row_ptr[i+1] - 1.
The access x[col[j]] is indirect, so the cache is used poorly.
Rolling (unrolling)
Unroll the inner loop by 2 or 4 so loop control and branch cost fall and more adds run in parallel.
Remember. The paper prints blocking and rolling strategies. Rolling is read as loop unrolling. Check the word your textbook uses.
A 4 x 4 sparse matrix in CRS (computed by script).
val = 10, 20, 30, 40, 50, 60. col = 0, 2, 1, 0, 2, 3. row_ptr = 0, 2, 3, 5, 6. x = 1, 2, 3, 4.
Row 0: 10 x 1 + 20 x 3 = 70. Row 1: 30 x 2 = 60. Row 2: 40 x 1 + 50 x 3 = 190. Row 3: 60 x 4 = 240.
Result y = (70, 60, 190, 240).
Real-life example
A tailor stitching a school uniform for 40 children does not walk to the cupboard for each button. He picks a handful of buttons and thread at once. Blocking brings a handful of data close. Unrolling stitches a few buttons per trip.
Figure: CRS storage of a sparse matrix
Same or opposite: blocking and unrolling
Point
Blocking
Unrolling
Same or opposite
Main aim
Keep data in cache or registers
Cut loop overhead
Opposite
Changes the order of work
Yes
Not much
Opposite
Both are optimisations of a serial kernel
Yes
Yes
Same
Helps most when
Memory is the limit
Loop control is a cost
Opposite
Exam tip. Show the CRS arrays and the kernel first. Then give one line each for register blocking, cache blocking and unrolling. Note the reading of rolling.
Q7. OpenMP: data scoping, work sharing and loop scheduling
Asked 1 time in 2022 · Unit 3
From the papers
“Q5 a) What is OpenMP? Explain the concepts of data scoping, work-sharing for loops and loop scheduling.” (May 2022)
The short answer
OpenMP is a directive based standard for shared memory programming in C, C++ and Fortran. Threads share one memory and a schedule decides which loop iterations each thread gets.
Write these points
Data scoping
shared: one copy that all threads see. private: each thread has its own copy.
firstprivate starts the private copy with the value before the loop. lastprivate copies out the value from the last iteration.
reduction: each thread keeps a partial result and OpenMP combines them.
Use default(none) to force a choice for every variable.
Work sharing for loops and scheduling
The for directive divides the iterations among the threads of a parallel region.
static: iterations are cut in equal chunks in advance. dynamic: threads take the next chunk when free. guided: chunks shrink as the loop proceeds.
#pragma omp parallel for schedule(static, 1) private(t) reduction(+:sum)
for (int i = 0; i < n; i++) { t = f(i); sum += t; }
Remember. The code is a short sketch and was not compiled here.
Load balance for 16 iterations on 4 threads (cost of iteration i is i + 1).
static (blocks of 4): thread costs 10, 26, 42, 58. The loop ends when the slowest ends: 58.
static,1 (round robin): thread costs 28, 32, 36, 40. The loop ends at 40.
dynamic,1 gives the same 28, 32, 36, 40 here. A good schedule cuts the time from 58 to 40.
Real-life example
Four students clean a long corridor. If each gets a fixed quarter, the student who gets the muddy end finishes last. If they take the next free tile each time, all finish together. Static and dynamic scheduling are these two plans.
Figure: static blocks and round robin scheduling
Same or opposite: static and dynamic scheduling
Point
Static
Dynamic
Same or opposite
Chunks fixed
Before the loop
At run time
Opposite
Overhead
Low
Higher
Opposite
Splits loop iterations among threads
Yes
Yes
Same
Best for
Equal cost iterations
Uneven cost iterations
Opposite
Exam tip. Open with a definition of OpenMP. Give the scoping clauses in a list and the three schedules in another. The cost example shows that a schedule changes time.
Q8. Non-blocking and blocking point to point communication
Asked 1 time in 2022 · Unit 5
From the papers
“Q5 b) What is non-blocking point-to-point communication? How it differs from blocking communication?” (May 2022)
The short answer
A blocking send or receive returns only when the buffer can be reused. A non-blocking call (MPI_Isend, MPI_Irecv) returns at once and the program checks later with a wait or test, so computation can overlap with communication.
Write these points
Non-blocking point to point
Post the receive and the send with Irecv and Isend. They return immediately.
Do useful work that does not touch the buffers.
Call MPI_Wait or MPI_Test to finish the transfer.
Only now use the received data or reuse the send buffer.
Differences
Blocking: simple, but the process idles while data moves.
Non-blocking: more complex, but can hide communication time.
Blocking calls can deadlock if two processes both send first and nobody receives.
MPI_Irecv(buf, n, MPI_DOUBLE, left, 0, comm, &req[0]);
MPI_Isend(out, n, MPI_DOUBLE, right, 0, comm, &req[1]);
compute_interior();
MPI_Waitall(2, req, MPI_STATUSES_IGNORE);
Remember. The code is a short sketch and was not run here.
Gain from overlap.
Computation takes 8 ms and communication takes 3 ms.
Blocking: 8 + 3 = 11 ms per step. Non-blocking with overlap: max(8, 3) = 8 ms.
Saving = 3 ms, which is 27 percent of 11 ms.
Real-life example
You put rice on the stove and wait next to it doing nothing, which is blocking. A smarter cook starts the rice, cuts vegetables while it cooks and checks the pot later, which is non-blocking. The cooking time is the same but the meal is ready earlier.
Figure: timeline with and without overlap
Same or opposite: blocking and non-blocking communication
Point
Blocking
Non-blocking
Same or opposite
Call returns
When the buffer is safe
At once
Opposite
Overlap with computation
No
Yes
Opposite
Moves data between two processes
Yes
Yes
Same
Code complexity
Low
Higher
Opposite
Exam tip. Define both in one line each. Show the four steps of a non-blocking exchange. The 8 ms and 3 ms example shows the gain from overlap.
Q9. Performance problems of OpenMP and their cures
Asked 1 time in 2022 · Unit 4
From the papers
“Q6) Discuss the performance problems that can be raised with OpenMP shared-memory programming, also discuss how they can be circumvented?” (May 2022)
The short answer
The main performance problems of OpenMP are load imbalance, false sharing, short loops, heavy synchronisation and memory limits. Each has a known cure.
Write these points
Problems and cures
Problem
Cause
Cure
Load imbalance
Uneven iteration cost
Use dynamic or guided schedule
False sharing
Threads write different data in one cache line
Pad data or use private copies
Thread start overhead
Loop is too short
Parallelise outer loops or use if clause
Serialisation
Critical sections and barriers
Use reduction, atomic, nowait
Memory limits
Bandwidth saturated or NUMA placement
First touch data in parallel, reuse cache
Serial parts limit the speedup by Amdahl's law, so reduce the serial fraction.
Measure with a profiler before and after each change.
Thread count: more threads than cores slows the program.
Scheduling: choose by the cost pattern of the loop.
A short loop is slower in parallel.
A loop takes 2 microseconds in serial. Starting a parallel region costs 5 microseconds.
On 4 threads the loop work is 2 / 4 = 0.5 microseconds, so the total is 5 + 0.5 = 5.5 microseconds.
Parallel (5.5) is slower than serial (2). The loop needs far more work to pay for the start cost.
Real-life example
Four people painting one wall can block each other if they all reach for the same paint tin. That is false sharing. If the walls are tiny, calling the painters costs more than painting. If one painter gets the large wall, the others wait. Each problem has a simple fix such as separate tins, bigger jobs or fair sharing.
Figure: false sharing on one cache line
Same or opposite: false sharing and true sharing
Point
False sharing
True sharing
Same or opposite
Threads use the same variable
No, different variables
Yes
Opposite
Same cache line is involved
Yes
Yes
Same
Cure
Padding, private copies
Locks, atomics, reductions
Opposite
Effect on speed
Slows without need
Needed for correctness
Opposite
Exam tip. Use the three column table. Add one number example. Link the final line to the cure for each problem.
Q10. Reducing communication overhead: non-blocking and asynchronous
Asked 1 time in 2022 · Unit 5
From the papers
“Q7 a) How to reduce the communication overhead? Differentiate non-blocking and asynchronous communication.” (May 2022)
The short answer
To reduce communication overhead, send fewer and larger messages, overlap communication with computation and cut the data exchanged. Non-blocking means the call returns at once, while asynchronous means the transfer proceeds in the background.
Write these points
Ways to reduce overhead
Aggregate small messages into one big message to pay the latency once.
Overlap with non-blocking calls and compute while data moves.
Choose a decomposition with a small surface to volume ratio, so less data crosses boundaries.
Map processes to the network layout (virtual topologies).
Avoid needless synchronisation such as extra barriers.
Use collective calls that are tuned for the machine.
Non-blocking and asynchronous
Non-blocking is about the call: it does not wait.
Asynchronous is about progress: the message moves without help from the program.
A library may take a non-blocking call but move the data only inside a later wait. Then there is no real overlap.
Latency cost with the model T = L + n / B (L = 2 microseconds, B = 5 GB/s).
1,000 messages of 1,000 bytes: 1,000 x (2 + 0.2) = 2,200 microseconds.
One message of 1,000,000 bytes: 2 + 200 = 202 microseconds.
Same data, 11 times faster because the latency is paid once.
Real-life example
A courier who delivers 1,000 envelopes one at a time makes 1,000 trips. A courier who puts them in one bag makes one trip. The fuel and waiting at the gate are the latency. Packing the bag is aggregation.
Figure: many small messages and one large message
Same or opposite: non-blocking and asynchronous communication
Point
Non-blocking
Asynchronous
Same or opposite
Describes
The call returns at once
Progress without the program
Opposite
Guarantees overlap
Not always
Yes
Opposite
Helps hide communication time
Yes
Yes
Same
Needs a later wait or test
Yes
Only to finish
Opposite
Exam tip. Give five ways to reduce the overhead and add the aggregation sum. In the second part explain the two words in two short lines.
High Performance Computing (CS-802 C) is an elective in Semester 8 of RGPV B.Tech CSE. It teaches how to make programs run fast on modern processors and parallel machines. Its five units cover processors and serial optimisation, data access, parallel computing basics, OpenMP and MPI. Write and time small programs, because performance is something you measure.
High Performance Computing unit-wise brief
Unit 1: Modern processors and serial optimisation
This unit covers cache based architecture, performance metrics and benchmarks, Moore's law, pipelining, superscalar and SIMD designs, memory hierarchies, multicore, multithreaded and vector processors. It also covers basic optimisations for serial code: profiling, simple measures, the role of compilers and C++ optimisations. Learn how the cache hierarchy affects speed.
Unit 2: Data access optimisation and parallel computers
Here you study balance analysis, storage order, algorithm classes and case studies for data access. Then come the kinds of parallel computer: shared memory, distributed memory, hybrid and networked systems. Compare shared and distributed memory.
Unit 3: Basics of parallel computing
This unit covers data and functional parallelism, parallel scalability laws, metrics, efficiency and load imbalance. It then starts shared memory programming with OpenMP: parallel execution, data scoping, work sharing, synchronisation, reductions, loop scheduling and tasking. Learn Amdahl's law with a numerical.
Unit 4: Efficient OpenMP programming
The unit covers profiling, performance pitfalls, improving work sharing constructs, the overhead of short loops, serialisation and false sharing. Know why false sharing slows a program.
Unit 5: Distributed memory programming with MPI
The last unit covers message passing with MPI: point to point and collective communication, non-blocking calls and virtual topologies. It then covers efficient MPI programming: performance tools, communication parameters, synchronisation and contention, and reducing communication overhead. Write a small program that uses a collective call.
Units follow the RGPV scheme and syllabus, B.Tech Computer Science and Engineering, Semester 8 (AICTE flexible curriculum, w.e.f. Jan 2021). For the full topic list of each unit, open the High Performance Computing notes.
What are the most important topics in High Performance Computing?
By how often they were asked in the papers on this site: Block diagram of a cache based microprocessor (1 times); Multi-core, multithreaded and vector processors (1 times); Parallelism and its variants (1 times); C++ optimisations (1 times); Scalar profiling: function and line based (1 times).
How were these High Performance Computing important questions chosen?
Each topic was counted from the questions in the past papers listed on this site (2022). Repeated is the number of times the topic came. The counts come from keyword matching and the answers are not teacher-reviewed, so use them together with your syllabus.
Is there a PDF of High Performance Computing important questions with answers?
Yes. The Paperwala Imp Question & Answer PDF for High Performance Computing is free to download from this page.
The 10 most repeated topics of High Performance Computing (CS-802-C) for RGPV B.Tech CSE semester 8, counted from the previous year papers on this site. High Performance Computing is also searched for as AL-802-B.