Updating of an earlier primer by Julia Lee and Dr. Chandra Asthagiri based on Dr. Jerry Potter’s work



Download 193.33 Kb.
Page1/4
Date19.10.2016
Size193.33 Kb.
#3534
  1   2   3   4

Page of

ASC PRIMER

Updating of an earlier primer by Julia Lee and Dr. Chandra Asthagiri

based on Dr. Jerry Potter’s work

Current version due to Dr. Oberta Slotterbeck
ASC is a high level parallel language developed originally by Dr. Jerry Potter. ASC stands for Associative Computing. While ASC has been implemented on several computers, all but one implementation on a ClearSpeed machine no longer exists. An emulator that runs on Windows,

however, allows a professor to introduce a different style of parallel computing, have a virtual machine on which to run, and calculate how many scalar and how many parallel operations are utilized on a run. ASC has been used in classes at Kent State University and Hiram College.


A recent article in Computer states:

“Chipmakers … are studying the efficiency of novel advanced parallel architectures for many core processors. However, software researchers still struggle to achieve new technology breakthroughs in the design of software architecture to make the programming of future many-core processors feasible.


Software architects are looking for new approaches to deal with various pitfalls and issues such as data dependency, race conditions, load balancing, nondeterminism, and deadlocks. In addition they are researching advanced parallel programming paradigms that will allow the construction of easy-to-use, productive, energy-efficient, scalable, and portable parallel applications.”[5]
Associative computing is an excellent paradigm that meets the criteria above. As programming an associative computing machine requires different thought processes than those used for other parallel machines, it would be useful educationally to introduce associative computing as one style of parallel programming. Moreover, experiences at Kent State University and Hiram College show that very little time is required to have students start working with the associative computing environment.
The purpose of this primer is to show the basics of the ASC language and show how the emulator works. Most of the material for this primer is taken from Dr. Potter’s publications [6],[7],[8], Hioe’s thesis [2], and Lee’s thesis [3]. There are 6 chapters. The first chapter discusses the background of ASC; the second chapter shows how to get started. Chapters 3, 4, and 5 discuss the parallel operations of ASC; Chapter 6 presents additional features of ASC.
Acknowledgement: This document was originally prepared through the efforts of many people, in particular Julia Lee and Chandra Asthagiri. The drawings are from Lee’s master thesis. Recently Dr. Slotterbeck has eliminated references to running the emulator on The Connection Machine and the WaveTracer as these are no longer existing machines and new programs were added.
Chapter 1

ASC Background


1.1 Introduction

ASC is a parallel computer language which can be used as an algorithmic language or as a programming language that will run on the ASC emulator on a sequential machine. Although timings don’t make sense, ASC can count scalar operations and parallel operations so comparisons between algorithms can be made. The STARAN Computer (Goodyear Aerospace, early 1970’s) and later the ASPRO provided an architectural model for associative computing embodied in the ASC model. Associative computing extends the data parallel paradigm to a complete computational model. It provides a practical model that supports massive parallelism.


The first pass with asc1.exe compiles an ASC program and produces an .iob file which contains intermediate code and a .lst file which shows the relationship between the source code and the triple address intermediate code. The second pass with asc2.exe generates an output file, if it is requested, showing print statements.
1.2 SIMD Machines the Target Architecture

There are several ways to exploit parallelism. One of these is to partition the data and let each block of data be processed by a particular processing element (PE). Each PE has its own local data, and all the PEs can execute at the same time to process the data. Thus, there is no CPU memory bottleneck that exists with sequential computers. Since there is a one to one relationship between the processors and memories, large amounts of data can be passed between the processors and memory. The same instruction is applied to all the PEs by broadcasting the instruction to all the PEs. All active PEs will execute the same instruction at the same time on its own data because each processor has its own local memory. This type of computer is called a Single Instruction Multiple Data (SIMD) computer. A SIMD computer consists of a Control Unit, simple processing units, each with its own private memory, and an interconnection network. The emulator supports some interconnection networks, but we won’t show that here.




  • SIMDs use less hardware than MIMDs as they have only one control unit and each PE is essentially an ALU.

  • SIMDs use less memory than MIMDs because

    • Only one copy of the instructions need to be stored

    • This allows more data to be stored in memory, which reduces movement of data between primary and secondary storage.

    • The control unit compiles the program and broadcasts the machine language instructions to execute to all PEs simultaneously,, eliminating all control communication between PEs. Only data is communicated between PEs. .

  • Some people believe the single instruction stream and synchronization of PEs make SIMD applications easier to program, understand, and debug. (Unfortunately, because the paradigm is unfamiliar to some, there are nay-sayers that believe it is harder to program a SIMD than a MIMD.

  • Control flow operations and scalar operations can be executed on the control unit while PEs are executing the PE instructions.

  • MIMD architectures require message passing or shared memory communications between the PEs, including explicit synchronization and other control primitives, which create a substantial; amount of additional overhead.

  • During a data communication operation between PEs,

    • PEs send data to a neighboring PE in parallel and in lock step

    • The data is moved along an interconnection network following the steps in a communication algorithm.

    • the entire communication operation is executed synchronously

  • Less complex hardware is needed in a SIMD since no message decoder is needed in PEs

    • MIMDs need a message decoder in each PE.

1.3 Associative Computing

An associative processor (such as the STARAN-E [10]), consists of a conventional sequential computer called the host, a sequential control, and an array of processors. Each processor in the array has its own memory. So, the machine can be visualized as a 2-dimensonal array with each “row” controlled by 1 PE and each “column” naming a parallel variable. Thus, each column’s values represents collectively a single parallel value.
The 3 basic components of an associative SIMD computer are:

1. Memory

(a) Sequential Associative Processor Control Memory

(b) Parallel Associative Array Memory

2. A set of Processing Elements (PE)

3. Communication Flip Network


The Control Memory stores the assembled instructions of the program and the array memory stores the data. The array memory, the local memory for each of the processors, provides content addressable and parallel processing capabilities. Each PE is associated with a row of memory. The PEs have three 1-bit registers M, X, and Y. The M register is used to mask and to select which processors will carry out the broadcast instruction. The X register is used for temporary storage and the Y register stores the result of a search operation.
1.4 The ASC Emulator

The ASC emulator is written in C. Currently it emulates 300 processors and a parallel array memory 8000 bits wide. However, a few of the examples in this primer have not been checked out and may differ when run on the emulator. Questions and suggestions should be directed to potter@cs.kent.edu, jbaker@cs.kent.edu or obie@hiram.edu.


1.5 The Associative Computing Model

ASC is based on the Associative Computing Model of Potter [8]. Data items which are related or associated are stored as one record and one such record is stored in the memory allocated to one processor in the array. All similar records, one record per PE, may be accessed in parallel. In associative computing, data records are referenced by describing their contents and not by their address. Since each memory cell has its own processor, there is no need to move data from memory to a CPU. Thus, associative computing promotes parallelism by maximizing the amount of data parallel processing.


The Associative Computing Model consists of a basic cycle of three phases:

1. search 2. process 3. retrieve


The search operation broadcasts the description of the desired object(s) of an association to all the active processors. This allows all processors to search for the desired object(s) in parallel. The processors which locate the desired object in the search phase are called the active responders.

The process phase consists of a sequence of operations which are executed by the active responders.



In the retrieve phase, values of specific items of the active responders are retrieved and used in subsequent cycles. The basic search, process retrieve cycle can be nested and in any one cycle the process and/or retrieve phase may be omitted [8]. When exiting a nested level, the group of active responders is restored to the previous state.
ASC associative computing offers many advantages over message passing or common memory programming. Although not discussed further here, these claims have been shown elsewhere in various papers. (See Additional References at the end of this document.)
ASC programs are often simple and similar to sequential programs. Some advantages of an associative computing approach being taught:


  • Consistent use of data parallel programming

  • Consistent use of global associative searching & responder processing

  • Usually, frequent use of the constant time global reduction operations: AND, OR, MAX, MIN

  • Broadcast of data using IS bus allows the use of the PE network to be restricted to parallel data movement.

  • Tabular representation of data

  • Use of searching instead of sorting

  • Use of searching instead of pointers

  • Use of searching instead of the ordering provided by linked lists, stacks, queues

  • Promotes an highly intuitive programming style that promotes high productivity

  • Uses structure codes (i.e., numeric representation) to represent data structures such as trees, graphs, embedded lists, and matrices.

    • See Nov. 1994 IEEE Computer article.

    • Also, see “Associative Computing” book by Potter.



The usual problems with parallel computing, namely deadlock, race conditions, load balancing, time spent in message passing and data movement, data dependency, and nondeterminism can’t occur.
On the other hand, students with the Associative Computing Lab at Kent State under Dr. Jerry Potter and Dr. Johnnie Baker and students at Hiram College in Dr. Slotterbeck’s classes have programmed many ASC examples such as:


  • A wide range of algorithms implemented in ASC without use of PE network

    • Graph Algorithms

      • minimum l spanning tree

      • shortest path

      • connected components

    • Computational Geometry Algorithms

      • convex hull algorithms (Jarvis March, Quickhull, Graham Scan, etc)

      • Dynamic hull algorithms

    • String Matching Algorithms

      • all exact substring matches

      • all exact matches with “don’t care” (i.e., wild card) characters.

    • Algorithms for NP-complete problems

      • traveling salesperson

      • 2-D knapsack.

    • Data Base Management Software

      • associative data base

      • relational data base

    • A Two Pass Compiler for ASC

      • first pass

      • optimization phase

    • Two Rule-Based Inference Engines

      • OPS-5 interpreter

      • PPL (Parallel Production Language interpreter)

    • A Context Sensitive Language Interpreter

      • (OPS-5 variables force context sensitivity)

    • An associative PROLOG interpreter



  • Numerous Programs in ASC using a PE network

    • 2-D Knapsack Algorithm using a 1-D mesh

    • Image Processing algorithms using 1-D mesh

    • FFT using Flip Network

    • Matrix Multiplication using 1-D mesh

    • Smith-Waterman Sequence Alignment using a linear network

    • An Air Traffic Control Program (using Flip network connecting PEs to memory)

      • Demonstrated using live data at Knoxville in mid 70’s.

Chapter 2

Getting Started
2.1 How to execute ASC programs on the emulator.

In a Windows environment, open a command prompt window and move to the directory where you stored asc1.exe, asc2.exe, and your program with an .asc extension. First compile with

>> asc1.exe –e Myprog.asc

The –e says output is to be 3 address code for the emulator. Other switches could be used to generate assembly code for the Connection Machine or the Wavetracer. The asc1 command outputs a .iob and a .lst file. The .iob file is the intermediate 3 address code produced for the emulator.


To execute Myprog.asc, use

>> asc2.exe –e Myprog.iob Myprog.out

where the .dat and .out files are optional. Omitting the .dat file means data must be entered interactively. Omitting the .out file means the output will be to the screen. ALL .dat FILES (AND INTERACTIVE INPUT) MUST END IN A BLANK LINE.
2.2 Program Structure

Only in a few cases (clearly marked) is case significant. However, caps will often be used to highlight actual code.


An ASC program can be identified as a main program or a subroutine (see Chapter 6 for subroutines). The order of the program structure is important. All command lines end with a semi-colon.
MAIN program-name

defining constants;

equivalencing variables;

declaring associations;


body of program;

END;
2.3 Defining Constants

The DEFINE and DEFLOG statements are used to define constants.

define(identifier, value);

deflog(identifier, value);

The DEFINE keyword is used to declare scalar constants, whereas the DEFLDEFLOG OG keyword is used to declare the logical constants. Scalar constants can be decimal, hexadecimal (X), octal(O) or binary(B).

Example: define(Maxnum, 200);

define(MyHex, X’3F’);

define(MyOct, O’765’);

define(MyBin, B’11001’);

deflog(TRUE, 1); /* There is no logical scalar*/

deflog(FALSE,0);


2.4 Reserved Words

Reserved words cannot be redefined, so they must not be used as variable names. The reserved words are listed in an appendix.

2.5 Declaring Variables

To declare a variable in ASC, the data mode and the data type of the variables must be indicated. ASC supports two modes of data items, namely scalar and parallel. ASC supports eight data types.


Scalar data items are stored in sequential memory of the computer and the parallel items are stored in the parallel array memory. Scalar data items are stored in fixed length words depending on the word size of the host) whereas parallel data items have varying lengths depending on the type of data. The keywords SCALAR and PARALLEL define the mode of the variable. The character $ indicates parallel mode or parallel operation.
ASC supports nine data types, namely integer (INT), hexadecimal (HEX), octal (OCT), binary (BIN), unsigned (CARD), character (CHAR), single precision (REAL), logical (LOGICAL), and index. (INDEX). Integers may occupy from 2 to 2256 bits. When declaring integer, users must determine the range of the variable since overflow of integer arithmetic is not detected by ASC. A logical variable is 1 bit long and is used to store values of 1 or 0, TRUE or FALSE. An index variable also occupies 1 bit of memory in parallel mode only. Index variables are important in ASC because they link the search, process, and retrieve phases [8]. These variables are used for parallel to scalar reduction (or indexing) purposes when using any control structure dealing with parallel variables. When used with a parallel field, the index variable refers to only one specific association at a time.
Variable names start with a letter and are at most 32 characters long. Lower case and upper case are normally indistinguishable although the performance monitor requires upper case. The width of a variable can be specified by using a colon after the variable name followed by a number indicating the field width. The general form is

FORMAT: data-type data-mode var1, var2;

For example:

int scalar aa,b;

int parallel tail[$], head[$], weight[$];

int found:8[$]; /*8 bit field */

char parallel node[$];

hex parallel code:4[$]; /*4 bit field*/

logical parallel found[$];

index parallel xx[$], yy[$];


Commas and spaces separate identifiers, but either can be used.
2.6 Multidimensional Variables

ASC allows multidimensional variables up to three dimensions.


int parallel aa[$, 5]; /* two dimensional parallel */

int parallel b[$, 5 , 5] /* three dimensional parallel */

int scalar c[3,5] /* two dimensional scalar array */
The two dimensional parallel array aa, above, consists of 5 parallel arrays: aa[$,0], aa[$,1], aa[$,2], aa[$,3], and aa[$,4]. Array indices start at zero and go to n-1, where n = 5.
Parallel array aa: (number of rows is set by the data input.)

aa[$,0]

aa[$,0]

aa[$,0]

aa[$,0]

aa[$,0]

1

4

3

2

1

2

5

4

2

6

3

1

2

2

3

4

3

4

5

1

2.7 The DEFVAR Statement

The DEFVAR statement allows the user to define the location of a variable in memory by defining the beginning of the helpful. This is helpful when the user needs to overlap two or more variables. The DEFVAR statement must come before the variable declaration and the second variable must be declared before the first variable.

FORMAT: defvar(var1, var2);


For example: defvar(aa,b); /* define aa in terms of b */
2.8 The scalar IF Statement

ASC has two IF statements, a scalar one and a parallel one. The scalar IF is similar to the IF found in conventional languages. When the IF statement evaluates to TRUE the body is executed, otherwise the body of the THEN is executed. As usual, the THEN is optional.


For example: if aa .eq. 5 then

sum = 0;


else

b = sum;


endif;
The parallel IF is used for parallel searching and is discussed in section 4.2.

2.9 Establishing Associations Between Variables

Associations can be established for parallel variables by using a logical parallel variable, Variables that are associated are related and can be referenced as a group using the logical parallel variable. The parallel variable must be declared prior to establishing the association.
FORMAT: associate var1, var2 with logical-parallel-variable;

Helpful examples will appear in some of the code in the appendices.


2.10 Operators in ASC

2.10.1 relational operators are usual 2.10.2 logical operators are usual

.lt. or < .not. or !

.gt. or > .or. or ||

.le. or <= .and. or &&

.ge. or >= .xor. or ^^

.eq. or ==

.ne. or !=

2.10.3 arithmetic operators


Operation

Operator

Opearand type

Result type

mult

*

real

real

mult

*

int

int

mult

*

real, int

real

div

/

real, int

real

div

/

int

int

div

/

real, int

real

add

+

real, int

real

add

+

int

int

add

+

real, int

real

sub

-

real

real

sub

-

int

int

sub

-

real, int

real

2.11 Parallel Arithmetic Operations

Arithmetic operations can be performed in parallel, which means that the operation applies to all the active responders in one operation. In a sequential computer, this would require a loop.



Download 193.33 Kb.

Share with your friends:
  1   2   3   4




The database is protected by copyright ©ua.originaldll.com 2024
send message

    Main page