QCon London: Mastering long-running processes in modern architectures
A Dimension Abstraction Approach to Vectorization in Matlab
1. A Dimension Abstraction Approach to Vectorization in Matlab Neil Birkbeck Jonathan Levesque Jose Nelson Amaral Computing Science University of Alberta Edmonton, Alberta, Canada
2.
3.
4.
5.
6.
7. Overview of Solution Vectorizable statement Data dependence-based vectorizer Knowledge of Shape of variables Propagate dimensionality up parse tree Dimensions Agree? Leave statement in loop No Yes Perform Transformations Output Vector statement
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23. Results (Menon & Pingali Examples) X(i,1:p)=X(i,1:p)-L(i,1:i-1)*X(1:i-1,1:p); for k=1:p, for j=1:(i-1), X(i,k)=X(i,k)-L(i,j)*X(j,k); end end for i=1:N, for j=1:N phi(k)=phi(k)+a(i,j)*x_se(i)*f(j); end end phi(k)=phi(k)+ sum (a(1:N,1:N)’* x_se(1:N).*f(1:N),1); for i=1:n, for j=1:n, for k=1:n, for l=1:n y(i)=y(i)+x(j)*A(i,k)* B(l,k)*C(l,j); end end end end y(1:n)=y(1:n)+x(1:n)’*... (A(1:n,1:n)*B(1:n,1:n)’*C(1:n,1:n))’; 5000 0.0001s 0.622s n=40 14 0.012s 0.174s N=1000 17 0.030s 0.536s i=500,p=5000 speedup Output time(s) Input time (s) Settings