ASC Language 1 Additional ASC Programming Comments NOTE: These are additional notes to be added to “ASC Programming” slides by Michael Scherger. Comparison.

Slides:



Advertisements
Similar presentations
Introduction to C Programming
Advertisements

Control Structures Selections Repetitions/iterations
Intermediate Code Generation
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
Chapter 7: User-Defined Functions II
Chapter 7: User-Defined Functions II Instructor: Mohammad Mojaddam.
 Control structures  Algorithm & flowchart  If statements  While statements.
ECE 103 Engineering Programming Chapter 11 One Minute Synopsis Herbert G. Mayer, PSU CS Status 7/1/2014.
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
ISBN Chapter 10 Implementing Subprograms.
Data Parallel Languages ASC multiC Fortran 90 & HPF.
CS 106 Introduction to Computer Science I 02 / 12 / 2007 Instructor: Michael Eckmann.
Loops – While, Do, For Repetition Statements Introduction to Arrays
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.
An Associative Program for the MST Problem Part 2 of Associative Computing.
Run-time Environment and Program Organization
ASC Programming Michael C. Scherger Department of Computer Science Kent State University September 27, 2002.
Arrays Data Structures - structured data are data organized to show the relationship among the individual elements. It usually requires a collecting mechanism.
ASC Program Example Part 3 of Associative Computing Examining the MST code in ASC Primer.
CS241 PASCAL I - Control Structures1 PASCAL I - Control Structures Philip Fees CS241.
Data Parallel Languages (Chapter 4) ASC Language multiC Fortran 90 and HPF.
Chapter 8 Physical Database Design. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Overview of Physical Database.
Chapter 1 Algorithm Analysis
A Simple Two-Pass Assembler
5-1 Chapter 5 The Repetition Process in VB.NET. 5-2 Learning Objectives Understand the importance of the repetition process in programming. Describe the.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition, Fifth Edition Chapter 7: User-Defined Functions II.
Comp 245 Data Structures Linked Lists. An Array Based List Usually is statically allocated; may not use memory efficiently Direct access to data; faster.
Computer Science 12 Mr. Jean May 2 nd, The plan: Video clip of the day Review of common errors in programs 2D Arrays.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
1 © 2002, Cisco Systems, Inc. All rights reserved. Arrays Chapter 7.
Arrays An array is a data structure that consists of an ordered collection of similar items (where “similar items” means items of the same type.) An array.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
COMPUTER PROGRAMMING. Iteration structures (loops) There may be a situation when you need to execute a block of code several number of times. In general,
Ch. 5 Ch. 51 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (more notes) Dr. Carter Tiernan.
PL/SQLPL/SQL Oracle10g Developer: PL/SQL Programming Chapter 3 Handling Data in PL/SQL Blocks.
CONTENTS Processing structures and commands Control structures – Sequence Sequence – Selection Selection – Iteration Iteration Naming conventions – File.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Control Statements I.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 5P. 1Winter Quarter C Programming Basics.
The ASC Language Part 2 of Associative Computing.
Addressing Modes Chapter 6 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
ITI 1120 Lab #5 Contributors: S. Boyd, R. Plesa, A. Felty, D. Inkpen, A. Williams, D. Amyot.
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
Oracle10g Developer: PL/SQL Programming1 Objectives SQL queries within PL/SQL Host or bind variables The %TYPE attribute Include queries and control structures.
CS241 PASCAL I - Control Structures1 PASCAL Control Structures Modified Slides of Philip Fees.
Ch. 5 Ch. 51 jcmt Summer 2003Programming Languages CSE3302 Programming Languages (more notes) Summer 2003 Dr. Carter Tiernan.
Chapter 8 Physical Database Design. Outline Overview of Physical Database Design Inputs of Physical Database Design File Structures Query Optimization.
Think Possibility 1 Iterative Constructs ITERATION / LOOPS C provides three loop structures: the for-loop, the while-loop, and the do-while-loop. Each.
 Software Development Life Cycle  Software Development Tools  High Level Programming:  Structures  Algorithms  Iteration  Pseudocode  Order of.
Data Structures and Algorithms Searching Algorithms M. B. Fayek CUFE 2006.
Arrays Chapter 7. MIS Object Oriented Systems Arrays UTD, SOM 2 Objectives Nature and purpose of an array Using arrays in Java programs Methods.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 7A Arrays (Concepts)
Today… Preparation for doing Assignment 1. Invoking methods overview. Conditionals and Loops. Winter 2016CMPE212 - Prof. McLeod1.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
Imperative Programming Statements and invariants.
Chapter 15 Running Time Analysis. Topics Orders of Magnitude and Big-Oh Notation Running Time Analysis of Algorithms –Counting Statements –Evaluating.
Loops causes program to execute the certain block of code repeatedly until some conditions are satisfied. Suppose you want to execute some code/s 10 times.
Chapter 7: User-Defined Functions II
Indexing Structures for Files and Physical Database Design
GC211Data Structure Lecture2 Sara Alhajjam.
Data Structures Interview / VIVA Questions and Answers
Scripts & Functions Scripts and functions are contained in .m-files
Ch 7: JavaScript Control Statements I.
User-Defined Functions
Arrays, For loop While loop Do while loop
Chapter 6 Intermediate-Code Generation
Java Programming Arrays
A Simple Two-Pass Assembler
Presentation transcript:

ASC Language 1 Additional ASC Programming Comments NOTE: These are additional notes to be added to “ASC Programming” slides by Michael Scherger. Comparison of logical parallel and index parallel –A index parallel variable selects a single scalar value from a parallel variable. –A logical parallel variable L is normally used to store the result of a search such as L[$] = A[$].eq. B[$] –ASC implementation simplifies usage by not formally distinguishing between the two. The correct type should be selected to improve readability. Mixed mode operations are supported and their result has the “natural” mode. For example, if int scalar a, b, c; int parallel p[$], q[$], r[$], t[$,4]; index parallel x[$], y[$]; then c = a + b scalar integer q[$] = a + p[$] parallel integer variable a + p[x]integer value r[$] = t[x,2]+3*p[$] parallel integer variable x[$] = p[$].eq. r[$]index parallel variable

ASC Language 2 Array Dimensions –Int parallel can have up to 3 dimensions First dimension is “$”, the parallel dimension –The array numbering is zero-based, so the declaration int parallel A[$,2] creates the following 1dimensional variables: A[$,0], A[$,1], A[$,2] Dynamic Storage allocation –allocate is used to activate a cell to store a new association record Creates a parallel index that points to the new cell –release is used to de-allocate storage of specified records in association Can release multiple records simultaneously. –Example: char parallel node[$], parent[$]; logical parallel tree[$]; index parallel x[$]; associate node[$], level[$], parent[$] with tree[$]; allocate x in tree[$] node[x] = ‘B’ endallocate x; release parent[$].eq. ‘A’ from tree[$].

ASC Language 3 Parallel IF-THEN-ELSE Example and Mask Trace if A[$].eq. 2 then A[$] = 5; else A[$] = 0; endif; any – elsenany statement –All active cells execute statements inside the any- block if there is one responder. –If there are no responders, then all active cells execute the statements inside the elsenany block –any can be used alone (without the elsenany) –Example any A[$].eq. 10 B[$] =11; elsenany B[$] = 100; endany; if then – elsenany statement A[$] BEFORE MASK BEFORE A[$] AFTER THEN MASK ELSE MASK

ASC Language 4 for construct –Often used when a process must be repeated for each cell that satisfies a certain condition. –The index variable is available throughout the body of the for statement –The index value of for is only evalulated initially –Example: sum = 0; for x in A[$].eq. 2 sum = sum + B[$]; endfor x; –Trace for example: Loop-Until Construct for sequential repetitions –Used for sequential type repetitions –See earlier slide and primer for details A[$]B[$]xloopsum st nd rd10

ASC Language 5 while contruct –Unlike the for statement, this construct re- evaluates the logical conditional statement prior to each execution of the body of the while. – The bit array resulting from the evaluation of the conditional statement is assigned to the index parallel variable on each pass. –The index parallel array is available for use within the body each loop. –The body of the while construct will continue to be executed until there are no responders (i.e., all zeros) in the index parallel variable. –Study example and trace in ASC Primer carefully to make sure you understand while. get statement –Used to retrieve a value from a specific field in a parallel variable satisfying a specific conditional statement. –Example: get x in tail[$].eq. 1 val[x] = 0; endget x; –Read trace of this example in on page 24 of ASC Primer to make sure its action is clear.

ASC Language 6 next statement –Similar to get except next updates the set of responders each time it is called. –Unlike get, two successive calls to next is expected to select two distinct cells (and two distinct association records). –Can be used in loops to sequentially process each responder. –See page of ASC Primer for more details. The maxval and minval functions –maxval returns the maximum value of the specified items among the active responders. –Similarly, minval returns the minimum value. –Example: if (tail[$].neq. 1) then k = maxval( weight[$]); endif; –See trace of example on pg 27 of Primer. The maxdex and mindex functions –They return the index of an (association) entry where a maximum or minimum occurs. –If maximum/minimum value occurs at more than one location, an arbitrary selection is made as to which index is returned.

ASC Language 7 setscope/endsetscope –setscope jumps out of current mask setting to another mask setting. –One use is to reactivate currently inactive processors. –Also allow immediate return to a previously calculated mask, such as an association. –is an unstructured command such as go-to and jumps from current environment to a new environment. Use sparingly –endsetscope resets mask to preceding setting. Restricted subroutine capability is currently available –See call and include on pg 25-6 of Primer. Use of personal pronouns and articles in ASC make code easier to read and shorter. –See page 29 of ASC Primer. The ASC Monitor is important for evaluation and comparison of various ASC algorithms and software. (See Pg of ASC Primer)

ASC Language 8 Scalar variable input –Static input can be handled in the code. –Also, define or deflog statements can be used to handle static input. –Dynamic input is currently not supported directly, but can be accomplished as follows: Reserve a parallel variable dummy (of desired type) for input. Reserve a parallel index variable used. A value to be stored in scalar variables is first read into dummy using a parallel-read and then transferred using get or next to the appropriate scalar variable. Example: read dummy[$] in used[x]; get x in used[$] scalar-variable = dummy[x]; endget x; NOTE: Don’t need to use associate statement to associate dummy with used. Omission causes no problems as no check is currently made.