User Tools

Site Tools


tutorial_forward_substitution

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorial_forward_substitution [2024/09/25 17:21]
sanjay
tutorial_forward_substitution [2024/09/26 07:56] (current)
sanjay [How to check more thoroughly]
Line 1: Line 1:
 =====Getting started with Alpha and AlphaZ===== =====Getting started with Alpha and AlphaZ=====
 +
 +Alpha is a polyhedral equational language, and AlphaZ is its "IDE:"  tools to read, write, edit, and analyze Alpha Programs, and also to compile them to executable code.
 +
 +=====Your first Alpha program (not hello world)=====
  
 In this tutorial, which complements Section 1.1 from [[https://www.cs.colostate.edu/~cs560/Fall2015/Lectures/foundations1.pdf | Foundations 1]], we will walk through a simple Alpha program that solves the equation Lx=b where L is a lower triangular matrix with unit diagonals, b is a known vector and x is the unknown vector, using the forward substitution algorithm.  With a little bit of algebraic reasoning, we derived a mathematical identity with x on the left hand side LHS.  We now want to write it as an equational program in Alpha.  You will see that it is surprisingly simple. In this tutorial, which complements Section 1.1 from [[https://www.cs.colostate.edu/~cs560/Fall2015/Lectures/foundations1.pdf | Foundations 1]], we will walk through a simple Alpha program that solves the equation Lx=b where L is a lower triangular matrix with unit diagonals, b is a known vector and x is the unknown vector, using the forward substitution algorithm.  With a little bit of algebraic reasoning, we derived a mathematical identity with x on the left hand side LHS.  We now want to write it as an equational program in Alpha.  You will see that it is surprisingly simple.
  
-=====Writing your first Alpha program and getting AlphaZ to produce executable C===== 
 ====Step 1: Affine System and Parameters ==== ====Step 1: Affine System and Parameters ====
 Let's start from an empty alpha file  “forward_sub".ab, in which with “FS" is the name of the system, and a positive integer N as its parameter. Let's start from an empty alpha file  “forward_sub".ab, in which with “FS" is the name of the system, and a positive integer N as its parameter.
Line 163: Line 166:
  
 ==make verify== ==make verify==
-This only becomes useful if you have a known, correct implementation of the function.  For this first tutorial, it does not make sense (it ends up comparing the outputs of two identical functions).  Later, when you produce different versions using scheduling directives, it becomes useful to validate the correctness agains the original equations, +This only becomes useful if you have a known, correct implementation of the function.  For this first tutorial, it does not make sense (it ends up comparing the outputs of two identical functions).  Later, when you produce different versions using scheduling directives, it becomes useful to validate the correctness against the original equations, 
-Compiles the code with another code named ''xxx_verify.c'' that defines function ''xxx_verify'' (''xxx'' is the system name).+Compiles the code with another code named ''xxx_verify.c'' that defines another function with the same signature, ''xxx_verify'' (''xxx'' is the system name).
 Users can provide different programs as ''xxx_verify'' to compare outputs. Users can provide different programs as ''xxx_verify'' to compare outputs.
 ==make verify-rand== ==make verify-rand==
tutorial_forward_substitution.1727306504.txt.gz · Last modified: 2024/09/25 17:21 by sanjay