Parllelizaion

19
Vivek Kantariya (09bce020) Guided by : Prof. Vibha Patel

Transcript of Parllelizaion

Page 1: Parllelizaion

Vivek Kantariya(09bce020)

Guided by :Prof. Vibha Patel

Page 2: Parllelizaion

Direct Simulation Monte Carlo Used for keep tracking of finite fluid flow Used in supersonic and hypersonic flow It has large amount of molecules in

probabilistic simulation Over billions of molecules in random motion Large number of iterations

Page 3: Parllelizaion

Multi-processing:-more than one processor working on execution of program

Multi-threading:-more than one thread are working on same code

Loop optimization:-reduce the overhead in execution of

loopby transformation

Page 4: Parllelizaion

Open Multi Processing API that supports shared memory multi

processing in C, C++, Fortran It  is an implementation of multithreading Comprised of :- 1) Compiler Directives

2) Runtime Library Routines3) Environment Variables

Page 5: Parllelizaion

Based on the existence of multiple threads in the shared memory programming paradigm

OpenMP is an explicit (not automatic) programming model, offering the programmer full control over parallelization.

Page 6: Parllelizaion

Fork: the master thread then creates a team of parallel threads

Join: When the team threads complete the statements in the parallel region construct, they synchronize and terminate, leaving only the master thread

Page 7: Parllelizaion

#include <omp.h>main () { #pragma omp parallel private(var1, var2)

shared(var3) { Parallel section executed by all threads ………  All threads join master thread and disband }

}

Page 8: Parllelizaion

#pragma omp parallel [options]{}

block of code that will be executed by multiple threads

omp_set_num_threads() library function set the number of threads dynamically

omp_set_nested() library routine for nested parallel regions

Page 9: Parllelizaion

A work-sharing construct divides the execution of the enclosed code region among the members of the team that encounter it.

Work-sharing constructs do not launch new threads

Three work sharing constructs:-1. DO / for 2. SECTIONS3. SINGLE

Page 10: Parllelizaion
Page 11: Parllelizaion

Fission / distribution Fusion / combining Interchange / permutation Inversion Loop-invariant code motion Loop reversal

Page 12: Parllelizaion

Replace multiple loops with a single one

Page 13: Parllelizaion

break down large loop body into smaller ones to achieve better utilization of locality of reference

Page 14: Parllelizaion

It is the process of exchanging the order of two iteration variables

Page 15: Parllelizaion

Replaces a while loop by an if block containing a do..while loop

Page 16: Parllelizaion

Moving statements which are not relevant to loop outside

Page 17: Parllelizaion

Run a loop backward so that loop fusion can be used

Page 18: Parllelizaion

1. www.ieeexplore.ieee.org

2. http://wikipedia.org

3. http://computing.llnl.gov/tutorials/openMP

Page 19: Parllelizaion