zanellia/prometeo

Flexible BLAS and LAPACK interface

zanellia opened this issue · 0 comments

The current interface to BLAS and LAPACK routines should be made more flexible, in the sense that different levels of granularity should be accessible though the same method without adding unnecessary complexity to simple calls. Below is a draft signature for gemm suggested by @giaf:

gemm(A[1:2,1:2], B.T, C[3:4,1:2], D=None, alpha=1.0, beta=1.0) ,

where A, B, C and D can also be transposed through e.g. A.T and views are possible too, for example:

gemm(A[1:2,1:2], B.T, C[3:4,1:2], D, beta=2.0).

This is easily implementable in Python, but will require some work in prometeo's parser. In particular in the argument inspection here

for arg in args:
)

we'd need to do something like this:

nargs = len(args)

# extract keyword arguments
...

# check expression in views (if any) using https://github.com/zanellia/prometeo/blob/f45a6347ea524164cc812fad80c9db1f4f94e17f/prometeo/cgen/code_gen_c.py#L244

# extract and unparse views of matrix arguments (if any)
first_index = astu.unparse(node.targets[0].slice.value.elts[0]).strip('\n')
second_index = astu.unparse(node.targets[0].slice.value.elts[1]).strip('\n')

# check for transposition (look if arg has an attribute an if it is 'T')

# pass this info to a generic `process_arg()` method