0% found this document useful (0 votes)
7 views4 pages

MPI and OpenMP in Parallel Computing

The document is a question bank for a course on Parallel Computing, covering various topics such as MPI, OpenMP, and CUDA. It includes questions on message passing, performance evaluation, parallel algorithms, and programming examples. The questions are organized into modules focusing on different aspects of parallel computing techniques and their applications.

Uploaded by

shettyshramanth
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views4 pages

MPI and OpenMP in Parallel Computing

The document is a question bank for a course on Parallel Computing, covering various topics such as MPI, OpenMP, and CUDA. It includes questions on message passing, performance evaluation, parallel algorithms, and programming examples. The questions are organized into modules focusing on different aspects of parallel computing techniques and their applications.

Uploaded by

shettyshramanth
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

QUESTIONBANK

Sub: Parallel Computing [22IS772] SEM: VII

Module-2

1. Make use of MPI function prototypes to explain a Greetings program demonstrating


message passing between processes.
2. Mention the advantages of MPI in parallel computing.
3. Explain the difference between shared-memory and distributed memory systems with
neat diagrams.
4. Define the SPMD model. How does MPI support the SPMD approach?
5. Explain i) Message matching, ii) Status-p argument
6. Apply the trapezoidal rule to estimate the area under a curve and describe how it is
parallelized using MPI with reference to its pseudocode.
7. Explain how input and output are handled in MPI programs.
8. Design tree-based communication logic to trace the flow of data during MPI_Reduce
and MPI_Allreduce operation across 8 MPI process.
9. List the differences between point-to-point and collective communication.
10. Illustrate the role of MPI_Allgather in implementing parallel Matrix-vector
multiplication.
11. Explain the syntax of MPI_Type_create_struct. Specify how displacements and
datatypes are specified.
12. Explain the performance evaluation metrics for MPI (speedup, efficiency, scalability).
13. Compute and compare the speedup for problem size n=1024 using 4 and 8 processes.
Calculate the efficiency for problem size n=2048 using 8 and 16 processes. Interpret
the results to assess scalability across different process counts.
14. Develop one phase of a parallel odd-even transposition sort for five processes using
safe communication, and justify how MPI_Sendrecv or MPI_Sendrev_replace
prevents deadlocks in this scenario.
15. Explain MPI_Scatter and MPI_Gather .write a function to read and distribute a vector

16. Estimate the parallel overhead𝑇𝑐𝑜(𝑛,𝑝)for 𝑛=4096and 𝑝=4.


using MPI_Scatter and Gather.

17. Compare the advantages and disadvantages of using bubble sort versus odd-even
transposition sort in a parallel distributed-memory system.
18. Compare the butterfly-structured global sum and tree-structured broadcast in
terms of: *Direction of communication *Purpose (data aggregation vs. distribution)
*Communication pattern and efficiency with 8 processors.

Programs

1. MPI_Send&MPI_Receive
2. Deadlock
3. Broadcast
Module-3

1. write a hello world program that uses openmp With Compiling and running OpenMP
programs steps
OR
Explain #pragma directive.
2. Give the differences between pthreads and omp programming.
3. Write a OpenMP program to find the prime numbers from 1 to n employing parallel for
directive. Record both serial and parallel execution times
[Link] OpenMP, what is meant by a team of threads, and how is it related to the master, parent,
and child threads? and explain their roles within a parallel region with diagram.
[Link] is conditional compilation using_OPENMP important for program portability, and
what errors can occur if it’s not used with a non-OpenMP compiler?
[Link] is a critical section and race condition, and why is it important in parallel
programming?
[Link] an OpenMP program to compute the sum of the first n natural numbers (1 + 2 + 3 +
… + n) using multiple threads
8. Write a note on scope of variables in openMP.

1. Explain the Reduction Clause in OPENMP.


2. What is a loop-carried dependence? Explain with an example.
OR
Consider the loop
a [ 0 ] = 0;
for ( i = 1; i < n ; i ++)
a [ i] = a [ i−1] + i ;
There’s clearly a loop-carried dependence, as the value of a[i] can’t be computed
without the value of a[i−1]. Can you see a way to eliminate this dependence
and parallelize the loop?
3. Explain how to parallelize the OpenMP program for estimating π.
4. Explain Scheduling in OpenMP

OR
Explain different Scheduling types in OpenMP.
[Link] the concept of the producer–consumer problem using OpenMP. Give functions to
explain the message passing using OpenMP.
6. Write the OpenMP parallel code for matrix–vector multiplication and explain the purpose of
each OpenMP clause-----(CACHE COHERENCE)
7. Write an OpenMP program that determines the default scheduling of parallel for loops. Its input
should be the number of iterations, and its output should be which iterations of a parallelized for
loop are executed by which thread. For example, if there are two threads and four iterations, the
output might be the following:

Thread 0: Iterations 0 −− 1
Thread 1: Iterations 2 – 3
8. Write an OpenMP program to calculate n Fibonacci numbers using tasks.
9. How do you ensure thread safety in OpenMP? Write a program for a multi-threaded
tokenizer.
Module-4
1. With a neat diagram Explain the architecture of modern GPUs in detail and Discuss the
concepts of SIMD, SMs, SPs, SIMT.
2. Write a CUDA program that prints greetings from the threads explain with Compiling and
running the program.
3. Define Threads, blocks, and grids and write a CUDA program that prints greetings from
threads in multiple blocks.
4. Explain Nvidia GPU compute capabilities and architectures, and how compute capability
affects thread limits, block sizes, and CUDA compatibility
5. Write a program to show Kernel and main function of a CUDA program that adds two
vectors.
6. Explain the CUDA vector addition program, describing how threads compute
individual elements and how the kernel is launched from the host.
7. Explain why CUDA kernels cannot return values directly to the host. Describe the
different methods used to return results from a CUDA kernel.
8. Explain the concept of CUDA trapezoidal rule I and write a serial function
implementing the trapezoidal rule for a single CPU.
9. Write a Program to Initialization, return value, and final update for CUDA kernel and
wrapper implementing trapezoidal rule and explain problems in Cuda implementation.
10. Explain CUDA trapezoidal rule II for improving performance by showing Basic sum
in Tree-structured communication.
11. What is Warps and warp shuffles, and explain the Tree-structured sum using warp
shuffle and Dissemination sum using shared memory.
12. Write a CUDA kernel implementing program for the trapezoidal rule and using
Warp_sum.
13. Write a program for CUDA kernel implementing the trapezoidal rule and using shared
memory.
14. Explain how CUDA handles the trapezoidal rule in multi-warp blocks and why
__syncthreads() is necessary to avoid race conditions during partial-sum reduction.
15. Write use shared memory and synchronization to implement the trapezoidal rule with
large thread blocks in CUDA?
16. Describe the steps required to convert a sequential n-body solver into a parallel
version using OpenMP.
17. Tree search problem (TSP)
18. the travelling salesperson problem, finding a minimum cost tour.

You might also like