21/01/2025
IPC ASSIGNMENT 1
Note:- For Assignment 1, implement all the three programs using OpenMP.
Prepare Viva on OpenMP, sample questions are listed below.
Evaluation metrics –
Demonstration of the entire program with output and viva based on
the implementation.
Viva on OpenMP.
Programming Questions
a. Implement Dot product operation of two vectors using OpenMP and Find
time complexity and speedup of each with respect to its serial version.
b. Implement Matrix-Matrix multiplication using OpenMP and Find time
complexity and speedup of each with respect to its serial version.
c. Implement Matrix-Vector multiplication using OpenMP and Find time
complexity and speedup of each with respect to its serial version.
Sample Viva- Questions on OpenMP
1. What is OpenMP? What is the motive behind using OpenMP?
2. How to compile and execute the code in the parallel region of OpenMP
program?
3. State the feature set of OpenMP API.
4. How work can be shared among threads in an OpenMP program? State the
OpenMP directives used for the same.
5. OpenMP is basically used to parallelize an application. Justify the
statement.
6. Explain all the constructs that a programmer really should be familiar with
while writing a OpenMP program?
7. What is the role of parallel constructs in OpenMP program?
8. Explain the use of following library functions.
a) void omp_set_num_threads(int num_threads)
b) int omp_get_num_threads(void)
c) int omp_get_max_threads(void)
d) int omp_get_thread_num(void)
e) int omp_get_num_procs(void)
f) int omp_in_parallel(void)
g) void omp_set_dynamic(int dynamic_threads)
h) int omp_get_dynamic(void)
i) void omp_set_nested(int nested)
j) void omp_get_nested(int nested)
k) void omp_init_lock(omp_lock_t *lock)
l) void omp_destroy_lock(omp_lock_t *lock)
9. What are the different causes supported by the parallel construct? Explain.
10.State OpenMP working constructs.
11.Explain loop construct in OpenMP program.
12.State the significance of the section construct in OpenMP program.
13.What are the different clauses supported by the loop construct? Explain.
14.What are the different clauses supported by the section construct? Explain
15.Give the list of clauses supported by the single construct.
16.Explain single construct in OpenMP program.
17.Explain the use of the following clauses supported by OpenMP.
a) Shared clause
b) Private clause
c) Last private clause
d) First private clause
e) Default clause
f) Nowait clause
g) Schedule clause
18.Explain or describe all the schedule kinds supported on the schedule clause.
19.Explain OpenMP synchronization constructs with their significance.
a) Barrier construct
b) Ordered construct
c) Critical construct
d) Atomic construct
20.Explain how OpenMP uses multi-threading to enhance program execution
speed.
21.Differentiate between parallel region and work-sharing constructs in
OpenMP.
22.How one can manage data and thread private variables in OpenMP?
23.Describe how loop constructs function in OpenMP, and their advantages.
24.How does OpenMP deal with nested parallelism?
25.How does OpenMP handle exceptions in a parallel region?
26.Can you explain how OpenMP’s thread teams work?
27.How does OpenMP handle memory management, particularly in a multi-
threading context?
28.How do you determine the number of threads to use in OpenMP for optimal
performance?
29.Could you provide an example of how and when to use the ‘atomic’
directive in OpenMP?
30.How would you handle data race conditions in OpenMP?
31.How does the ‘collapse’ clause work in OpenMP, and in what situations
would you use it?
32.Describe how the ‘ordered’ directive is used in OpenMP.
33.How does OpenMP’s dynamic adjustment of threads feature work?
34.Using suitable example (parallel code), explain in what situation schedule
clause is used in OpenMP?
35.Gustafson Barsis law says that “Speedup tends to increase with problem
size.” Justify the statement.
Note: Some of the theory part is not yet covered in theory classes, before
evaluation all the syllabus may get covered.