ParaFlow A practical, easy to use, parallel processing language.

Slides:



Advertisements
Similar presentations
Objects and Classes David Walker CS 320. Advanced Languages advanced programming features –ML data types, exceptions, modules, objects, concurrency,...
Advertisements

C Language.
Ruby (on Rails) CSE 190M, Spring 2009 Week 3. Web Programming in Ruby Ruby can be used to write dynamic web pages Similar to PHP, chunks of Ruby begins.
Written by: Dr. JJ Shepherd
1 CS 161 Introduction to Programming and Problem Solving Chapter 9 C++ Program Components Herbert G. Mayer, PSU Status 10/20/2014.
Liang, Introduction to Programming with C++, Second Edition, (c) 2010 Pearson Education, Inc. All rights reserved Chapter 5 Function Basics.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Names and Scopes CS 351. Program Binding We should be familiar with this notion. A variable is bound to a method or current block e.g in C++: namespace.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
Reasons to study concepts of PL
1 Chapter 2 Introductory Programs. 2 Getting started To create and run a Java program –Create a text file with a.java extension for the source code. For.
Scott Grissom, copyright 2004Ch 3: Java Features Slide 1 Why Java? It is object-oriented provides many ready to use classes platform independent modern.
Squirrel Programming Language By Nandini Bhatta CS537 Summer 2008.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles C/C++ Emery Berger and Mark Corner University of Massachusetts.
Guide To UNIX Using Linux Third Edition
C++ fundamentals.
Peter Juszczyk CS 492/493 - ISGS. // Is this C# or Java? class TestApp { static void Main() { int counter = 0; counter++; } } The answer is C# - In C#
C++ Functions. 2 Agenda What is a function? What is a function? Types of C++ functions: Types of C++ functions: Standard functions Standard functions.
OOP Languages: Java vs C++
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
Programming Languages and Paradigms Object-Oriented Programming.
Operator Precedence First the contents of all parentheses are evaluated beginning with the innermost set of parenthesis. Second all multiplications, divisions,
EE4E. C++ Programming Lecture 1 From C to C++. Contents Introduction Introduction Variables Variables Pointers and references Pointers and references.
Static and Dynamic Behavior CMPS Power of OOP Derives from the ability of objects to change their behavior dynamically at run time. Static – refers.
Chapter 21 Generics 1. Generics - Overview Generic Methods specify a set of related methods Generic classes specify a set of related types Software reuse.
Programming Language C++ Xulong Peng CSC415 Programming Languages.
1 Names, Scopes and Bindings Aaron Bloomfield CS 415 Fall
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
CS212: Object Oriented Analysis and Design Lecture 7: Arrays, Pointers and Dynamic Memory Allocation.
C# Versus Java Author: Eaddy, Marc Source: Software Tools for the Professional Programmer. Dr. Dobb's Journal. Feb2001, Vol. 26 Issue 2, p74 Hong Lu CS699A.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
C# EMILEE KING. HISTORY OF C# In the late 1990’s Microsoft recognized the need to be able to develop applications that can run on multiple operating system.
Copyright © Curt Hill Structured Data What this course is about.
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
1 Chapter 2 C++ Syntax and Semantics, and the Program Development Process.
Lecture 19 CIS 208 Wednesday, April 06, Welcome to C++ Basic program style and I/O Class Creation Templates.
Java Basics Opening Discussion zWhat did we talk about last class? zWhat are the basic constructs in the programming languages you are familiar.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
M1G Introduction to Programming 2 5. Completing the program.
Copyright Curt Hill Arrays in C/C++ What? Why? How?
Chapter 8 Class Inheritance and Interfaces F Superclasses and Subclasses  Keywords: super F Overriding methods  The Object Class  Modifiers: protected,
A Quick Java Course part 1 Michael McDougall CIS 573 September 27 th, 1999.
Functions Math library functions Function definition Function invocation Argument passing Scope of an variable Programming 1 DCT 1033.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Object Oriented Programming Session # 03.  Abstraction: Process of forming of general and relevant information from a complex scenarios.  Encapsulation:
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
CSCI-383 Object-Oriented Programming & Design Lecture 25.
Java & C++ Comparisons How important are classes and objects?? What mechanisms exist for input and output?? Are references and pointers the same thing??
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
FIT Objectives By the end of this lecture, students should: understand the role of constructors understand how non-default constructors are.
 Static  Example for Static Field  Example for Static Method  Math class methods  Casting  Scope of Declaration  Method Overloading  Constructor.
Terms and Rules II Professor Evan Korth New York University (All rights reserved)
Mid-Year Review. Coding Problems In general, solve the coding problems by doing it piece by piece. Makes it easier to think about Break parts of code.
Unit – 3 Control structures. Condition Statements 1.If.…..else :- Has someone ever told you, "if you work hard, then you will succeed"? And what happens.
Presentation By :- Nikhil R. Anande ( ) Electronic & Communication Engineering. 3 nd Year / 5 th Semester FACULTY GUIDE : RAHIUL PATEL SIR MICROCONTROLLER.
Java and C# - Some Commonalities Compile into machine-independent, language- independent code which runs in a managed execution environment Garbage Collection.
Design issues for Object-Oriented Languages
CS 215 Final Review Ismail abumuhfouz Fall 2014.
Introduction to C++ Systems Programming.
Chapter 5 Function Basics
CS360 Windows Programming
Functional Programming with Java
Chapter 5 Function Basics
Java Programming Language
Arrays in Java What, why and how Copyright Curt Hill.
Java Inheritance.
SPL – PS1 Introduction to C++.
Presentation transcript:

ParaFlow A practical, easy to use, parallel processing language.

Parallel programming constructs: Para: executes in parallel on all items in a collection. Flow: marks a function as having no side effects.

Simplicity No objects or even functions are required. Hello world program is just: –print(“Hello world.”); Built in string type is easy and powerful. Memory for strings and objects is automatically freed. Files are automatically closed. Syntax is simple and readable. Generally very like C or Java. No threads to synchronize.

Example Flow Function flow polar(double angle,rad) into (double x,y) { x = rad * math.cos(angle); y = rad * math.sin(angle); } (double a,r) = polar(4.0, 5.0); // The compiler would report an error if // the polar function modified any // global variables since it is declared as // “flow”. Functions with side effects must be // declared with the “to” keyword instead.

Para expression constructs // Make an array to work on. array of int a = (1,2,3,4,5,6); // Get array of all elements squared array of int aSquared = para (x in a) get x*x; // Get maximum value in array int maxA = para (x in a) max x; // Get array just containing odd numbers array of int odd = para (x in a) filter x&1;

The para…do construct // Declare a 2-D point class class point {double x,y;} // function to scale an array of points to blowUp(array of point points, double scaleFactor) { // With the para … do construct can alter // all elements in a collection in parallel. para (p in points) do { p.x *= scaleFactor; p.y *= scaleFactor; }

The case statement // The case is different from C’s switch case (name) { “Mark”,”Angie” : occupation = “programmer”; “Heidi” : occupation = “writer”; “Rover” : { occupation = “dog”; print(“Woof”); } else : occupation = “unknown”; } // Motivation for difference is to avoid problems // with missing breaks, and allow use of non-integer // expressions.

Object Oriented Features Classes with single inheritance. Interfaces similar to Java. Automatic serialization of objects No overloading (but default parameters allowed). Methods must be declared polymorphic to be overridden.

A Simple Class and Serialization class family { string name; array of string members; } family kents = (“Kent”, (“Mira”, “Tisa”, “Jim”, “Heidi)); print(kents); > (“Kent”, (“Mira”, “Tisa”, “Jim”, “Heidi”)) print(kents.members.size) > 4

Other Advanced Features Flexible quotes makes embedding HTML and other intricate text in program easy. Does variable substitution in strings. Bounds checking on array accesses, and checking for use of uninitialized objects. Errors generate stack trace and position of error in source. For statement operates over collections (and makes bounds checks unneeded). Traditional for (;;) also supported. No need to predeclare functions or for separate header files. Built in dir (aka hash,directory) collection. No need to cast objects out of collections.

Printing HTML fragment string title = “My ParaFlow CGI Program $programName”; string background = “images/gears.jpg”; print(quote to ENDOFHTML $title BACKGROUND=“$background”> Hello HTML CGI World from ParaFlow ENDOFHTML);

Example Dir and For dir of int numNames = 1, 2, 3) print(numNames[“one”]);  1 for (i in numNames) print( i + “ “ + i*i);  1 1  2 4  3 9 for in numNames) print(“$key -> $val);  one -> 1  two -> 2  three-> 3

Run Time Errors to goTooFar(array of int a, int value) // Set all elements of a to a value with a bug { for (int i=0; i<= a.size; i++) a[i] = value; } to initArrays(array of int a, int aVal, string why) // Initialize two arrays to values { print(“Initializing a and b because $why”); goTooFar(a,aVal); } array[10] of int a; initArrays(a,123,”just because”);  Initializing a because just because  start stack dump  goTooFar(a:, value:123)  initArrays(a:, aVal:123, why:”just because”)  Run time error line 5 col 4 of pastEnd.pf: array access out of bounds

More complex classes class animal { string name; to printName() {print(self.name);} polymorphic to speak() {print(“???”); } } class dog extends animal { polymorphic to speak() {print(“bark”); } } class toyPoodle extends dog { polymorphic to speak() {print(“yip”); } } dog fido = (“Fido”), toyPoodle fifi = (“Fifi”); array of animals = (fido, fifi) foreach (a in animals) a.speak(); >bark >yip

What’s Implemented Classes with inheritance & polymorphism Print and file I/O that handles objects of different types without being told how. For, while, if, case, functions with multiple returns Modules, exceptions, interfaces String, file, html fetch libraries. Reference counting/auto freeing of objects Serial implementations of “para” constructs.

Still to come Making parallel constructs actually work in parallel. Generating Pentium rather than C code. –Current code is about 1/4 speed of equivalent C Generating Open Source buzz on language –Open Source Conf Portland in July is launch

Implementation Whole module done in memory in many passes: –Tokenizer –Scan tokens for class names –Parser –Resolving variable names –Type checker –C code generator Calls gcc on C code.