Parllelizaion
-
Upload
vivek-kantariya -
Category
Technology
-
view
190 -
download
0
Transcript of Parllelizaion
Vivek Kantariya(09bce020)
Guided by :Prof. Vibha Patel
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
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
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
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.
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
#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 }
}
#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
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
Fission / distribution Fusion / combining Interchange / permutation Inversion Loop-invariant code motion Loop reversal
Replace multiple loops with a single one
break down large loop body into smaller ones to achieve better utilization of locality of reference
It is the process of exchanging the order of two iteration variables
Replaces a while loop by an if block containing a do..while loop
Moving statements which are not relevant to loop outside
Run a loop backward so that loop fusion can be used
1. www.ieeexplore.ieee.org
2. http://wikipedia.org
3. http://computing.llnl.gov/tutorials/openMP