Changes between Version 8 and Version 9 of DataParallel/Regular


Ignore:
Timestamp:
May 15, 2009 1:38:02 AM (5 years ago)
Author:
gckeller
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataParallel/Regular

    v8 v9  
    1515== Language Support == 
    1616 
    17 The remainder of this document is a first design draft for SAC style language support of multidimensional arrays in the context of DPH. The implementation is not completed yet, and there are several open questions. 
    18  
    19  
     17The remainder of this document is a first design draft for SaC style language support of multidimensional arrays in the context of DPH. The implementation is not completed yet, and there are several open questions. 
    2018 
    2119== The regular array type == 
     
    2321=== SaC === 
    2422 
     23In SaC, multidimensional arrays are represented by two vectors, the shape and the data vector, where vectors are one dimensional arrays. Scalar values are viewed as 0-dimensional arrays. The function `reshape` takes as first argument a shape vector, as second an array, and creates an array with identical data vector and the given shape vector. For example: 
     24{{{ 
     25  reshape ([3,2],[1,2,3,4,5,6]) 
     26}}} 
     27produces a 3 times 2 matrix. 
     28 
    2529=== DPH ===  
    26 Regular parallel arrays are similar to arrays in SAC, with one major 
    27 difference: array operations in DPH are fully typed, and consequently, what 
    28 is called 'shape invariant programming' in SAC works differently in DPH. In particular, in DPH the dimensionality of an array (not its size, however) are encoded in its type. 
     30Regular parallel arrays are similar to arrays in SaC, with one major 
     31difference: SaC employs a mix of static and dynamic type checking, combined with a form of shape inference, whereas we use GHC's type checker to ensure certain domain restrictions are not violated.   
     32 
     33'''Note:''' currently, we are only able to statically check that restrictions regarding the dimensionality of and array are met, but not with respect to the size. SaC is, to a certain extend, able to do so. I still need to check if there are some cases where the DPH approach would statically find some dimensionality bugs where SaC wouldn't - need to check that.  
     34 
     35 
     36array operations in DPH are fully typed, and consequently, what 
     37is called 'shape invariant programming' in SaC works differently in DPH. In particular, in DPH the dimensionality of an array (not its size, however) are encoded in its type. 
    2938 
    3039An multidimensional array is parametrised with its dimensionality and its 
     
    5160type instance Shape (Int, Int) = (((),Int), Int) 
    5261}}} 
     62The user, however,  doesn't need to be aware of this and can view the shape of an n-dimensional array  a n-tuple. 
    5363 
    5464For readability, we define the following type synonyms: