This tool supports automatic optimization and parallel evaluation of linear algebraic computations on GPUs. It's primary purpose is to let scientists focus on science while providing them with reasonable utilization of the available massively parallel architecture.
- You build the expression tree of your calculation using high level primitives known from functional programming (lambda expressions, higher order functions, etc.).
- We analyze and transform the expression tree to make it more suitable for GPU evaluation, and
- determine how to allocate threads and memory to effectively utilize your hardware.
- Finally we produce SYCL code, which you just need to compile&run to get the result of your calculation.
There is a very basic but complete example in eval. You can also find more complex expression trees in FunctionalTest.hs, and the generated SYCL codes in test.
scl x: Scalar constant with value x. Its type is double
.
add a b, mul a b: Scalar addition and multiplication. The type of a, b and the result is double
.
vecView id [d1,...,dn]: A tensor of size d1 x … x dn referencing used data id.
Its type is power (power (… power double (dim dn) … ) (dim d2)) (dim d1)
.
var id t: The variable of a lambda function with given identifier and type.
lam v t: Lambda abstraction that binds variable v in the expression t. If the type of v and t is a and b, then the result is of type arrow a b
.
Higher order functions:
Operation | Parameter types | Result type | Result |
---|---|---|---|
app(f, x) | arrow(a,b), a | b | f(x) |
map(f, [x1,…,xn]) | arrow(a,b), power(a,n) | power(b,n) | [f(x1),...,f(xn)] |
zipWith(f, [x1,…,xn], [y1,…,yn]) | arrow(a,arrow(b,c)), power(a,n), power(b,n) | power(c,n) | [f(x1,y1),...,f(xn,yn)] |
reduce(f,[x1,…,x1]) | arrow(a,arrow(a,a)), power(a,n) | a | x1 (n = 1) reduce(f,[f(x1,x2),…,xn]) (n > 1) |