Lab Manual — Programs
PC - Lab Manual (Simplified) · BCS7O2 · 2022 scheme
Program 1
Write an OpenMP program to sort an array of n elements using both Sequential Merge Sort and Parallel Merge Sort (using Sections). Record the difference in execution time.
Program 2
Write an OpenMP program that divides the iterations into chunks containing 2 iterations respectively (OMP_SCHEDULE=static,2). Its input should be the number of iterations, and its output should display 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: Thread 0 : Iterations 0 – 1 Thread 1 : Iterations 2 – 3
Program 3
Write an OpenMP program to calculate n Fibonacci numbers using tasks.
Program 4
Write an OpenMP program to find the prime numbers from 1 to n employing the parallel for directive. Record both serial and parallel execution times.