Created
January 22, 2013 13:29
-
-
Save zoep/4594664 to your computer and use it in GitHub Desktop.
tiled version with task groups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**** Tiled LU decomposition *****/ | |
void lu(double **a, int range, int B) | |
{ | |
int i,j,k; | |
double ** l_inv, ** u_inv; | |
tbb::task_group g,f; | |
for (k=0;k<range-1;k++) { | |
/****Compute LU decomposition on upper left tile*****/ | |
lu_kernel(a,k*B,k*B,B,B); | |
/****Compute inverted L and U matrices of upper left tile*****/ | |
l_inv=get_inv_l(a,k*B,k*B,B,B); | |
u_inv=get_inv_u(a,k*B,k*B,B,B); | |
/*****Compute LU decomposition on upper horizontal frame and left vertical frame*****/ | |
for (i=k+1;i<range;i++) { | |
g.run([=]{ | |
mm_lower(l_inv,0,0,a,k*B,i*B,a,k*B,i*B,B,B,B); | |
mm_upper(a,i*B,k*B,u_inv,0,0,a,i*B,k*B,B,B,B);}); | |
} | |
g.wait(); | |
/*****Update trailing blocks*****/ | |
for (i=k+1;i<range;i++) { | |
f.run([=,&j]{ | |
for (j=k+1;j<range;j++) { | |
mm_update(a,i*B,k*B,a,k*B,j*B,a,i*B,j*B,B,B,B); | |
} | |
}); | |
} | |
f.wait(); | |
} | |
/***** Compute LU on final diagonal block *****/ | |
lu_kernel(a,(range-1)*B,(range-1)*B,B,B); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment