CS 584 Lecture 14 n Assignment –Program due now –Check the web »Create program model & do calculations »Additional calculation problems n Paper presentations.

Slides:



Advertisements
Similar presentations
Introduction to C Programming
Advertisements

Arrays.
Intermediate Code Generation
Chapter 10 Introduction to Arrays
COEN Expressions and Assignment
CS 584 Lecture 17 n Assignment? n C* program n Papers n Test n When?
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 6 Functions.
Data Parallel Algorithms Presented By: M.Mohsin Butt
ASC Language 1 Additional ASC Programming Comments NOTE: These are additional notes to be added to “ASC Programming” slides by Michael Scherger. Comparison.
1 Arrays  Arrays are objects that help us organize large amounts of information  Chapter 8 focuses on: array declaration and use passing arrays and array.
Linda: A Data-space Approach to Parallel Programming CSE60771 – Distributed Systems David Moore.
CS 584 Lecture 16 n Assignment -- Due Friday n C* program n Paper reviews.
Arrays Data Structures - structured data are data organized to show the relationship among the individual elements. It usually requires a collecting mechanism.
C++ for Engineers and Scientists Third Edition
Lesson 6 Functions Also called Methods CS 1 Lesson 6 -- John Cole1.
CS 106 Introduction to Computer Science I 03 / 17 / 2008 Instructor: Michael Eckmann.
C++ fundamentals.
C programming---Arrays scalar: capable of holding a single data item aggregate variables: capable of holding a collections of values. Two kinds of aggregates.
Programming Concepts MIT - AITI. Variables l A variable is a name associated with a piece of data l Variables allow you to store and manipulate data in.
1 Chapter 9 Spaces with LINDA. 2 Linda Linda is an experimental programming concept unlike ADA or Occam which are fully developed production-quality languages.
Chapter 6Java: an Introduction to Computer Science & Programming - Walter Savitch 1 l Array Basics l Arrays in Classes and Methods l Programming with Arrays.
Lecture 4: Parallel Programming Models. Parallel Programming Models Parallel Programming Models: Data parallelism / Task parallelism Explicit parallelism.
LECTURE LECTURE 17 More on Templates 20 An abstract recipe for producing concrete code.
Ryan Chu. Arithmetic Expressions Arithmetic expressions consist of operators, operands, parentheses, and function calls. The purpose is to specify an.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Microsoft Visual Basic 2008 CHAPTER NINE Using Arrays and File Handling.
Microsoft Visual Basic 2005 CHAPTER 9 Using Arrays and File Handling.
 2004 Prentice Hall, Inc. All rights reserved. 1 Chapter 11 - JavaScript: Arrays Outline 11.1 Introduction 11.2 Arrays 11.3 Declaring and Allocating Arrays.
Using Arrays and File Handling
EE4E. C++ Programming Lecture 1 From C to C++. Contents Introduction Introduction Variables Variables Pointers and references Pointers and references.
A First Book of ANSI C Fourth Edition
Microsoft Visual C++.NET Chapter 61 Memory Management.
Session 7 JavaScript/Jscript: Arrays Matakuliah: M0114/Web Based Programming Tahun: 2005 Versi: 5.
Overloading Binary Operators Two ways to overload –As a member function of a class –As a friend function As member functions –General syntax Data Structures.
Array (continue).
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Chapter 18 Java Collections Framework
Stored Procedures Week 9. Test Details Stored Procedures SQL can call code written in iSeries High Level Languages –Called stored procedures SQL has.
M180: Data Structures & Algorithms in Java Arrays in Java Arab Open University 1.
C++ for Engineers and Scientists Second Edition Chapter 11 Arrays.
Coordination Models and Languages Part I: Coordination Languages and Linda Part II: Technologies based on Tuple space concept beyond Linda Part III: Comparison.
Design Issues. How to parallelize  Task decomposition  Data decomposition  Dataflow decomposition Jaruloj Chongstitvatana 2 Parallel Programming: Parallelization.
Data Structure Introduction.
Starting Out with C++ Early Objects ~~ 7 th Edition by Tony Gaddis, Judy Walters, Godfrey Muganda Modified for CMPS 1044 Midwestern State University 6-1.
Copyright © 2002 W. A. Tucker1 Chapter 9 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Session 1 Module 1: Introduction to Data Integrity
 2008 Pearson Education, Inc. All rights reserved. 1 Arrays and Vectors.
Lecture 5 functions 1 © by Pearson Education, Inc. All Rights Reserved.
Chapter 8 Arrays. A First Book of ANSI C, Fourth Edition2 Introduction Atomic variable: variable whose value cannot be further subdivided into a built-in.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Chapter 6 Functions. 6-2 Topics 6.1 Modular Programming 6.2 Defining and Calling Functions 6.3 Function Prototypes 6.4 Sending Data into a Function 6.5.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 7A Arrays (Concepts)
Chapter 9 Introduction to Arrays Fundamentals of Java.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
CS 116 Object Oriented Programming II Lecture 13 Acknowledgement: Contains materials provided by George Koutsogiannakis and Matt Bauer.
1. Advanced SQL Functions Procedural Constructs Triggers.
Windows Programming Lecture 03. Pointers and Arrays.
User-Written Functions
GC211Data Structure Lecture2 Sara Alhajjam.
CS 326 Programming Languages, Concepts and Implementation
Department of Computer Science,
CS 584 Lecture 15 Assignment? (Due Friday) Friday paper presentations
Microsoft Access Illustrated
Variables and Arithmetic Operations
PHP.
Object Oriented Programming in java
JavaScript Arrays.
CodePainter Revolution Trainer Course
Arrays.
Presentation transcript:

CS 584 Lecture 14 n Assignment –Program due now –Check the web »Create program model & do calculations »Additional calculation problems n Paper presentations on Friday by: –Matt Probst –Glenn Judd

High Level Parallel Programming n Message Passing is considered to be low- level parallel programming. n Why not have a high level parallel programming language? –Easier? –More efficient? –Same performance?

High Level Parallel Programming n Many high level languages introduced –SR (University of Arizona) –HPF –C* –others n A high level language compiles to message passing code which is then compiled to machine code to be executed.

Data Parallel Programming n Parallel & scalar data n Based on operations being performed on each data element of a parallel variable. n A statement executed on parallel data is performed on each element individually n Functions are provided to include the element index in the operation

C* n Data parallel language n Based on standard C with extensions n Produce code for both SIMD and MIMD n Accept any standard C program and compile it correctly.

C* n Presents a global view abstraction of the parallel machine. n Data can be parallel or scalar –scalar is default n Parallel data is acted upon by new or overloaded operators and statements n Parallel variables are seen and operated on as monolithic vectors or arrays.

C* Additions to C n Reserved words –bool, dimof, everywhere, overload, pcoord, shape, where, with, and others n New operators – ?, >?=, % –[] index operator is used as a unary prefix n Overloaded Operators –reductions, etc.

Parallel Variables n A shape is an indication of an arrangement of a parallel variable n Parallel variables are declared in 2 Steps –Declare the shape –Declare a variable that is based on the shape n The compiler automatically distributes the variable across the architecture.

Declaring Parallel Variables n Shape Declaration –Gives the compiler clues on partitioning –Uses left indexing followed by shape name –shape [10]Sb, [50][30]Sc n Variable declaration –Declare type and shape of each variable –int ai1:Sb, ai2:Sc

Parallel Variables n Shapes can be used for all variable types including structures and unions. n Shapes can be dynamically created just the same as arrays are created. –Single dimension only –Fake multiple dimensions

Using Parallel Variables n Addressed just like arrays only backwards –index first –[5][6]ai2 = 23; –for (I = 0; I < 10; I++) [I]c = [I]a + [I]b;

Parallel Variable Operations n Parallel to scalar reduction –scalar op parallel_variable –x += ai1; –Operators n Result is combined with scalar value!! +=sum&=bitwise AND<?=min -=neg. sum^=bitwise XOR>?=max *=product|=bitwise OR /=1/product

Contextualization n Sets up a boolean mask to prevent an operation on certain elements of a shape n Where statement –where (where-expression) then-body –where (where-expression) then-body else else-body

Contextualization n The where-expression must be based on the shape that will be operated on. n Example –where (b >= 3) c = b + a n Assignment only occurs in the active positions.

The with statement n The with statement is used for selecting the current shape to operate on. n The with-statement must be used to select a current shape before any parallel code may be executed n with (shape-expression) shape-body

pcoord n Works on the current shape n Returns the element number n You supply which dimension you are interested in. n int:current pcoord(int dim) –dim == 0 returns the row –dim == 1 returns the column

#include #define SIZE 1000 shape [SIZE]span; main(){ double sum; double width; with(span) { double x:span; x = (pcoord (0) + 0.5) * 1.0/SIZE; sum = (+= (4.0/(1 + x*x))); } sum *= 1.0/SIZE; printf("Estimation is %lf\n", sum); }

Linda n Consists of several operations that work on a global data space (tuple space) n The operations have been added to several languages. n MIMD programming model –Interaction is through tuple space

Tuples n A tuple is an object consisting of: –a key –zero or more arguments »Example ("jim", 88, 1.5) n The key is used for matching

Tuple Space n Global data space n Collection of tuples n Tuples may be: –inserted (out) –read (rd and rdp) –deleted(in and inp) –evaluated(eval) »forks a new worker

Tuple Space

n Updating a tuple –delete - modify - insert n Duplicate key entries is allowed –Non-determinism n inp and rdp guarantee to locate a matching tuple iff a matching tuple must have been added and could not have been removed before the request

Example Programs n Database search n Master-Worker n Divide and Conquer

procedure manager count = 0 until EOF do read datum from file OUT("datum", datum) count++ enddo best = 0.0 for j = 1 to count IN("score", value) if (value > best) best = value endfor for j = 1 to numworkers OUT("datum", "stop") endfor end

procedure worker IN("datum", datum) until datum == "stop" value = compare(datum, target) OUT("score", value) IN("datum", datum) enddo end

Tuple Space n Perfect candidate for a database. n Simplifies parallel programming? n Performance? –Consider the implementation of the tuple space.

Tuple Space Implementation n Central n What advantages/disadvantages does this implementation present?

Tuple Space Implementation n Distributed n What advantages/disadvantages does this implementation present?