RAPTOR Syntax and Semantics - Arrays Array variable - Array variables are used to store many values (of the same type) without having to have many variable names. Instead of many variables names a count-controlled loop is used to gain access (index) the individual elements (values) of an array variable. RAPTOR has one and two dimensional arrays of numbers. A one dimensional array can be thought of as a sequence (or a list). A two dimensional array can be thought of as a table (grid or matrix). To create an array variable in RAPTOR, use it like an array variable. i.e. have an index, ex. Score[1], Values[x], Matrix[3,4], etc. All array variables are indexed starting with 1 and go up to the largest index used so far. RAPTOR array variables grow in size as needed. The assignment statement GPAs[24] ← 4.0 assigns the value 4.0 to the 24th element of the array GPAs. If the array variable GPAs had not been used before then the other 23 elements of the GPAs array are initialized to 0 at the same time. i.e. The array variable GPAs would have the following values: 1 2 3 4… Array variables in action- Arrays and count-controlled loop statements were made for each other. Notice in each example below the connection between the Loop Control Variable and the array index! Notice how the Length_Of function can be used in the count-controlled loop test! Notice that each example below is a count-controlled loop and has an Initialize, Test, Execute, and Modify part (I.T.E.M)! Assigning values to an array variable Reading values into an array variable Writing out an array variable’s values Computing the total and average of an array variable’s values Index ← 1 Index ← 1 Index ← 1 Total ← 0 Loop Loop Loop Index ← 1 PUT “The value of the array at position “ + Index + “ is “ + GPAs[Index] Loop GPAs[Index] ← 4.0 “Enter the GPA of student “” + Index + “: “ GET GPAs[Index] Index >= 24 Index >= 24 Index >= Length_Of (GPAs) Index ← Index + 1 Index ← Index + 1 Index ← Index + 1 Total ← Total + GPAs[Index] Index >= Length_Of(GPAs) Index ← Index + 1 … 23 24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.0 The initialization of previous elements to 0 happens only when the array variable is created. Successive assignment statements to the GPAs variable affect only the individual element listed. For example, the following successive assignment statements GPAs[20] GPAs[11] ← ← 1.7 3.2 would place the value 1.7 into the 20th position of the array, and would place the value 3.2 into the 11th position of the array. i.e. GPAs[20] ← 1.7 GPAs[11] ← 3.2 1 2 3 4… … 23 24 Initialize the elements of a two dimensional array (A two dimensional array requires two loops) Row ← 1 Loop Average ← Total / Length_Of(GPAs) Find the largest value of all the values in an array variable Find the INDEX of the largest value of all the values in an array variable Highest_GPA ← GPAs[1] Highest_GPA_Index ←1 Index ← 1 Index ← 1 Loop Loop GPAs[Index] > Highest_GPA GPAs[Index] >= GPAs[Highest_GPA_Index] Column ← 1 Loop 0 0 0 0 0 0 0 0 0 0 3.2 0 0 0 0 0 0 0 0 1.7 0 0 0 4.0 An array variable name, like GPAs, refers to ALL elements of the array. Adding an index (position) to the array variable enables you to refer to any specific element of the array variable. Two dimensional arrays work similarly. i.e. Table[7,2] refers to the element in the 7 th row and 2nd column. Individual elements of an array can be used exactly like any other variable. E.g. the array element GPAs[5] can be used anywhere the number variable X can be used. The Length_Of function can be used to determine (and return) the number of elements that are associated with a particular array variable. For example, after all the above, Length_Of(GPAs) is 24. Matrix[Row, Column] ← 1 Column >= 20 Column ← Column + 1 Highest_GPA ← GPAs[Index] Highest_GPA_Index ← Index Index >= Length_Of(GPAs) Index >= Length_Of(GPAs) Index ← Index + 1 Index ← Index + 1 PUT “The highest GPA is “ + Highest_GPA¶ PUT “The highest GPA is “ + GPAs[Highest_GPA_Index] + “ it is at position “ + Highest_GPA_Index¶ Row >= 20 Row ← Row + 1
View full slide show




hybrid incr/absolute encoders • add more information to index channel to reduce amount of seeking required to find reference position. • interface requires lots of wires (parallel) or a special comm. protocol
View full slide show




Slightly Less Simple Loops (C) for (index = 0; index < length; index++) { dst[index] = pow(src1[index], src2[index]); } for (index = 0; index < length; index++) { dst[index] = src1[index] % src2[index]; } for (index = 0; index < length; index++) { dst[index] = sqrt(src[index]); } for (index = 0; index < length; index++) { dst[index] = cos(src[index]); } for (index = 0; index < length; index++) { dst[index] = exp(src[index]); } for (index = 0; index < length; index++) { dst[index] = log(src[index]); } Supercomputing in Plain English: Instruct Lev Par Tue Feb 13 2018 48
View full slide show




Detailed Summary of Hypothesis Testing   Research Hypothesis Information Retention Same Day 2-Day Lag #1 An interface metaphor that is based on concrete business domain attributes will enable a user to retain significantly more information when compared to an interface metaphor that is based on abstract business domain attributes.   #2: A user who possesses strong familiarity of the business domain will retain significantly more information than a user who possesses weak familiarity of the business domain    #3a: When using an interface metaphor based on abstract business domain attributes, the amount of symbolic information retained by SDFs will be significantly MORE than the amount of symbolic information retained by WDFs.     #3b: The amount of symbolic information retained by WDFs when using an interface metaphor based on concrete business domain attributes will be significantly MORE than the amount of symbolic information retained by WDFs when using an interface metaphor based on abstract business domain attributes. #4a: When using an interface metaphor based on abstract business domain attributes, the amount of spatial information retained by SDFs will be significantly MORE than the amount of spatial information retained by WDFs.            #4b: The amount of spatial information retained by WDFs when using an interface metaphor based on concrete business domain attributes will be significantly MORE than the amount of spatial information retained by WDFs when using an interface metaphor based on abstract business domain attributes. #4c: The amount of spatial information retained by SDFs when using an interface metaphor based on concrete business domain attributes will be significantly MORE than the amount of spatial information retained by SDFs when using an interface metaphor based on abstract business domain attributes.        - Significant at  = .05  - p = .062      
View full slide show




Some Simple Loops (C) for (index = 0; index < length; index++) { dst[index] = src1[index] + src2[index]; } for (index = 0; index < length; index++) { dst[index] = src1[index] - src2[index]; } for (index = 0; index < length; index++) { dst[index] = src1[index] * src2[index]; } for (index = 0; index < length; index++) { dst[index] = src1[index] / src2[index]; } for (index = 0; index < length; index++) { sum = sum + src[index]; } Supercomputing in Plain English: Instruct Lev Par Tue Feb 13 2018 46
View full slide show




Jagged arrays  Implemented as arrays of arrays , 4 index type index lower bound index upper bound address address , 3 , 3 index type index type index lower bound index lower bound index upper bound index upper bound address address , 7 , 7 index type index type index lower bound index lower bound index upper bound index upper bound address address , 4 , 4 index type index type index lower bound index lower bound index upper bound index upper bound address address , 5 , 5 index type index type index lower bound index lower bound index upper bound index upper bound address address 24
View full slide show




A Very Complicated Loop lot = 0.0 DO index = 1, length lot = lot + & src1(index) * src2(index) + & src3(index) * src4(index) + & (src1(index) + src2(index)) * & (src3(index) + src4(index)) * & (src1(index) - src2(index)) * & (src3(index) - src4(index)) * & (src1(index) - src3(index) + & src2(index) - src4(index)) * & (src1(index) + src3(index) & src2(index) + src4(index)) + & (src1(index) * src3(index)) + & (src2(index) * src4(index)) END DO & & & & & & & & & & & & 24 arithmetic ops per iteration 4 memory/cache loads per iteration Supercomputing in Plain English: Instruct Lev Par Tue Feb 13 2018 63
View full slide show




Wordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words wordsWordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words Wordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words wordsWordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words words Wordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words words Wordswords words MOREWORDS WORDS MOR AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words words Wordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words words Wordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words words Wordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words words Wordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words words Wordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words words Wordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words words Wordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words wordsWordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words wordsWordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words wordsWordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words wordsWordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words wordsWordswords words MOREWORDS WORDSWordswords words MOREWORDS WORDS MORE AND MORE WORDS WORDS words worsds wordswordswords WORDS WORDS more words long words hosrt words words
View full slide show




Why Synchronize? Synchronizing is necessary when the code that follows a parallel section needs all threads to have their final answers. #pragma omp parallel for for (index = 0; index < length; index++) { x[index] = index / 1024.0; if ((index / 1000) < 1) { y[index] = log(x[index]); } else { y[index] = x[index] + 2; } } /* Need to synchronize here! */ for (index = 0; index < length; index++) { z[index] = y[index] + y[length – index + 1]; } Parallel Programming: Shared Memory Parallel OK Supercomputing Symposium, Tue Oct 11 2011 76
View full slide show




Time Barbie Tootle Hayes Cape Cartoon Room I Cartoon Room II Suzanne M. Scharer Rosa M. Ailabouni Monday Aug 5th, 2013 10:10-11:50 A1L-A Analog Circuits I Chr: Ming Gu, Shantanu Chakrabartty Track: Analog and Mixed Signal Integrated Circuits A1L-B Low Power Digital Circuit Design Techniques A1L-C Chr: Joanne Degroat Student Contest I Track: Digital Integrated Chr: Mohammed Ismail Circuits, SoC and NoC Track: INVITED ONLY A1L-D Design and Analysis for Power Systems and Power Electronics Chr: Hoi Lee, Ayman Fayed Track: Power Systems and Power Electronics A1L-E Design and Analysis of Linear and Non-Linear Systems Chr: Samuel Palermo Track: Linear and Non-linear Circuits and Systems A1L-F Emerging Technologues Chr: Khaled Salama Track: Emerging Technologies Monday Aug 5th, 2013 13:10-14:50 A2L-A Analog Circuits II Chr: Ming Gu, Shantanu Chakrabartty Track: Analog and Mixed Signal Integrated Circuits A2L-B Low Power VLSI Design Methodology Chr: Genevieve Sapijaszko Track: Digital Integrated Circuits, SoC and NoC A2L-C Student Contest II Chr: Sleiman Bou-Sleiman Track: INVITED ONLY A2L-D Power Management and Energy Harvesting Chr: Ayman Fayed, Hoi Lee Track: Power Management and Energy Harvesting A2L-E Oscillators and Chaotic Systems Chr: Samuel Palermo, Warsame Ali Track: Linear and Non-linear Circuits and Systems A2L-F Bioengineering Systems Chr: Khaled Salama Track: Bioengineering Systems and Bio Chips A4L-A Analog Design Techniques I Chr: Dong Ha Track: Analog and Mixed Signal Integrated Circuits A4L-B Imaging and Wireless Sensors Chr: Igor Filanovsky Track: Analog and Mixed Signal Integrated Circuits A4L-C Special Session: Characterization of Nano Materials and Circuits Chr: Nayla El-Kork Track: SPECIAL SESSION A4L-D Special Session: Power Management and Energy Harvesting Chr: Paul Furth Track: SPECIAL SESSION A4L-E Communication and Signal Processing Circuits Chr: Samuel Palermo Track: Linear and Non-linear Circuits and Systems A4L-F Sensing and Measurement of Biological Signals Chr: Hoda Abdel-Aty-Zohdy Track: Bioengineering Systems and Bio Chips B2L-A Analog Design Techniques II Chr: Valencia Koomson Track: Analog and Mixed Signal Integrated Circuits B2L-B VLSI Design Reliability Chr: Shantanu Chakrabartty, Gursharan Reehal Track: Digital Integrated Circuits, SoC and NoC B2L-D B2L-C Special Session: University and Delta-Sigma Modulators Industry Training in the Art of Chr: Vishal Saxena Electronics Track: Analog and Mixed Signal Chr: Steven Bibyk Integrated Circuits Track: SPECIAL SESSION B2L-E Radio Frequency Integrated Circuits Chr: Nathan Neihart, Mona Hella Track: RFICs, Microwave, and Optical Systems B2L-F Bio-inspired Green Technologies Chr: Hoda Abdel-Aty-Zohdy Track: Bio-inspired Green Technologies B3L-A Analog Design Techniques III Chr: Valencia Koomson Track: Analog and Mixed Signal Integrated Circuits B3L-B VLSI Design, Routing, and Testing Chr: Nader Rafla Track: Programmable Logic, VLSI, CAD and Layout B3L-C Special Session: High-Precision and High-Speed Data Converters I Chr: Samuel Palermo Track: SPECIAL SESSION B3L-D B3L-E Special Session: Advancing the RF/Optical Devices and Circuits Frontiers of Solar Energy Chr: Mona Hella, Nathan Neihart Chr: Michael Soderstrand Track: RFICs, Microwave, and Track: SPECIAL SESSION Optical Systems B5L-A Nyquist-Rate Data Converters Chr: Vishal Saxena Track: Analog and Mixed Signal Integrated Circuits B5L-B Digital Circuits Chr: Nader Rafla Track: Programmable Logic, VLSI, CAD and Layout B5L-C Special Session: High-Precision and High-Speed Data Converters II Chr: Samuel Palermo Track: SPECIAL SESSION B5L-D Special Session: RF-FPGA Circuits and Systems for Enhancing Access to Radio Spectrum (CAS-EARS) Chr: Arjuna Madanayake, Vijay Devabhaktuni Track: SPECIAL SESSION B5L-E B5L-F Analog and RF Circuit Memristors, DG-MOSFETS and Techniques Graphine FETs Chr: Igor Filanovsky Chr: Reyad El-Khazali Track: Analog and Mixed Signal Track: Nanoelectronics and Integrated Circuits Nanotechnology C2L-A Phase Locked Loops Chr: Chung-Chih Hung Track: Analog and Mixed Signal Integrated Circuits C2L-B Computer Arithmetic and Cryptography Chr: George Purdy Track: Programmable Logic, VLSI, CAD and Layout C2L-C Special Session: Reversible Computing Chr: Himanshu Thapliyal Track: SPECIAL SESSION C2L-D Special Session: Self-healing and Self-Adaptive Circuits and Systems Chr: Abhilash Goyal, Abhijit Chatterjee Track: SPECIAL SESSION C2L-E Digital Signal Processing-Media and Control Chr: Wasfy Mikhael, Steven Bibyk Track: Digital Signal Processing C2L-F Advances in Communications and Wireless Systems Chr: Sami Muhaidat Track: Communication and Wireless Systems C3L-A SAR Analog-to-Digital Converters Chr: Vishal Saxena Track: Analog and Mixed Signal Integrated Circuits C3L-B Real Time Systems Chr: Brian Dupaix, Abhilash Goyal Track: System Architectures C3L-C Image Processing and Interpretation Chr: Annajirao Garimella Track: Image Processing and Multimedia Systems C3L-D Special Session: Verification and Trusted Mixed Signal Electronics Development Chr: Greg Creech, Steven Bibyk Track: SPECIAL SESSION C3L-E Digital Signal Processing I Chr: Ying Liu Track: Digital Signal Processing C3L-F Wireless Systems I Chr: Sami Muhaidat Track: Communication and Wireless Systems C5L-A Wireless Systems II Chr: Sami Muhaidat Track: Communication and Wireless Systems C5L-B System Architectures Chr: Swarup Bhunia, Abhilash Goyal Track: System Architectures C5L-C Image Embedding Compression and Analysis Chr: Annajirao Garimella Track: Image Processing and Multimedia Systems C5L-D Low Power Datapath Design Chr: Wasfy Mikhael Track: Digital Integrated Circuits, SoC and NoC C5L-E Digital Signal Processing II Chr: Moataz AbdelWahab Track: Digital Signal Processing C5L-F Advances in Control Systems, Mechatronics, and Robotics Chr: Charna Parkey, Genevieve Sapijaszko Track: Control Systems, Mechatronics, and Robotics Monday Aug 5th, 2013 16:00-17:40 Tuesday Aug 6th, 2013 10:10-11:50 Tuesday Aug 6th, 2013 13:10-14:50 Tuesday Aug 6th, 2013 16:00-17:40 Wednesday Aug 7th, 2013 10:10-11:50 Wednesday Aug 7th, 2013 13:10-14:50 Wednesday Aug 7th, 2013 16:00-17:40 B3L-F Carbon Nanotube-based Sensors and Beyond Chr: Nayla El-Kork Track: Nanoelectronics and Nanotechnology 5
View full slide show




Reading Array Values Using for Loop #1 #include int main () { /* main */ const int z_length = 6; const int program_success_code = 0; float z[z_length], z_squared[z_length]; int index; for (index = 0; index < z_length; index++) { printf("Input z[%d]:\n", index); scanf("%f", &z[index]); } /* for index */ for (index = 0; index < z_length; index++) { z_squared[index] = z[index] * z[index]; } /* for index */ for (index = 0; index < z_length; index++) { printf("%19.7f^2 = %19.7f\n", z[index], z_squared[index]); } /* for index */ return program_success_code; “Use at least 19 spaces total, } /* main */ 7 of which are to the right of the decimal point.” Array Lesson 2 2 CS1313 Spring 2019
View full slide show




Named Constants as Loop Bounds #1 #include int main () { /* main */ const int z_length = 6; const int lower_bound = 0; const int program_success_code = 0; float z[z_length], z_squared[z_length]; int index; for (index = lower_bound; index < z_length; index++) { printf("Input z[%d]:\n", index); scanf("%f", &z[index]); } /* for index */ for (index = lower_bound; index < z_length; index++) { z_squared[index] = z[index] * z[index]; } /* for index */ for (index = lower_bound; index < z_length; index++) { printf("%19.7f^2 = %19.7f\n", z[index], z_squared[index]); } /* for index */ return program_success_code; } /* main */ Array Lesson 2 CS1313 Spring 2019 11
View full slide show




Slightly Less Simple Loops (F90) DO index = 1, length dst(index) = src1(index) ** src2(index) !! src1 ^ src2 END DO DO index = 1, length dst(index) = MOD(src1(index), src2(index)) END DO DO index = 1, length dst(index) = SQRT(src(index)) END DO DO index = 1, length dst(index) = COS(src(index)) END DO DO index = 1, length dst(index) = EXP(src(index)) END DO DO index = 1, length dst(index) = LOG(src(index)) END DO Supercomputing in Plain English: Instruct Lev Par Tue Feb 13 2018 47
View full slide show




Some Complicated Loops DO index = 1, length madd (or FMA): dst(index) = src1(index) + 5.0 * src2(index) mult then add END DO (2 ops) dot = 0 DO index = 1, length dot product dot = dot + src1(index) * src2(index) (2 ops) END DO DO index = 1, length dst(index) = src1(index) * src2(index) + & & src3(index) * src4(index) END DO from our example (3 ops) DO index = 1, length diff12 = src1(index) - src2(index) Euclidean distance (6 ops) diff34 = src3(index) - src4(index) dst(index) = SQRT(diff12 * diff12 + diff34 * diff34) END DO Supercomputing in Plain English: Instruct Lev Par Tue Feb 13 2018 62
View full slide show




Why Synchronize? Synchronizing is necessary when the code that follows a parallel section needs all threads to have their final answers. #pragma omp parallel for for (index = 0; index < length; index++) { x[index] = index / 1024.0; if ((index / 1000) < 1) { y[index] = log(x[index]); } else { y[index] = x[index] + 2; } } /* Need to synchronize here! */ for (index = 0; index < length; index++) { z[index] = y[index] + y[length – index + 1]; } Sponsored by DOD HPCMP, SC11/ACM, NCSI and OK EPSCoR Shared Memory Multithreading Intermediate Parallel, July 31 – Aug 6 2011 86
View full slide show




Quadrature Shaft Encoding • Basic shaft encoding method: measures how far an axle rotates and its speed, but cannot tell when the axle changes direction • Quadrature Shaft Encoding: measures precise rotation of axles and velocity; maintains accurate counts even when the axle’s direction of rotation changes • Applications: – Position monitoring of trapped systems, where the mechanics of a system limit travel between known stop positions, e.g., rotary robot arms, where encoders are used to measure joint angles, and Cartesian robots, where the rotation of a long worm screw moves a rack back and forth – Measure the motion of robot wheels, as part of dead-reckoning robot positioning systems. By accumulating the result of a robot’s wheels driving it along a surface, an estimate of overall translational movement can be made. A pair of encoders is used on a single shaft. The encoders are aligned so that their two data streams are one quarter cycle (90 deg.) out of phase. When rapidly sampling the data from the two encoders, only one of the encoders will change state at a time. Which encoder changes determines the direction that the shaft is rotating. Copyright Prentice Hall, 2001 12
View full slide show




Reading Array on One Line of Input #2 #include int main () { /* main */ const int z_length = 6; const int program_success_code = 0; float z[z_length], z_squared[z_length]; int index; printf("Input all %d values of z:\n", z_length); for (index = 0; index < 6; index++) { scanf("%f", &z[index]); } /* for index */ for (index = 0; index < 6; index++) { z_squared[index] = z[index] * z[index]; } /* for index */ for (index = 0; index < 6; index++) { printf("%19.7f^2 = %19.7f\n", z[index], z_squared[index]); } /* for index */ return program_success_code; } /* main */ Array Lesson 2 CS1313 Spring 2019 8
View full slide show