Dependency Test in Loops By Amala Gandhi. Data Dependence Three types of data dependence: 1. Flow (True) dependence : read-after-write int a, b, c; a.

Slides:



Advertisements
Similar presentations
The Important Thing About By. The Important Thing About ******** The important thing about ***** is *****. It is true s/he can *****, *****, and *****.
Advertisements

Selection Feature of C: Decision making statements: It allow us to take decisions as to which code is to be executed next. Since these statements control.
Control Structures.
Name: Date: Understand multiplication as jumps of Independent / Some adult support / A lot of adult support 1) 2) 3) 4) 5) 6) 7) 8) 9) ©
Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Introduction to Java 2 Programming Lecture 5 Array and Collections.
Guide to solving complex circuits.
Repetition Statements Perform the same task repeatedly Allow the computer to do the tedious, boring things.
Iterations for loop. Outcome Introduction to for loop The use of for loop instead of while loop Nested for loops.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 3: Flow Control I: For Loops.
3-1 Chapter 3 Flow of Control (part a - branching)
Lesson 6A – Loops By John B. Owen All rights reserved ©2011.
Program Looping EE2372 Software Design I Dr. Gerardo Rosiles.
Praktikum C Programming Perulangan / Loop. Bentuk Loop 1.Perintah for 2.Perintah while 3.Perintah do-while.
For(int i = 1; i
Copyright 2008 by Pearson Education 1 Nested loops reading: 2.3 self-check: exercises: videos: Ch. 2 #4.
Programming In C++ Spring Semester 2013 Lecture 3 Programming In C++, Lecture 3 By Umer Rana.
Looping Structures: Do Loops
Functions, Domain and Range
Introduction to Arrays Chapter What is an array? An array is an ordered collection that stores many elements of the same type within one variable.
How SAS implements structured programming constructs
Do-while Loops Programming. COMP102 Prog Fundamentals I: do-while Loops /Slide 2 The do-while Statement l Syntax do action while (condition) l How it.
Two-Dimensional Arrays Chapter What is a two-dimensional array? A two-dimensional array has “rows” and “columns,” and can be thought of as a series.
Jeopardy Start Final Jeopardy Question Category 1Category 2Category 3Category 4Category
Powerpoint Jeopardy Category 1Category 2Category 3Category 4Category
Java POWERED BY: ARVIND DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING RADHA GOVIND GROUP OF INSTITUTIONS,MEERUT.
Control Structure There are two kind of control structure in GWBASIC one is iteration/loop or repetitive and second make decision/condition. Iteration/Loop.
SORTING Lecture 12B CS2110 – Spring InsertionSort 2 pre: b 0 b.length ? post: b 0 b.length sorted inv: or: b[0..i-1] is sorted b 0 i b.length sorted.
COSC513 Operating System Research Paper Fundamental Properties of Programming for Parallelism Student: Feng Chen (134192)
CS 201 Compiler Construction
Whitebox Testing Fra: CS Fall Whitebox Testing AKA Structural, Basis Path Test Normally used at unit level Assumes errors at unit level are.
Instruction-Level Parallel Processors {Objective: executing two or more instructions in parallel} 4.1 Evolution and overview of ILP-processors 4.2 Dependencies.
Making Choices in C if/else statement logical operators break and continue statements switch statement the conditional operator.
Optimizing single thread performance Dependence Loop transformations.
Faculty of Sciences and Social Sciences HOPE Java: Loops within loops Stewart Blakeway FML 213
A loop is a repetition control structure. it causes a single statement or block to be executed repeatedly What is a loop?
1 Lecture 14 Chapter 6 Looping Dale/Weems/Headington.
1. Know the different types of flow block 2. Understand how problems can be broken down into smaller problems.
Repetition Control Structure. Introduction Many applications require certain operations to be carried out more than once. Such situations require repetition.
int num = 22; if (num > 0) if (num % 5 == 0) System.out.println(num); else System.out.println(num + “ is negative”);
1 For Loops l From Chapter 9 l A shorthand way of coding count loops.
GCSE Computing#BristolMet Session Objectives #23 MUST understand what is meant by the programming term iteration SHOULD describe methods of looping used.
LOOPING IN C. What would be the output of the following program main( ) { int j ; while ( j
While ( number
Conditional Statements A conditional statement lets us choose which statement will be executed next Conditional statements give us the power to make basic.
for( 起始條件 ; 判斷式 ; 條件運算 ){ // 迴圈內容 } while( 判斷式 ){ // 迴圈內容 } do{ // 迴圈內容 } while( 判斷式 ) ;
LESSON 5 Loop Control Structure. Loop Control Structure  Operation made over and over again.  Iterate statement.
Looping I (while statement). CSCE 1062 Outline  Looping/repetition construct  while statement (section 5.1)
Flowchart Symbols Terminal Process Input/ Output Decision
Dependence Analysis Important and difficult
Think What will be the output?
CiS 260: App Dev I Chapter 4: Control Structures II.
For Loops October 12, 2017.
Loops October 10, 2017.
Conditional Construct
محاضرة 1: مقدمة للمسـاق و مراجعـة للأساسيـات
Control structures to direct program flow
Solution to problem 4. a) Control flow graph art Start k = i + 2 * j
What output is produced by the following fragment?
Chapter 4 Loops Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved
CS150 Introduction to Computer Science 1
Loops Prof.Gaikwad Varsha P. Information Technology Dept.
Statements and flow control
Program Flow.
PROGRAM FLOWCHART Iteration Statements.
Print the following triangle, using nested loops
For Loops Pages
Types of loops definite loop: A loop that executes a known number of times. Examples: Repeat these statements 10 times. Repeat these statements k times.
Iteration Statement for

Presentation transcript:

Dependency Test in Loops By Amala Gandhi

Data Dependence Three types of data dependence: 1. Flow (True) dependence : read-after-write int a, b, c; a = c * 10; b = 2 * a + c; 2. Anti Dependency: write-after-read int a, b, c; a = b* 4+ c; c = b + 40; 3. Output Dependence: write-after-write int a, b, c; a = b *c ; a = b + c + 10;

Dependency in Loops Two main types of dependency in loops Loop Independent : Dependence in same iteration for (i = 2; i<= 4; i++){ a[i] = b[i] + c[i]; d[i] = a[i]; } Loop Carried : Dependence over the iteration for (i = 2 ; i< = 4; i++) { a[i] = b[i] + c[i]; d[i] = a[i-1]; }

Loop Dependency Analysis With automatic parallelization, the compiler detects loops that can be safely and efficiently executed in parallel Automatic parallelization, kind of optimization Shorter execution time Adds the parallel compiler directives To know whether two usages of an array access the same memory location, compiler needs to perform certain dependency tests

Greatest Common Divisor Test A Linear Diophantine equation a1*x1 + a2*x an*xn = c Above equation has a solution if, the greatest common divisor of a1,a2,..an can divide the c i.e. the result of the division is an integer. Example: 15*x +6*y -9*z = 12 gcd of 15, 6 and 9 is 3 3 can divide 12 Hence the equation has a solution. If equation has a solution, means has dependency,else no dependency

GCD Test contd. Code Snippet: for (i= 1; i < N; i++) { a[2* i] =.. ;.. = a[3* i - 5]; } Equation formation: 2x = 3y - 5 i.e. 2x – 3y = -5 GCD(2,3) = 1, divides 5 Has a dependency If there was no dependency, then compiler can directly go forward for applying the parallelization technique.

GCD Test Limitation GCD ignores bounds for (i = 1; i< 10; i++) { a[i] = b[i] + c[i]; d[i] = a[i-100]; } For above example, GCD test shows that there is dependence, but actually it has ignored bounds. GCD test also does not provide distance or direction information To overcome this limitation, GCD test is combined with Banerjee test Many such tests are present, different compilers may use different loop dependency test

Take Aways Terminologies used in Data Dependence and Loop Dependence Analysis Concept of tests used in Loop Dependence Analysis with the help of GCD test

Thank You