Home PC - Lab Manual (Simplified) Lab Manual

Lab Manual — Programs

PC - Lab Manual (Simplified) · BCS7O2 · 2022 scheme

4 programs
Program 1

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.

C Text output
Program 2

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

C Text output
Program 3

Program 3

Write an OpenMP program to calculate n Fibonacci numbers using tasks.

C Text output
Program 4

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.

C Text output