Skip to content

A parallel programming implementation in C using OpenMP

Notifications You must be signed in to change notification settings

ashish10alex/openmp-jacobi

Repository files navigation

openmp-jacobi

A parallel programming implementation in C using OpenMP

Introduction

Jacobi iterative method has been used to compute temperature distribution for a rectangular 2D problem. The boundary condition is set and temperature distribution has been calculated for a range of problem sizes with tolerance kept at 0.0001. The main aim of this project is concentrated at computing the speedup achieved while comparing the serial code provided with the contrived parallel version of the code.

Speed up is defined as ratio of the serial runtime obtained under the best optimization and algorithmic conditions to the time taken by the parallel version of the code to solve the same problem with certain number of processors.

Serial code execution

gcc jacobi_serial.c -o serial.out

./serial.out <matrix size> <matrix size> <tolerance>

./serial.out 200 200 0.0001

serial Implementation

Parallel code validation

The above code prints out matrices obtained from both serial and parallel implementations with the execution times for each. Validation has been performed at this stage for various problem sizes and 1,2,3,4 threads. The same script substracts the resultant parallel output from serial output and gives the values for the same as shown in figure below.

gcc -fopenmp jacobi_parallel_validation.c -o test.out

./test.out <matrix size> <matrix size> <tolerance> < threads >

./test.out 10 10 0.0001 2

Parellel code validation

Progressive Speedup

Progressive speedup can be visualized by running the following

gcc -fopenmp progressive_speedup.c -o speed.out

./speed.out <matrix size> <matrix size> <tolerance>

Progressive speedup

Optimized Parallel version

gcc -fopenmp jacobi_optimized.c -o omp_2.out

./omptimized.out <matrix size> <matrix size> <tolerance>

optimized_parallel

optimized_parallel

About

A parallel programming implementation in C using OpenMP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages