parllelizaion
TRANSCRIPT
![Page 1: Parllelizaion](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/1.jpg)
Vivek Kantariya(09bce020)
Guided by :Prof. Vibha Patel
![Page 2: Parllelizaion](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/2.jpg)
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](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/3.jpg)
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](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/4.jpg)
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](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/5.jpg)
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](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/6.jpg)
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](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/7.jpg)
#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](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/8.jpg)
#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](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/9.jpg)
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](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/10.jpg)
![Page 11: Parllelizaion](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/11.jpg)
Fission / distribution Fusion / combining Interchange / permutation Inversion Loop-invariant code motion Loop reversal
![Page 12: Parllelizaion](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/12.jpg)
Replace multiple loops with a single one
![Page 13: Parllelizaion](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/13.jpg)
break down large loop body into smaller ones to achieve better utilization of locality of reference
![Page 14: Parllelizaion](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/14.jpg)
It is the process of exchanging the order of two iteration variables
![Page 15: Parllelizaion](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/15.jpg)
Replaces a while loop by an if block containing a do..while loop
![Page 16: Parllelizaion](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/16.jpg)
Moving statements which are not relevant to loop outside
![Page 17: Parllelizaion](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/17.jpg)
Run a loop backward so that loop fusion can be used
![Page 18: Parllelizaion](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/18.jpg)
1. www.ieeexplore.ieee.org
2. http://wikipedia.org
3. http://computing.llnl.gov/tutorials/openMP
![Page 19: Parllelizaion](https://reader037.vdocuments.site/reader037/viewer/2022103016/55509825b4c9058b208b475d/html5/thumbnails/19.jpg)